Search in sources :

Example 1 with SendCertificateToRecipientType

use of se.riv.clinicalprocess.healthcond.certificate.sendCertificateToRecipient.v2.SendCertificateToRecipientType in project webcert by sklintyg.

the class SendCertificateToRecipientResponderStub method sendCertificateToRecipient.

@Override
@StubLatencyAware
@StubModeAware
public SendCertificateToRecipientResponseType sendCertificateToRecipient(String logicalAddress, SendCertificateToRecipientType parameters) {
    CertificateHolder fromStore = intygStore.getIntygForCertificateId(parameters.getIntygsId().getExtension());
    SendCertificateToRecipientResponseType responseType = new SendCertificateToRecipientResponseType();
    if (fromStore == null) {
        ResultType resultOfCall = new ResultType();
        resultOfCall.setResultCode(ResultCodeType.ERROR);
        resultOfCall.setErrorId(ErrorIdType.APPLICATION_ERROR);
        responseType.setResult(resultOfCall);
        return responseType;
    }
    intygStore.addStatus(parameters.getIntygsId().getExtension(), new CertificateStateHolder("FKASSA", CertificateState.SENT, LocalDateTime.now()));
    ResultType resultType = new ResultType();
    resultType.setResultCode(ResultCodeType.OK);
    responseType.setResult(resultType);
    return responseType;
}
Also used : SendCertificateToRecipientResponseType(se.riv.clinicalprocess.healthcond.certificate.sendCertificateToRecipient.v2.SendCertificateToRecipientResponseType) CertificateStateHolder(se.inera.intyg.common.support.modules.support.api.CertificateStateHolder) CertificateHolder(se.inera.intyg.common.support.modules.support.api.CertificateHolder) ResultType(se.riv.clinicalprocess.healthcond.certificate.v3.ResultType) StubModeAware(se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware) StubLatencyAware(se.inera.intyg.webcert.intygstjanststub.mode.StubLatencyAware)

Example 2 with SendCertificateToRecipientType

use of se.riv.clinicalprocess.healthcond.certificate.sendCertificateToRecipient.v2.SendCertificateToRecipientType in project webcert by sklintyg.

the class SendCertificateToRecipientTypeConverter method convert.

public static SendCertificateToRecipientType convert(String intygsId, String personnummer, HoSPersonal skickatAv, String recipient) {
    SendCertificateToRecipientType request = new SendCertificateToRecipientType();
    request.setSkickatTidpunkt(LocalDateTime.now());
    request.setIntygsId(buildIntygId(intygsId));
    request.setPatientPersonId(InternalConverterUtil.getPersonId(createPnr(personnummer)));
    request.setMottagare(buildPart(recipient));
    request.setSkickatAv(buildSkickatAv(skickatAv));
    return request;
}
Also used : SendCertificateToRecipientType(se.riv.clinicalprocess.healthcond.certificate.sendCertificateToRecipient.v2.SendCertificateToRecipientType)

Example 3 with SendCertificateToRecipientType

use of se.riv.clinicalprocess.healthcond.certificate.sendCertificateToRecipient.v2.SendCertificateToRecipientType in project webcert by sklintyg.

the class SendCertificateServiceClientImpl method sendCertificate.

@Override
public SendCertificateToRecipientResponseType sendCertificate(String intygsId, String personId, String skickatAvJson, String recipient, String logicalAddress) {
    validateArgument(intygsId, "Cannot send certificate, argument 'intygsId' is null or empty.");
    validateArgument(personId, "Cannot send certificate, argument 'personId' is null or empty.");
    validateArgument(skickatAvJson, "Cannot send certificate, argument 'skickatAvJson' is null or empty.");
    validateArgument(recipient, "Cannot send certificate, argument 'recipient' is null or empty.");
    validateArgument(logicalAddress, "Cannot send certificate, argument 'logicalAddress' is null or empty.");
    HoSPersonal skickatAv = parseJson(skickatAvJson);
    SendCertificateToRecipientType request = SendCertificateToRecipientTypeConverter.convert(intygsId, personId, skickatAv, recipient);
    return sendService.sendCertificateToRecipient(logicalAddress, request);
}
Also used : HoSPersonal(se.inera.intyg.common.support.model.common.internal.HoSPersonal) SendCertificateToRecipientType(se.riv.clinicalprocess.healthcond.certificate.sendCertificateToRecipient.v2.SendCertificateToRecipientType)

Example 4 with SendCertificateToRecipientType

use of se.riv.clinicalprocess.healthcond.certificate.sendCertificateToRecipient.v2.SendCertificateToRecipientType in project webcert by sklintyg.

the class SendCertificateToRecipientTypeConverterTest method testConvert.

@Test
public void testConvert() throws Exception {
    final String intygsId = "intygsid";
    final String enhetsId = "enhetsid";
    final String enhetsnamn = "enhetsnamn";
    final String patientPersonId = "201212121212";
    final String skapadAvFullstandigtNamn = "fullstÃĪndigt namn";
    final String skapadAvPersonId = "skapad av pid";
    final String arbetsplatsKod = "arbetsplatsKod";
    final String postadress = "postadress";
    final String postNummer = "postNummer";
    final String postOrt = "postOrt";
    final String epost = "epost";
    final String telefonNummer = "telefonNummer";
    final String vardgivarid = "vardgivarid";
    final String vardgivarNamn = "vardgivarNamn";
    final String forskrivarKod = "forskrivarKod";
    final String recipient = "TRANSP";
    HoSPersonal skickatAv = buildHosPersonal(enhetsId, enhetsnamn, skapadAvFullstandigtNamn, skapadAvPersonId, arbetsplatsKod, postadress, postNummer, postOrt, epost, telefonNummer, vardgivarid, vardgivarNamn, forskrivarKod);
    SendCertificateToRecipientType result = SendCertificateToRecipientTypeConverter.convert(intygsId, patientPersonId, skickatAv, recipient);
    assertNotNull(result.getIntygsId().getRoot());
    assertEquals(intygsId, result.getIntygsId().getExtension());
    assertNotNull(result.getPatientPersonId().getRoot());
    assertEquals(patientPersonId, result.getPatientPersonId().getExtension());
    assertEquals(skapadAvFullstandigtNamn, result.getSkickatAv().getHosPersonal().getFullstandigtNamn());
    assertNotNull(result.getSkickatAv().getHosPersonal().getPersonalId().getRoot());
    assertEquals(skapadAvPersonId, result.getSkickatAv().getHosPersonal().getPersonalId().getExtension());
    assertNotNull(result.getSkickatAv().getHosPersonal().getEnhet().getEnhetsId().getRoot());
    assertEquals(enhetsId, result.getSkickatAv().getHosPersonal().getEnhet().getEnhetsId().getExtension());
    assertNotNull(result.getSkickatAv().getHosPersonal().getEnhet().getEnhetsId().getExtension());
    assertEquals(enhetsnamn, result.getSkickatAv().getHosPersonal().getEnhet().getEnhetsnamn());
    assertNotNull(result.getSkickatAv().getHosPersonal().getEnhet().getArbetsplatskod().getRoot());
    assertEquals(arbetsplatsKod, result.getSkickatAv().getHosPersonal().getEnhet().getArbetsplatskod().getExtension());
    assertEquals(postadress, result.getSkickatAv().getHosPersonal().getEnhet().getPostadress());
    assertEquals(postNummer, result.getSkickatAv().getHosPersonal().getEnhet().getPostnummer());
    assertEquals(postOrt, result.getSkickatAv().getHosPersonal().getEnhet().getPostort());
    assertEquals(epost, result.getSkickatAv().getHosPersonal().getEnhet().getEpost());
    assertEquals(telefonNummer, result.getSkickatAv().getHosPersonal().getEnhet().getTelefonnummer());
    assertNotNull(result.getSkickatAv().getHosPersonal().getEnhet().getVardgivare().getVardgivareId().getRoot());
    assertEquals(vardgivarid, result.getSkickatAv().getHosPersonal().getEnhet().getVardgivare().getVardgivareId().getExtension());
    assertEquals(vardgivarNamn, result.getSkickatAv().getHosPersonal().getEnhet().getVardgivare().getVardgivarnamn());
    assertEquals(forskrivarKod, result.getSkickatAv().getHosPersonal().getForskrivarkod());
    assertNotNull(result.getSkickatTidpunkt());
    assertNotNull(result.getMottagare().getCodeSystem());
    assertEquals("TRANSP", result.getMottagare().getCode());
}
Also used : HoSPersonal(se.inera.intyg.common.support.model.common.internal.HoSPersonal) SendCertificateToRecipientType(se.riv.clinicalprocess.healthcond.certificate.sendCertificateToRecipient.v2.SendCertificateToRecipientType) Test(org.junit.Test)

Aggregations

SendCertificateToRecipientType (se.riv.clinicalprocess.healthcond.certificate.sendCertificateToRecipient.v2.SendCertificateToRecipientType)3 HoSPersonal (se.inera.intyg.common.support.model.common.internal.HoSPersonal)2 Test (org.junit.Test)1 CertificateHolder (se.inera.intyg.common.support.modules.support.api.CertificateHolder)1 CertificateStateHolder (se.inera.intyg.common.support.modules.support.api.CertificateStateHolder)1 StubLatencyAware (se.inera.intyg.webcert.intygstjanststub.mode.StubLatencyAware)1 StubModeAware (se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware)1 SendCertificateToRecipientResponseType (se.riv.clinicalprocess.healthcond.certificate.sendCertificateToRecipient.v2.SendCertificateToRecipientResponseType)1 ResultType (se.riv.clinicalprocess.healthcond.certificate.v3.ResultType)1