Search in sources :

Example 11 with Patient

use of se.inera.intyg.common.support.model.common.internal.Patient in project webcert by sklintyg.

the class PatientDetailsResolverTest method testSosDoiIntygFristaendeWithNoDBIntygAndPuOk.

/**
 * DOI - Fristående. DB saknas, PU finns. Namn och adress från PU.
 */
@Test
public void testSosDoiIntygFristaendeWithNoDBIntygAndPuOk() throws ModuleNotFoundException, IOException {
    when(puService.getPerson(any(Personnummer.class))).thenReturn(buildPersonSvar());
    when(webCertUserService.getUser()).thenReturn(freeWebCertUser);
    when(freeWebCertUser.getValdVardenhet()).thenReturn(buildVardenhet());
    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) Patient(se.inera.intyg.common.support.model.common.internal.Patient) Test(org.junit.Test)

Example 12 with Patient

use of se.inera.intyg.common.support.model.common.internal.Patient in project webcert by sklintyg.

the class PatientDetailsResolverTest method testTSIntygFristaendeWithPuOk.

/**
 * TS + fristående + PU == Allt från PU
 */
@Test
public void testTSIntygFristaendeWithPuOk() {
    when(puService.getPerson(any(Personnummer.class))).thenReturn(buildPersonSvar());
    when(webCertUserService.getUser()).thenReturn(freeWebCertUser);
    Patient patient = testee.resolvePatient(PNR, "ts-bas");
    assertEquals(PNR, patient.getPersonId());
    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) Patient(se.inera.intyg.common.support.model.common.internal.Patient) Test(org.junit.Test)

Example 13 with Patient

use of se.inera.intyg.common.support.model.common.internal.Patient in project webcert by sklintyg.

the class PatientDetailsResolverTest method testTSIntygIntegrationWithPuOkButAddressMissingFromIntegration.

/**
 * TS - integration - PU: Namn + meta från PU, adress från PU
 */
@Test
public void testTSIntygIntegrationWithPuOkButAddressMissingFromIntegration() {
    when(puService.getPerson(any(Personnummer.class))).thenReturn(buildPersonSvar());
    when(webCertUserService.getUser()).thenReturn(integratedWebCertUser);
    when(integratedWebCertUser.getParameters()).thenReturn(buildIntegrationParametersWithNullAddress());
    Patient patient = testee.resolvePatient(PNR, "ts-bas");
    assertEquals(PNR, patient.getPersonId());
    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 || INTEGR_AVLIDEN, patient.isAvliden());
    assertEquals(false, patient.isSekretessmarkering());
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) Patient(se.inera.intyg.common.support.model.common.internal.Patient) Test(org.junit.Test)

Example 14 with Patient

use of se.inera.intyg.common.support.model.common.internal.Patient in project webcert by sklintyg.

the class PatientDetailsResolverTest method testSOSDBIntygFristaendeWithPuUnavailable.

/**
 * Dödsbevis + fristående + EJ PU == null
 */
@Test
public void testSOSDBIntygFristaendeWithPuUnavailable() {
    when(puService.getPerson(any(Personnummer.class))).thenReturn(buildErrorPersonSvar());
    when(webCertUserService.getUser()).thenReturn(freeWebCertUser);
    Patient patient = testee.resolvePatient(PNR, "db");
    assertNull(patient);
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) Patient(se.inera.intyg.common.support.model.common.internal.Patient) Test(org.junit.Test)

Example 15 with Patient

use of se.inera.intyg.common.support.model.common.internal.Patient 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)

Aggregations

Patient (se.inera.intyg.common.support.model.common.internal.Patient)62 Test (org.junit.Test)28 Personnummer (se.inera.intyg.schemas.contract.Personnummer)28 Utkast (se.inera.intyg.webcert.persistence.utkast.model.Utkast)12 HoSPersonal (se.inera.intyg.common.support.model.common.internal.HoSPersonal)11 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)7 Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)7 Vardenhet (se.inera.intyg.common.support.model.common.internal.Vardenhet)6 ModuleApi (se.inera.intyg.common.support.modules.support.api.ModuleApi)6 ArrayList (java.util.ArrayList)5 Before (org.junit.Before)5 Vardgivare (se.inera.intyg.common.support.model.common.internal.Vardgivare)5 Vardgivare (se.inera.intyg.infra.integration.hsa.model.Vardgivare)5 IntygContentHolder (se.inera.intyg.webcert.web.service.intyg.dto.IntygContentHolder)5 Relations (se.inera.intyg.webcert.web.web.controller.api.dto.Relations)5 IOException (java.io.IOException)4 GrundData (se.inera.intyg.common.support.model.common.internal.GrundData)4 ModuleNotFoundException (se.inera.intyg.common.support.modules.registry.ModuleNotFoundException)4 ModuleException (se.inera.intyg.common.support.modules.support.api.exception.ModuleException)4 PersonSvar (se.inera.intyg.infra.integration.pu.model.PersonSvar)4