Search in sources :

Example 31 with HoSPersonal

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);
}
Also used : HoSPersonal(se.inera.intyg.common.support.model.common.internal.HoSPersonal) Utlatande(se.inera.intyg.common.support.model.common.internal.Utlatande) GrundData(se.inera.intyg.common.support.model.common.internal.GrundData) PagaendeSignering(se.inera.intyg.webcert.persistence.utkast.model.PagaendeSignering) Vardenhet(se.inera.intyg.infra.integration.hsa.model.Vardenhet) Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) VardpersonReferens(se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens) Before(org.junit.Before)

Example 32 with HoSPersonal

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;
}
Also used : HoSPersonal(se.inera.intyg.common.support.model.common.internal.HoSPersonal) Patient(se.inera.intyg.common.support.model.common.internal.Patient)

Example 33 with HoSPersonal

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;
}
Also used : HoSPersonal(se.inera.intyg.common.support.model.common.internal.HoSPersonal) Patient(se.inera.intyg.common.support.model.common.internal.Patient)

Example 34 with HoSPersonal

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;
}
Also used : CreateNewDraftRequest(se.inera.intyg.webcert.web.service.utkast.dto.CreateNewDraftRequest) HoSPersonal(se.inera.intyg.common.support.model.common.internal.HoSPersonal)

Example 35 with HoSPersonal

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));
}
Also used : HoSPersonal(se.inera.intyg.common.support.model.common.internal.HoSPersonal) Vardenhet(se.inera.intyg.infra.integration.hsa.model.Vardenhet) WebCertUser(se.inera.intyg.webcert.web.service.user.dto.WebCertUser) Test(org.junit.Test)

Aggregations

HoSPersonal (se.inera.intyg.common.support.model.common.internal.HoSPersonal)38 WebCertUser (se.inera.intyg.webcert.web.service.user.dto.WebCertUser)15 Test (org.junit.Test)13 Patient (se.inera.intyg.common.support.model.common.internal.Patient)11 GrundData (se.inera.intyg.common.support.model.common.internal.GrundData)10 Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)10 Before (org.junit.Before)8 Utkast (se.inera.intyg.webcert.persistence.utkast.model.Utkast)7 Vardenhet (se.inera.intyg.common.support.model.common.internal.Vardenhet)5 Vardgivare (se.inera.intyg.common.support.model.common.internal.Vardgivare)5 ValidateDraftResponse (se.inera.intyg.common.support.modules.support.api.dto.ValidateDraftResponse)5 Vardenhet (se.inera.intyg.infra.integration.hsa.model.Vardenhet)5 Personnummer (se.inera.intyg.schemas.contract.Personnummer)5 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)4 Vardgivare (se.inera.intyg.infra.integration.hsa.model.Vardgivare)4 VardpersonReferens (se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens)4 CreateNewDraftRequest (se.inera.intyg.webcert.web.service.utkast.dto.CreateNewDraftRequest)4 UpdatePatientOnDraftRequest (se.inera.intyg.webcert.web.service.utkast.dto.UpdatePatientOnDraftRequest)4 AbstractVardenhet (se.inera.intyg.infra.integration.hsa.model.AbstractVardenhet)3 SaveDraftResponse (se.inera.intyg.webcert.web.service.utkast.dto.SaveDraftResponse)3