Skip to content

Commit

Permalink
Unassign consultation beds while shifting is completed (#1266)
Browse files Browse the repository at this point in the history
unassign consultation beds while shifting is completed
  • Loading branch information
khavinshankar authored Apr 23, 2023
1 parent c208c46 commit 9f9614f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion care/facility/api/viewsets/shifting.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
BREATHLESSNESS_CHOICES,
SHIFTING_STATUS_CHOICES,
PatientConsultation,
ConsultationBed,
ShiftingRequest,
ShiftingRequestComment,
User,
Expand Down Expand Up @@ -136,8 +137,12 @@ def transfer(self, request, *args, **kwargs):
shifting_obj.save(update_fields=["status"])
# Discharge from all other active consultations
PatientConsultation.objects.filter(patient=patient, discharge_date__isnull=True).update(
discharge_date=localtime(now())
discharge_date=localtime(now()), discharge_reason="REF"
)
ConsultationBed.objects.filter(
consultation=patient.last_consultation, end_date__isnull=True
).update(end_date=localtime(now()))

return Response({"transfer": "completed"}, status=status.HTTP_200_OK)
return Response({"error": "Invalid Request"}, status=status.HTTP_400_BAD_REQUEST)

Expand Down

0 comments on commit 9f9614f

Please sign in to comment.