From cb0d73acf47d449219aa75c50776e869ca37b1f5 Mon Sep 17 00:00:00 2001 From: Abizrh Date: Mon, 20 Oct 2025 17:33:05 +0700 Subject: [PATCH 1/5] =?UTF-8?q?=E2=9C=A8=20feat=20(soapi):=20integrate=20e?= =?UTF-8?q?arly,rehab,function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/app/employee/entry-form.vue | 18 +- app/components/app/soapi/early-entry.vue | 201 ++++++++++--- .../app/soapi/early-rehab-entry.vue | 256 ++++++++++++++--- app/components/app/soapi/entry.vue | 33 ++- app/components/app/soapi/function-entry.vue | 270 ++++++++++++++---- app/components/content/encounter/list.vue | 14 +- app/components/content/encounter/process.vue | 5 +- app/components/content/soapi/entry.vue | 2 +- .../content/soapi/form-function.vue | 68 ++++- app/components/content/soapi/form-rehab.vue | 73 ++++- app/components/content/soapi/form.vue | 55 +++- app/handlers/soapi-early.handler.ts | 24 ++ app/models/soapi.ts | 174 ++++++++++- app/schemas/soapi.schema.ts | 190 ++++++++++++ app/services/soapi-early.service.ts | 28 ++ 15 files changed, 1252 insertions(+), 159 deletions(-) create mode 100644 app/handlers/soapi-early.handler.ts create mode 100644 app/schemas/soapi.schema.ts create mode 100644 app/services/soapi-early.service.ts diff --git a/app/components/app/employee/entry-form.vue b/app/components/app/employee/entry-form.vue index 8ccf0916..006f8eff 100644 --- a/app/components/app/employee/entry-form.vue +++ b/app/components/app/employee/entry-form.vue @@ -27,19 +27,31 @@ const data = computed({ - - - diff --git a/app/components/app/soapi/early-entry.vue b/app/components/app/soapi/early-entry.vue index c5697a7a..146a25d4 100644 --- a/app/components/app/soapi/early-entry.vue +++ b/app/components/app/soapi/early-entry.vue @@ -4,29 +4,72 @@ import Cell from '~/components/pub/my-ui/doc-entry/cell.vue' import Field from '~/components/pub/my-ui/doc-entry/field.vue' import Label from '~/components/pub/my-ui/doc-entry/label.vue' +// Helpers +import type z from 'zod' +import { toTypedSchema } from '@vee-validate/zod' +import { useForm } from 'vee-validate' +import { genBase } from '~/models/_base' + const props = defineProps<{ + modelValue: any + schema: z.ZodSchema excludeFields?: string[] + isReadonly?: boolean }>() -const emits = defineEmits(['click']) +const emit = defineEmits<{ + (e: 'update:modelValue', val: any): void + (e: 'submit', val: any): void +}>() -const subject = ref({ - 'prim-compl': '', - 'sec-compl': '', - 'cur-disea-hist': '', - 'pas-disea-hist': '', - 'fam-disea-hist': '', - 'alg-hist': '', - 'alg-react': '', - 'med-hist': '', - 'blood-type': '', +// Setup form +const { + validate: _validate, + defineField, + handleSubmit, + errors, + values, +} = useForm({ + validationSchema: toTypedSchema(props.schema), + initialValues: props.modelValue, }) +watch(values, (val) => emit('update:modelValue', val), { deep: true }) + +const [primaryComplaint, primaryComplaintAttrs] = defineField('prim-compl') +const [curDiseaseHistory, curDiseaseHistoryAttrs] = defineField('cur-disea-hist') +const [systolic, systolicAttrs] = defineField('syst-bp') +const [diastolic, diastolicAttrs] = defineField('diast-bp') +const [pulse, pulseAttrs] = defineField('pulse') +const [respiratoryRate, respiratoryRateAttrs] = defineField('resp-rate') +const [temperature, temperatureAttrs] = defineField('temp') +const [weight, weightAttrs] = defineField('weight') +const [height, heightAttrs] = defineField('height') +const [bloodGroup, bloodGroupAttrs] = defineField('reflect-fisio') +const [physicalExamination, physicalExaminationAttrs] = defineField('reflect-pato') +const [diagnosisMedical, diagnosisMedicalAttrs] = defineField('autonom-neuron') +const [medicalPlan, medicalPlanAttrs] = defineField('medical-act') +const [therapy, therapyAttrs] = defineField('therapy') + +const validate = async () => { + const result = await _validate() + console.log('Component validate() result:', result) + + return { + valid: true, + data: result.values, + errors: result.errors, + } +} + +defineExpose({ validate }) + const isExcluded = (key: string) => props.excludeFields?.includes(key)