use of se.inera.intyg.common.support.model.common.internal.HoSPersonal in project webcert by sklintyg.
the class SignaturServiceImplTest method setup.
@Before
public void setup() throws Exception {
hoSPerson = new HoSPersonal();
hoSPerson.setPersonId("AAA");
hoSPerson.setFullstandigtNamn("Dr Dengroth");
VardpersonReferens vardperson = new VardpersonReferens();
vardperson.setHsaId(hoSPerson.getPersonId());
vardperson.setNamn(hoSPerson.getFullstandigtNamn());
utkast = createUtkast(INTYG_ID, 1, INTYG_TYPE, UtkastStatus.DRAFT_INCOMPLETE, INTYG_JSON, vardperson, ENHET_ID, PERSON_ID);
completedUtkast = createUtkast(INTYG_ID, 2, INTYG_TYPE, UtkastStatus.DRAFT_COMPLETE, INTYG_JSON, vardperson, ENHET_ID, PERSON_ID);
signedUtkast = createUtkast(INTYG_ID, 3, INTYG_TYPE, UtkastStatus.SIGNED, INTYG_JSON, vardperson, ENHET_ID, PERSON_ID);
vardenhet = new Vardenhet(ENHET_ID, "testNamn");
vardgivare = new Vardgivare("123", "vardgivare");
vardgivare.setVardenheter(Collections.singletonList(vardenhet));
user = createWebCertUser(true);
when(webcertUserService.getUser()).thenReturn(user);
when(moduleRegistry.getModuleApi(any())).thenReturn(moduleApi);
when(moduleApi.updateBeforeSigning(any(), any(), any())).thenReturn(INTYG_JSON);
Utlatande utlatande = mock(Utlatande.class);
GrundData grunddata = new GrundData();
grunddata.setSkapadAv(new HoSPersonal());
when(utlatande.getGrundData()).thenReturn(grunddata);
when(moduleApi.getUtlatandeFromJson(anyString())).thenReturn(utlatande);
setTypedField(intygSignatureService, new SignaturTicketTracker());
pagaendeSignering = mock(PagaendeSignering.class);
when(pagaendeSignering.getInternReferens()).thenReturn(PAGAENDE_SIGN_ID);
when(pagaendeSignering.getIntygData()).thenReturn(INTYG_JSON);
when(pagaendeSignering.getIntygsId()).thenReturn(INTYG_ID);
when(pagaendeSignering.getSigneradAvHsaId()).thenReturn(hoSPerson.getPersonId());
when(pagaendeSignering.getSigneradAvNamn()).thenReturn(hoSPerson.getFullstandigtNamn());
when(pagaendeSigneringRepository.findOne(any())).thenReturn(pagaendeSignering);
when(pagaendeSigneringRepository.save(any(PagaendeSignering.class))).thenReturn(pagaendeSignering);
}
use of se.inera.intyg.common.support.model.common.internal.HoSPersonal in project webcert by sklintyg.
the class IntygModuleApiController method createUtkastFromDifferentIntygTypeRequest.
private CreateUtkastFromTemplateRequest createUtkastFromDifferentIntygTypeRequest(String orgIntygsId, String newIntygsTyp, String orgIntygsTyp, CopyIntygRequest request) {
HoSPersonal hosPerson = createHoSPersonFromUser();
Patient patient = createPatientFromCopyIntygRequest(request);
CreateUtkastFromTemplateRequest req = new CreateUtkastFromTemplateRequest(orgIntygsId, newIntygsTyp, patient, hosPerson, orgIntygsTyp);
// Add new personnummer to request
addPersonnummerToRequest(req, userService.getUser().getParameters());
// Set djupintegrerad flag on request to true if origin is DJUPINTEGRATION
setDeepIntegrationFlagOnRequest(req);
return req;
}
use of se.inera.intyg.common.support.model.common.internal.HoSPersonal in project webcert by sklintyg.
the class IntygModuleApiController method createCompletionCopyRequest.
private CreateCompletionCopyRequest createCompletionCopyRequest(String orgIntygsId, String intygsTyp, String meddelandeId, CopyIntygRequest copyRequest) {
HoSPersonal hosPerson = createHoSPersonFromUser();
Patient patient = createPatientFromCopyIntygRequest(copyRequest);
CreateCompletionCopyRequest req = new CreateCompletionCopyRequest(orgIntygsId, intygsTyp, meddelandeId, patient, hosPerson, copyRequest.getKommentar());
// Add new personnummer to request
addPersonnummerToRequest(req, userService.getUser().getParameters());
// Set djupintegrerad flag on request to true if origin is DJUPINTEGRATION
setDeepIntegrationFlagOnRequest(req);
return req;
}
use of se.inera.intyg.common.support.model.common.internal.HoSPersonal in project webcert by sklintyg.
the class CreateDraftCertificateResponderImplTest method createCreateNewDraftRequest.
private CreateNewDraftRequest createCreateNewDraftRequest(Vardenhet vardenhet) {
CreateNewDraftRequest draftRequest = new CreateNewDraftRequest(UTKAST_ID, null, null, new HoSPersonal(), null);
draftRequest.getHosPerson().setVardenhet(vardenhet);
return draftRequest;
}
use of se.inera.intyg.common.support.model.common.internal.HoSPersonal in project webcert by sklintyg.
the class IntygConverterUtilTest method testBuildHosPersonalFromWebCertUserWithSpecialiseringarAndBefattningar.
@Test
public void testBuildHosPersonalFromWebCertUserWithSpecialiseringarAndBefattningar() {
final String hsaId = "hsaid";
final String namn = "namn";
final String befattning1 = "befattning1";
final String befattning2 = "befattning2";
final String specialisering1 = "specialisering1";
final String specialisering2 = "specialisering2";
se.inera.intyg.common.support.model.common.internal.Vardenhet vardenhet = new se.inera.intyg.common.support.model.common.internal.Vardenhet();
WebCertUser user = new WebCertUser();
user.setHsaId(hsaId);
user.setNamn(namn);
user.setBefattningar(Arrays.asList(befattning1, befattning2));
user.setSpecialiseringar(Arrays.asList(specialisering1, specialisering2));
HoSPersonal result = IntygConverterUtil.buildHosPersonalFromWebCertUser(user, vardenhet);
assertEquals(hsaId, result.getPersonId());
assertEquals(namn, result.getFullstandigtNamn());
assertEquals(2, result.getBefattningar().size());
assertEquals(befattning1, result.getBefattningar().get(0));
assertEquals(befattning2, result.getBefattningar().get(1));
assertEquals(2, result.getSpecialiteter().size());
assertEquals(specialisering1, result.getSpecialiteter().get(0));
assertEquals(specialisering2, result.getSpecialiteter().get(1));
}
Aggregations