Search in sources :

Example 36 with FragaSvar

use of se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar in project webcert by sklintyg.

the class FragaSvarRepositoryTest method testFilterFragaSvarFiltersOutNoIntygsTyp.

@Test
public void testFilterFragaSvarFiltersOutNoIntygsTyp() {
    fragasvarRepository.save(buildFragaSvarFraga(ENHET_1_ID, Status.PENDING_INTERNAL_ACTION, HSA_1_ID, HSA_1_NAMN));
    Filter filter = new Filter();
    filter.getEnhetsIds().add(ENHET_1_ID);
    List<FragaSvar> fragaSvar = fragasvarRepository.filterFragaSvar(filter);
    assertEquals(0, fragaSvar.size());
}
Also used : Filter(se.inera.intyg.webcert.persistence.model.Filter) FragaSvar(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar) Test(org.junit.Test)

Example 37 with FragaSvar

use of se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar in project webcert by sklintyg.

the class FragaSvarRepositoryTest method testFindByExternReferens.

@Test
public void testFindByExternReferens() {
    FragaSvar saved = buildFragaSvarFraga("Enhet-1-id", Status.PENDING_EXTERNAL_ACTION);
    fragasvarRepository.save(saved);
    FragaSvar read = fragasvarRepository.findByExternReferens(saved.getExternReferens());
    assertEquals(read.getInternReferens(), saved.getInternReferens());
}
Also used : FragaSvar(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar) Test(org.junit.Test)

Example 38 with FragaSvar

use of se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar in project webcert by sklintyg.

the class FragaSvarRepositoryTest method testFindByIntygsReferens.

@Test
public void testFindByIntygsReferens() {
    FragaSvar saved = buildFragaSvarFraga(ENHET_1_ID);
    saved.setIntygsReferens(new IntygsReferens("non-existing-intygs-id", "fk", Personnummer.createPersonnummer("19121212-1212").get(), "Sven Persson", FRAGA_SENT_DATE));
    fragasvarRepository.save(saved);
    fragasvarRepository.save(buildFragaSvarFraga(ENHET_3_ID));
    fragasvarRepository.save(buildFragaSvarFraga(ENHET_4_ID));
    List<FragaSvar> result = fragasvarRepository.findByIntygsReferensIntygsId(INTYGS_REFERENS.getIntygsId());
    assertEquals(2, result.size());
}
Also used : IntygsReferens(se.inera.intyg.webcert.persistence.fragasvar.model.IntygsReferens) FragaSvar(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar) Test(org.junit.Test)

Example 39 with FragaSvar

use of se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar in project webcert by sklintyg.

the class FragaSvarRepositoryTest method buildFragaSvarFraga.

private FragaSvar buildFragaSvarFraga(String enhetsId, Status status, String frageStallare, boolean answered) {
    FragaSvar f = new FragaSvar();
    f.setExternaKontakter(new HashSet<>(Arrays.asList("KONTAKT1", "KONTAKT2", "KONTAKT3")));
    f.setAmne(Amne.AVSTAMNINGSMOTE);
    f.setExternReferens("externReferens");
    f.setFrageSigneringsDatum(FRAGA_SIGN_DATE);
    f.setFrageSkickadDatum(FRAGA_SENT_DATE);
    f.setFrageStallare(frageStallare);
    Vardperson vardperson = new Vardperson();
    vardperson.setEnhetsId(enhetsId);
    vardperson.setEnhetsnamn(enhetsId + "-namnet");
    f.setVardperson(vardperson);
    f.setFrageText("Detta var ju otydligt formulerat!");
    f.setIntygsReferens(INTYGS_REFERENS);
    f.setStatus(status);
    if (answered) {
        f.setSvarsText("Ett svar på frågan");
    }
    return f;
}
Also used : Vardperson(se.inera.intyg.webcert.persistence.fragasvar.model.Vardperson) FragaSvar(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar)

Example 40 with FragaSvar

use of se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar in project webcert by sklintyg.

the class FragaSvarModuleApiController method closeQAsAsHandled.

@PUT
@Path("/stang")
@Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET)
public List<FragaSvar> closeQAsAsHandled(List<QARequest> qas) {
    List<FragaSvar> fragaSvars = new ArrayList<>();
    for (QARequest qa : qas) {
        abortIfFragaSvarNotActive(qa.getIntygsTyp());
        fragaSvars.add(fragaSvarService.closeQuestionAsHandled(qa.getFragaSvarId()));
    }
    return fragaSvars;
}
Also used : QARequest(se.inera.intyg.webcert.web.web.controller.api.dto.QARequest) ArrayList(java.util.ArrayList) FragaSvar(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) PUT(javax.ws.rs.PUT)

Aggregations

FragaSvar (se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar)71 Test (org.junit.Test)42 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)14 IntygsReferens (se.inera.intyg.webcert.persistence.fragasvar.model.IntygsReferens)11 Vardperson (se.inera.intyg.webcert.persistence.fragasvar.model.Vardperson)11 Produces (javax.ws.rs.Produces)7 AttributedURIType (org.w3.wsaddressing10.AttributedURIType)7 Path (javax.ws.rs.Path)6 Filter (se.inera.intyg.webcert.persistence.model.Filter)6 LocalDateTime (java.time.LocalDateTime)5 Consumes (javax.ws.rs.Consumes)5 WebCertUser (se.inera.intyg.webcert.web.service.user.dto.WebCertUser)5 ArendeListItem (se.inera.intyg.webcert.web.web.controller.api.dto.ArendeListItem)5 ArrayList (java.util.ArrayList)4 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)4 SendMedicalCertificateAnswerResponseType (se.inera.ifv.insuranceprocess.healthreporting.sendmedicalcertificateanswerresponder.v1.SendMedicalCertificateAnswerResponseType)4 SendMedicalCertificateAnswerType (se.inera.ifv.insuranceprocess.healthreporting.sendmedicalcertificateanswerresponder.v1.SendMedicalCertificateAnswerType)4 SendMedicalCertificateQuestionType (se.inera.ifv.insuranceprocess.healthreporting.sendmedicalcertificatequestionresponder.v1.SendMedicalCertificateQuestionType)4 WebCertServiceException (se.inera.intyg.webcert.common.service.exception.WebCertServiceException)4 Amne (se.inera.intyg.webcert.persistence.fragasvar.model.Amne)4