Search in sources :

Example 1 with CertificateHolder

use of se.inera.intyg.common.support.modules.support.api.CertificateHolder in project webcert by sklintyg.

the class GetMedicalCertificateResponderStub method getMedicalCertificate.

@Override
@StubLatencyAware
@StubModeAware
public GetMedicalCertificateResponseType getMedicalCertificate(String logicalAddress, GetMedicalCertificateRequestType request) {
    GetMedicalCertificateResponseType response = new GetMedicalCertificateResponseType();
    CertificateHolder intygResponse = intygStore.getIntygForCertificateId(request.getCertificateId());
    if (intygResponse != null) {
        response.setMeta(ModelConverter.toCertificateMetaType(intygResponse));
        attachCertificateDocument(intygResponse, response);
        if (intygResponse.isRevoked()) {
            response.setResult(ResultTypeUtil.errorResult(ErrorIdType.REVOKED, String.format("Certificate '%s' has been revoked", intygResponse.getId())));
        } else {
            response.setResult(ResultTypeUtil.okResult());
        }
    } else {
        response.setResult(ResultTypeUtil.errorResult(ErrorIdType.VALIDATION_ERROR, "Intyg not found in stub"));
    }
    return response;
}
Also used : GetMedicalCertificateResponseType(se.inera.intyg.clinicalprocess.healthcond.certificate.getmedicalcertificate.v1.GetMedicalCertificateResponseType) CertificateHolder(se.inera.intyg.common.support.modules.support.api.CertificateHolder) StubModeAware(se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware) StubLatencyAware(se.inera.intyg.webcert.intygstjanststub.mode.StubLatencyAware)

Example 2 with CertificateHolder

use of se.inera.intyg.common.support.modules.support.api.CertificateHolder 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 3 with CertificateHolder

use of se.inera.intyg.common.support.modules.support.api.CertificateHolder in project webcert by sklintyg.

the class RegisterTSDiabetesResponderStub method buildStubInternalCertificate.

private CertificateHolder buildStubInternalCertificate(RegisterTSDiabetesType parameters) {
    CertificateHolder certificate = new CertificateHolder();
    certificate.setId(parameters.getIntyg().getIntygsId());
    certificate.setType(parameters.getIntyg().getIntygsTyp());
    certificate.setCivicRegistrationNumber(Personnummer.createPersonnummer(parameters.getIntyg().getGrundData().getPatient().getPersonId().getExtension()).orElse(null));
    certificate.setSignedDate(LocalDateTime.parse(parameters.getIntyg().getGrundData().getSigneringsTidstampel(), DateTimeFormatter.ISO_LOCAL_DATE_TIME));
    certificate.setCareUnitId(parameters.getIntyg().getGrundData().getSkapadAv().getVardenhet().getEnhetsId().getExtension());
    certificate.setCareUnitName(parameters.getIntyg().getGrundData().getSkapadAv().getVardenhet().getEnhetsnamn());
    certificate.setSigningDoctorName(parameters.getIntyg().getGrundData().getSkapadAv().getFullstandigtNamn());
    certificate.setAdditionalInfo(parameters.getIntyg().getOvrigKommentar());
    certificate.setCareGiverId(parameters.getIntyg().getGrundData().getSkapadAv().getVardenhet().getVardgivare().getVardgivarid().getExtension());
    return certificate;
}
Also used : CertificateHolder(se.inera.intyg.common.support.modules.support.api.CertificateHolder)

Example 4 with CertificateHolder

use of se.inera.intyg.common.support.modules.support.api.CertificateHolder 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 5 with CertificateHolder

use of se.inera.intyg.common.support.modules.support.api.CertificateHolder in project webcert by sklintyg.

the class BootstrapBean method addIntyg.

private void addIntyg(Resource res) throws JAXBException, IOException {
    CertificateHolder response = objectMapper.readValue(res.getInputStream(), CertificateHolder.class);
    intygStore.addIntyg(response);
}
Also used : CertificateHolder(se.inera.intyg.common.support.modules.support.api.CertificateHolder)

Aggregations

CertificateHolder (se.inera.intyg.common.support.modules.support.api.CertificateHolder)8 StubModeAware (se.inera.intyg.webcert.intygstjanststub.mode.StubModeAware)4 StubLatencyAware (se.inera.intyg.webcert.intygstjanststub.mode.StubLatencyAware)3 CertificateStateHolder (se.inera.intyg.common.support.modules.support.api.CertificateStateHolder)2 RevokeMedicalCertificateResponseType (se.inera.ifv.insuranceprocess.healthreporting.revokemedicalcertificateresponder.v1.RevokeMedicalCertificateResponseType)1 ResultOfCall (se.inera.ifv.insuranceprocess.healthreporting.v2.ResultOfCall)1 GetMedicalCertificateResponseType (se.inera.intyg.clinicalprocess.healthcond.certificate.getmedicalcertificate.v1.GetMedicalCertificateResponseType)1 ListCertificatesForCareResponseType (se.riv.clinicalprocess.healthcond.certificate.listcertificatesforcare.v3.ListCertificatesForCareResponseType)1 ListaType (se.riv.clinicalprocess.healthcond.certificate.listcertificatesforcare.v3.ListaType)1 SendCertificateToRecipientResponseType (se.riv.clinicalprocess.healthcond.certificate.sendCertificateToRecipient.v2.SendCertificateToRecipientResponseType)1 HsaId (se.riv.clinicalprocess.healthcond.certificate.types.v3.HsaId)1 Intyg (se.riv.clinicalprocess.healthcond.certificate.v3.Intyg)1 ResultType (se.riv.clinicalprocess.healthcond.certificate.v3.ResultType)1