From a64cbc7226ac6c242cd491ee087c6cf1052e3767 Mon Sep 17 00:00:00 2001 From: maniamartial Date: Tue, 9 Jun 2026 10:54:14 +0300 Subject: [PATCH] feat: create ybocs nad ymrs templates defaults --- .../SuicidalPatientAssessmentModal.tsx | 214 +++++----- .../suicidal/SuicidalAssessmentList.tsx | 382 ++++++++++++------ frontend/src/pages/Doctor.tsx | 3 +- frontend/src/services/common.ts | 21 + frontend/src/services/suicidalAssessment.ts | 16 +- healthcare/api/common.py | 30 ++ healthcare/api/suicidal_assessment.py | 50 ++- healthcare/fixtures/gad7_template.json | 1 + healthcare/fixtures/phq9_template.json | 1 + .../fixtures/prescription_frequency.json | 10 + healthcare/fixtures/ybocs_template.json | 113 ++++++ .../suicidal_patient_assessment.json | 19 +- .../ybocs_template/ybocs_template.json | 2 +- .../ymrs_assessment/ymrs_assessment.json | 4 +- healthcare/hooks.py | 6 + .../public/frontend/assets/index-B6CWSqlB.js | 117 ++++++ .../public/frontend/assets/index-BwYnwq9z.css | 1 + .../public/frontend/assets/index-Cc7mdPgF.js | 117 ------ .../public/frontend/assets/index-nMxbIa-c.css | 1 - healthcare/public/frontend/index.html | 4 +- healthcare/www/health_frontend.html | 4 +- 21 files changed, 728 insertions(+), 388 deletions(-) create mode 100644 healthcare/fixtures/ybocs_template.json create mode 100644 healthcare/public/frontend/assets/index-B6CWSqlB.js create mode 100644 healthcare/public/frontend/assets/index-BwYnwq9z.css delete mode 100644 healthcare/public/frontend/assets/index-Cc7mdPgF.js delete mode 100644 healthcare/public/frontend/assets/index-nMxbIa-c.css diff --git a/frontend/src/components/admissions/SuicidalPatientAssessmentModal.tsx b/frontend/src/components/admissions/SuicidalPatientAssessmentModal.tsx index 2b044eac12..5e18a274c4 100644 --- a/frontend/src/components/admissions/SuicidalPatientAssessmentModal.tsx +++ b/frontend/src/components/admissions/SuicidalPatientAssessmentModal.tsx @@ -2,14 +2,26 @@ import { useState, useRef, useCallback, useEffect } from 'react' import { createSuicidalPatientAssessment } from '../../services/suicidalAssessment' -import { - fetchPatientOptions, - fetchInpatientAdmissionOptions, +import { + fetchPatientOptions, + fetchInpatientAdmissionOptions, fetchHealthcarePractitioners, - type LinkFieldOption + fetchIpRiskAnalysisOptions, + getCurrentUserPractitioner, + type LinkFieldOption, } from '../../services/common' import { toast } from '../../hooks/useToast' -import { X, ChevronDown } from 'lucide-react' +import { AlertTriangle, ChevronDown, FileText, Info } from 'lucide-react' +import { + CM_BTN_CANCEL, + CM_BTN_PRIMARY, + CREATE_MODAL_BODY_GRADIENT, + CREATE_MODAL_FOOTER_STICKY, + CREATE_MODAL_OVERLAY, + CreateModalHeader, + createModalShellClass, + createModalTabButtonClass, +} from '../ui/CreateModalChrome' interface SuicidalPatientAssessmentModalProps { admissionNo: string @@ -33,7 +45,7 @@ type SelectYesNoUnknown = '' | 'Yes' | 'No' | 'Unknown' interface FormState { // Basic Info assessment_date: string - assessed_by: string + practitioner: string // Suicidal Thoughts overwhelmed_thoughts_harming: SelectValue overwhelmed_thoughts_explanation: string @@ -111,7 +123,7 @@ const today = new Date().toISOString().split('T')[0] const emptyForm = (): FormState => ({ assessment_date: today, - assessed_by: '', + practitioner: '', overwhelmed_thoughts_harming: '', overwhelmed_thoughts_explanation: '', thoughts_occurrence_frequency: '', @@ -335,7 +347,7 @@ function GeneralTab({ form, setField, currentAdmission, currentPatient, currentPatientName, isLockedContext, - fetchPatientOpts, fetchAdmissionOpts, + fetchPatientOpts, fetchAdmissionOpts, fetchIpRiskOpts, setCurrentAdmission, setCurrentPatient, setCurrentPatientName, }: { form: FormState @@ -346,6 +358,7 @@ function GeneralTab({ isLockedContext: boolean fetchPatientOpts: (s: string) => Promise fetchAdmissionOpts: (s: string) => Promise + fetchIpRiskOpts: (s: string) => Promise setCurrentAdmission: (v: string) => void setCurrentPatient: (v: string) => void setCurrentPatientName: (v: string) => void @@ -410,10 +423,10 @@ function GeneralTab({
setField('assessed_by', opt.name)} - onClear={() => setField('assessed_by', '')} + label="Practitioner" + value={form.practitioner} + onSelect={(opt) => setField('practitioner', opt.name)} + onClear={() => setField('practitioner', '')} fetchOptions={async (search) => { const result = await fetchHealthcarePractitioners(search || undefined) return result @@ -601,10 +614,14 @@ function GeneralTab({

Reference & Additional Notes

-
- - setField('ip_risk_analysis_reference', e.target.value)} className={inputClass} placeholder="Link to IP Risk Analysis..." /> -
+ setField('ip_risk_analysis_reference', opt.name)} + onClear={() => setField('ip_risk_analysis_reference', '')} + fetchOptions={fetchIpRiskOpts} + placeholder="Search IP Risk Analysis..." + />