Search in sources :

Example 1 with ArendeListItem

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);
}
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 2 with ArendeListItem

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());
}
Also used : ArendeListItem(se.inera.intyg.webcert.web.web.controller.api.dto.ArendeListItem) Arende(se.inera.intyg.webcert.persistence.arende.model.Arende) Test(org.junit.Test)

Example 3 with ArendeListItem

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());
}
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 4 with ArendeListItem

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;
}
Also used : ArendeListItem(se.inera.intyg.webcert.web.web.controller.api.dto.ArendeListItem)

Example 5 with ArendeListItem

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;
}
Also used : ArendeListItem(se.inera.intyg.webcert.web.web.controller.api.dto.ArendeListItem) ArendeListItemConverter(se.inera.intyg.webcert.web.converter.ArendeListItemConverter) QueryFragaSvarResponse(se.inera.intyg.webcert.web.service.fragasvar.dto.QueryFragaSvarResponse) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ArendeListItem (se.inera.intyg.webcert.web.web.controller.api.dto.ArendeListItem)11 Test (org.junit.Test)6 ArendeAmne (se.inera.intyg.webcert.persistence.arende.model.ArendeAmne)5 FragaSvar (se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar)4 LocalDateTime (java.time.LocalDateTime)3 Arende (se.inera.intyg.webcert.persistence.arende.model.Arende)3 Status (se.inera.intyg.webcert.persistence.model.Status)3 Transactional (org.springframework.transaction.annotation.Transactional)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Preconditions (com.google.common.base.Preconditions)1 Strings (com.google.common.base.Strings)1 Clock (java.time.Clock)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Set (java.util.Set)1