Search in sources :

Example 1 with CertificateStatusUpdateForCareType

use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareType in project webcert by sklintyg.

the class RouteIT method setupConverter.

private void setupConverter() throws ModuleException {
    when(mockFk7263Transform.createCertificateStatusUpdateForCareType(any(NotificationMessage.class))).thenAnswer(invocation -> {
        NotificationMessage msg = (NotificationMessage) invocation.getArguments()[0];
        if (msg == null) {
            return null;
        }
        CertificateStatusUpdateForCareType request = new CertificateStatusUpdateForCareType();
        UtlatandeType utlatande = new UtlatandeType();
        UtlatandeId id = new UtlatandeId();
        id.setExtension(msg.getIntygsId());
        utlatande.setUtlatandeId(id);
        request.setUtlatande(utlatande);
        return request;
    });
}
Also used : NotificationMessage(se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage) UtlatandeId(se.riv.clinicalprocess.healthcond.certificate.types.v1.UtlatandeId) UtlatandeType(se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.UtlatandeType) CertificateStatusUpdateForCareType(se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareType)

Example 2 with CertificateStatusUpdateForCareType

use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareType in project webcert by sklintyg.

the class NotificationTransformerTest method setupInternalToNotification.

private void setupInternalToNotification() throws ModuleException {
    when(internalToNotification.createCertificateStatusUpdateForCareType(any())).thenAnswer(invocation -> {
        NotificationMessage msg = (NotificationMessage) invocation.getArguments()[0];
        if (msg == null) {
            return null;
        }
        CertificateStatusUpdateForCareType request = new CertificateStatusUpdateForCareType();
        UtlatandeType utlatande = new UtlatandeType();
        UtlatandeId utlatandeId = new UtlatandeId();
        utlatandeId.setExtension(msg.getIntygsId());
        utlatande.setUtlatandeId(utlatandeId);
        request.setUtlatande(utlatande);
        return request;
    });
}
Also used : NotificationMessage(se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage) UtlatandeId(se.riv.clinicalprocess.healthcond.certificate.types.v1.UtlatandeId) UtlatandeType(se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.UtlatandeType) CertificateStatusUpdateForCareType(se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareType)

Example 3 with CertificateStatusUpdateForCareType

use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareType 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 4 with CertificateStatusUpdateForCareType

use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareType 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)

Example 5 with CertificateStatusUpdateForCareType

use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareType in project webcert by sklintyg.

the class NotificationTypeConverterTest method testConvert.

@Test
public void testConvert() throws Exception {
    final String intygsId = "intygsid";
    final LocalDateTime handelsetid = LocalDateTime.now().minusDays(1);
    final HandelsekodEnum handelsetyp = HandelsekodEnum.ANDRAT;
    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");
    CertificateStatusUpdateForCareType res = NotificationTypeConverter.convert(msg, intyg);
    assertEquals(intyg, res.getIntyg());
    assertEquals(HandelsekodEnum.ANDRAT.value(), res.getHandelse().getHandelsekod().getCode());
    assertEquals(HandelsekodEnum.ANDRAT.description(), res.getHandelse().getHandelsekod().getDisplayName());
    assertEquals(handelsetid, res.getHandelse().getTidpunkt());
    assertNotNull(res.getHandelse().getHandelsekod().getCodeSystem());
    // handelsekod -> codeSystemName is not valid in schema but incorrectly generated in java class
    // therefore we should not populate this field
    assertNull(res.getHandelse().getHandelsekod().getCodeSystemName());
    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) Test(org.junit.Test)

Aggregations

CertificateStatusUpdateForCareType (se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType)6 NotificationMessage (se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage)5 CertificateStatusUpdateForCareType (se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareType)5 UtlatandeType (se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.UtlatandeType)4 UtlatandeId (se.riv.clinicalprocess.healthcond.certificate.types.v1.UtlatandeId)4 Intyg (se.riv.clinicalprocess.healthcond.certificate.v3.Intyg)4 LocalDateTime (java.time.LocalDateTime)3 Test (org.junit.Test)3 HandelsekodEnum (se.inera.intyg.common.support.common.enumerations.HandelsekodEnum)3 ArendeCount (se.inera.intyg.common.support.modules.support.api.notification.ArendeCount)3 Handelse (se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.Handelse)2 LocalDate (java.time.LocalDate)1 List (java.util.List)1 Map (java.util.Map)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 QName (javax.xml.namespace.QName)1 JaxbDataFormat (org.apache.camel.converter.jaxb.JaxbDataFormat)1 NotificationStubEntry (se.inera.intyg.webcert.notificationstub.v3.stat.NotificationStubEntry)1