Skip to content

Commit

Permalink
Merge pull request #7996 from coronasafe/develop
Browse files Browse the repository at this point in the history
Merge Develop to Staging v24.24.0
  • Loading branch information
gigincg authored Jun 7, 2024
2 parents 0c36d11 + d9e8747 commit fc32629
Show file tree
Hide file tree
Showing 16 changed files with 574 additions and 327 deletions.
15 changes: 15 additions & 0 deletions src/Common/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1370,3 +1370,18 @@ export const PATIENT_NOTES_THREADS = {
} as const;

export const RATION_CARD_CATEGORY = ["BPL", "APL", "NO_CARD"] as const;

export const DEFAULT_ALLOWED_EXTENSIONS = [
"image/*",
"video/*",
"audio/*",
"text/plain",
"text/csv",
"application/rtf",
"application/msword",
"application/vnd.oasis.opendocument.text",
"application/pdf",
"application/vnd.ms-excel",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"application/vnd.oasis.opendocument.spreadsheet,application/pdf",
];
23 changes: 22 additions & 1 deletion src/Components/Common/FilePreviewDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ type FilePreviewProps = {
fixedWidth?: boolean;
};

const previewExtensions = [
".html",
".htm",
".pdf",
".mp4",
".webm",
".jpg",
".jpeg",
".png",
".gif",
".webp",
];

const FilePreviewDialog = (props: FilePreviewProps) => {
const { show, onClose, file_state, setFileState, downloadURL, fileUrl } =
props;
Expand Down Expand Up @@ -130,13 +143,21 @@ const FilePreviewDialog = (props: FilePreviewProps) => {
}}
pageNumber={page}
/>
) : (
) : previewExtensions.includes(file_state.extension) ? (
<iframe
sandbox=""
title="Source Files"
src={fileUrl}
className="h-[75vh] w-full"
/>
) : (
<div className="flex h-full w-full flex-col items-center justify-center">
<CareIcon
icon="l-file"
className="mb-4 text-5xl text-gray-600"
/>
Can't preview this file. Try downloading it.
</div>
)}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,15 +304,11 @@ let make = (
(state.ventilator_interface !=
CriticalCare__VentilatorParameters.decodeVentilatorInterfaceType(
ventilatorInterfaceOptions[0].value,
) ||
switch state.bilateral_air_entry {
| Some(true) => true
| _ => false
} ||
switch (state.etco2) {
| Some(intValue) => true
| None => false
})
) &&
state.ventilator_interface !=
CriticalCare__VentilatorParameters.decodeVentilatorInterfaceType(
ventilatorInterfaceOptions[3].value,
))
) {
toggleOpen()
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,18 @@ const PrincipalDiagnosisSelect = <T extends Option>(props: Props<T>) => {
}}
errorClassName="hidden"
/>
{diagnosis && (
<span className="mt-3 flex w-full flex-wrap justify-center gap-x-1 px-2 text-center text-gray-900">
<p>This encounter will be categorised under:</p>
<p className="font-bold">{diagnosis.chapter}</p>
</span>
)}
{diagnosis &&
(diagnosis.chapter ? (
<span className="mt-3 flex w-full flex-wrap justify-center gap-x-1 px-2 text-center text-gray-900">
<p>This encounter will be categorised under:</p>
<p className="font-bold">{diagnosis.chapter}</p>
</span>
) : (
<span className="mt-3 flex w-full flex-wrap justify-center gap-x-1 px-2 text-center italic text-gray-700">
This encounter will not be categorised under any chapter as the
diagnosis does not fall under a chapter.
</span>
))}
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Diagnosis/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PerformedByModel } from "../HCX/misc";
export type ICD11DiagnosisModel = {
id: string;
label: string;
chapter: string;
chapter?: string;
};

export const ActiveConditionVerificationStatuses = [
Expand Down
4 changes: 1 addition & 3 deletions src/Components/Facility/ConsultationForm.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Notification from "../../Utils/Notifications.js";

import { BedModel, ConsentRecord, FacilityModel } from "./models";
import { BedModel, FacilityModel } from "./models";
import {
CONSULTATION_SUGGESTION,
DISCHARGE_REASONS,
Expand Down Expand Up @@ -119,7 +119,6 @@ type FormDetails = {
death_confirmed_doctor: string;
InvestigationAdvice: InvestigationType[];
procedures: ProcedureType[];
consent_records: ConsentRecord[];
};

const initForm: FormDetails = {
Expand Down Expand Up @@ -170,7 +169,6 @@ const initForm: FormDetails = {
death_confirmed_doctor: "",
InvestigationAdvice: [],
procedures: [],
consent_records: [],
};

const initError = Object.assign(
Expand Down
15 changes: 10 additions & 5 deletions src/Components/Facility/models.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,18 @@ export interface OptionsType {

export type PatientCategory = "Comfort Care" | "Mild" | "Moderate" | "Critical";

export type ConsentRecord = {
export interface PatientConsentModel {
id: string;
type: (typeof CONSENT_TYPE_CHOICES)[number]["id"];
patient_code_status?: (typeof CONSENT_PATIENT_CODE_STATUS_CHOICES)[number]["id"];
deleted?: boolean;
};
patient_code_status:
| (typeof CONSENT_PATIENT_CODE_STATUS_CHOICES)[number]["id"]
| null;
archived: boolean;
archived_by?: UserBareMinimum;
archived_date: string;
created_date: string;
created_by: UserBareMinimum;
}

export interface ConsultationModel {
encounter_date: string;
Expand Down Expand Up @@ -174,7 +180,6 @@ export interface ConsultationModel {
is_readmission?: boolean;
medico_legal_case?: boolean;
investigation?: InvestigationType[];
consent_records?: ConsentRecord[];
}

export interface PatientStatsModel {
Expand Down
65 changes: 43 additions & 22 deletions src/Components/Patient/DailyRounds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import routes from "../../Redux/api";
import { Scribe } from "../Scribe/Scribe";
import { DAILY_ROUND_FORM_SCRIBE_DATA } from "../Scribe/formDetails";
import { DailyRoundsModel } from "./models";
import { fetchEventTypeByName } from "../Facility/ConsultationDetails/Events/types";
import InvestigationBuilder from "../Common/prescription-builder/InvestigationBuilder";
import { FieldErrorText } from "../Form/FormFields/FormField";
import { error } from "@pnotify/core";
Expand Down Expand Up @@ -61,6 +60,7 @@ const initForm: any = {
systolic: null,
investigations: [],
investigations_dirty: false,
symptoms_dirty: false,
diastolic: null,
pulse: null,
resp: null,
Expand Down Expand Up @@ -139,6 +139,7 @@ export const DailyRounds = (props: any) => {
"review_interval",
"bp",
"pulse",
"temperature",
"resp",
"investigations",
"ventilator_spo2",
Expand All @@ -149,7 +150,6 @@ export const DailyRounds = (props: any) => {

const fetchRoundDetails = useCallback(async () => {
setIsLoading(true);
fetchEventTypeByName("");
let formData: any = initialData;
if (id) {
const { data } = await request(routes.getDailyReport, {
Expand Down Expand Up @@ -271,8 +271,7 @@ export const DailyRounds = (props: any) => {
return !invalidForm;
};

const handleSubmit = async (e: React.SyntheticEvent) => {
e.preventDefault();
const handleSubmit = async () => {
const validForm = validateForm();
if (validForm) {
setIsLoading(true);
Expand Down Expand Up @@ -420,6 +419,32 @@ export const DailyRounds = (props: any) => {
return <Loading />;
}

const submitButtonDisabled = (() => {
if (buttonText !== "Save") {
return false;
}

if (["VENTILATOR", "DOCTORS_LOG"].includes(state.form.rounds_type)) {
return false;
}

if (state.form["symptoms_dirty"]) {
return false;
}

if (
formFields.every(
(field) =>
JSON.stringify(state.form[field]) ===
JSON.stringify(initialData[field]),
)
) {
return true;
}

return false;
})();

return (
<Page
title={headerText}
Expand Down Expand Up @@ -448,10 +473,7 @@ export const DailyRounds = (props: any) => {
}}
/>
</div>
<form
onSubmit={(e) => handleSubmit(e)}
className="w-full max-w-4xl rounded-lg bg-white px-8 py-5 shadow md:m-4 md:px-16 md:py-11"
>
<form className="w-full max-w-4xl rounded-lg bg-white px-8 py-5 shadow md:m-4 md:px-16 md:py-11">
<DraftSection
handleDraftSelect={(newState) => {
dispatch({ type: "set_state", state: newState });
Expand Down Expand Up @@ -504,7 +526,14 @@ export const DailyRounds = (props: any) => {
<div className="grid grid-cols-1 gap-x-6 md:grid-cols-2">
<div className="pb-6 md:col-span-2">
<FieldLabel>Symptoms</FieldLabel>
<EncounterSymptomsBuilder />
<EncounterSymptomsBuilder
onChange={() => {
handleFormFieldChange({
name: "symptoms_dirty",
value: true,
});
}}
/>
</div>

<TextAreaFormField
Expand Down Expand Up @@ -722,19 +751,11 @@ export const DailyRounds = (props: any) => {
<div className="mt-4 flex flex-col-reverse justify-end gap-2 md:flex-row">
<Cancel onClick={() => goBack()} />
<Submit
disabled={
buttonText === "Save" &&
formFields.every(
(field: string) =>
JSON.stringify(state.form[field]) ===
JSON.stringify(initialData[field]),
) &&
(state.form.temperature == initialData.temperature ||
isNaN(state.form.temperature)) &&
state.form.rounds_type !== "VENTILATOR" &&
state.form.rounds_type !== "DOCTORS_LOG"
}
onClick={(e) => handleSubmit(e)}
disabled={submitButtonDisabled}
onClick={(e) => {
e.preventDefault();
handleSubmit();
}}
label={buttonText}
/>
</div>
Expand Down
Loading

0 comments on commit fc32629

Please sign in to comment.