Search in sources :

Example 21 with Vardgivare

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

the class StatisticsGroupByUtilTest method buildUserOfRole.

private WebCertUser buildUserOfRole(Role role) {
    WebCertUser user = new WebCertUser();
    user.setRoles(AuthoritiesResolverUtil.toMap(role));
    user.setAuthorities(AuthoritiesResolverUtil.toMap(role.getPrivileges(), Privilege::getName));
    user.setOrigin(UserOriginType.DJUPINTEGRATION.name());
    user.setHsaId("testuser");
    user.setNamn("test userman");
    Vardenhet vardenhet = new Vardenhet(HSA1, "enhet");
    Vardgivare vardgivare = new Vardgivare("vardgivare", "Vardgivaren");
    vardgivare.getVardenheter().add(vardenhet);
    user.setVardgivare(Collections.singletonList(vardgivare));
    user.setValdVardenhet(vardenhet);
    return user;
}
Also used : 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 22 with Vardgivare

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

the class UtkastServiceImplTest method createUser.

private WebCertUser createUser() {
    Role role = AUTHORITIES_RESOLVER.getRole(AuthoritiesConstants.ROLE_LAKARE);
    WebCertUser user = new WebCertUser();
    user.setRoles(AuthoritiesResolverUtil.toMap(role));
    user.setAuthorities(AuthoritiesResolverUtil.toMap(role.getPrivileges(), Privilege::getName));
    user.setHsaId("hsaId");
    user.setNamn("namn");
    List<String> tmp = new ArrayList<>();
    tmp.add("Ortoped");
    user.setSpecialiseringar(tmp);
    user.setTitel("Befattning");
    Vardgivare vardgivare = new Vardgivare();
    vardgivare.setId("vardgivarid");
    vardgivare.setNamn("vardgivarnamn");
    user.setValdVardgivare(vardgivare);
    Vardenhet vardenhet = new Vardenhet();
    vardenhet.setId(UTKAST_ENHETS_ID);
    vardenhet.setNamn("enhetnamn");
    user.setValdVardenhet(vardenhet);
    vardgivare.setVardenheter(Arrays.asList(vardenhet));
    user.setVardgivare(Arrays.asList(vardgivare));
    user.setParameters(new IntegrationParameters(USER_REFERENCE, "", "", "", "", "", "", "", "", false, false, false, true));
    return user;
}
Also used : Role(se.inera.intyg.infra.security.common.model.Role) IntegrationParameters(se.inera.intyg.webcert.web.web.controller.integration.dto.IntegrationParameters) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) Vardenhet(se.inera.intyg.infra.integration.hsa.model.Vardenhet) WebCertUser(se.inera.intyg.webcert.web.service.user.dto.WebCertUser)

Example 23 with Vardgivare

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

the class UtkastServiceImplTest method setup.

@Before
public void setup() {
    hoSPerson = new HoSPersonal();
    hoSPerson.setPersonId("AAA");
    hoSPerson.setFullstandigtNamn("Dr Dengroth");
    hoSPerson.getBefattningar().add("Befattning");
    hoSPerson.getSpecialiteter().add("Ortoped");
    defaultPatient = new Patient();
    defaultPatient.setPersonId(PERSONNUMMER);
    defaultPatient.setFornamn("fornamn");
    defaultPatient.setMellannamn("mellannamn");
    defaultPatient.setPostadress("pa1");
    defaultPatient.setPostnummer("0000");
    defaultPatient.setPostort("ort");
    se.inera.intyg.common.support.model.common.internal.Vardgivare vardgivare = new se.inera.intyg.common.support.model.common.internal.Vardgivare();
    vardgivare.setVardgivarid("SE234234");
    vardgivare.setVardgivarnamn("Vårdgivaren");
    se.inera.intyg.common.support.model.common.internal.Vardenhet vardenhet = new se.inera.intyg.common.support.model.common.internal.Vardenhet();
    vardenhet.setArbetsplatsKod("00000");
    vardenhet.setEnhetsnamn("Vårdenheten");
    vardenhet.setEnhetsid("SE234897348");
    vardenhet.setPostadress("Sjukvägen 1");
    vardenhet.setPostnummer("12345");
    vardenhet.setPostort("Testberga");
    vardenhet.setTelefonnummer("0123-456789");
    vardenhet.setEpost("ingen@ingen.se");
    vardenhet.setVardgivare(vardgivare);
    VardpersonReferens vardperson = new VardpersonReferens();
    vardperson.setHsaId(hoSPerson.getPersonId());
    vardperson.setNamn(hoSPerson.getFullstandigtNamn());
    hoSPerson.setVardenhet(vardenhet);
    utkast = createUtkast(INTYG_ID, UTKAST_VERSION, INTYG_TYPE, UtkastStatus.DRAFT_INCOMPLETE, INTYG_JSON, vardperson, PERSONNUMMER);
    signedUtkast = createUtkast(INTYG_ID, INTYG_VERSION, INTYG_TYPE, UtkastStatus.SIGNED, INTYG_JSON, vardperson, PERSONNUMMER);
}
Also used : Patient(se.inera.intyg.common.support.model.common.internal.Patient) Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) Vardenhet(se.inera.intyg.infra.integration.hsa.model.Vardenhet) HoSPersonal(se.inera.intyg.common.support.model.common.internal.HoSPersonal) ValidateDraftResponse(se.inera.intyg.common.support.modules.support.api.dto.ValidateDraftResponse) SaveDraftResponse(se.inera.intyg.webcert.web.service.utkast.dto.SaveDraftResponse) VardpersonReferens(se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens) Before(org.junit.Before)

Example 24 with Vardgivare

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

the class SignaturServiceImplTest method setup.

@Before
public void setup() throws Exception {
    hoSPerson = new HoSPersonal();
    hoSPerson.setPersonId("AAA");
    hoSPerson.setFullstandigtNamn("Dr Dengroth");
    VardpersonReferens vardperson = new VardpersonReferens();
    vardperson.setHsaId(hoSPerson.getPersonId());
    vardperson.setNamn(hoSPerson.getFullstandigtNamn());
    utkast = createUtkast(INTYG_ID, 1, INTYG_TYPE, UtkastStatus.DRAFT_INCOMPLETE, INTYG_JSON, vardperson, ENHET_ID, PERSON_ID);
    completedUtkast = createUtkast(INTYG_ID, 2, INTYG_TYPE, UtkastStatus.DRAFT_COMPLETE, INTYG_JSON, vardperson, ENHET_ID, PERSON_ID);
    signedUtkast = createUtkast(INTYG_ID, 3, INTYG_TYPE, UtkastStatus.SIGNED, INTYG_JSON, vardperson, ENHET_ID, PERSON_ID);
    vardenhet = new Vardenhet(ENHET_ID, "testNamn");
    vardgivare = new Vardgivare("123", "vardgivare");
    vardgivare.setVardenheter(Collections.singletonList(vardenhet));
    user = createWebCertUser(true);
    when(webcertUserService.getUser()).thenReturn(user);
    when(moduleRegistry.getModuleApi(any())).thenReturn(moduleApi);
    when(moduleApi.updateBeforeSigning(any(), any(), any())).thenReturn(INTYG_JSON);
    Utlatande utlatande = mock(Utlatande.class);
    GrundData grunddata = new GrundData();
    grunddata.setSkapadAv(new HoSPersonal());
    when(utlatande.getGrundData()).thenReturn(grunddata);
    when(moduleApi.getUtlatandeFromJson(anyString())).thenReturn(utlatande);
    setTypedField(intygSignatureService, new SignaturTicketTracker());
    pagaendeSignering = mock(PagaendeSignering.class);
    when(pagaendeSignering.getInternReferens()).thenReturn(PAGAENDE_SIGN_ID);
    when(pagaendeSignering.getIntygData()).thenReturn(INTYG_JSON);
    when(pagaendeSignering.getIntygsId()).thenReturn(INTYG_ID);
    when(pagaendeSignering.getSigneradAvHsaId()).thenReturn(hoSPerson.getPersonId());
    when(pagaendeSignering.getSigneradAvNamn()).thenReturn(hoSPerson.getFullstandigtNamn());
    when(pagaendeSigneringRepository.findOne(any())).thenReturn(pagaendeSignering);
    when(pagaendeSigneringRepository.save(any(PagaendeSignering.class))).thenReturn(pagaendeSignering);
}
Also used : HoSPersonal(se.inera.intyg.common.support.model.common.internal.HoSPersonal) Utlatande(se.inera.intyg.common.support.model.common.internal.Utlatande) GrundData(se.inera.intyg.common.support.model.common.internal.GrundData) PagaendeSignering(se.inera.intyg.webcert.persistence.utkast.model.PagaendeSignering) Vardenhet(se.inera.intyg.infra.integration.hsa.model.Vardenhet) Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) VardpersonReferens(se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens) Before(org.junit.Before)

Example 25 with Vardgivare

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

the class FragaSvarServiceImplTest method buildUserOfRole.

private WebCertUser buildUserOfRole(Role role) {
    WebCertUser user = new WebCertUser();
    user.setRoles(AuthoritiesResolverUtil.toMap(role));
    user.setAuthorities(AuthoritiesResolverUtil.toMap(role.getPrivileges(), Privilege::getName));
    user.setOrigin("NORMAL");
    user.setHsaId("testuser");
    user.setNamn("test userman");
    Feature feature = new Feature();
    feature.setName(AuthoritiesConstants.FEATURE_HANTERA_FRAGOR);
    feature.setGlobal(true);
    feature.setIntygstyper(ImmutableList.of("fk7263"));
    user.setFeatures(ImmutableMap.of(AuthoritiesConstants.FEATURE_HANTERA_FRAGOR, feature));
    Vardenhet vardenhet = new Vardenhet("enhet", "Enhet");
    Vardgivare vardgivare = new Vardgivare("vardgivare", "Vardgivaren");
    vardgivare.getVardenheter().add(vardenhet);
    user.setVardgivare(Collections.singletonList(vardgivare));
    user.setValdVardenhet(vardenhet);
    return user;
}
Also used : Vardenhet(se.inera.intyg.infra.integration.hsa.model.Vardenhet) Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) Feature(se.inera.intyg.infra.security.common.model.Feature) 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