Search in sources :

Example 6 with Intyg

use of se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.Intyg in project webcert by sklintyg.

the class NotificationPatientEnricherTest method testSekretessmarkeradPatientIsNotUpdated.

@Test
public void testSekretessmarkeradPatientIsNotUpdated() throws TemporaryException {
    when(puService.getPerson(any(Personnummer.class))).thenReturn(buildPersonSvar(true));
    Intyg intyg = buildIntyg("luae_fs");
    testee.enrichWithPatient(intyg);
    verify(puService, times(1)).getPerson(any(Personnummer.class));
    Patient p = intyg.getPatient();
    assertEquals("191212121212", p.getPersonId().getExtension());
    assertEquals("", p.getFornamn());
    assertEquals("", p.getMellannamn());
    assertEquals("Sekretessmarkering", p.getEfternamn());
    assertEquals("", p.getPostadress());
    assertEquals("", p.getPostnummer());
    assertEquals("", p.getPostort());
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) Intyg(se.riv.clinicalprocess.healthcond.certificate.v3.Intyg) TypAvIntyg(se.riv.clinicalprocess.healthcond.certificate.types.v3.TypAvIntyg) Patient(se.riv.clinicalprocess.healthcond.certificate.v3.Patient) Test(org.junit.Test)

Example 7 with Intyg

use of se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.Intyg in project webcert by sklintyg.

the class NotificationPatientEnricherTest method testLuaeFsIsEnriched.

@Test
public void testLuaeFsIsEnriched() throws TemporaryException {
    when(puService.getPerson(any(Personnummer.class))).thenReturn(buildPersonSvar(false));
    Intyg intyg = buildIntyg("luae_fs");
    testee.enrichWithPatient(intyg);
    verify(puService, times(1)).getPerson(any(Personnummer.class));
    Patient p = intyg.getPatient();
    assertEquals("Tolvan", p.getFornamn());
    assertEquals("Mellis", p.getMellannamn());
    assertEquals("Tolvansson", p.getEfternamn());
    assertEquals("Tolvgatan 12", p.getPostadress());
    assertEquals("12121", p.getPostnummer());
    assertEquals("Tolvhult", p.getPostort());
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) Intyg(se.riv.clinicalprocess.healthcond.certificate.v3.Intyg) TypAvIntyg(se.riv.clinicalprocess.healthcond.certificate.types.v3.TypAvIntyg) Patient(se.riv.clinicalprocess.healthcond.certificate.v3.Patient) Test(org.junit.Test)

Example 8 with Intyg

use of se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.Intyg in project webcert by sklintyg.

the class NotificationTypeConverterTest method buildIntyg.

private Intyg buildIntyg() {
    Enhet enhet = new Enhet();
    enhet.setArbetsplatskod(new ArbetsplatsKod());
    enhet.setVardgivare(new Vardgivare());
    // Not accepted value
    enhet.setEpost("");
    HosPersonal skapadAv = new HosPersonal();
    skapadAv.setEnhet(enhet);
    Intyg intyg = new Intyg();
    intyg.setSkapadAv(skapadAv);
    return intyg;
}
Also used : HosPersonal(se.riv.clinicalprocess.healthcond.certificate.v3.HosPersonal) Enhet(se.riv.clinicalprocess.healthcond.certificate.v3.Enhet) ArbetsplatsKod(se.riv.clinicalprocess.healthcond.certificate.types.v3.ArbetsplatsKod) Intyg(se.riv.clinicalprocess.healthcond.certificate.v3.Intyg) Vardgivare(se.riv.clinicalprocess.healthcond.certificate.v3.Vardgivare)

Example 9 with Intyg

use of se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.Intyg in project webcert by sklintyg.

the class NotificationTypeConverterTest method testNotUpdatingExistingValues.

@Test
public void testNotUpdatingExistingValues() {
    final String intygsId = "intygsid";
    final String arbetsplatskod = "ARBETSPLATSKOD";
    final String epost = "EPOST";
    final LocalDateTime handelsetid = LocalDateTime.now().minusDays(1);
    final HandelsekodEnum handelsetyp = HandelsekodEnum.ANDRAT;
    Intyg intyg = buildIntyg();
    Enhet enhet = intyg.getSkapadAv().getEnhet();
    enhet.getArbetsplatskod().setExtension(arbetsplatskod);
    enhet.setEpost(epost);
    NotificationMessage msg = new NotificationMessage(intygsId, "luse", handelsetid, handelsetyp, "address", "", null, new ArendeCount(4, 3, 2, 1), new ArendeCount(4, 3, 2, 1), SchemaVersion.VERSION_3, "ref");
    CertificateStatusUpdateForCareType res = NotificationTypeConverter.convert(msg, intyg);
    assertEquals(arbetsplatskod, res.getIntyg().getSkapadAv().getEnhet().getArbetsplatskod().getExtension());
    assertEquals(epost, res.getIntyg().getSkapadAv().getEnhet().getEpost());
}
Also used : LocalDateTime(java.time.LocalDateTime) Enhet(se.riv.clinicalprocess.healthcond.certificate.v3.Enhet) NotificationMessage(se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage) Intyg(se.riv.clinicalprocess.healthcond.certificate.v3.Intyg) ArendeCount(se.inera.intyg.common.support.modules.support.api.notification.ArendeCount) CertificateStatusUpdateForCareType(se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType) HandelsekodEnum(se.inera.intyg.common.support.common.enumerations.HandelsekodEnum) Test(org.junit.Test)

Example 10 with Intyg

use of se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.Intyg in project webcert by sklintyg.

the class NotificationTypeConverterTest method testConvertWhenHandelsekodIsNYFRFM.

@Test
public void testConvertWhenHandelsekodIsNYFRFM() throws Exception {
    final String intygsId = "intygsid";
    final LocalDateTime handelsetid = LocalDateTime.now().minusDays(1);
    final LocalDate sistaSvarsDatum = LocalDate.now().plusWeeks(3);
    final HandelsekodEnum handelsetyp = HandelsekodEnum.NYFRFM;
    final Amneskod amneskod = AmneskodCreator.create("KOMPLT", "Komplettering");
    final int skickadeFragorTotalt = 8;
    final int skickadeFragorHanterade = 7;
    final int skickadeFragorBesvarade = 6;
    final int skickadeFragorEjBesvarade = 5;
    final int mottagnaFragorTotalt = 4;
    final int mottagnaFragorHanterade = 3;
    final int mottagnaFragorBesvarade = 2;
    final int mottagnaFragorEjBesvarade = 1;
    final Intyg intyg = buildIntyg();
    ArendeCount skickadeFragor = new ArendeCount(skickadeFragorTotalt, skickadeFragorEjBesvarade, skickadeFragorBesvarade, skickadeFragorHanterade);
    ArendeCount mottagnaFragor = new ArendeCount(mottagnaFragorTotalt, mottagnaFragorEjBesvarade, mottagnaFragorBesvarade, mottagnaFragorHanterade);
    NotificationMessage msg = new NotificationMessage(intygsId, "luse", handelsetid, handelsetyp, "address", "", null, skickadeFragor, mottagnaFragor, SchemaVersion.VERSION_3, "ref", amneskod, sistaSvarsDatum);
    CertificateStatusUpdateForCareType res = NotificationTypeConverter.convert(msg, intyg);
    assertEquals(intyg, res.getIntyg());
    assertEquals(HandelsekodEnum.NYFRFM.value(), res.getHandelse().getHandelsekod().getCode());
    assertEquals(HandelsekodEnum.NYFRFM.description(), res.getHandelse().getHandelsekod().getDisplayName());
    assertEquals(handelsetid, res.getHandelse().getTidpunkt());
    assertEquals(sistaSvarsDatum, res.getHandelse().getSistaDatumForSvar());
    assertEquals(amneskod.getCode(), res.getHandelse().getAmne().getCode());
    assertEquals(amneskod.getCodeSystem(), res.getHandelse().getAmne().getCodeSystem());
    assertEquals(amneskod.getDisplayName(), res.getHandelse().getAmne().getDisplayName());
    assertSkickadeFrågor(skickadeFragorTotalt, skickadeFragorHanterade, skickadeFragorBesvarade, skickadeFragorEjBesvarade, res);
    assertMottagnaFragor(mottagnaFragorTotalt, mottagnaFragorHanterade, mottagnaFragorBesvarade, mottagnaFragorEjBesvarade, res);
    // Make sure we have a valid Intyg according to service contract
    assertEquals(NotificationTypeConverter.TEMPORARY_ARBETSPLATSKOD, res.getIntyg().getSkapadAv().getEnhet().getArbetsplatskod().getExtension());
    assertNull(res.getIntyg().getSkapadAv().getEnhet().getEpost());
}
Also used : LocalDateTime(java.time.LocalDateTime) NotificationMessage(se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage) Intyg(se.riv.clinicalprocess.healthcond.certificate.v3.Intyg) ArendeCount(se.inera.intyg.common.support.modules.support.api.notification.ArendeCount) CertificateStatusUpdateForCareType(se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType) HandelsekodEnum(se.inera.intyg.common.support.common.enumerations.HandelsekodEnum) LocalDate(java.time.LocalDate) Amneskod(se.riv.clinicalprocess.healthcond.certificate.types.v3.Amneskod) Test(org.junit.Test)

Aggregations

Intyg (se.riv.clinicalprocess.healthcond.certificate.v3.Intyg)15 TypAvIntyg (se.riv.clinicalprocess.healthcond.certificate.types.v3.TypAvIntyg)7 Test (org.junit.Test)6 NotificationMessage (se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage)5 Patient (se.riv.clinicalprocess.healthcond.certificate.v3.Patient)5 ArendeCount (se.inera.intyg.common.support.modules.support.api.notification.ArendeCount)4 CertificateStatusUpdateForCareType (se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType)4 Intyg (se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.Intyg)4 HsaId (se.riv.clinicalprocess.healthcond.certificate.types.v3.HsaId)4 Enhet (se.riv.clinicalprocess.healthcond.certificate.v3.Enhet)4 LocalDateTime (java.time.LocalDateTime)3 HandelsekodEnum (se.inera.intyg.common.support.common.enumerations.HandelsekodEnum)3 ModuleApi (se.inera.intyg.common.support.modules.support.api.ModuleApi)3 Personnummer (se.inera.intyg.schemas.contract.Personnummer)3 Enhet (se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.Enhet)3 HosPersonal (se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.HosPersonal)3 ArbetsplatsKod (se.riv.clinicalprocess.healthcond.certificate.types.v3.ArbetsplatsKod)3 PersonId (se.riv.clinicalprocess.healthcond.certificate.types.v3.PersonId)3 HosPersonal (se.riv.clinicalprocess.healthcond.certificate.v3.HosPersonal)3 Vardgivare (se.riv.clinicalprocess.healthcond.certificate.v3.Vardgivare)3