Search in sources :

Example 11 with Vardgivare

use of se.inera.intyg.infra.integration.hsa.model.Vardgivare in project webcert by sklintyg.

the class MailNotificationServiceTest method setupTestlandVardgivare.

@PostConstruct
public void setupTestlandVardgivare() throws IOException {
    Vardgivare vardgivare = new CustomObjectMapper().readValue(new ClassPathResource("MailNotificationServiceTest/landstinget-testland.json").getFile(), Vardgivare.class);
    hsaStub.getVardgivare().add(vardgivare);
}
Also used : CustomObjectMapper(se.inera.intyg.common.util.integration.json.CustomObjectMapper) Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) ClassPathResource(org.springframework.core.io.ClassPathResource) PostConstruct(javax.annotation.PostConstruct)

Example 12 with Vardgivare

use of se.inera.intyg.infra.integration.hsa.model.Vardgivare in project webcert by sklintyg.

the class PatientDetailsResolverTest method testSosDoiIntygIntegrationWithNoDBIntygAndPuUnavailable.

/**
 * DOI - Integration. DB saknas, PU saknas == Ingen info
 */
@Test
public void testSosDoiIntygIntegrationWithNoDBIntygAndPuUnavailable() throws ModuleNotFoundException, IOException {
    when(puService.getPerson(any(Personnummer.class))).thenReturn(buildErrorPersonSvar());
    when(webCertUserService.getUser()).thenReturn(integratedWebCertUser);
    when(integratedWebCertUser.getValdVardgivare()).thenReturn(new Vardgivare("vg-1", "vardgivare-1"));
    List<Utkast> drafts = new ArrayList<>();
    when(utkastRepository.findDraftsByPatientAndVardgivareAndStatus(anyString(), anyString(), anyList(), anySet())).thenReturn(drafts);
    Patient patient = testee.resolvePatient(PNR, "doi");
    assertNull(patient);
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast) ArrayList(java.util.ArrayList) Patient(se.inera.intyg.common.support.model.common.internal.Patient) Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) Test(org.junit.Test)

Example 13 with Vardgivare

use of se.inera.intyg.infra.integration.hsa.model.Vardgivare in project webcert by sklintyg.

the class PatientDetailsResolverTest method testSosDoiIntygIntegrationWithNoDBIntygAndPuOk.

/**
 * DOI - Integration. DB saknas, PU finns == allt från PU
 */
@Test
public void testSosDoiIntygIntegrationWithNoDBIntygAndPuOk() throws ModuleNotFoundException, IOException {
    when(puService.getPerson(any(Personnummer.class))).thenReturn(buildPersonSvar());
    when(webCertUserService.getUser()).thenReturn(integratedWebCertUser);
    when(integratedWebCertUser.getValdVardgivare()).thenReturn(new Vardgivare("vg-1", "vardgivare-1"));
    List<Utkast> drafts = new ArrayList<>();
    when(utkastRepository.findDraftsByPatientAndVardgivareAndStatus(anyString(), anyString(), anyList(), anySet())).thenReturn(drafts);
    Patient patient = testee.resolvePatient(PNR, "doi");
    assertEquals(PNR.getPersonnummer(), patient.getPersonId().getPersonnummer());
    assertEquals(FNAMN, patient.getFornamn());
    assertEquals(MNAMN, patient.getMellannamn());
    assertEquals(LNAMN, patient.getEfternamn());
    assertEquals(POST_ADDR, patient.getPostadress());
    assertEquals(POST_NR, patient.getPostnummer());
    assertEquals(POST_ORT, patient.getPostort());
    assertEquals(PU_AVLIDEN, patient.isAvliden());
    assertEquals(false, patient.isSekretessmarkering());
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast) ArrayList(java.util.ArrayList) Patient(se.inera.intyg.common.support.model.common.internal.Patient) Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) Test(org.junit.Test)

Example 14 with Vardgivare

use of se.inera.intyg.infra.integration.hsa.model.Vardgivare in project webcert by sklintyg.

the class PatientDetailsResolverTest method testSosDoiIntygIntegrationWithExistingDBIntygAndPuUnavailable.

/**
 * DOI - Integration. DB finns, PU saknas. Namn och adress från DB-intyget, avliden från integrationsparam.
 */
@Test
public void testSosDoiIntygIntegrationWithExistingDBIntygAndPuUnavailable() throws ModuleNotFoundException, IOException {
    when(puService.getPerson(any(Personnummer.class))).thenReturn(buildErrorPersonSvar());
    when(webCertUserService.getUser()).thenReturn(integratedWebCertUser);
    when(integratedWebCertUser.getValdVardgivare()).thenReturn(new Vardgivare("vg-1", "vardgivare-1"));
    List<Utkast> drafts = buildSosDBDrafts();
    when(utkastRepository.findDraftsByPatientAndVardgivareAndStatus(anyString(), anyString(), anyList(), anySet())).thenReturn(drafts);
    ModuleApi moduleApi = mock(ModuleApi.class);
    when(moduleApi.getUtlatandeFromJson(anyString())).thenReturn(buildSosDoiUtlatande());
    when(moduleRegistry.getModuleApi("db")).thenReturn(moduleApi);
    Patient patient = testee.resolvePatient(PNR, "doi");
    assertEquals(PNR.getPersonnummer(), patient.getPersonId().getPersonnummer());
    assertEquals(DB_FNAMN, patient.getFornamn());
    assertEquals(DB_MNAMN, patient.getMellannamn());
    assertEquals(DB_ENAMN, patient.getEfternamn());
    assertEquals(DB_POST_ADDR, patient.getPostadress());
    assertEquals(DB_POST_NR, patient.getPostnummer());
    assertEquals(DB_POST_ORT, patient.getPostort());
    assertEquals(INTEGR_AVLIDEN, patient.isAvliden());
    assertEquals(false, patient.isSekretessmarkering());
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) ModuleApi(se.inera.intyg.common.support.modules.support.api.ModuleApi) Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast) Patient(se.inera.intyg.common.support.model.common.internal.Patient) Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) Test(org.junit.Test)

Example 15 with Vardgivare

use of se.inera.intyg.infra.integration.hsa.model.Vardgivare in project webcert by sklintyg.

the class PatientDetailsResolverTest method testSosDoiIntygIntegrationWithExistingDBIntygAndPuOk.

// - Dödsorsaksintyg - //
/**
 * DOI - Integration. DB finns, PU finns. Namn och adress från DB-intyget, avliden/sekr från PU.
 */
@Test
public void testSosDoiIntygIntegrationWithExistingDBIntygAndPuOk() throws ModuleNotFoundException, IOException {
    when(puService.getPerson(any(Personnummer.class))).thenReturn(buildPersonSvar());
    when(webCertUserService.getUser()).thenReturn(integratedWebCertUser);
    when(integratedWebCertUser.getValdVardgivare()).thenReturn(new Vardgivare("vg-1", "vardgivare-1"));
    List<Utkast> drafts = buildSosDBDrafts();
    when(utkastRepository.findDraftsByPatientAndVardgivareAndStatus(anyString(), anyString(), anyList(), anySet())).thenReturn(drafts);
    ModuleApi moduleApi = mock(ModuleApi.class);
    when(moduleApi.getUtlatandeFromJson(anyString())).thenReturn(buildSosDoiUtlatande());
    when(moduleRegistry.getModuleApi("db")).thenReturn(moduleApi);
    Patient patient = testee.resolvePatient(PNR, "doi");
    assertEquals(PNR.getPersonnummer(), patient.getPersonId().getPersonnummer());
    assertEquals(DB_FNAMN, patient.getFornamn());
    assertEquals(DB_MNAMN, patient.getMellannamn());
    assertEquals(DB_ENAMN, patient.getEfternamn());
    assertEquals(DB_POST_ADDR, patient.getPostadress());
    assertEquals(DB_POST_NR, patient.getPostnummer());
    assertEquals(DB_POST_ORT, patient.getPostort());
    assertEquals(PU_AVLIDEN || INTEGR_AVLIDEN, patient.isAvliden());
    assertEquals(false, patient.isSekretessmarkering());
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) ModuleApi(se.inera.intyg.common.support.modules.support.api.ModuleApi) Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast) Patient(se.inera.intyg.common.support.model.common.internal.Patient) Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) Test(org.junit.Test)

Aggregations

Vardgivare (se.inera.intyg.infra.integration.hsa.model.Vardgivare)26 Vardenhet (se.inera.intyg.infra.integration.hsa.model.Vardenhet)17 WebCertUser (se.inera.intyg.webcert.web.service.user.dto.WebCertUser)12 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)5 Patient (se.inera.intyg.common.support.model.common.internal.Patient)5 Role (se.inera.intyg.infra.security.common.model.Role)5 HoSPersonal (se.inera.intyg.common.support.model.common.internal.HoSPersonal)4 Personnummer (se.inera.intyg.schemas.contract.Personnummer)4 Utkast (se.inera.intyg.webcert.persistence.utkast.model.Utkast)4 Before (org.junit.Before)3 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 ModuleApi (se.inera.intyg.common.support.modules.support.api.ModuleApi)2 Mottagning (se.inera.intyg.infra.integration.hsa.model.Mottagning)2 VardpersonReferens (se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens)2 HashMap (java.util.HashMap)1 PostConstruct (javax.annotation.PostConstruct)1 ClassPathResource (org.springframework.core.io.ClassPathResource)1 GrundData (se.inera.intyg.common.support.model.common.internal.GrundData)1 Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)1