use of se.inera.intyg.webcert.web.web.controller.api.dto.ArendeListItem 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);
}
use of se.inera.intyg.webcert.web.web.controller.api.dto.ArendeListItem in project webcert by sklintyg.
the class ArendeListItemConverterTest method testConvertArendeVidarebefordradNull.
@Test
public void testConvertArendeVidarebefordradNull() {
Arende arende = createArende(ArendeAmne.KONTKT, "intygsId", "intygTyp", "meddelandeId", "patientPersonId", "signeratAvName", "skickatAv", LocalDateTime.now(), Status.ANSWERED, null, "enhetsnamn", "vardgivarnamn");
ArendeListItem result = ArendeListItemConverter.convert(arende);
assertEquals(false, result.isVidarebefordrad());
}
use of se.inera.intyg.webcert.web.web.controller.api.dto.ArendeListItem 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());
}
use of se.inera.intyg.webcert.web.web.controller.api.dto.ArendeListItem in project webcert by sklintyg.
the class ArendeListItemConverter method convert.
public static ArendeListItem convert(Arende arende) {
ArendeListItem res = new ArendeListItem();
res.setAmne(arende.getAmne().name());
res.setFragestallare(arende.getSkickatAv());
res.setIntygId(arende.getIntygsId());
res.setIntygTyp(arende.getIntygTyp());
res.setMeddelandeId(arende.getMeddelandeId());
res.setPatientId(arende.getPatientPersonId());
res.setReceivedDate(arende.getSenasteHandelse());
res.setSigneratAvNamn(arende.getSigneratAvName());
res.setStatus(arende.getStatus());
res.setVidarebefordrad(getSafeBooleanValue(arende.getVidarebefordrad()));
res.setEnhetsnamn(arende.getEnhetName());
res.setVardgivarnamn(arende.getVardgivareName());
return res;
}
use of se.inera.intyg.webcert.web.web.controller.api.dto.ArendeListItem in project webcert by sklintyg.
the class FragaSvarServiceImpl method filterFragaSvar.
@Override
@Transactional(value = "jpaTransactionManager", readOnly = true)
public QueryFragaSvarResponse filterFragaSvar(Filter filter) {
List<ArendeListItem> results = fragaSvarRepository.filterFragaSvar(filter).stream().map(ArendeListItemConverter::convert).filter(Objects::nonNull).collect(Collectors.toList());
int totalResultsCount = fragaSvarRepository.filterCountFragaSvar(filter);
QueryFragaSvarResponse response = new QueryFragaSvarResponse();
response.setResults(results);
response.setTotalCount(totalResultsCount);
return response;
}
Aggregations