use of se.inera.intyg.schemas.contract.Personnummer in project webcert by sklintyg.
the class CreateDraftCertificateValidatorImpl method validateApplicationErrors.
@Override
public ResultValidator validateApplicationErrors(Utlatande utlatande, IntygUser user) {
ResultValidator errors = ResultValidator.newInstance();
String personId = utlatande.getPatient().getPersonId().getExtension();
Personnummer personnummer = createPersonnummer(errors, personId).orElse(null);
if (errors.hasErrors()) {
return errors;
}
// Check if PU-service is responding
validatePUServiceResponse(errors, personnummer);
if (errors.hasErrors()) {
return errors;
}
validateSekretessmarkeringOchIntygsTyp(errors, personnummer, utlatande.getTypAvUtlatande(), user);
validateCreateForAvlidenPatientAllowed(errors, personnummer, utlatande.getTypAvUtlatande().getCode());
return errors;
}
use of se.inera.intyg.schemas.contract.Personnummer in project webcert by sklintyg.
the class CreateDraftCertificateValidatorImpl method validateApplicationErrors.
@Override
public ResultValidator validateApplicationErrors(Intyg intyg, IntygUser user) {
ResultValidator errors = ResultValidator.newInstance();
String personId = intyg.getPatient().getPersonId().getExtension();
Personnummer personnummer = createPersonnummer(errors, personId).orElse(null);
if (errors.hasErrors()) {
return errors;
}
// Check if PU-service is responding
validatePUServiceResponse(errors, personnummer);
if (errors.hasErrors()) {
return errors;
}
validateSekretessmarkeringOchIntygsTyp(errors, personnummer, intyg.getTypAvIntyg(), user);
validateCreateForAvlidenPatientAllowed(errors, personnummer, intyg.getTypAvIntyg().getCode());
return errors;
}
use of se.inera.intyg.schemas.contract.Personnummer in project webcert by sklintyg.
the class StatisticsGroupByUtilTest method testFilterInvalidPersonnummer.
@Test
public void testFilterInvalidPersonnummer() {
List<GroupableItem> queryResult = new ArrayList<>();
queryResult.add(new GroupableItem("id-1", HSA1, PNR1, FK7263));
queryResult.add(new GroupableItem("id-2", HSA2, PNR2, TSBAS));
queryResult.add(new GroupableItem("id-3", HSA1, null, FK7263));
queryResult.add(new GroupableItem("id-4", HSA1, "", TSBAS));
queryResult.add(new GroupableItem("id-5", HSA2, "thisisainvalidparameter", FK7263));
List<Personnummer> result = testee.getPersonummerList(queryResult);
assertEquals(2, result.size());
}
use of se.inera.intyg.schemas.contract.Personnummer in project webcert by sklintyg.
the class StatisticsGroupByUtilTest method testFilterAndGroupForTwoResultsOfSameUnitOneIsSekrForVardadmin.
@Test
public void testFilterAndGroupForTwoResultsOfSameUnitOneIsSekrForVardadmin() {
when(webCertUserService.getUser()).thenReturn(buildUserOfRole(AUTHORITIES_RESOLVER.getRole("VARDADMINISTRATOR")));
Personnummer pnr1 = Personnummer.createPersonnummer(PNR1).get();
Personnummer pnr2 = Personnummer.createPersonnummer(PNR2).get();
Map<Personnummer, SekretessStatus> sekrMap = new HashMap<>();
sekrMap.put(pnr1, SekretessStatus.FALSE);
sekrMap.put(pnr2, SekretessStatus.TRUE);
when(patientDetailsResolver.getSekretessStatusForList(anyList())).thenReturn(sekrMap);
List<GroupableItem> queryResult = new ArrayList<>();
queryResult.add(new GroupableItem("id-1", HSA1, PNR1, FK7263));
queryResult.add(new GroupableItem("id-2", HSA1, PNR2, FK7263));
// Should be filtered away
queryResult.add(new GroupableItem("id-3", HSA1, PNR2, TSBAS));
Map<String, Long> result = testee.toSekretessFilteredMap(queryResult);
assertEquals(1, result.size());
assertEquals(new Long(1L), result.get(HSA1));
}
use of se.inera.intyg.schemas.contract.Personnummer in project webcert by sklintyg.
the class StatisticsGroupByUtilTest method setup.
@Before
public void setup() {
Personnummer pnr1 = Personnummer.createPersonnummer(PNR1).get();
Personnummer pnr2 = Personnummer.createPersonnummer(PNR2).get();
Personnummer pnr3 = Personnummer.createPersonnummer(PNR3).get();
Map<Personnummer, SekretessStatus> sekrMap = new HashMap<>();
sekrMap.put(pnr1, SekretessStatus.FALSE);
sekrMap.put(pnr2, SekretessStatus.TRUE);
sekrMap.put(pnr3, SekretessStatus.FALSE);
when(patientDetailsResolver.getSekretessStatusForList(anyList())).thenReturn(sekrMap);
}
Aggregations