Skip to content

Commit

Permalink
fix: merge ip and op number (#6132)
Browse files Browse the repository at this point in the history
Signed-off-by: Aakash Singh <[email protected]>
  • Loading branch information
sainak authored Aug 25, 2023
1 parent 2f86fde commit edc0705
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 38 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/patient_spec/patient_crud.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ describe("Patient Creation with consultation", () => {
.type("Examination details and Clinical conditions");
cy.get("#weight").click().type("70");
cy.get("#height").click().type("170");
cy.get("#ip_no").type("192.168.1.11");
cy.get("#patient_no").type("IP007");
cy.get(
"#icd11_diagnoses_object input[placeholder='Select'][role='combobox']"
)
Expand Down
38 changes: 16 additions & 22 deletions src/Components/Facility/ConsultationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ type FormDetails = {
history_of_present_illness: string;
prescribed_medication: string;
consultation_notes: string;
ip_no: string;
op_no: string;
patient_no: string;
procedure: ProcedureType[];
investigation: InvestigationType[];
is_telemedicine: BooleanStrings;
Expand Down Expand Up @@ -132,8 +131,7 @@ const initForm: FormDetails = {
history_of_present_illness: "",
prescribed_medication: "",
consultation_notes: "",
ip_no: "",
op_no: "",
patient_no: "",
procedure: [],
investigation: [],
is_telemedicine: "false",
Expand Down Expand Up @@ -314,8 +312,7 @@ export const ConsultationForm = (props: any) => {
? PATIENT_CATEGORIES.find((i) => i.text === res.data.category)
?.id ?? "Comfort"
: "Comfort",
ip_no: res.data.ip_no ? res.data.ip_no : "",
op_no: res.data.op_no ? res.data.op_no : "",
patient_no: res.data.patient_no ?? "",
verified_by: res.data.verified_by ? res.data.verified_by : "",
OPconsultation: res.data.consultation_notes,
is_telemedicine: `${res.data.is_telemedicine}`,
Expand Down Expand Up @@ -387,7 +384,7 @@ export const ConsultationForm = (props: any) => {
invalidForm = true;
}
return;
case "ip_no":
case "patient_no":
if (state.form.suggestion !== "A") return;
if (!state.form[field]) {
errors[field] = "IP Number is required as person is admitted";
Expand Down Expand Up @@ -612,8 +609,7 @@ export const ConsultationForm = (props: any) => {
history_of_present_illness: state.form.history_of_present_illness,
prescribed_medication: state.form.prescribed_medication,
discharge_date: state.form.discharge_date,
ip_no: state.form.ip_no,
op_no: state.form.op_no,
patient_no: state.form.patient_no,
icd11_diagnoses: state.form.icd11_diagnoses_object.map(
(o: ICD11DiagnosisModel) => o.id
),
Expand Down Expand Up @@ -1101,19 +1097,17 @@ export const ConsultationForm = (props: any) => {
)}
</>
)}
{state.form.suggestion !== "A" ? (
<div className="col-span-6 mb-6" ref={fieldRef["op_no"]}>
<TextFormField {...field("op_no")} label="OP Number" />
</div>
) : (
<div className="col-span-6 mb-6" ref={fieldRef["ip_no"]}>
<TextFormField
{...field("ip_no")}
label="IP Number"
required={state.form.suggestion === "A"}
/>
</div>
)}
<div className="col-span-6 mb-6" ref={fieldRef["patient_no"]}>
<TextFormField
{...field("patient_no")}
label={
state.form.suggestion === "A"
? "IP Number"
: "OP Number"
}
required={state.form.suggestion === "A"}
/>
</div>
</div>

<div className="flex flex-col gap-4 pb-4">
Expand Down
3 changes: 1 addition & 2 deletions src/Components/Facility/models.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ export interface ConsultationModel {
referred_to_object?: FacilityModel;
referred_to_external?: string;
suggestion?: string;
ip_no?: string;
op_no?: string;
patient_no?: string;
consultation_status?: number;
is_kasp?: boolean;
kasp_enabled_date?: string;
Expand Down
8 changes: 4 additions & 4 deletions src/Components/Patient/ManagePatients.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export const PatientManager = () => {
page: qParams.page || 1,
limit: resultsPerPage,
name: qParams.name || undefined,
ip_or_op_no: qParams.ip_or_op_no || undefined,
patient_no: qParams.patient_no || undefined,
is_active:
!qParams.last_consultation_discharge_reason &&
(qParams.is_active || "True"),
Expand Down Expand Up @@ -356,7 +356,7 @@ export const PatientManager = () => {
qParams.is_active,
qParams.disease_status,
qParams.name,
qParams.ip_or_op_no,
qParams.patient_no,
qParams.page,
qParams.phone_number,
qParams.emergency_phone_number,
Expand Down Expand Up @@ -875,7 +875,7 @@ export const PatientManager = () => {
label="Search by IP/OP Number"
placeholder="Enter IP/OP Number"
secondary
{...queryField("ip_or_op_no")}
{...queryField("patient_no")}
/>
</div>
<div className="md:flex md:gap-4">
Expand Down Expand Up @@ -913,7 +913,7 @@ export const PatientManager = () => {
phoneNumber("Primary number", "phone_number"),
phoneNumber("Emergency number", "emergency_phone_number"),
badge("Patient name", "name"),
badge("IP/OP number", "ip_or_op_no"),
badge("IP/OP number", "patient_no"),
...dateRange("Modified", "modified_date"),
...dateRange("Created", "created_date"),
...dateRange("Admitted", "last_consultation_admission_date"),
Expand Down
10 changes: 4 additions & 6 deletions src/Components/Patient/PatientInfoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ export default function PatientInfoCard(props: {

const patient = props.patient;
const consultation = props.consultation;
const ip_no = consultation?.ip_no;
const op_no = consultation?.op_no;

const category: PatientCategory | undefined =
consultation?.last_daily_round?.patient_category ?? consultation?.category;
Expand Down Expand Up @@ -157,12 +155,12 @@ export default function PatientInfoCard(props: {
{consultation?.facility_name}
</Link>

{(consultation?.suggestion === "A" || op_no) && (
{consultation?.patient_no && (
<span className="pl-2 capitalize md:col-span-2">
<span className="badge badge-pill badge-primary">
{consultation?.suggestion !== "A"
? `OP: ${op_no}`
: `IP: ${ip_no}`}
{`${consultation?.suggestion === "A" ? "IP" : "OP"}: ${
consultation?.patient_no
}`}
</span>
</span>
)}
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Shifting/ShiftDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,9 @@ export default function ShiftDetails(props: { id: string }) {
</div>
<div>
<span className="font-semibold leading-relaxed">
{t("op_ip_no")}:{" "}
{t("patient_no")}:{" "}
</span>
{consultation.ip_no || "-"}
{consultation.patient_no || "-"}
</div>
</div>
<div className="mt-2 flex justify-between">
Expand Down
2 changes: 1 addition & 1 deletion src/Locale/en/Common.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"close": "Close",
"print_referral_letter": "Print Referral Letter",
"date_of_positive_covid_19_swab": "Date of Positive Covid 19 Swab",
"op_ip_no": "OP/IP No",
"patient_no": "OP/IP No",
"date_of_admission": "Date of Admission",
"india_1": "India",
"unique_id": "Unique Id",
Expand Down

0 comments on commit edc0705

Please sign in to comment.