use of org.hl7.gravity.refimpl.sdohexchange.dto.response.CodingDto in project Gravity-SDOH-Exchange-RI by FHIR.
the class ServiceRequestToDtoConverter method convert.
@Override
public ServiceRequestDto convert(ServiceRequest serviceRequest) {
String id = serviceRequest.getIdElement().getIdPart();
ServiceRequestDto serviceRequestDto = new ServiceRequestDto(id);
Coding categoryCode = serviceRequest.getCategoryFirstRep().getCodingFirstRep();
serviceRequestDto.setCategory(new CodingDto(categoryCode.getCode(), categoryCode.getDisplay()));
Coding requestCode = serviceRequest.getCode().getCodingFirstRep();
serviceRequestDto.setCode(new CodingDto(requestCode.getCode(), requestCode.getDisplay()));
serviceRequestDto.setOccurrence(convertOccurrence(serviceRequest.getOccurrence()));
serviceRequestDto.setConditions(serviceRequest.getReasonReference().stream().map(typeToDtoConverter::convert).collect(Collectors.toList()));
serviceRequestDto.setGoals(serviceRequest.getSupportingInfo().stream().filter(info -> info.getReferenceElement().getResourceType().equals(Goal.class.getSimpleName())).map(typeToDtoConverter::convert).collect(Collectors.toList()));
// TODO: confirm display
serviceRequestDto.setConsent(serviceRequest.getSupportingInfo().stream().filter(info -> info.getReferenceElement().getResourceType().equals(Consent.class.getSimpleName())).map(typeToDtoConverter::convert).findAny().orElse(null));
return serviceRequestDto;
}
use of org.hl7.gravity.refimpl.sdohexchange.dto.response.CodingDto in project Gravity-SDOH-Exchange-RI by FHIR.
the class PatientTaskItemInfoHolderToItemDtoConverter method convert.
@Override
public PatientTaskItemDto convert(T taskInfoHolder) {
Task task = taskInfoHolder.getTask();
Questionnaire questionnaire = taskInfoHolder.getQuestionnaire();
PatientTaskItemDto taskDto = createDto();
taskDto.setId(task.getIdElement().getIdPart());
taskDto.setName(task.getDescription());
taskDto.setPriority(task.getPriority().getDisplay());
taskDto.setLastModified(FhirUtil.toLocalDateTime(task.getLastModifiedElement()));
taskDto.setStatus(task.getStatus().getDisplay());
taskDto.setStatusReason(task.getStatusReason().getText());
setReferralTask(task, taskDto);
List<Coding> codings = task.getCode().getCoding();
PatientTaskCode code = getCode(taskDto, codings);
if (code != null) {
Coding coding = code.toCoding();
taskDto.setCode(new CodingDto(coding.getCode(), coding.getDisplay()));
}
setTaskType(task, taskDto, code);
if (questionnaire != null) {
taskDto.setAssessment(new ReferenceDto(questionnaire.getIdElement().getIdPart(), questionnaire.getTitle()));
}
for (TaskOutputComponent outputComponent : task.getOutput()) {
Type componentValue = outputComponent.getValue();
Coding coding = FhirUtil.findCoding(Lists.newArrayList(outputComponent.getType()), SDCTemporaryCode.SYSTEM, SDCTemporaryCode.QUESTIONNAIRE_RESPONSE.getCode());
if (coding != null) {
Reference qrRef = (Reference) componentValue;
if (QuestionnaireResponse.class.getSimpleName().equals(qrRef.getReferenceElement().getResourceType())) {
taskDto.setAssessmentResponse(new ReferenceDto(qrRef.getReferenceElement().getIdPart(), coding.getDisplay()));
}
}
if (componentValue instanceof CodeableConcept) {
CodeableConcept outcome = (CodeableConcept) componentValue;
taskDto.setOutcome(outcome.getText());
}
}
return taskDto;
}
Aggregations