Search in sources :

Example 6 with FragaSvar

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

the class FragaSvarTestUtil method buildFragaWithSvar.

/**
 * Builds a FragaSvara, a question with reply, from the supplied params.
 *
 * @param enhetsId
 * @param status
 * @param fragestallare
 * @param hsaId
 * @param fragaSkickad
 * @param svarSkickad
 * @param vidarebefordrad
 * @return
 */
public static FragaSvar buildFragaWithSvar(String enhetsId, Status status, Amne amne, String fragestallare, String hsaId, String fragaSkickad, String svarSkickad, boolean vidarebefordrad) {
    FragaSvar f = buildFraga(1L, enhetsId, status, amne, fragestallare, hsaId, fragaSkickad, vidarebefordrad);
    f.setSvarSigneringsDatum((svarSkickad != null ? LocalDateTime.parse(svarSkickad) : SVAR_SIGN_DATE));
    f.setSvarSkickadDatum((svarSkickad != null ? LocalDateTime.parse(svarSkickad) : SVAR_SENT_DATE));
    f.setSvarsText(SVAR_TEXT);
    return f;
}
Also used : FragaSvar(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar)

Example 7 with FragaSvar

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

the class ReceiveMedicalCertificateAnswerIT method createQuestion.

private int createQuestion(String typ, String intygId, String personnummer) {
    LocalDateTime now = LocalDateTime.now();
    FragaSvar fs = new FragaSvar();
    fs.setAmne(Amne.ARBETSTIDSFORLAGGNING);
    fs.setFrageText("Frågetext");
    fs.setIntygsReferens(new IntygsReferens(intygId, typ, Personnummer.createPersonnummer(personnummer).get(), "Api Restman", now));
    fs.setStatus(Status.PENDING_INTERNAL_ACTION);
    fs.setFrageSkickadDatum(now);
    fs.setMeddelandeRubrik("Meddelanderubrik");
    fs.setFrageStallare(FrageStallare.WEBCERT.getKod());
    fs.setFrageSigneringsDatum(now);
    fs.setVardAktorNamn("Vardaktor");
    fs.setVardAktorHsaId("Test-hsa-id");
    fs.setExternReferens("FK-REF-1");
    Vardperson vardperson = new Vardperson();
    vardperson.setEnhetsId("IFV1239877878-1042");
    vardperson.setArbetsplatsKod("0000000");
    vardperson.setEnhetsnamn("blub");
    vardperson.setHsaId("IFV1239877878-1049");
    vardperson.setVardgivarId("TESTVG");
    vardperson.setVardgivarnamn("VG TEST SYD");
    vardperson.setNamn("Hr Doktor");
    fs.setVardperson(vardperson);
    Response response = given().log().all().contentType(ContentType.JSON).body(fs).expect().statusCode(200).when().post("testability/fragasvar").then().extract().response();
    JsonPath model = new JsonPath(response.body().asString());
    return model.get("internReferens");
}
Also used : LocalDateTime(java.time.LocalDateTime) Vardperson(se.inera.intyg.webcert.persistence.fragasvar.model.Vardperson) Response(com.jayway.restassured.response.Response) IntygsReferens(se.inera.intyg.webcert.persistence.fragasvar.model.IntygsReferens) FragaSvar(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar) JsonPath(com.jayway.restassured.path.json.JsonPath)

Example 8 with FragaSvar

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

the class ArendeListItemConverterTest method testConvertEmptyIntygReferens.

@Test
public void testConvertEmptyIntygReferens() {
    FragaSvar fs = new FragaSvar();
    fs.setVardperson(new Vardperson());
    ArendeListItem arende = ArendeListItemConverter.convert(fs);
    assertNull(arende);
}
Also used : Vardperson(se.inera.intyg.webcert.persistence.fragasvar.model.Vardperson) ArendeListItem(se.inera.intyg.webcert.web.web.controller.api.dto.ArendeListItem) FragaSvar(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar) Test(org.junit.Test)

Example 9 with FragaSvar

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

the class ArendeListItemConverterTest method testConvertFragaSvarWithoutCorrespondingArendeAmne.

@Test
public void testConvertFragaSvarWithoutCorrespondingArendeAmne() {
    final Amne amne = Amne.ARBETSTIDSFORLAGGNING;
    FragaSvar fs = createFragaSvar("fragestallare", "intygId", "intygTyp", patientId, (long) 13, LocalDateTime.now(), "signeratAv", "enhetsnamn", "vardgivarnamn", amne, false, Status.PENDING_INTERNAL_ACTION);
    ArendeListItem arende = ArendeListItemConverter.convert(fs);
    assertNotNull(arende);
    assertEquals(amne.name(), arende.getAmne());
}
Also used : ArendeListItem(se.inera.intyg.webcert.web.web.controller.api.dto.ArendeListItem) FragaSvar(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar) Amne(se.inera.intyg.webcert.persistence.fragasvar.model.Amne) ArendeAmne(se.inera.intyg.webcert.persistence.arende.model.ArendeAmne) Test(org.junit.Test)

Example 10 with FragaSvar

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

the class ArendeListItemConverterTest method createFragaSvar.

private FragaSvar createFragaSvar(String fragestallare, String intygsId, String intygsTyp, String patientId, Long internReferens, LocalDateTime senasteHandelse, String signeratAv, String enhetsnamn, String vardgivarnamn, Amne amne, Boolean vidarebefordrad, Status status) {
    FragaSvar res = new FragaSvar();
    res.setFrageStallare(fragestallare);
    res.setIntygsReferens(new IntygsReferens(intygsId, intygsTyp, Personnummer.createPersonnummer(patientId).get(), null, null));
    res.setInternReferens(internReferens);
    res.setFrageSkickadDatum(senasteHandelse);
    Vardperson vp = new Vardperson();
    vp.setNamn(signeratAv);
    vp.setEnhetsnamn(enhetsnamn);
    vp.setVardgivarnamn(vardgivarnamn);
    res.setVardperson(vp);
    res.setAmne(amne);
    res.setVidarebefordrad(vidarebefordrad);
    res.setStatus(status);
    return res;
}
Also used : Vardperson(se.inera.intyg.webcert.persistence.fragasvar.model.Vardperson) IntygsReferens(se.inera.intyg.webcert.persistence.fragasvar.model.IntygsReferens) FragaSvar(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar)

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