Search in sources :

Example 36 with Patient

use of se.inera.intyg.common.support.model.common.internal.Patient in project webcert by sklintyg.

the class CreateUtkastFromTemplateBuilderTest method setup.

@Before
public void setup() {
    hoSPerson = new HoSPersonal();
    hoSPerson.setPersonId(HOSPERSON_ID);
    hoSPerson.setFullstandigtNamn(HOSPERSON_NAME);
    Vardgivare vardgivare = new Vardgivare();
    vardgivare.setVardgivarid(VARDGIVARE_ID);
    vardgivare.setVardgivarnamn(VARDGIVARE_NAME);
    Vardenhet vardenhet = new Vardenhet();
    vardenhet.setEnhetsid(VARDENHET_ID);
    vardenhet.setEnhetsnamn(VARDENHET_NAME);
    vardenhet.setVardgivare(vardgivare);
    hoSPerson.setVardenhet(vardenhet);
    patient = new Patient();
    patient.setPersonId(PATIENT_SSN);
}
Also used : HoSPersonal(se.inera.intyg.common.support.model.common.internal.HoSPersonal) Patient(se.inera.intyg.common.support.model.common.internal.Patient) 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) Before(org.junit.Before)

Example 37 with Patient

use of se.inera.intyg.common.support.model.common.internal.Patient in project webcert by sklintyg.

the class UtkastApiControllerTest method buildPatient.

private Patient buildPatient() {
    Patient patient = new Patient();
    patient.setPersonId(PATIENT_PERSONNUMMER);
    patient.setEfternamn(PATIENT_EFTERNAMN);
    patient.setFornamn(PATIENT_FORNAMN);
    patient.setMellannamn(PATIENT_MELLANNAMN);
    patient.setFullstandigtNamn(PATIENT_FORNAMN + " " + PATIENT_MELLANNAMN + " " + PATIENT_EFTERNAMN);
    patient.setPostadress(PATIENT_POSTADRESS);
    patient.setPostnummer(PATIENT_POSTNUMMER);
    patient.setPostort(PATIENT_POSTORT);
    return patient;
}
Also used : Patient(se.inera.intyg.common.support.model.common.internal.Patient)

Example 38 with Patient

use of se.inera.intyg.common.support.model.common.internal.Patient in project webcert by sklintyg.

the class UtkastServiceImplTest method testUpdatePatientOnDraft.

@Test
public void testUpdatePatientOnDraft() throws Exception {
    utkast.setEnhetsId(UTKAST_ENHETS_ID);
    Patient newPatient = getUpdatedPatient();
    UpdatePatientOnDraftRequest request = new UpdatePatientOnDraftRequest(newPatient.getPersonId(), utkast.getIntygsId(), utkast.getVersion());
    WebCertUser user = createUser();
    Utlatande utlatande = mock(Utlatande.class);
    GrundData grunddata = new GrundData();
    grunddata.setPatient(defaultPatient);
    grunddata.setSkapadAv(new HoSPersonal());
    String expectedPatientId = defaultPatient.getPersonId().getPersonnummer();
    when(utlatande.getGrundData()).thenReturn(grunddata);
    // Make a spy out of the utkast so we can verify invocations on the setters with proper names further down.
    utkast = spy(utkast);
    when(mockUtkastRepository.findOne(INTYG_ID)).thenReturn(utkast);
    when(moduleRegistry.getModuleApi(INTYG_TYPE)).thenReturn(mockModuleApi);
    when(mockModuleApi.updateBeforeSave(anyString(), any(Patient.class))).thenReturn("{}");
    when(mockModuleApi.getUtlatandeFromJson(anyString())).thenReturn(utlatande);
    when(mockUtkastRepository.save(utkast)).thenReturn(utkast);
    when(userService.getUser()).thenReturn(user);
    when(mockModuleApi.updateBeforeSave(anyString(), any(HoSPersonal.class))).thenReturn("{}");
    draftService.updatePatientOnDraft(request);
    verify(mockUtkastRepository).save(any(Utkast.class));
    verify(notificationService).sendNotificationForDraftChanged(any(Utkast.class));
    verify(utkast).setPatientPersonnummer(any(Personnummer.class));
    assertEquals(expectedPatientId, user.getParameters().getBeforeAlternateSsn());
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) HoSPersonal(se.inera.intyg.common.support.model.common.internal.HoSPersonal) Utlatande(se.inera.intyg.common.support.model.common.internal.Utlatande) Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast) Patient(se.inera.intyg.common.support.model.common.internal.Patient) GrundData(se.inera.intyg.common.support.model.common.internal.GrundData) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) UpdatePatientOnDraftRequest(se.inera.intyg.webcert.web.service.utkast.dto.UpdatePatientOnDraftRequest) WebCertUser(se.inera.intyg.webcert.web.service.user.dto.WebCertUser) Test(org.junit.Test)

Example 39 with Patient

use of se.inera.intyg.common.support.model.common.internal.Patient 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 40 with Patient

use of se.inera.intyg.common.support.model.common.internal.Patient in project webcert by sklintyg.

the class IntygModuleApiControllerTest method setupCertificateData.

@BeforeClass
public static void setupCertificateData() {
    utlatande = new Fk7263Utlatande();
    utlatande.setId(CERTIFICATE_ID);
    utlatande.setTyp(CERTIFICATE_TYPE);
    GrundData grundData = new GrundData();
    patient = new Patient();
    patient.setPersonId(createPnr(PERSON_ID));
    patient.setFornamn("Fornamn");
    patient.setEfternamn("Efternamn");
    grundData.setPatient(patient);
    utlatande.setGrundData(grundData);
    List<Status> status = new ArrayList<>();
    status.add(new Status(CertificateState.RECEIVED, "HSVARD", LocalDateTime.now()));
    status.add(new Status(CertificateState.SENT, "FKASSA", LocalDateTime.now()));
}
Also used : Status(se.inera.intyg.common.support.model.Status) Fk7263Utlatande(se.inera.intyg.common.fk7263.model.internal.Fk7263Utlatande) ArrayList(java.util.ArrayList) Patient(se.inera.intyg.common.support.model.common.internal.Patient) GrundData(se.inera.intyg.common.support.model.common.internal.GrundData) BeforeClass(org.junit.BeforeClass)

Aggregations

Patient (se.inera.intyg.common.support.model.common.internal.Patient)62 Test (org.junit.Test)28 Personnummer (se.inera.intyg.schemas.contract.Personnummer)28 Utkast (se.inera.intyg.webcert.persistence.utkast.model.Utkast)12 HoSPersonal (se.inera.intyg.common.support.model.common.internal.HoSPersonal)11 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)7 Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)7 Vardenhet (se.inera.intyg.common.support.model.common.internal.Vardenhet)6 ModuleApi (se.inera.intyg.common.support.modules.support.api.ModuleApi)6 ArrayList (java.util.ArrayList)5 Before (org.junit.Before)5 Vardgivare (se.inera.intyg.common.support.model.common.internal.Vardgivare)5 Vardgivare (se.inera.intyg.infra.integration.hsa.model.Vardgivare)5 IntygContentHolder (se.inera.intyg.webcert.web.service.intyg.dto.IntygContentHolder)5 Relations (se.inera.intyg.webcert.web.web.controller.api.dto.Relations)5 IOException (java.io.IOException)4 GrundData (se.inera.intyg.common.support.model.common.internal.GrundData)4 ModuleNotFoundException (se.inera.intyg.common.support.modules.registry.ModuleNotFoundException)4 ModuleException (se.inera.intyg.common.support.modules.support.api.exception.ModuleException)4 PersonSvar (se.inera.intyg.infra.integration.pu.model.PersonSvar)4