Skip to content

Commit ed7b307

Browse files
authored
Restructured Consent Records (#7946)
1 parent 5f05c0c commit ed7b307

File tree

11 files changed

+495
-283
lines changed

11 files changed

+495
-283
lines changed

src/Common/constants.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,3 +1370,18 @@ export const PATIENT_NOTES_THREADS = {
13701370
} as const;
13711371

13721372
export const RATION_CARD_CATEGORY = ["BPL", "APL", "NO_CARD"] as const;
1373+
1374+
export const DEFAULT_ALLOWED_EXTENSIONS = [
1375+
"image/*",
1376+
"video/*",
1377+
"audio/*",
1378+
"text/plain",
1379+
"text/csv",
1380+
"application/rtf",
1381+
"application/msword",
1382+
"application/vnd.oasis.opendocument.text",
1383+
"application/pdf",
1384+
"application/vnd.ms-excel",
1385+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
1386+
"application/vnd.oasis.opendocument.spreadsheet,application/pdf",
1387+
];

src/Components/Common/FilePreviewDialog.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,19 @@ type FilePreviewProps = {
3232
fixedWidth?: boolean;
3333
};
3434

35+
const previewExtensions = [
36+
".html",
37+
".htm",
38+
".pdf",
39+
".mp4",
40+
".webm",
41+
".jpg",
42+
".jpeg",
43+
".png",
44+
".gif",
45+
".webp",
46+
];
47+
3548
const FilePreviewDialog = (props: FilePreviewProps) => {
3649
const { show, onClose, file_state, setFileState, downloadURL, fileUrl } =
3750
props;
@@ -130,13 +143,21 @@ const FilePreviewDialog = (props: FilePreviewProps) => {
130143
}}
131144
pageNumber={page}
132145
/>
133-
) : (
146+
) : previewExtensions.includes(file_state.extension) ? (
134147
<iframe
135148
sandbox=""
136149
title="Source Files"
137150
src={fileUrl}
138151
className="h-[75vh] w-full"
139152
/>
153+
) : (
154+
<div className="flex h-full w-full flex-col items-center justify-center">
155+
<CareIcon
156+
icon="l-file"
157+
className="mb-4 text-5xl text-gray-600"
158+
/>
159+
Can't preview this file. Try downloading it.
160+
</div>
140161
)}
141162
</div>
142163
</div>

src/Components/Facility/ConsultationForm.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as Notification from "../../Utils/Notifications.js";
22

3-
import { BedModel, ConsentRecord, FacilityModel } from "./models";
3+
import { BedModel, FacilityModel } from "./models";
44
import {
55
CONSULTATION_SUGGESTION,
66
DISCHARGE_REASONS,
@@ -119,7 +119,6 @@ type FormDetails = {
119119
death_confirmed_doctor: string;
120120
InvestigationAdvice: InvestigationType[];
121121
procedures: ProcedureType[];
122-
consent_records: ConsentRecord[];
123122
};
124123

125124
const initForm: FormDetails = {
@@ -170,7 +169,6 @@ const initForm: FormDetails = {
170169
death_confirmed_doctor: "",
171170
InvestigationAdvice: [],
172171
procedures: [],
173-
consent_records: [],
174172
};
175173

176174
const initError = Object.assign(

src/Components/Facility/models.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,18 @@ export interface OptionsType {
9999

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

102-
export type ConsentRecord = {
102+
export interface PatientConsentModel {
103103
id: string;
104104
type: (typeof CONSENT_TYPE_CHOICES)[number]["id"];
105-
patient_code_status?: (typeof CONSENT_PATIENT_CODE_STATUS_CHOICES)[number]["id"];
106-
deleted?: boolean;
107-
};
105+
patient_code_status:
106+
| (typeof CONSENT_PATIENT_CODE_STATUS_CHOICES)[number]["id"]
107+
| null;
108+
archived: boolean;
109+
archived_by?: UserBareMinimum;
110+
archived_date: string;
111+
created_date: string;
112+
created_by: UserBareMinimum;
113+
}
108114

109115
export interface ConsultationModel {
110116
encounter_date: string;
@@ -174,7 +180,6 @@ export interface ConsultationModel {
174180
is_readmission?: boolean;
175181
medico_legal_case?: boolean;
176182
investigation?: InvestigationType[];
177-
consent_records?: ConsentRecord[];
178183
}
179184

180185
export interface PatientStatsModel {

0 commit comments

Comments
 (0)