Skip to content

Commit

Permalink
BAH-4001 | Add. Set flag to mark system generated tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
mohan-13 committed Jul 16, 2024
1 parent 6c4f1d6 commit 99a241f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

public class IPDEventUtils {

public static TaskRequest createNonMedicationTaskRequest(IPDEvent ipdEvent, String name, String taskType) {
public static TaskRequest createNonMedicationTaskRequest(IPDEvent ipdEvent, String name, String taskType, Boolean isSystemGenerated) {
TaskRequest taskRequest = new TaskRequest();
taskRequest.setName(name);
taskRequest.setTaskType(taskType);
Expand All @@ -17,6 +17,7 @@ public static TaskRequest createNonMedicationTaskRequest(IPDEvent ipdEvent, Stri
taskRequest.setRequestedStartTime(new Date());
taskRequest.setIntent(FhirTask.TaskIntent.ORDER);
taskRequest.setStatus(FhirTask.TaskStatus.REQUESTED);
taskRequest.setIsSystemGeneratedTask(isSystemGenerated);
return taskRequest;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void handleEvent(IPDEvent event) {
.orElse(null);
if (eventConfig != null) {
for(TaskDetail taskDetail : eventConfig.getTasks()) {
TaskRequest taskRequest = IPDEventUtils.createNonMedicationTaskRequest(event, taskDetail.getName(), "nursing_activity_system");
TaskRequest taskRequest = IPDEventUtils.createNonMedicationTaskRequest(event, taskDetail.getName(), "nursing_activity_system",true);
Task task = taskMapper.fromRequest(taskRequest);
taskService.saveTask(task);
log.info("Task created " + taskDetail.getName());
Expand All @@ -49,4 +49,4 @@ public void handleEvent(IPDEvent event) {


}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void handleEvent(IPDEvent event) {
String patientUuid = admittedPatient.getBedPatientAssignment().getPatient().getUuid();
IPDEvent ipdEvent = new IPDEvent(null, patientUuid, event.getIpdEventType());
for(TaskDetail taskDetail : eventConfig.getTasks()) {
TaskRequest taskRequest = IPDEventUtils.createNonMedicationTaskRequest(ipdEvent, taskDetail.getName(), "nursing_activity_system");
TaskRequest taskRequest = IPDEventUtils.createNonMedicationTaskRequest(ipdEvent, taskDetail.getName(), "nursing_activity_system",true);
Task task = taskMapper.fromRequest(taskRequest);
tasks.add(task);
}
Expand All @@ -57,4 +57,4 @@ private ConfigDetail getEventConfig(IPDEvent event){
.orElse(null);
return eventConfig;
}
}
}

0 comments on commit 99a241f

Please sign in to comment.