Admitted on
- {formatDateTime(itemData.admission_date)}
+ {formatDateTime(itemData.encounter_date)}
{itemData.is_readmission && (
{
name:
consultationData.suggestion === "A"
? `Admitted on ${formatDateTime(
- consultationData.admission_date!
+ consultationData.encounter_date!
)}`
: consultationData.suggestion_text,
},
@@ -345,19 +345,19 @@ export const ConsultationDetails = (props: any) => {
{consultationData.admitted_to}
- {(consultationData.admission_date ??
- consultationData.discharge_date) && (
+ {(consultationData.discharge_date ??
+ consultationData.encounter_date) && (
{relativeTime(
consultationData.discharge_date
? consultationData.discharge_date
- : consultationData.admission_date
+ : consultationData.encounter_date
)}
)}
- {consultationData.admission_date &&
- formatDateTime(consultationData.admission_date)}
+ {consultationData.encounter_date &&
+ formatDateTime(consultationData.encounter_date)}
{consultationData.discharge_date &&
` - ${formatDateTime(consultationData.discharge_date)}`}
diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx
index 3207787a27d..72944389235 100644
--- a/src/Components/Facility/ConsultationForm.tsx
+++ b/src/Components/Facility/ConsultationForm.tsx
@@ -3,6 +3,7 @@ import * as Notification from "../../Utils/Notifications.js";
import { BedModel, FacilityModel } from "./models";
import {
CONSULTATION_SUGGESTION,
+ ConsultationSuggestionValue,
PATIENT_CATEGORIES,
REVIEW_AT_CHOICES,
TELEMEDICINE_ACTIONS,
@@ -82,14 +83,14 @@ type FormDetails = {
symptoms: number[];
other_symptoms: string;
symptoms_onset_date?: Date;
- suggestion: string;
+ suggestion: ConsultationSuggestionValue;
route_to_facility?: RouteToFacility;
patient: string;
facility: string;
admitted: BooleanStrings;
admitted_to: string;
category: string;
- admission_date?: Date;
+ encounter_date?: Date;
icu_admission_date?: Date;
discharge_date: null;
referred_to?: string;
@@ -139,7 +140,7 @@ const initForm: FormDetails = {
admitted: "false",
admitted_to: "",
category: "",
- admission_date: new Date(),
+ encounter_date: new Date(),
icu_admission_date: undefined,
discharge_date: null,
referred_to: "",
@@ -375,7 +376,7 @@ export const ConsultationForm = (props: any) => {
const formData = {
...res.data,
symptoms_onset_date: isoStringToDate(res.data.symptoms_onset_date),
- admission_date: isoStringToDate(res.data.admission_date),
+ encounter_date: isoStringToDate(res.data.encounter_date),
icu_admission_date: isoStringToDate(res.data.icu_admission_date),
admitted: res.data.admitted ? String(res.data.admitted) : "false",
admitted_to: res.data.admitted_to ? res.data.admitted_to : "",
@@ -485,15 +486,12 @@ export const ConsultationForm = (props: any) => {
invalidForm = true;
}
return;
- case "admission_date":
- if (
- ["A", "DC"].includes(state.form.suggestion) &&
- !state.form[field]
- ) {
+ case "encounter_date":
+ if (!state.form[field]) {
errors[field] = "Field is required";
invalidForm = true;
}
- if (dayjs(state.form.admission_date).isBefore(dayjs("2000-01-01"))) {
+ if (dayjs(state.form.encounter_date).isBefore(dayjs("2000-01-01"))) {
errors[field] = "Admission date cannot be before 01/01/2000";
invalidForm = true;
}
@@ -685,9 +683,7 @@ export const ConsultationForm = (props: any) => {
suggestion: state.form.suggestion,
route_to_facility: state.form.route_to_facility,
admitted: state.form.suggestion === "A",
- admission_date: ["A", "DC"].includes(state.form.suggestion)
- ? state.form.admission_date
- : undefined,
+ encounter_date: state.form.encounter_date,
category: state.form.category,
is_kasp: state.form.is_kasp,
kasp_enabled_date: JSON.parse(state.form.is_kasp) ? new Date() : null,
@@ -1134,7 +1130,7 @@ export const ConsultationForm = (props: any) => {
label="Decision after consultation"
{...selectField("suggestion")}
options={CONSULTATION_SUGGESTION.filter(
- ({ deprecated }) => !deprecated
+ (option) => !("deprecated" in option)
)}
/>
@@ -1200,30 +1196,35 @@ export const ConsultationForm = (props: any) => {
>
)}
- {["A", "DC"].includes(state.form.suggestion) && (
-
- )}
+ label={
+ {
+ A: "Date & Time of Admission to the Facility",
+ DC: "Date & Time of Domiciliary Care commencement",
+ OP: "Date & Time of Out-patient visit",
+ DD: "Date & Time of Encounter",
+ HI: "Date & Time of Encounter",
+ R: "Date & Time of Encounter",
+ }[state.form.suggestion]
+ }
+ type="datetime-local"
+ value={dayjs(state.form.encounter_date).format(
+ "YYYY-MM-DDTHH:mm"
+ )}
+ max={dayjs().format("YYYY-MM-DDTHH:mm")}
+ />
+