Search in sources :

Example 6 with Vardgivare

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

the class StatModuleApiController method populateStatsResponseWithVardgivarStats.

private void populateStatsResponseWithVardgivarStats(StatsResponse statsResponse, List<Vardgivare> vardgivare, Map<String, Long> intygStats, Map<String, Long> fragaSvarStats) {
    VardgivareStats vgStats;
    for (Vardgivare vg : vardgivare) {
        vgStats = new VardgivareStats(vg.getNamn(), vg.getId());
        vgStats.getVardenheter().addAll(createAndPopulateVardenheterWithStats(vg.getVardenheter(), intygStats, fragaSvarStats));
        statsResponse.getVardgivare().add(vgStats);
    }
}
Also used : VardgivareStats(se.inera.intyg.webcert.web.web.controller.moduleapi.dto.VardgivareStats) Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare)

Example 7 with Vardgivare

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

the class ElegWebCertUserDetailsService method decorateWebCertUserWithVardgivare.

private void decorateWebCertUserWithVardgivare(HoSPersonType hosPerson, WebCertUser webCertUser) {
    String id = hosPerson.getEnhet().getVardgivare().getVardgivareId().getExtension();
    String namn = hosPerson.getEnhet().getVardgivare().getVardgivarenamn();
    Vardgivare vardgivare = new Vardgivare(id, namn);
    Vardenhet vardenhet = new Vardenhet(hosPerson.getEnhet().getEnhetsId().getExtension(), hosPerson.getEnhet().getEnhetsnamn());
    resolveArbetsplatsKod(hosPerson, vardenhet);
    vardenhet.setPostadress(hosPerson.getEnhet().getPostadress());
    vardenhet.setPostnummer(hosPerson.getEnhet().getPostnummer());
    vardenhet.setPostort(hosPerson.getEnhet().getPostort());
    vardenhet.setTelefonnummer(hosPerson.getEnhet().getTelefonnummer());
    vardenhet.setEpost(hosPerson.getEnhet().getEpost());
    List<Vardenhet> vardenhetList = new ArrayList<>();
    vardenhetList.add(vardenhet);
    vardgivare.setVardenheter(vardenhetList);
    List<Vardgivare> vardgivareList = new ArrayList<>();
    vardgivareList.add(vardgivare);
    webCertUser.setVardgivare(vardgivareList);
    webCertUser.setValdVardenhet(vardenhet);
    webCertUser.setValdVardgivare(vardgivare);
    // Since privatläkare doesn't have "Medarbetaruppdrag" we cannot reliably populate "miuNamnPerVardenhetsId".
    // Populate with an empty map.
    webCertUser.setMiuNamnPerEnhetsId(new HashMap<>());
}
Also used : ArrayList(java.util.ArrayList) Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) Vardenhet(se.inera.intyg.infra.integration.hsa.model.Vardenhet)

Example 8 with Vardgivare

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

the class ElegWebCertUserDetailsService method setFirstVardenhetOnFirstVardgivareAsDefault.

private boolean setFirstVardenhetOnFirstVardgivareAsDefault(WebCertUser user) {
    Vardgivare firstVardgivare = user.getVardgivare().get(0);
    user.setValdVardgivare(firstVardgivare);
    Vardenhet firstVardenhet = firstVardgivare.getVardenheter().get(0);
    user.setValdVardenhet(firstVardenhet);
    return true;
}
Also used : Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) Vardenhet(se.inera.intyg.infra.integration.hsa.model.Vardenhet)

Example 9 with Vardgivare

use of se.inera.intyg.infra.integration.hsa.model.Vardgivare 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 10 with Vardgivare

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

the class LogServiceImplTest method createUser.

private WebCertUser createUser() {
    Role role = AUTHORITIES_RESOLVER.getRole(AuthoritiesConstants.ROLE_LAKARE);
    Vardenhet ve = new Vardenhet("VARDENHET_ID", "Vårdenheten");
    Vardgivare vg = new Vardgivare("VARDGIVARE_ID", "Vårdgivaren");
    vg.setVardenheter(Collections.singletonList(ve));
    WebCertUser user = new WebCertUser();
    user.setRoles(AuthoritiesResolverUtil.toMap(role));
    user.setAuthorities(AuthoritiesResolverUtil.toMap(role.getPrivileges(), Privilege::getName));
    user.setHsaId("HSAID");
    user.setNamn("Markus Gran");
    user.setVardgivare(Collections.singletonList(vg));
    user.changeValdVardenhet("VARDENHET_ID");
    user.setTitel("Överläkare");
    user.setMiuNamnPerEnhetsId(buildMiUMap());
    return user;
}
Also used : Role(se.inera.intyg.infra.security.common.model.Role) Vardenhet(se.inera.intyg.infra.integration.hsa.model.Vardenhet) Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) WebCertUser(se.inera.intyg.webcert.web.service.user.dto.WebCertUser)

Aggregations

Vardgivare (se.inera.intyg.infra.integration.hsa.model.Vardgivare)26 Vardenhet (se.inera.intyg.infra.integration.hsa.model.Vardenhet)17 WebCertUser (se.inera.intyg.webcert.web.service.user.dto.WebCertUser)12 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)5 Patient (se.inera.intyg.common.support.model.common.internal.Patient)5 Role (se.inera.intyg.infra.security.common.model.Role)5 HoSPersonal (se.inera.intyg.common.support.model.common.internal.HoSPersonal)4 Personnummer (se.inera.intyg.schemas.contract.Personnummer)4 Utkast (se.inera.intyg.webcert.persistence.utkast.model.Utkast)4 Before (org.junit.Before)3 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 ModuleApi (se.inera.intyg.common.support.modules.support.api.ModuleApi)2 Mottagning (se.inera.intyg.infra.integration.hsa.model.Mottagning)2 VardpersonReferens (se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens)2 HashMap (java.util.HashMap)1 PostConstruct (javax.annotation.PostConstruct)1 ClassPathResource (org.springframework.core.io.ClassPathResource)1 GrundData (se.inera.intyg.common.support.model.common.internal.GrundData)1 Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)1