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);
}
}
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<>());
}
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;
}
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());
}
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;
}
Aggregations