张田田 10 месяцев назад
Родитель
Сommit
b2d2373d31

+ 67 - 73
src/pages/index/care/issueService.vue

@@ -137,9 +137,9 @@ const patientHealthRecords = ref<HealthReportVO[]>([]);
 async function loadHealthRecords(patientId?: string) {
   try {
     const { data } = await getPatientHealthRecordsMethod(1, 100, { patientId: patientId ?? currentPatient.value?.patientId! });
-    patientHealthRecords.value = data
+    patientHealthRecords.value = data;
   } catch (err) {
-    patientHealthRecords.value = []
+    patientHealthRecords.value = [];
   }
 }
 const patientRecord = ref<PatientRecord[]>([]);
@@ -204,7 +204,6 @@ onMounted(async () => {
   }
   // 获取省份
   await loadProvinces();
-
 });
 // 患者标签
 const patientTags = ref<PatientTagVO[]>([]);
@@ -229,7 +228,6 @@ async function selectPatient(item: any) {
   // 清空服务包选择
   selectedPackage.value = '';
   currentSelectedPackage.value = null;
- 
 }
 
 // 打开调养记录
@@ -347,10 +345,9 @@ const totalPrice = computed(() => {
 });
 function onSelectProject({ row }: any) {
   if ((formData.items ?? []).some((item) => item.conditioningProgramDetail?.name === row.name)) {
-    message.warning('不能重复添加该项目');
+    notification.warning({ message: '不能重复添加该项目' });
     return;
   }
-
   // 添加新行到主表格
   if (!formData.items) formData.items = [];
   formData.items.push({
@@ -364,25 +361,8 @@ function onSelectProject({ row }: any) {
     totalMeasure: '',
     totalPrice: '',
     initialDay: '',
-    cwcpAcuMeridians: [
-      {
-        id: 0,
-        name: '',
-        code: '',
-        type: '',
-        photo: '',
-      },
-    ],
-    cwcpAcuPoints: [
-      {
-        id: 0,
-        name: '',
-        code: '',
-        type: '',
-        merName: '',
-        photo: '',
-      },
-    ],
+    cwcpAcuMeridians: [],
+    cwcpAcuPoints: [],
     conditioningProgramDetail: {
       ...row,
       id: row.id || '',
@@ -405,6 +385,7 @@ function onSelectProject({ row }: any) {
     },
     remark: '',
   });
+  console.log(formData.items, '添加项目之后');
   // 关闭弹窗
   showProjectPopover.value = false;
   // 清空搜索
@@ -472,26 +453,26 @@ function detailPreview(row) {
   }
 }
 function editPart(row) {
-    VxeUI.modal.open({
-      title: `编辑部位`,
-      height: 700,
-      width: 750,
-      escClosable: true,
-      destroyOnClose: true,
-      id: `edit-part-modal`,
-      remember: true,
-      storage: true,
-      slots: {
-        default() {
-          return h(AcupointEdit, <any>{
-            data: row,
-            onSubmit(data: any) {
-              VxeUI.modal.close(`edit-part-modal`);
-            },
-          });
-        },
+  VxeUI.modal.open({
+    title: `编辑部位`,
+    height: 700,
+    width: 750,
+    escClosable: true,
+    destroyOnClose: true,
+    id: `edit-part-modal`,
+    remember: true,
+    storage: true,
+    slots: {
+      default() {
+        return h(AcupointEdit, <any>{
+          data: row,
+          onSubmit(data: any) {
+            VxeUI.modal.close(`edit-part-modal`);
+          },
+        });
       },
-    });
+    },
+  });
 }
 const allProjects = ref<
   Array<{
@@ -526,7 +507,7 @@ function calculateCount(row: any) {
   const frequency = Number(row.frequencyMeasure) || 0;
   const maxCount = row.conditioningProgramDetail.cpDynamicPricingRule?.[1]?.max;
   const acCount = (row.acuMeridianNames?.length ?? 0) + (row.acuPointNames?.length ?? 0);
-  // console.log(row, 'calculateCount',pricingType);
+  console.log(row, '添加计算数量的函数', pricingType, row.conditioningProgramDetail.pricingType);
   // 一口价
   if (pricingType === '0') {
     // 检查是否选择了"不限"
@@ -546,13 +527,19 @@ function calculateCount(row: any) {
     // 按穴位计价
     const frequencyType = Number(row.frequencyType) || 0;
     row.totalMeasure = Math.ceil((period / frequencyType) * frequency);
+    console.log(row.totalMeasure, 'row.totalMeasure', acCount, maxCount);
     if (acCount > maxCount) {
       if (row.conditioningProgramDetail.cpDynamicPricingRule?.[1]?.priceType === 0) {
         // 单价
-        let unitPrice: number = row.conditioningProgramDetail.cpDynamicPricingRule[1].price*acCount;
-        row.unitPrice = unitPrice;
-        // row.totalMeasure = Math.ceil((period / frequencyType) * frequency);
-        row.totalPrice = Math.ceil((period / frequencyType) * frequency * unitPrice);
+        if (acCount > 0) {
+          let unitPrice: number = row.conditioningProgramDetail.cpDynamicPricingRule[1].price * acCount;
+          row.unitPrice = unitPrice;
+          // row.totalMeasure = Math.ceil((period / frequencyType) * frequency);
+          row.totalPrice = Math.ceil((period / frequencyType) * frequency * unitPrice);
+        } else {
+          row.unitPrice = '-';
+          row.totalPrice = 0;
+        }
       } else if (row.conditioningProgramDetail.cpDynamicPricingRule?.[1]?.priceType === 1) {
         // 一口价
         row.unitPrice = '-';
@@ -560,14 +547,19 @@ function calculateCount(row: any) {
         // row.totalMeasure = Math.ceil((period / frequencyType) * frequency);
       }
     } else {
-      // console.log("数量很少",row.conditioningProgramDetail.cpDynamicPricingRule?.[0]?.priceType)
+      console.log('数量很少', row.conditioningProgramDetail.cpDynamicPricingRule?.[0]);
       if (row.conditioningProgramDetail.cpDynamicPricingRule?.length > 0) {
         if (row.conditioningProgramDetail.cpDynamicPricingRule?.[0]?.priceType === 0) {
           // 单价
-          let unitPrice: number = row.conditioningProgramDetail.cpDynamicPricingRule[0].price*acCount;
-          row.unitPrice = unitPrice;
-          // row.totalMeasure = Math.ceil((period / frequencyType) * frequency);
-          row.totalPrice = Math.ceil((period / frequencyType) * frequency * unitPrice );
+          if (acCount > 0) {
+            let unitPrice: number = row.conditioningProgramDetail.cpDynamicPricingRule[0].price * acCount;
+            row.unitPrice = unitPrice;
+            // row.totalMeasure = Math.ceil((period / frequencyType) * frequency);
+            row.totalPrice = Math.ceil((period / frequencyType) * frequency * unitPrice);
+          } else {
+            row.unitPrice = '-';
+            row.totalPrice = 0;
+          }
           // console.log("数量很少",row.totalPrice,'row.unitPrice',row.unitPrice,'period',period,'frequencyType',frequencyType,'acCount',acCount)
         } else if (row.conditioningProgramDetail.cpDynamicPricingRule?.[0]?.priceType === 1) {
           // 一口价
@@ -612,7 +604,6 @@ async function selectCw(item: any) {
   form.conditioningWrapName = item.name;
   form.conditioningWrapId = item.id;
   form.phone = item.phone;
- 
 }
 function handleCancel() {
   console.log('取消');
@@ -621,11 +612,14 @@ function handleCancel() {
 watch(
   () => formData.items,
   (newData) => {
+    console.log(newData, 'newData');
     if (!newData) return;
     newData.forEach((row) => {
-      if (row?.days || row?.frequencyType || row?.frequencyMeasure) {
-        calculateCount(row);
-      }
+      console.log(row, '数据更新');
+      calculateCount(row);
+      // if (row?.days || row?.frequencyType || row?.frequencyMeasure) {
+      //   calculateCount(row);
+      // }
     });
   },
   { deep: true }
@@ -843,7 +837,9 @@ function openPatientTagEdit(event: MouseEvent) {
           id: currentPatient.value?.patientId!,
           tags: patientTags.value,
           onDestroy(values?: PatientTagVO[]) {
-            if (values) { patientTags.value = values; }
+            if (values) {
+              patientTags.value = values;
+            }
             VxeUI.modal.close(id);
           },
         });
@@ -853,9 +849,9 @@ function openPatientTagEdit(event: MouseEvent) {
 }
 
 function openHistoryPreviewHandle() {
-  const data = currentPatient.value
-  const patient = { id: data?.patientId }
-  const report = { id: data?.healthAnalysisReportId }
+  const data = currentPatient.value;
+  const patient = { id: data?.patientId };
+  const report = { id: data?.healthAnalysisReportId };
 
   const component = defineAsyncComponent(() => import('@/components/PatientHealthRecordPreview.vue'));
   const id = `drawer:report-history:preview`;
@@ -876,9 +872,7 @@ function openHistoryPreviewHandle() {
           patient,
           report,
           onDestroy,
-          onRefresh() {
-
-          },
+          onRefresh() {},
         });
       },
     },
@@ -903,7 +897,7 @@ function openPatientHealthRecord(row: { id: string }, showType: 'analysis' | 'sc
     width: window.innerWidth - 256,
     escClosable: true,
     maskClosable: true,
-    title: {analysis: `健康分析报告`, scheme: `调理方案`}[showType],
+    title: { analysis: `健康分析报告`, scheme: `调理方案` }[showType],
     slots: {
       default() {
         return h(component, {
@@ -1036,7 +1030,7 @@ function openPatientHealthRecord(row: { id: string }, showType: 'analysis' | 'sc
                     <a-input v-model:value="row.frequencyType" style="width: 50px" @change="() => calculateCount(row)" :disabled="row.frequencyType === '不限'" />
                     <span>天</span>
                     <a-input v-model:value="row.frequencyMeasure" style="width: 50px" @change="() => calculateCount(row)" :disabled="row.frequencyType === '不限'" />
-                      <span>{{ row.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit ? row.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit : '次' }}</span>
+                    <span>{{ row.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit ? row.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit : '次' }}</span>
                   </div>
                   <div>
                     <a-checkbox-group
@@ -1058,7 +1052,7 @@ function openPatientHealthRecord(row: { id: string }, showType: 'analysis' | 'sc
                   <a-input v-model:value="row.frequencyType" style="width: 50px" @change="() => calculateCount(row)" />
                   <span>天</span>
                   <a-input v-model:value="row.frequencyMeasure" style="width: 50px" @change="() => calculateCount(row)" />
-                    <span>{{ row.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit ? row.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit : '次' }}</span>
+                  <span>{{ row.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit ? row.conditioningProgramDetail?.cpFixedPricingRule?.convertUnit : '次' }}</span>
                 </div>
               </template>
             </vxe-column>
@@ -1195,8 +1189,8 @@ function openPatientHealthRecord(row: { id: string }, showType: 'analysis' | 'sc
     </div>
     <!-- 右侧调养记录 -->
     <div class="right-panel flex flex-col overflow-hidden">
-      <section style="flex: 0 0 auto; max-height: 270px; overflow-y: auto;">
-        <div style="margin-top: -6px; padding-right: 8px;">
+      <section style="flex: 0 0 auto; max-height: 270px; overflow-y: auto">
+        <div style="margin-top: -6px; padding-right: 8px">
           <label>标签:</label>
           <a-tag v-for="tag in patientTags" :key="tag.id" :color="tag.color">{{ tag.name }}</a-tag>
           <a-button type="link" @click="openPatientTagEdit($event)">
@@ -1206,11 +1200,11 @@ function openPatientHealthRecord(row: { id: string }, showType: 'analysis' | 'sc
           </a-button>
         </div>
       </section>
-      <section style="margin: 8px;">
+      <section style="margin: 8px">
         <a-button type="primary" block @click="openHistoryPreviewHandle()">健康档案</a-button>
       </section>
       <div class="record-title">报告记录</div>
-      <section class="overflow-auto" style="flex: 4 4 auto; min-height: 240px;">
+      <section class="overflow-auto" style="flex: 4 4 auto; min-height: 240px">
         <div class="record-list">
           <div class="record-item flex justify-between" v-for="item in patientHealthRecords" :key="item.id" @click="openPatientHealthRecord(item, 'analysis')">
             {{ item.date }}
@@ -1220,7 +1214,7 @@ function openPatientHealthRecord(row: { id: string }, showType: 'analysis' | 'sc
         </div>
       </section>
       <div class="record-title">调养记录</div>
-      <section class="overflow-auto" style="flex: 4 4 auto; min-height: 240px;">
+      <section class="overflow-auto" style="flex: 4 4 auto; min-height: 240px">
         <div class="record-list">
           <div class="record-item" v-for="item in patientRecord" :key="item.id" @click="openRecord(item)">{{ item.estimatedStartDate }}~{{ item.estimatedEndDate }}</div>
           <div v-if="!patientRecord.length" style="padding-bottom: 8px; text-align: center; margin-top: 40px">暂无数据</div>

+ 8 - 0
src/request/api/care.api.ts

@@ -288,6 +288,14 @@ export function getConditioningRecordDetailMethod(data: Partial<SystemCwModel>)
     });
   }
 }
+// 获取的返回的机构服务包内容
+export function getCopyCwMethod(data: Partial<SystemCwModel>) {
+  return request.Post(`/fdhb-pc/conditioningManage/wrap/copyCw/${data.id}/${data.institutionId}`, {
+    name: 'get-copy-cw',
+    cacheFor: null,
+  });
+}
+
 // 获取患者列表
 export function getPatientListMethod( query?: Record<string, any>) {
   return request.Post<List<SystemCwModel>>('/fdhb-pc/patientCrManage/todayPcrs', query ?? {}, {

+ 4 - 4
src/service/AcupointEdit.vue

@@ -5,7 +5,7 @@ import { VxeUI } from 'vxe-pc-ui';
 import { MinusCircleOutlined } from '@ant-design/icons-vue';
 import { pageAcupointMethod, pageMeridianMethod } from '@/request/api/care.api';
 import RemoteSelect from '@/libs/v-select-page/RemoteSelect.vue';
-import type { SystemCwModel } from '@/model/system.model';
+import type { SystemCwModel } from '@/model/care.model';
 const props = defineProps<{
   data: SystemCwModel;
 }>();
@@ -100,11 +100,11 @@ function save() {
   VxeUI.modal.close(`edit-part-modal`);
 }
 onMounted(() => {
-  // console.log(props.data, 'data-onmounted');
-  if (props.data.cwcpAcuPoints) {
+  console.log(props.data.cwcpAcuPoints, 'data-onmounted');
+  if (props.data.cwcpAcuPoints && props.data.cwcpAcuPoints.length > 0 && props.data.cwcpAcuPoints[0].name) {
     acupointList.value = [...props.data.cwcpAcuPoints];
   }
-  if (props.data.cwcpAcuMeridians) {
+  if (props.data.cwcpAcuMeridians && props.data.cwcpAcuMeridians.length > 0 && props.data.cwcpAcuMeridians[0].name) {
     meridianList.value = [...props.data.cwcpAcuMeridians];
   }
 });

+ 25 - 15
src/service/EditSystemService.vue

@@ -227,19 +227,19 @@ function onSelectProject({ row }: any) {
   }
   // 添加新行到主表格
   if (!formData.items) formData.items = [];
-  if (row.cpDynamicPricingRule[0]?.priceType === 0) {
-    // 单价
-    let unitPrice: number = row.cpDynamicPricingRule[0].price;
-    row.unitPrice = unitPrice;
-  } else if (row.cpDynamicPricingRule[0]?.priceType === 1) {
-    // 一口价
-    row.unitPrice = '-';
-  }
+  // if (row.cpDynamicPricingRule[0]?.priceType === 0) {
+  //   // 单价
+  //   let unitPrice: number = row.cpDynamicPricingRule[0].price;
+  //   row.unitPrice = unitPrice;
+  // } else if (row.cpDynamicPricingRule[0]?.priceType === 1) {
+  //   // 一口价
+  //   row.unitPrice = '-';
+  // }
   formData.items.push({
     id: '',
     conditioningWrapId: '',
     conditioningProgramId: row.id,
-    unitPrice: row.unitPrice,
+    unitPrice: '-',
     days: '',
     frequencyType: '',
     frequencyMeasure: '',
@@ -388,9 +388,14 @@ function calculateCount(row: any) {
     if (acCount > maxCount) {
       if (row.conditioningProgramDetail.cpDynamicPricingRule?.[1]?.priceType === 0) {
         // 单价
-        let unitPrice: number = row.conditioningProgramDetail.cpDynamicPricingRule[1].price * acCount;
-        row.unitPrice = unitPrice;
-        row.totalPrice = Math.ceil((period / frequencyType) * frequency * unitPrice);
+        if(acCount > 0){
+          let unitPrice: number = row.conditioningProgramDetail.cpDynamicPricingRule[1].price * acCount;
+          row.unitPrice = unitPrice;
+          row.totalPrice = Math.ceil((period / frequencyType) * frequency * unitPrice);
+        }else{
+          row.unitPrice = '-';
+          row.totalPrice = 0;
+        }
       } else if (row.conditioningProgramDetail.cpDynamicPricingRule?.[1]?.priceType === 1) {
         // 一口价
         row.unitPrice = '-';
@@ -400,9 +405,14 @@ function calculateCount(row: any) {
       if (row.conditioningProgramDetail.cpDynamicPricingRule?.length > 0) {
         if (row.conditioningProgramDetail.cpDynamicPricingRule?.[0]?.priceType === 0) {
           // 单价
-          let unitPrice: number = row.conditioningProgramDetail.cpDynamicPricingRule[0].price * acCount;
-          row.unitPrice = unitPrice;
-          row.totalPrice = Math.ceil((period / frequencyType) * frequency * unitPrice);
+          if(acCount > 0){
+            let unitPrice: number = row.conditioningProgramDetail.cpDynamicPricingRule[0].price * acCount;
+            row.unitPrice = unitPrice;
+            row.totalPrice = Math.ceil((period / frequencyType) * frequency * unitPrice);
+          }else{
+            row.unitPrice = '-';
+            row.totalPrice = 0;
+          }
         } else if (row.conditioningProgramDetail.cpDynamicPricingRule?.[0]?.priceType === 1) {
           // 一口价
           row.unitPrice = '-';

+ 8 - 4
src/service/IntroduceProjectList.vue

@@ -2,11 +2,11 @@
 import { ref } from 'vue';
 import type { SystemItemModel, SystemCwModel } from '@/model/care.model';
 import { VxeUI } from 'vxe-pc-ui';
-import { getConditioningRecordDetailMethod } from '@/request/api/care.api';
+import { getCopyCwMethod } from '@/request/api/care.api';
 const tableData = ref<SystemItemModel[]>([]);
 
 type FollowModel = Partial<SystemCwModel>;
-const props = defineProps<{ data: FollowModel; id: number | string }>();
+const props = defineProps<{ data: FollowModel; id: number | string,institutionId:number | string}>();
 
 // 引入已有项目
 async function handleAdd(row: any) {
@@ -22,10 +22,14 @@ function handleCancel() {
 const dataObj = reactive({
   types: 'institution',
   id: props.id,
+  institutionId: props.institutionId,
 });
+
 onMounted(async () => {
-  const res: any = await getConditioningRecordDetailMethod(dataObj);
-  tableData.value = res.items;
+  const res: any = await getCopyCwMethod(dataObj);
+  if(res && res.items && res.items.length > 0){
+    tableData.value = res.items;
+  }
 });
 const checked = ref(true);
 </script>

+ 33 - 14
src/service/ServicePackageList.vue

@@ -1,8 +1,8 @@
 <script lang="ts" setup>
-import { ref, reactive } from 'vue';
+import { ref } from 'vue';
 import { VxeUI } from 'vxe-pc-ui';
 import IntroduceProjectList from '@/service/IntroduceProjectList.vue';
-import { getSystemCpListMethod, getConditioningRecordDetailMethod } from '@/request/api/care.api';
+import { getSystemCpListMethod,getCopyCwMethod } from '@/request/api/care.api';
 import { usePagination } from 'alova/client';
 import type { SystemCwModel } from '@/model/care.model';
 type FollowModel = Partial<SystemCwModel>;
@@ -18,37 +18,55 @@ const { loading, page, pageSize, total, onSuccess, replace, refresh, remove } =
 onSuccess(({ data: { data } }) => {
   tableData.value = data;
   loading.value = false;
-  console.log(tableData.value, 'tableData');
 });
 const id = ref<string>('');
+const institutionId = ref<string>('');
 async function handleSelect(model?: SystemCwModel) {
-  console.log(model, '选择引入');
   if (model?.id) {
     id.value = model.id;
+    institutionId.value = model.institutionId;
     try {
       const params = {
         types: 'institution',
         id: model.id,
+        institutionId: model.institutionId,
       };
-      const res: any = await getConditioningRecordDetailMethod(params);
+      const res: any = await getCopyCwMethod(params);
       if (res && res.items && res.items.length > 0) {
         res.items.forEach((item: any) => {
           delete item.conditioningProgramDetail.id;
         });
         props.data.items = [...res.items];
+        props.data.items?.forEach((row: any) => {
+          row.frequencyTypeing = row.frequencyType ? [row.frequencyType] : [];
+        });
+      }
+     
+      // 确保 conditioningWrapPatientMatchRule 存在
+      if (!props.data.conditioningWrapPatientMatchRule) {
+        props.data.conditioningWrapPatientMatchRule = {
+          sex: '',
+          age: '',
+          diagnoseDiseaseNames: [],
+          diagnoseSyndromeNames: [],
+          constitutionGroupNames: [],
+          willillStateNames: [],
+        };
       }
-      props.data.items?.forEach((row: any) => {
-        row.frequencyTypeing = row.frequencyType ? [row.frequencyType] : [];
-      });
+
       props.data.cwPatientMatchRules = model.cwPatientMatchRules;
       props.data.price = model.price;
       props.data.name = model.name;
-      props.data.conditioningWrapPatientMatchRule.diagnoseDiseaseNames = model.conditioningWrapPatientMatchRule.diagnoseDiseaseNames;
-      props.data.conditioningWrapPatientMatchRule.diagnoseSyndromeNames = model.conditioningWrapPatientMatchRule.diagnoseSyndromeNames;
-      props.data.conditioningWrapPatientMatchRule.constitutionGroupNames = model.conditioningWrapPatientMatchRule.constitutionGroupNames; 
-      props.data.conditioningWrapPatientMatchRule.sex = model.conditioningWrapPatientMatchRule.sex;
-      props.data.conditioningWrapPatientMatchRule.age = model.conditioningWrapPatientMatchRule.age;
-      props.data.conditioningWrapPatientMatchRule.willillStateNames = model.conditioningWrapPatientMatchRule.willillStateNames;
+      
+      // 安全地访问 conditioningWrapPatientMatchRule 属性
+      if (model.conditioningWrapPatientMatchRule) {
+        props.data.conditioningWrapPatientMatchRule.diagnoseDiseaseNames = model.conditioningWrapPatientMatchRule.diagnoseDiseaseNames || [];
+        props.data.conditioningWrapPatientMatchRule.diagnoseSyndromeNames = model.conditioningWrapPatientMatchRule.diagnoseSyndromeNames || [];
+        props.data.conditioningWrapPatientMatchRule.constitutionGroupNames = model.conditioningWrapPatientMatchRule.constitutionGroupNames || [];
+        props.data.conditioningWrapPatientMatchRule.sex = model.conditioningWrapPatientMatchRule.sex || '';
+        props.data.conditioningWrapPatientMatchRule.age = model.conditioningWrapPatientMatchRule.age || '';
+        props.data.conditioningWrapPatientMatchRule.willillStateNames = model.conditioningWrapPatientMatchRule.willillStateNames || [];
+      }
     } catch (err) {
       console.error('Error fetching data:', err);
     }
@@ -68,6 +86,7 @@ async function handleSelect(model?: SystemCwModel) {
         return h(IntroduceProjectList, {
           data: { ...props.data },
           id: id.value,
+          institutionId: institutionId.value,
           onSubmit() {
             VxeUI.modal.close(`introduceProjectList-modal`);
           },