Search in sources :

Example 1 with Intyg

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

the class ListCertificatesForCareResponderStub method listCertificatesForCare.

@Override
@StubLatencyAware
@StubModeAware
public ListCertificatesForCareResponseType listCertificatesForCare(String logicalAddress, ListCertificatesForCareType parameters) {
    ListCertificatesForCareResponseType response = new ListCertificatesForCareResponseType();
    response.setIntygsLista(new ListaType());
    response.getIntygsLista().getIntyg();
    List<CertificateHolder> intygForEnhetAndPersonnummer = intygStore.getIntygForEnhetAndPersonnummer(parameters.getEnhetsId().stream().map(HsaId::getExtension).collect(Collectors.toList()), parameters.getPersonId().getExtension());
    for (CertificateHolder cert : intygForEnhetAndPersonnummer) {
        Intyg intyg = getIntyg(cert);
        intyg.getStatus().addAll(CertificateStateHolderConverter.toIntygsStatusType(cert.getCertificateStates()));
        response.getIntygsLista().getIntyg().add(intyg);
    }
    return response;
}
Also used : CertificateHolder(se.inera.intyg.common.support.modules.support.api.CertificateHolder) Intyg(se.riv.clinicalprocess.healthcond.certificate.v3.Intyg) ListaType(se.riv.clinicalprocess.healthcond.certificate.listcertificatesforcare.v3.ListaType) HsaId(se.riv.clinicalprocess.healthcond.certificate.types.v3.HsaId) ListCertificatesForCareResponseType(se.riv.clinicalprocess.healthcond.certificate.listcertificatesforcare.v3.ListCertificatesForCareResponseType) StubModeAware(se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware) StubLatencyAware(se.inera.intyg.webcert.intygstjanststub.mode.StubLatencyAware)

Example 2 with Intyg

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

the class CreateDraftCertificateResponderImplTest method createCertificateType.

private CreateDraftCertificateType createCertificateType() {
    // Type
    TypAvIntyg utlTyp = new TypAvIntyg();
    utlTyp.setCode("fk7263");
    // HoSPerson
    HsaId userHsaId = new HsaId();
    userHsaId.setExtension(USER_HSAID);
    userHsaId.setRoot("USERHSAID");
    HsaId unitHsaId = new HsaId();
    unitHsaId.setExtension(UNIT_HSAID);
    unitHsaId.setRoot("UNITHSAID");
    Enhet hosEnhet = new Enhet();
    hosEnhet.setEnhetsId(unitHsaId);
    HosPersonal hosPerson = new HosPersonal();
    hosPerson.setFullstandigtNamn("Abel Baker");
    hosPerson.setPersonalId(userHsaId);
    hosPerson.setEnhet(hosEnhet);
    // Patient
    PersonId personId = new PersonId();
    personId.setRoot("PERSNR");
    personId.setExtension("19121212-1212");
    Patient patType = new Patient();
    patType.setPersonId(personId);
    patType.setFornamn("Adam");
    patType.setMellannamn("Cesarsson");
    patType.setEfternamn("Eriksson");
    Intyg utlatande = new Intyg();
    utlatande.setTypAvIntyg(utlTyp);
    utlatande.setSkapadAv(hosPerson);
    utlatande.setPatient(patType);
    utlatande.setRef("Test-ref");
    CreateDraftCertificateType certificateType = new CreateDraftCertificateType();
    certificateType.setIntyg(utlatande);
    return certificateType;
}
Also used : HosPersonal(se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.HosPersonal) Enhet(se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.Enhet) TypAvIntyg(se.riv.clinicalprocess.healthcond.certificate.types.v3.TypAvIntyg) PersonId(se.riv.clinicalprocess.healthcond.certificate.types.v3.PersonId) CreateDraftCertificateType(se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.CreateDraftCertificateType) TypAvIntyg(se.riv.clinicalprocess.healthcond.certificate.types.v3.TypAvIntyg) Intyg(se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.Intyg) Patient(se.riv.clinicalprocess.healthcond.certificate.v3.Patient) HsaId(se.riv.clinicalprocess.healthcond.certificate.types.v3.HsaId)

Example 3 with Intyg

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

the class CreateDraftCertificateValidatorImplTest method buildIntyg.

private Intyg buildIntyg(String intygsKod, String patientEfternamn, String patientFornamn, String hosPersonalFullstandigtNamn, String enhetsId, String enhetsnamn, boolean createUnit, String personId) {
    Intyg intyg = new Intyg();
    TypAvIntyg typAvIntyg = new TypAvIntyg();
    typAvIntyg.setCode(intygsKod);
    intyg.setTypAvIntyg(typAvIntyg);
    Patient patient = new Patient();
    patient.setEfternamn(patientEfternamn);
    patient.setFornamn(patientFornamn);
    if (personId != null) {
        patient.setPersonId(new PersonId());
        patient.getPersonId().setExtension(personId);
    }
    intyg.setPatient(patient);
    HosPersonal hosPersonal = new HosPersonal();
    hosPersonal.setFullstandigtNamn(hosPersonalFullstandigtNamn);
    HsaId personalHsaId = new HsaId();
    personalHsaId.setExtension("personal-1");
    hosPersonal.setPersonalId(personalHsaId);
    if (createUnit) {
        Enhet enhet = new Enhet();
        enhet.setEnhetsId(new HsaId());
        enhet.getEnhetsId().setExtension(enhetsId);
        enhet.setEnhetsnamn(enhetsnamn);
        hosPersonal.setEnhet(enhet);
    }
    intyg.setSkapadAv(hosPersonal);
    return intyg;
}
Also used : HosPersonal(se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.HosPersonal) Enhet(se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.Enhet) TypAvIntyg(se.riv.clinicalprocess.healthcond.certificate.types.v3.TypAvIntyg) PersonId(se.riv.clinicalprocess.healthcond.certificate.types.v3.PersonId) TypAvIntyg(se.riv.clinicalprocess.healthcond.certificate.types.v3.TypAvIntyg) Intyg(se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.Intyg) Patient(se.riv.clinicalprocess.healthcond.certificate.v3.Patient) HsaId(se.riv.clinicalprocess.healthcond.certificate.types.v3.HsaId)

Example 4 with Intyg

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

the class NotificationTransformerTest method testSchemaVersion2Transformation.

@Test
public void testSchemaVersion2Transformation() throws Exception {
    NotificationMessage notificationMessage = new NotificationMessage(INTYGS_ID, LUSE, LocalDateTime.now(), HandelsekodEnum.SKAPAT, LOGISK_ADRESS, "{ }", null, ArendeCount.getEmpty(), ArendeCount.getEmpty(), SchemaVersion.VERSION_3, "ref");
    Message message = spy(new DefaultMessage());
    message.setBody(notificationMessage);
    ModuleApi moduleApi = mock(ModuleApi.class);
    when(moduleRegistry.getModuleApi(eq(LUSE))).thenReturn(moduleApi);
    Intyg intyg = new Intyg();
    IntygId intygsId = new IntygId();
    intygsId.setExtension(INTYGS_ID);
    intyg.setIntygsId(intygsId);
    HosPersonal hosPersonal = new HosPersonal();
    Enhet enhet = new Enhet();
    enhet.setArbetsplatskod(new ArbetsplatsKod());
    enhet.setVardgivare(new Vardgivare());
    hosPersonal.setEnhet(enhet);
    intyg.setSkapadAv(hosPersonal);
    when(moduleApi.getIntygFromUtlatande(any())).thenReturn(intyg);
    transformer.process(message);
    assertEquals(INTYGS_ID, ((se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType) message.getBody()).getIntyg().getIntygsId().getExtension());
    assertEquals(HandelsekodEnum.SKAPAT.value(), message.getHeader(NotificationRouteHeaders.HANDELSE));
    assertEquals(INTYGS_ID, message.getHeader(NotificationRouteHeaders.INTYGS_ID));
    assertEquals(LOGISK_ADRESS, message.getHeader(NotificationRouteHeaders.LOGISK_ADRESS));
    assertEquals(SchemaVersion.VERSION_3.name(), message.getHeader(NotificationRouteHeaders.VERSION));
    verify(message, times(1)).setHeader(eq(NotificationRouteHeaders.LOGISK_ADRESS), eq(LOGISK_ADRESS));
    verify(message, times(1)).setHeader(eq(NotificationRouteHeaders.INTYGS_ID), eq(INTYGS_ID));
    verify(message, times(1)).setHeader(eq(NotificationRouteHeaders.HANDELSE), eq(HandelsekodEnum.SKAPAT.value()));
    verify(message, times(1)).setHeader(eq(NotificationRouteHeaders.VERSION), eq(SchemaVersion.VERSION_3.name()));
    verify(moduleRegistry, times(1)).getModuleApi(eq(LUSE));
    verify(moduleApi, times(1)).getUtlatandeFromJson(any());
    verify(moduleApi, times(1)).getIntygFromUtlatande(any());
    verify(notificationPatientEnricher, times(1)).enrichWithPatient(any());
}
Also used : DefaultMessage(org.apache.camel.impl.DefaultMessage) ModuleApi(se.inera.intyg.common.support.modules.support.api.ModuleApi) HosPersonal(se.riv.clinicalprocess.healthcond.certificate.v3.HosPersonal) ArbetsplatsKod(se.riv.clinicalprocess.healthcond.certificate.types.v3.ArbetsplatsKod) Message(org.apache.camel.Message) NotificationMessage(se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage) DefaultMessage(org.apache.camel.impl.DefaultMessage) Intyg(se.riv.clinicalprocess.healthcond.certificate.v3.Intyg) Vardgivare(se.riv.clinicalprocess.healthcond.certificate.v3.Vardgivare) IntygId(se.riv.clinicalprocess.healthcond.certificate.types.v3.IntygId) Enhet(se.riv.clinicalprocess.healthcond.certificate.v3.Enhet) NotificationMessage(se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage) Test(org.junit.Test)

Example 5 with Intyg

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

the class NotificationPatientEnricherTest method buildIntyg.

private Intyg buildIntyg(String intygsTyp) {
    Intyg intyg = new Intyg();
    TypAvIntyg typAvIntyg = new TypAvIntyg();
    typAvIntyg.setCode(intygsTyp);
    intyg.setTyp(typAvIntyg);
    intyg.setPatient(NotificationTestHelper.buildPatient());
    return intyg;
}
Also used : TypAvIntyg(se.riv.clinicalprocess.healthcond.certificate.types.v3.TypAvIntyg) Intyg(se.riv.clinicalprocess.healthcond.certificate.v3.Intyg) TypAvIntyg(se.riv.clinicalprocess.healthcond.certificate.types.v3.TypAvIntyg)

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 Patient (se.riv.clinicalprocess.healthcond.certificate.v3.Patient)6 NotificationMessage (se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage)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 PermanentException (se.inera.intyg.webcert.common.sender.exception.PermanentException)3 TemporaryException (se.inera.intyg.webcert.common.sender.exception.TemporaryException)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