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;
}
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;
}
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;
}
Aggregations