Search in sources :

Example 1 with AbstractVardenhet

use of se.inera.intyg.infra.integration.hsa.model.AbstractVardenhet in project webcert by sklintyg.

the class SendMessageToRecipientTypeBuilder method buildEnhet.

private static Enhet buildEnhet(WebCertUser user) {
    Enhet enhet = new Enhet();
    SelectableVardenhet sourceVardenhet = user.getValdVardenhet();
    if (sourceVardenhet != null && sourceVardenhet instanceof AbstractVardenhet) {
        AbstractVardenhet valdVardenhet = (AbstractVardenhet) sourceVardenhet;
        enhet.setArbetsplatskod(InternalConverterUtil.getArbetsplatsKod(valdVardenhet.getArbetsplatskod()));
        enhet.setEnhetsId(InternalConverterUtil.getHsaId(valdVardenhet.getId()));
        enhet.setEnhetsnamn(StringUtils.defaultString(valdVardenhet.getNamn()));
        enhet.setEpost(StringUtils.trimToNull(valdVardenhet.getEpost()));
        enhet.setPostadress(StringUtils.defaultString(valdVardenhet.getPostadress()));
        enhet.setPostnummer(StringUtils.defaultString(valdVardenhet.getPostnummer()));
        enhet.setPostort(StringUtils.defaultString(valdVardenhet.getPostort()));
        enhet.setTelefonnummer(StringUtils.defaultString(valdVardenhet.getTelefonnummer()));
    }
    enhet.setVardgivare(buildVardgivare(user.getValdVardgivare()));
    return enhet;
}
Also used : Enhet(se.riv.clinicalprocess.healthcond.certificate.v3.Enhet) AbstractVardenhet(se.inera.intyg.infra.integration.hsa.model.AbstractVardenhet) SelectableVardenhet(se.inera.intyg.infra.integration.hsa.model.SelectableVardenhet)

Example 2 with AbstractVardenhet

use of se.inera.intyg.infra.integration.hsa.model.AbstractVardenhet in project webcert by sklintyg.

the class HoSPersonHelper method createVardenhetFromIntygUser.

public static Vardenhet createVardenhetFromIntygUser(String enhetId, IntygUser user) {
    AbstractVardenhet enhet = HoSPersonHelper.findVardenhetEllerMottagning(user, enhetId).orElseThrow(() -> new IllegalStateException("User '" + user.getHsaId() + "' has no MIU for care unit '" + enhetId + "'"));
    if (enhet instanceof se.inera.intyg.infra.integration.hsa.model.Vardenhet) {
        se.inera.intyg.infra.integration.hsa.model.Vardenhet hsaVardenhet = (se.inera.intyg.infra.integration.hsa.model.Vardenhet) enhet;
        se.inera.intyg.infra.integration.hsa.model.Vardgivare hsaVardgivare = HoSPersonHelper.findVardgivare(user, hsaVardenhet.getVardgivareHsaId()).orElseThrow(() -> new IllegalStateException("Unable to find parent vÄrdgivare for vardenhet '" + enhetId + "'"));
        Vardenhet vardenhet = new Vardenhet();
        vardenhet.setEnhetsnamn(hsaVardenhet.getNamn());
        vardenhet.setEnhetsid(hsaVardenhet.getId());
        vardenhet.setArbetsplatsKod(hsaVardenhet.getArbetsplatskod());
        vardenhet.setPostadress(hsaVardenhet.getPostadress());
        vardenhet.setPostnummer(hsaVardenhet.getPostnummer());
        vardenhet.setPostort(hsaVardenhet.getPostort());
        vardenhet.setTelefonnummer(hsaVardenhet.getTelefonnummer());
        se.inera.intyg.common.support.model.common.internal.Vardgivare vardgivare = new se.inera.intyg.common.support.model.common.internal.Vardgivare();
        vardgivare.setVardgivarid(hsaVardgivare.getId());
        vardgivare.setVardgivarnamn(hsaVardgivare.getNamn());
        vardenhet.setVardgivare(vardgivare);
        return vardenhet;
    }
    if (enhet instanceof Mottagning) {
        Mottagning m = (Mottagning) enhet;
        se.inera.intyg.infra.integration.hsa.model.Vardgivare hsaVardgivare = HoSPersonHelper.findVardgivareForMottagning(user, m.getId()).orElseThrow(() -> new IllegalStateException("Unable to find parent vÄrdgivare for mottagning '" + enhetId + "'"));
        Vardenhet vardenhet = new Vardenhet();
        vardenhet.setEnhetsnamn(m.getNamn());
        vardenhet.setEnhetsid(m.getId());
        vardenhet.setArbetsplatsKod(m.getArbetsplatskod());
        vardenhet.setPostadress(m.getPostadress());
        vardenhet.setPostnummer(m.getPostnummer());
        vardenhet.setPostort(m.getPostort());
        vardenhet.setTelefonnummer(m.getTelefonnummer());
        se.inera.intyg.common.support.model.common.internal.Vardgivare vardgivare = new se.inera.intyg.common.support.model.common.internal.Vardgivare();
        vardgivare.setVardgivarid(hsaVardgivare.getId());
        vardgivare.setVardgivarnamn(hsaVardgivare.getNamn());
        vardenhet.setVardgivare(vardgivare);
        return vardenhet;
    }
    throw new IllegalArgumentException("AbstractVardenhet instance passed to createVardenhetFromIntygUser was of unsupported type: " + enhet.getClass().getName());
}
Also used : AbstractVardenhet(se.inera.intyg.infra.integration.hsa.model.AbstractVardenhet) AbstractVardenhet(se.inera.intyg.infra.integration.hsa.model.AbstractVardenhet) Vardenhet(se.inera.intyg.common.support.model.common.internal.Vardenhet) Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) Mottagning(se.inera.intyg.infra.integration.hsa.model.Mottagning)

Example 3 with AbstractVardenhet

use of se.inera.intyg.infra.integration.hsa.model.AbstractVardenhet in project webcert by sklintyg.

the class IntygConverterUtil method buildVardenhet.

private static Vardenhet buildVardenhet(WebCertUser user) {
    Vardenhet vardenhet = new Vardenhet();
    SelectableVardenhet sourceVardenhet = user.getValdVardenhet();
    if (sourceVardenhet != null && sourceVardenhet instanceof AbstractVardenhet) {
        AbstractVardenhet valdVardenhet = (AbstractVardenhet) sourceVardenhet;
        vardenhet.setArbetsplatsKod(valdVardenhet.getArbetsplatskod());
        vardenhet.setEnhetsid(valdVardenhet.getId());
        vardenhet.setEnhetsnamn(valdVardenhet.getNamn());
        vardenhet.setEpost(valdVardenhet.getEpost());
        vardenhet.setPostadress(valdVardenhet.getPostadress());
        vardenhet.setPostnummer(valdVardenhet.getPostnummer());
        vardenhet.setPostort(valdVardenhet.getPostort());
        vardenhet.setTelefonnummer(valdVardenhet.getTelefonnummer());
    }
    vardenhet.setVardgivare(buildVardgivare(user.getValdVardgivare()));
    return vardenhet;
}
Also used : AbstractVardenhet(se.inera.intyg.infra.integration.hsa.model.AbstractVardenhet) Vardenhet(se.inera.intyg.common.support.model.common.internal.Vardenhet) AbstractVardenhet(se.inera.intyg.infra.integration.hsa.model.AbstractVardenhet) SelectableVardenhet(se.inera.intyg.infra.integration.hsa.model.SelectableVardenhet) SelectableVardenhet(se.inera.intyg.infra.integration.hsa.model.SelectableVardenhet)

Example 4 with AbstractVardenhet

use of se.inera.intyg.infra.integration.hsa.model.AbstractVardenhet in project webcert by sklintyg.

the class CopyCompletionUtkastBuilderTest method createWebcertUser.

private WebCertUser createWebcertUser() {
    WebCertUser user = new WebCertUser();
    user.setHsaId(HOSPERSON_ID);
    user.setNamn(HOSPERSON_NAME);
    se.inera.intyg.infra.integration.hsa.model.Vardgivare vGivare = new se.inera.intyg.infra.integration.hsa.model.Vardgivare();
    vGivare.setId(VARDGIVARE_ID);
    vGivare.setNamn(VARDENHET_NAME);
    user.setVardgivare(Arrays.asList(vGivare));
    AbstractVardenhet vardenhet = new se.inera.intyg.infra.integration.hsa.model.Vardenhet();
    vardenhet.setId(VARDENHET_ID);
    vardenhet.setNamn(VARDENHET_NAME);
    user.setValdVardenhet(vardenhet);
    return user;
}
Also used : ValidateDraftResponse(se.inera.intyg.common.support.modules.support.api.dto.ValidateDraftResponse) CopyUtkastBuilderResponse(se.inera.intyg.webcert.web.service.utkast.dto.CopyUtkastBuilderResponse) AbstractVardenhet(se.inera.intyg.infra.integration.hsa.model.AbstractVardenhet) Vardgivare(se.inera.intyg.common.support.model.common.internal.Vardgivare) AbstractVardenhet(se.inera.intyg.infra.integration.hsa.model.AbstractVardenhet) Vardenhet(se.inera.intyg.common.support.model.common.internal.Vardenhet) WebCertUser(se.inera.intyg.webcert.web.service.user.dto.WebCertUser)

Example 5 with AbstractVardenhet

use of se.inera.intyg.infra.integration.hsa.model.AbstractVardenhet in project webcert by sklintyg.

the class CreateRenewalCopyUtkastBuilderImplTest method createWebcertUser.

private WebCertUser createWebcertUser() {
    WebCertUser user = new WebCertUser();
    user.setHsaId(HOSPERSON_ID);
    user.setNamn(HOSPERSON_NAME);
    se.inera.intyg.infra.integration.hsa.model.Vardgivare vGivare = new se.inera.intyg.infra.integration.hsa.model.Vardgivare();
    vGivare.setId(VARDGIVARE_ID);
    vGivare.setNamn(VARDENHET_NAME);
    user.setVardgivare(Arrays.asList(vGivare));
    AbstractVardenhet vardenhet = new se.inera.intyg.infra.integration.hsa.model.Vardenhet();
    vardenhet.setId(VARDENHET_ID);
    vardenhet.setNamn(VARDENHET_NAME);
    user.setValdVardenhet(vardenhet);
    user.setValdVardgivare(vGivare);
    return user;
}
Also used : ValidateDraftResponse(se.inera.intyg.common.support.modules.support.api.dto.ValidateDraftResponse) CopyUtkastBuilderResponse(se.inera.intyg.webcert.web.service.utkast.dto.CopyUtkastBuilderResponse) AbstractVardenhet(se.inera.intyg.infra.integration.hsa.model.AbstractVardenhet) Vardgivare(se.inera.intyg.common.support.model.common.internal.Vardgivare) AbstractVardenhet(se.inera.intyg.infra.integration.hsa.model.AbstractVardenhet) Vardenhet(se.inera.intyg.common.support.model.common.internal.Vardenhet) WebCertUser(se.inera.intyg.webcert.web.service.user.dto.WebCertUser)

Aggregations

AbstractVardenhet (se.inera.intyg.infra.integration.hsa.model.AbstractVardenhet)6 Vardenhet (se.inera.intyg.common.support.model.common.internal.Vardenhet)5 Vardgivare (se.inera.intyg.common.support.model.common.internal.Vardgivare)3 ValidateDraftResponse (se.inera.intyg.common.support.modules.support.api.dto.ValidateDraftResponse)3 WebCertUser (se.inera.intyg.webcert.web.service.user.dto.WebCertUser)3 CopyUtkastBuilderResponse (se.inera.intyg.webcert.web.service.utkast.dto.CopyUtkastBuilderResponse)3 SelectableVardenhet (se.inera.intyg.infra.integration.hsa.model.SelectableVardenhet)2 Mottagning (se.inera.intyg.infra.integration.hsa.model.Mottagning)1 Vardgivare (se.inera.intyg.infra.integration.hsa.model.Vardgivare)1 Enhet (se.riv.clinicalprocess.healthcond.certificate.v3.Enhet)1