Search in sources :

Example 6 with MedicinsktArende

use of se.inera.intyg.webcert.persistence.arende.model.MedicinsktArende in project webcert by sklintyg.

the class ArendeViewConverter method convertToMedicinsktArendeView.

private List<MedicinsktArendeView> convertToMedicinsktArendeView(List<MedicinsktArende> medicinskaArenden, String intygsId, String intygsTyp) {
    List<MedicinsktArendeView> medicinskaArendenViews = new ArrayList<>();
    if (CollectionUtils.isEmpty(medicinskaArenden)) {
        return medicinskaArendenViews;
    }
    List<String> frageIds = medicinskaArenden.stream().map(MedicinsktArende::getFrageId).distinct().collect(Collectors.toList());
    ModuleApi moduleApi = null;
    try {
        moduleApi = moduleRegistry.getModuleApi(intygsTyp);
    } catch (ModuleNotFoundException e) {
        LOG.error("Module not found for certificate of type {}", intygsTyp);
        Throwables.propagate(e);
    }
    Utlatande utlatande = intygService.fetchIntygData(intygsId, intygsTyp, false).getUtlatande();
    Map<String, List<String>> arendeParameters = moduleApi.getModuleSpecificArendeParameters(utlatande, frageIds);
    for (MedicinsktArende arende : medicinskaArenden) {
        Integer position = getListPositionForInstanceId(arende);
        String jsonPropertyHandle = getJsonPropertyHandle(arende, position, arendeParameters);
        MedicinsktArendeView view = MedicinsktArendeView.builder().setFrageId(arende.getFrageId()).setInstans(arende.getInstans()).setText(arende.getText()).setPosition(Math.max(position - 1, 0)).setJsonPropertyHandle(jsonPropertyHandle).build();
        medicinskaArendenViews.add(view);
    }
    return medicinskaArendenViews;
}
Also used : ModuleApi(se.inera.intyg.common.support.modules.support.api.ModuleApi) ModuleNotFoundException(se.inera.intyg.common.support.modules.registry.ModuleNotFoundException) MedicinsktArende(se.inera.intyg.webcert.persistence.arende.model.MedicinsktArende) Utlatande(se.inera.intyg.common.support.model.common.internal.Utlatande) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) MedicinsktArendeView(se.inera.intyg.webcert.web.web.controller.api.dto.MedicinsktArendeView)

Example 7 with MedicinsktArende

use of se.inera.intyg.webcert.persistence.arende.model.MedicinsktArende in project webcert by sklintyg.

the class ArendeRepositoryTest method buildMedicinsktArende.

private MedicinsktArende buildMedicinsktArende(String frageId, Integer instans, String text) {
    MedicinsktArende res = new MedicinsktArende();
    res.setFrageId(frageId);
    res.setInstans(instans);
    res.setText(text);
    return res;
}
Also used : MedicinsktArende(se.inera.intyg.webcert.persistence.arende.model.MedicinsktArende)

Example 8 with MedicinsktArende

use of se.inera.intyg.webcert.persistence.arende.model.MedicinsktArende in project webcert by sklintyg.

the class ArendeServiceTest method buildArende.

private Arende buildArende(String meddelandeId, String intygId, LocalDateTime senasteHandelse, LocalDateTime timestamp, String enhetId) {
    Arende arende = new Arende();
    arende.setStatus(Status.PENDING_INTERNAL_ACTION);
    arende.setAmne(ArendeAmne.OVRIGT);
    arende.setReferensId("<fk-extern-referens>");
    arende.setMeddelandeId(meddelandeId);
    arende.setEnhetId(enhetId);
    arende.setSenasteHandelse(senasteHandelse);
    arende.setMeddelande("frageText");
    arende.setTimestamp(timestamp);
    List<MedicinsktArende> komplettering = new ArrayList<>();
    arende.setIntygsId(intygId);
    arende.setIntygTyp(INTYG_TYP);
    arende.setPatientPersonId(PNR.getPersonnummer());
    arende.setSigneratAv("Signatur");
    arende.setSistaDatumForSvar(senasteHandelse.plusDays(7).toLocalDate());
    arende.setKomplettering(komplettering);
    arende.setRubrik("rubrik");
    arende.setSkickatAv("Avsandare");
    arende.setVidarebefordrad(false);
    return arende;
}
Also used : MedicinsktArende(se.inera.intyg.webcert.persistence.arende.model.MedicinsktArende) MedicinsktArende(se.inera.intyg.webcert.persistence.arende.model.MedicinsktArende) Arende(se.inera.intyg.webcert.persistence.arende.model.Arende)

Aggregations

MedicinsktArende (se.inera.intyg.webcert.persistence.arende.model.MedicinsktArende)8 Arende (se.inera.intyg.webcert.persistence.arende.model.Arende)4 ImmutableList (com.google.common.collect.ImmutableList)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)1 ModuleNotFoundException (se.inera.intyg.common.support.modules.registry.ModuleNotFoundException)1 ModuleApi (se.inera.intyg.common.support.modules.support.api.ModuleApi)1 WebCertServiceException (se.inera.intyg.webcert.common.service.exception.WebCertServiceException)1 Utkast (se.inera.intyg.webcert.persistence.utkast.model.Utkast)1 MedicinsktArendeView (se.inera.intyg.webcert.web.web.controller.api.dto.MedicinsktArendeView)1