use of se.inera.intyg.infra.integration.pu.model.Person in project webcert by sklintyg.
the class ElegWebCertUserDetailsServiceTest method buildPersonSvar.
private PersonSvar buildPersonSvar(boolean sekretessMarkerad, PersonSvar.Status status) {
Personnummer personnummer = Personnummer.createPersonnummer(PERSON_ID).get();
Person person = new Person(personnummer, sekretessMarkerad, false, "fornamn", "", "Efternamn", "gatan", "12345", "postort");
return new PersonSvar(person, status);
}
use of se.inera.intyg.infra.integration.pu.model.Person in project webcert by sklintyg.
the class CopyUtkastServiceImpl method buildCompletionUtkastBuilderResponse.
private CopyUtkastBuilderResponse buildCompletionUtkastBuilderResponse(CreateCompletionCopyRequest copyRequest, String originalIntygId, boolean addRelation) throws ModuleNotFoundException, ModuleException {
Person patientDetails = updatePatientDetails(copyRequest);
CopyUtkastBuilderResponse builderResponse;
if (utkastRepository.exists(originalIntygId)) {
builderResponse = copyCompletionUtkastBuilder.populateCopyUtkastFromOrignalUtkast(copyRequest, patientDetails, addRelation, false, false);
} else {
builderResponse = copyCompletionUtkastBuilder.populateCopyUtkastFromSignedIntyg(copyRequest, patientDetails, addRelation, false, false);
}
return builderResponse;
}
use of se.inera.intyg.infra.integration.pu.model.Person in project webcert by sklintyg.
the class CopyUtkastServiceImpl method buildReplacementUtkastBuilderResponse.
private CopyUtkastBuilderResponse buildReplacementUtkastBuilderResponse(CreateReplacementCopyRequest replacementCopyRequest, String originalIntygId) throws ModuleNotFoundException, ModuleException {
Person patientDetails = updatePatientDetails(replacementCopyRequest);
CopyUtkastBuilderResponse builderResponse;
if (utkastRepository.exists(originalIntygId)) {
builderResponse = createReplacementUtkastBuilder.populateCopyUtkastFromOrignalUtkast(replacementCopyRequest, patientDetails, true, replacementCopyRequest.isCoherentJournaling(), true);
} else {
builderResponse = createReplacementUtkastBuilder.populateCopyUtkastFromSignedIntyg(replacementCopyRequest, patientDetails, true, replacementCopyRequest.isCoherentJournaling(), true);
}
return builderResponse;
}
use of se.inera.intyg.infra.integration.pu.model.Person in project webcert by sklintyg.
the class CopyCompletionUtkastBuilderTest method testPopulateCompletionFromSignedIntyg.
@Test
public void testPopulateCompletionFromSignedIntyg() throws Exception {
IntygContentHolder ich = createIntygContentHolder();
when(mockIntygService.fetchIntygData(INTYG_ID, INTYG_TYPE, false)).thenReturn(ich);
CreateCompletionCopyRequest copyRequest = buildCompletionRequest();
copyRequest.setMeddelandeId("meddelandeId");
Person patientDetails = new Person(PATIENT_SSN, false, false, PATIENT_FNAME, PATIENT_MNAME, PATIENT_LNAME, "Postadr", "12345", "postort");
ValidateDraftResponse vdr = new ValidateDraftResponse(ValidationStatus.VALID, new ArrayList<>());
when(mockModuleApi.validateDraft(isNull())).thenReturn(vdr);
CopyUtkastBuilderResponse builderResponse = copyCompletionBuilder.populateCopyUtkastFromSignedIntyg(copyRequest, patientDetails, true, false, false);
assertNotNull(builderResponse.getUtkastCopy());
assertNotNull(builderResponse.getUtkastCopy().getModel());
assertEquals(INTYG_TYPE, builderResponse.getUtkastCopy().getIntygsTyp());
assertEquals(PATIENT_SSN, builderResponse.getUtkastCopy().getPatientPersonnummer());
assertEquals(PATIENT_FNAME, builderResponse.getUtkastCopy().getPatientFornamn());
assertEquals(PATIENT_MNAME, builderResponse.getUtkastCopy().getPatientMellannamn());
assertEquals(PATIENT_LNAME, builderResponse.getUtkastCopy().getPatientEfternamn());
assertEquals(INTYG_ID, builderResponse.getUtkastCopy().getRelationIntygsId());
ArgumentCaptor<CreateDraftCopyHolder> requestCaptor = ArgumentCaptor.forClass(CreateDraftCopyHolder.class);
verify(mockModuleApi).createCompletionFromTemplate(requestCaptor.capture(), any(), eq(KOMMENTAR));
// verify full name is set
assertNotNull(requestCaptor.getValue().getPatient().getFullstandigtNamn());
assertEquals(PATIENT_FNAME + " " + PATIENT_MNAME + " " + PATIENT_LNAME, requestCaptor.getValue().getPatient().getFullstandigtNamn());
}
use of se.inera.intyg.infra.integration.pu.model.Person in project webcert by sklintyg.
the class CopyCompletionUtkastBuilderTest method testPopulateCompletionFromOriginalDecoratesWithReferensId.
@Test
public void testPopulateCompletionFromOriginalDecoratesWithReferensId() throws Exception {
final String intygsTyp = "lisjp";
final String meddelandeId = "meddelandeId";
final String referensId = UUID.randomUUID().toString();
Arende arende = new Arende();
arende.setReferensId(referensId);
when(moduleRegistry.getModuleApi(intygsTyp)).thenReturn(mockModuleApi);
when(mockUtkastRepository.findOne(INTYG_ID)).thenReturn(createOriginalUtkast());
when(mockModuleApi.validateDraft(isNull())).thenReturn(new ValidateDraftResponse(ValidationStatus.VALID, new ArrayList<>()));
when(arendeService.getArende(meddelandeId)).thenReturn(arende);
CreateCompletionCopyRequest copyRequest = buildCompletionRequest();
copyRequest.setMeddelandeId(meddelandeId);
copyRequest.setTyp(intygsTyp);
copyRequest.setOriginalIntygTyp(intygsTyp);
Person patientDetails = new Person(PATIENT_SSN, false, false, PATIENT_FNAME, PATIENT_MNAME, PATIENT_LNAME, "Postadr", "12345", "postort");
copyCompletionBuilder.populateCopyUtkastFromOrignalUtkast(copyRequest, patientDetails, true, false, false);
ArgumentCaptor<CreateDraftCopyHolder> createDraftCopyHolderCaptor = ArgumentCaptor.forClass(CreateDraftCopyHolder.class);
verify(mockModuleApi).createCompletionFromTemplate(createDraftCopyHolderCaptor.capture(), any(), eq(KOMMENTAR));
assertNotNull(createDraftCopyHolderCaptor.getValue());
assertEquals(meddelandeId, createDraftCopyHolderCaptor.getValue().getRelation().getMeddelandeId());
assertEquals(RelationKod.KOMPLT, createDraftCopyHolderCaptor.getValue().getRelation().getRelationKod());
assertEquals(referensId, createDraftCopyHolderCaptor.getValue().getRelation().getReferensId());
assertEquals(INTYG_ID, createDraftCopyHolderCaptor.getValue().getRelation().getRelationIntygsId());
}
Aggregations