Эх сурвалжийг харах

患者管理列表增加来源机构,按来源机构展示患者数据

张田田 5 сар өмнө
parent
commit
966cfcf661

+ 8 - 0
src/components/PatientHealthRecordPreview.vue

@@ -15,6 +15,9 @@ import HealthReportAnalysisWidget from '@/widgets/HealthReportAnalysisWidget.vue
 const props = defineProps<{
   patient: Partial<PatientModel>;
   report: Partial<ReportModel>;
+  source?: string;
+  sourceInsName?: string;
+
 }>();
 
 const emits = defineEmits<{
@@ -185,6 +188,11 @@ function openIndicatorRecordsPreview() {
   <div class="p-6">
     <div class="flex">
       <section class="flex-auto">
+        <div class="row mb-5s" v-if="source || sourceInsName"> 
+         <span class="text-lg mr-20">来源</span>
+          <span class="text-lg mr-10" v-if="source">渠道:{{ source }}</span>
+          <span class="text-lg" v-if="sourceInsName">机构:{{ sourceInsName }}</span>
+        </div>
         <header class="flex items-center">
           <div class="title">基本信息</div>
           <a-button type="link" @click="openPatientRecordsPreview">更新记录</a-button>

+ 7 - 0
src/model/patient.model.ts

@@ -8,6 +8,10 @@ export interface PatientQuery {
   cardno?: string;
   isHaveHealthAnalysisReport?: boolean;
   tags?: string[];
+  source?: string;
+  sourceInsId?: number;
+  sourceInsName?: string;
+  pcrCount?: number;
 
   count?: number;
 }
@@ -43,6 +47,9 @@ export interface EditPatientModel {
 export interface PatientReportModel extends PatientModel {
   uid: string;
   report: ReportModel;
+  source?: string;
+  sourceInsName?: string;
+  sourceInsId?: number;
 }
 
 export interface PatientRecordModel extends PatientModel {

+ 97 - 5
src/pages/index/patient/history.vue

@@ -1,14 +1,14 @@
 <script setup lang="ts">
 import { h } from 'vue';
-import { notification } from 'ant-design-vue';
+import { notification, Row } from 'ant-design-vue';
 import { usePagination, useRequest } from 'alova/client';
 import { patientsHistoryMethod, patientsHistoryPullMethod, searchTagsFromSelectableMethod, carePatientMethod, patientMethod } from '@/request/api/patient.api';
 import type { PatientQuery, PatientReportModel, PatientTagVO } from '@/model';
 import { list2Groups } from '@/tools/data';
-
+import { branchMethod } from '@/request/api/system.api';
 import { VxeButton, type VxeFormListeners, type VxeFormProps, VxeUI } from 'vxe-pc-ui';
 import type { VxeGridInstance, VxeGridListeners, VxeGridProps } from 'vxe-table';
-
+import { getDictionaryMethod } from '@/request/api/dictionary.api';
 import { usePermission } from '@/core/usePermission';
 import ReportAnalysisCountEdit from '@/components/ReportAnalysisCountEdit.vue';
 import PatientEdit from '@/components/PatientEdit.vue';
@@ -17,7 +17,7 @@ import PatientTagEdit from '@/components/PatientTagEdit.vue';
 import PatientHealthRecordPreview from '@/components/PatientHealthRecordPreview.vue';
 import router from '@/router';
 import { editRoleMethod } from '@/request/api/system.api';
-
+const { data: branch, loading: branchLoading } = useRequest(branchMethod);
 const { data: selectable, loading: tagsLoading } = useRequest(searchTagsFromSelectableMethod, { initialData: [] });
 
 const model = shallowRef<PatientQuery>();
@@ -69,7 +69,54 @@ const searchFormProps = reactive<VxeFormProps<PatientQuery>>({
       },
     },
     {
+      field: 'source',
+      title: '来源渠道',
       span: 6,
+      itemRender: {
+        name: 'VxeSelect',
+        props: {
+          loading: tagsLoading,
+          placeholder: '请选择',
+          options: computed(() => sourceOptions.value),
+          optionProps: { value: 'value', label: 'label' },
+          clearable: true,
+          filterable: true,
+        },
+      },
+    },
+    {
+      field: 'sourceInsId',
+      title: '来源机构',
+      span: 6,
+      itemRender: {
+        name: 'VxeTreeSelect',
+        props: {
+          loading: computed(() => branchLoading.value),
+          options: computed(() => branch.value),
+          optionProps: { value: 'id' },
+          clearable: true,
+        },
+      },
+    },
+    {
+      field: 'pcrCount',
+      title: '调养次数',
+      span: 5,
+      itemRender: {
+        name: 'VxeNumberInput',
+        props: {
+          placeholder: '请输入',
+          min: 1,
+          controls: false,
+          precision: 0,
+          step: 1,
+          max: 999,
+        },
+      },
+    },
+    {
+      align: 'right',
+      span: 24,
       itemRender: {
         name: 'VxeButtonGroup',
         options: [
@@ -88,6 +135,32 @@ const searchFormEmits: VxeFormListeners<PatientQuery> = {
     model.value = { ...data };
   },
 };
+const sourceOptions = ref<any[]>([
+  // { label: '小程序', value: 'miniProgram' },
+  // { label: 'H5', value: 'h5' },
+  // { label: 'APP', value: 'app' },
+  // { label: '其他', value: 'other' },
+]);
+const sourceOptionsLoading = ref(false);
+// 获取来源渠道
+async function getSourceTypeOptions() {
+  sourceOptionsLoading.value = true;
+  try {
+    const res = await getDictionaryMethod('patient_source_type');
+    console.log(res, 'getSourceTypeOptions');
+    if (res?.length > 0) {
+      sourceOptions.value = res; // 直接使用返回的数据
+      sourceOptionsLoading.value = false;
+    }
+  } catch (error: any) {
+    notification.error({
+      message: error?.message ?? '获取来源渠道失败',
+    });
+    sourceOptionsLoading.value = false;
+  } finally {
+    sourceOptionsLoading.value = false;
+  }
+}
 
 const gridRef = ref<VxeGridInstance<PatientReportModel>>();
 const gridOptions = reactive<VxeGridProps<PatientReportModel>>({
@@ -118,8 +191,11 @@ const gridOptions = reactive<VxeGridProps<PatientReportModel>>({
     { field: 'phone', title: '手机号码', minWidth: 80 },
     { field: 'gender', title: '性别', minWidth: 40, formatter: 'gender' },
     { field: 'age', title: '年龄', minWidth: 40, formatter: ({ cellValue }) => (cellValue ? `${cellValue}岁` : '') },
+    { field: 'pcrCount', title: '调养次数', minWidth: 20 },
     { field: 'diagnosis', title: '诊断', minWidth: 40 },
     { field: 'tags', title: '标签' },
+    { field: 'source', title: '来源渠道', minWidth: 40 },
+    { field: 'sourceInsName', title: '来源机构', minWidth: 40 },
     { field: 'createTime', title: '创建时间' },
     {
       field: 'action',
@@ -174,16 +250,30 @@ onSuccess(({ data: { data } }) => {
   gridRef.value?.loadData(data);
 });
 
+// 获取来源机构
+// const insLoading = ref(false);
+// const insArr = ref<any[]>([]);
+// async function getInstitutionList(orgId: number) {
+//   insLoading.value = true;
+//   const res = await branchMethod(1, 0, orgId);
+//   if (res && res.length > 0) {
+//     insArr.value = res;
+//   }
+//   insLoading.value = false;
+// }
 onMounted(() => {
   model.value = toRaw(searchFormProps.data);
+  // getInstitutionList(1);
+  getSourceTypeOptions();
 });
 
-function openHistoryPreviewHandle({ report, ...patient }: PatientReportModel, index?: number) {
+function openHistoryPreviewHandle({ report, source, sourceInsName, ...patient }: PatientReportModel, index?: number) {
   const id = `drawer:report-history:preview`;
   const onDestroy = () => {
     VxeUI.drawer.close(id);
   };
   onDestroy();
+  console.log(patient, source, sourceInsName, 'patient=======');
   VxeUI.drawer.open({
     id,
     title: `健康档案`,
@@ -196,6 +286,8 @@ function openHistoryPreviewHandle({ report, ...patient }: PatientReportModel, in
         return h(PatientHealthRecordPreview, {
           patient,
           report,
+          source,
+          sourceInsName,
           onDestroy,
           onRefresh() {
             refresh(page.value);