Search in sources :

Example 6 with SendMessageToRecipientType

use of se.riv.clinicalprocess.healthcond.certificate.sendMessageToRecipient.v2.SendMessageToRecipientType in project webcert by sklintyg.

the class SendMessageToRecipientTypeBuilder method build.

public static SendMessageToRecipientType build(Arende arende, WebCertUser skickatAv, String logiskAdressMottagare) {
    SendMessageToRecipientType request = new SendMessageToRecipientType();
    request.setAmne(buildAmne(arende));
    request.setIntygsId(buildIntygId(arende));
    request.setLogiskAdressMottagare(logiskAdressMottagare);
    request.setMeddelande(arende.getMeddelande());
    request.setMeddelandeId(arende.getMeddelandeId());
    request.setPaminnelseMeddelandeId(arende.getPaminnelseMeddelandeId());
    request.setPatientPersonId(InternalConverterUtil.getPersonId(createPnr(arende.getPatientPersonId())));
    request.setReferensId(arende.getReferensId());
    request.setRubrik(arende.getRubrik());
    request.setSistaDatumForSvar(arende.getSistaDatumForSvar());
    request.setSkickatAv(buildHosPersonalFromWebCertUser(skickatAv));
    request.setSkickatTidpunkt(arende.getSkickatTidpunkt());
    decorateWithSvarPa(request, arende);
    return request;
}
Also used : SendMessageToRecipientType(se.riv.clinicalprocess.healthcond.certificate.sendMessageToRecipient.v2.SendMessageToRecipientType)

Example 7 with SendMessageToRecipientType

use of se.riv.clinicalprocess.healthcond.certificate.sendMessageToRecipient.v2.SendMessageToRecipientType in project webcert by sklintyg.

the class SendMessageToRecipientTypeBuilderTest method buildTest.

@Test
public void buildTest() {
    final Arende arende = buildArende();
    final WebCertUser skickatAv = buildWebCertUser(true);
    final String logiskAdressMottagare = "logical address";
    SendMessageToRecipientType result = SendMessageToRecipientTypeBuilder.build(arende, skickatAv, logiskAdressMottagare);
    assertNotNull(result);
    assertEquals(logiskAdressMottagare, result.getLogiskAdressMottagare());
    assertEquals(AMNE.name(), result.getAmne().getCode());
    assertEquals(AMNE.getDescription(), result.getAmne().getDisplayName());
    assertNotNull(result.getAmne().getCodeSystem());
    assertEquals(MEDDELANDE, result.getMeddelande());
    assertEquals(MEDDELANDE_ID, result.getMeddelandeId());
    assertEquals(PAMINNELSE_MEDDELANDE_ID, result.getPaminnelseMeddelandeId());
    assertEquals(PATIENT_PERSON_ID, result.getPatientPersonId().getExtension());
    assertNotNull(result.getPatientPersonId().getRoot());
    assertEquals(REFERENS_ID, result.getReferensId());
    assertEquals(RUBRIK, result.getRubrik());
    assertEquals(SISTA_DATUM_FOR_SVAR, result.getSistaDatumForSvar());
    assertEquals(SKICKAT_TIDPUNKT, result.getSkickatTidpunkt());
    assertEquals(SVAR_PA_ID, result.getSvarPa().getMeddelandeId());
    assertEquals(SVAR_PA_REFERENS, result.getSvarPa().getReferensId());
    assertEquals(ENHET_ID, result.getIntygsId().getRoot());
    assertEquals(INTYG_ID, result.getIntygsId().getExtension());
    assertEquals(PERSONAL_HSA_ID, result.getSkickatAv().getPersonalId().getExtension());
    assertNotNull(result.getSkickatAv().getPersonalId().getRoot());
    assertEquals(USER_NAMN, result.getSkickatAv().getFullstandigtNamn());
    assertEquals(USER_FORSKRIVARKOD, result.getSkickatAv().getForskrivarkod());
    assertEquals(ARBETSPLATSKOD, result.getSkickatAv().getEnhet().getArbetsplatskod().getExtension());
    assertNotNull(result.getSkickatAv().getEnhet().getArbetsplatskod().getRoot());
    assertEquals(VARDENHET_EPOST, result.getSkickatAv().getEnhet().getEpost());
    assertEquals(VARDENHET_ENHET_ID, result.getSkickatAv().getEnhet().getEnhetsId().getExtension());
    assertNotNull(result.getSkickatAv().getEnhet().getEnhetsId().getRoot());
    assertEquals(VARDENHET_NAMN, result.getSkickatAv().getEnhet().getEnhetsnamn());
    assertEquals(VARDENHET_POSTADRESS, result.getSkickatAv().getEnhet().getPostadress());
    assertEquals(VARDENHET_POSTNUMMER, result.getSkickatAv().getEnhet().getPostnummer());
    assertEquals(VARDENHET_POSTORT, result.getSkickatAv().getEnhet().getPostort());
    assertEquals(VARDENHET_TELEFONNUMMER, result.getSkickatAv().getEnhet().getTelefonnummer());
    assertEquals(VARDGIVARE_ID, result.getSkickatAv().getEnhet().getVardgivare().getVardgivareId().getExtension());
    assertNotNull(result.getSkickatAv().getEnhet().getVardgivare().getVardgivareId().getRoot());
    assertEquals(VARDGIVARE_NAMN, result.getSkickatAv().getEnhet().getVardgivare().getVardgivarnamn());
}
Also used : Arende(se.inera.intyg.webcert.persistence.arende.model.Arende) SendMessageToRecipientType(se.riv.clinicalprocess.healthcond.certificate.sendMessageToRecipient.v2.SendMessageToRecipientType) WebCertUser(se.inera.intyg.webcert.web.service.user.dto.WebCertUser) Test(org.junit.Test)

Example 8 with SendMessageToRecipientType

use of se.riv.clinicalprocess.healthcond.certificate.sendMessageToRecipient.v2.SendMessageToRecipientType in project webcert by sklintyg.

the class SendMessageToRecipientTypeBuilderTest method buildQuestionTest.

@Test
public void buildQuestionTest() {
    final Arende arende = buildArende();
    // question
    arende.setSvarPaId(null);
    final WebCertUser skickatAv = buildWebCertUser(true);
    final String logiskAdressMottagare = "logical address";
    SendMessageToRecipientType result = SendMessageToRecipientTypeBuilder.build(arende, skickatAv, logiskAdressMottagare);
    assertNotNull(result);
    assertEquals(AMNE.name(), result.getAmne().getCode());
    assertNull(result.getSvarPa());
}
Also used : Arende(se.inera.intyg.webcert.persistence.arende.model.Arende) SendMessageToRecipientType(se.riv.clinicalprocess.healthcond.certificate.sendMessageToRecipient.v2.SendMessageToRecipientType) WebCertUser(se.inera.intyg.webcert.web.service.user.dto.WebCertUser) Test(org.junit.Test)

Example 9 with SendMessageToRecipientType

use of se.riv.clinicalprocess.healthcond.certificate.sendMessageToRecipient.v2.SendMessageToRecipientType in project webcert by sklintyg.

the class SendMessageToRecipientTypeBuilderTest method buildTestNullToEmptyString.

@Test
public void buildTestNullToEmptyString() {
    final Arende arende = buildArende();
    final WebCertUser skickatAv = buildWebCertUser(false);
    final String logiskAdressMottagare = "logical address";
    SendMessageToRecipientType result = SendMessageToRecipientTypeBuilder.build(arende, skickatAv, logiskAdressMottagare);
    assertEquals("", result.getSkickatAv().getEnhet().getEnhetsnamn());
    assertEquals("", result.getSkickatAv().getEnhet().getPostadress());
    assertEquals("", result.getSkickatAv().getEnhet().getPostnummer());
    assertEquals("", result.getSkickatAv().getEnhet().getPostort());
    assertEquals("", result.getSkickatAv().getEnhet().getTelefonnummer());
    assertNull(result.getSkickatAv().getEnhet().getEpost());
    assertEquals("", result.getSkickatAv().getEnhet().getVardgivare().getVardgivarnamn());
}
Also used : Arende(se.inera.intyg.webcert.persistence.arende.model.Arende) SendMessageToRecipientType(se.riv.clinicalprocess.healthcond.certificate.sendMessageToRecipient.v2.SendMessageToRecipientType) WebCertUser(se.inera.intyg.webcert.web.service.user.dto.WebCertUser) Test(org.junit.Test)

Aggregations

SendMessageToRecipientType (se.riv.clinicalprocess.healthcond.certificate.sendMessageToRecipient.v2.SendMessageToRecipientType)9 Test (org.junit.Test)4 Arende (se.inera.intyg.webcert.persistence.arende.model.Arende)4 WebCertUser (se.inera.intyg.webcert.web.service.user.dto.WebCertUser)3 JAXBException (javax.xml.bind.JAXBException)2 StringWriter (java.io.StringWriter)1 WebServiceException (javax.xml.ws.WebServiceException)1 PermanentException (se.inera.intyg.webcert.common.sender.exception.PermanentException)1 TemporaryException (se.inera.intyg.webcert.common.sender.exception.TemporaryException)1 WebCertServiceException (se.inera.intyg.webcert.common.service.exception.WebCertServiceException)1 MedicinsktArende (se.inera.intyg.webcert.persistence.arende.model.MedicinsktArende)1 CertificateSenderException (se.inera.intyg.webcert.web.service.certificatesender.CertificateSenderException)1 ObjectFactory (se.riv.clinicalprocess.healthcond.certificate.sendMessageToRecipient.v2.ObjectFactory)1 SendMessageToRecipientResponseType (se.riv.clinicalprocess.healthcond.certificate.sendMessageToRecipient.v2.SendMessageToRecipientResponseType)1 Amneskod (se.riv.clinicalprocess.healthcond.certificate.types.v3.Amneskod)1 ArbetsplatsKod (se.riv.clinicalprocess.healthcond.certificate.types.v3.ArbetsplatsKod)1 HsaId (se.riv.clinicalprocess.healthcond.certificate.types.v3.HsaId)1 IntygId (se.riv.clinicalprocess.healthcond.certificate.types.v3.IntygId)1 PersonId (se.riv.clinicalprocess.healthcond.certificate.types.v3.PersonId)1 Enhet (se.riv.clinicalprocess.healthcond.certificate.v3.Enhet)1