Search in sources :

Example 6 with Vardenhet

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

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

use of se.inera.intyg.infra.integration.hsa.model.Vardenhet 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)

Example 9 with Vardenhet

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

the class MailNotificationServiceImplTest method setUp.

@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    ReflectionTestUtils.setField(mailNotificationService, "adminMailAddress", "AdminMail");
    ReflectionTestUtils.setField(mailNotificationService, "fromAddress", "FromAddress");
    ReflectionTestUtils.setField(mailNotificationService, "webCertHostUrl", "WebCertHostUrl");
    ReflectionTestUtils.setField(mailNotificationService, "ppLogicalAddress", "PpLogicalAddress");
    MimeMessage mimeMessage = new MimeMessage(mock(MimeMessage.class));
    doReturn(mimeMessage).when(mailSender).createMimeMessage();
    Vardenhet vardenhet = new Vardenhet("aflkjdsalkjjlk", "dsaflkj", null, null, "adsflkjasdflkjadfsjlk");
    vardenhet.setEpost("epost@mockadress.net");
    doReturn(vardenhet).when(hsaOrganizationUnitService).getVardenhet(anyString());
}
Also used : MimeMessage(javax.mail.internet.MimeMessage) Vardenhet(se.inera.intyg.infra.integration.hsa.model.Vardenhet) Before(org.junit.Before)

Example 10 with Vardenhet

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

the class PageControllerTest method createMockVardgivare.

private Vardgivare createMockVardgivare() {
    Vardgivare vg = new Vardgivare("vg-1", "Vårdgivare 1");
    Vardenhet ve = new Vardenhet("ve-1", "Vårdenhet 1");
    vg.setVardenheter(Collections.singletonList(ve));
    return vg;
}
Also used : Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) Vardenhet(se.inera.intyg.infra.integration.hsa.model.Vardenhet)

Aggregations

Vardenhet (se.inera.intyg.infra.integration.hsa.model.Vardenhet)24 Vardgivare (se.inera.intyg.infra.integration.hsa.model.Vardgivare)17 WebCertUser (se.inera.intyg.webcert.web.service.user.dto.WebCertUser)13 HoSPersonal (se.inera.intyg.common.support.model.common.internal.HoSPersonal)5 Role (se.inera.intyg.infra.security.common.model.Role)5 ArrayList (java.util.ArrayList)4 Before (org.junit.Before)4 Test (org.junit.Test)3 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 VardpersonReferens (se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens)2 HashMap (java.util.HashMap)1 MimeMessage (javax.mail.internet.MimeMessage)1 GrundData (se.inera.intyg.common.support.model.common.internal.GrundData)1 Patient (se.inera.intyg.common.support.model.common.internal.Patient)1 Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)1 ValidateDraftResponse (se.inera.intyg.common.support.modules.support.api.dto.ValidateDraftResponse)1 Mottagning (se.inera.intyg.infra.integration.hsa.model.Mottagning)1 SelectableVardenhet (se.inera.intyg.infra.integration.hsa.model.SelectableVardenhet)1 Feature (se.inera.intyg.infra.security.common.model.Feature)1 Privilege (se.inera.intyg.infra.security.common.model.Privilege)1