Bladeren bron

肠内营养

chenying2100 2 maanden geleden
bovenliggende
commit
c3d865e8d4

+ 63 - 0
src/api/patients/nutrition/index.ts

@@ -0,0 +1,63 @@
+import request from '@/utils/request';
+import { AxiosPromise } from 'axios';
+import { NutritionVO, NutritionForm, NutritionQuery } from '@/api/system/nutrition/types';
+
+/**
+ * 查询肠内营养列表
+ * @param query
+ * @returns {*}
+ */
+
+export const listEnteralNutrition = (query?: NutritionQuery): AxiosPromise<NutritionVO[]> => {
+  return request({
+    url: '/system/nutrition/list',
+    method: 'get',
+    params: query
+  });
+};
+
+/**
+ * 查询肠内营养详细
+ * @param id
+ */
+export const getEnteralNutrition = (id: string | number): AxiosPromise<NutritionVO> => {
+  return request({
+    url: '/system/nutrition/' + id,
+    method: 'get'
+  });
+};
+
+/**
+ * 新增肠内营养
+ * @param data
+ */
+export const addEnteralNutrition = (data: NutritionForm) => {
+  return request({
+    url: '/system/nutrition',
+    method: 'post',
+    data: data
+  });
+};
+
+/**
+ * 修改肠内营养
+ * @param data
+ */
+export const updateEnteralNutrition = (data: NutritionForm) => {
+  return request({
+    url: '/system/nutrition',
+    method: 'put',
+    data: data
+  });
+};
+
+/**
+ * 删除肠内营养
+ * @param id
+ */
+export const delEnteralNutrition = (id: string | number | Array<string | number>) => {
+  return request({
+    url: '/system/nutrition/' + id,
+    method: 'delete'
+  });
+};

+ 372 - 0
src/api/patients/nutrition/types.ts

@@ -0,0 +1,372 @@
+export interface EnteralNutritionVO {
+  /**
+   * 主键ID
+   */
+  id: string | number;
+
+  /**
+   * 结算管理id
+   */
+  settlementId: string | number;
+
+  /**
+   * 开方日期
+   */
+  prescriptionDate: string;
+
+  /**
+   * 组号
+   */
+  groupNo: string;
+
+  /**
+   * 营养产品
+   */
+  nutritionProduct: string;
+
+  /**
+   * 停嘱日期
+   */
+  stopDate: string;
+
+  /**
+   * 处方类型
+   */
+  prescriptionType: string;
+
+  /**
+   * 数量
+   */
+  quantity: number;
+
+  /**
+   * 用量/次
+   */
+  dosePerTime: string;
+
+  /**
+   * 餐次时间
+   */
+  mealTime: string;
+
+  /**
+   * 频次
+   */
+  frequency: string;
+
+  /**
+   * 首日
+   */
+  firstDay: string;
+
+  /**
+   * 用量/日
+   */
+  dosePerDay: string;
+
+  /**
+   * 使用天数
+   */
+  usageDays: number;
+
+  /**
+   * 用量/总
+   */
+  totalDose: string;
+
+  /**
+   * 规格
+   */
+  specification: string;
+
+  /**
+   * 用法
+   */
+  usage: string;
+
+  /**
+   * 制剂液量/次
+   */
+  preparationVolumePerTime: string;
+
+  /**
+   * 制剂浓度/次
+   */
+  preparationConcentrationPerTime: string;
+
+  /**
+   * 能量密度/次
+   */
+  energyDensityPerTime: string;
+
+  /**
+   * 处方备注
+   */
+  prescriptionRemark: string;
+
+  /**
+   * 每日热量
+   */
+  dailyCalories: string;
+
+  /**
+   * 金额
+   */
+  amount: number;
+
+  /**
+   * 状态(0正常 1停用)
+   */
+  status: string;
+
+}
+
+export interface EnteralNutritionForm extends BaseEntity {
+  /**
+   * 主键ID
+   */
+  id?: string | number;
+
+  /**
+   * 结算管理id
+   */
+  settlementId?: string | number;
+
+  /**
+   * 开方日期
+   */
+  prescriptionDate?: string;
+
+  /**
+   * 组号
+   */
+  groupNo?: string;
+
+  /**
+   * 营养产品
+   */
+  nutritionProduct?: string;
+  nutritionProductId?: string;
+
+  /**
+   * 停嘱日期
+   */
+  stopDate?: string;
+
+  /**
+   * 处方类型
+   */
+  prescriptionType?: string;
+
+  /**
+   * 数量
+   */
+  quantity?: number;
+
+  /**
+   * 用量/次
+   */
+  dosePerTime?: string|;
+
+  /**
+   * 餐次时间
+   */
+  mealTime?: string;
+
+  /**
+   * 频次
+   */
+  frequency?: number;
+
+  /**
+   * 首日
+   */
+  firstDay?: number;
+
+  /**
+   * 用量/日
+   */
+  dosePerDay?: string;
+
+  /**
+   * 使用天数
+   */
+  usageDays?: number;
+
+  /**
+   * 用量/总
+   */
+  totalDose?: string;
+
+  /**
+   * 规格
+   */
+  specification?: string;
+
+  /**
+   * 用法
+   */
+  usage?: string;
+
+  /**
+   * 制剂液量/次
+   */
+  preparationVolumePerTime?: string;
+
+  /**
+   * 制剂浓度/次
+   */
+  preparationConcentrationPerTime?: string;
+
+  /**
+   * 能量密度/次
+   */
+  energyDensityPerTime?: string;
+
+  /**
+   * 处方备注
+   */
+  prescriptionRemark?: string;
+
+  /**
+   * 每日热量
+   */
+  dailyCalories?: string;
+
+  /**
+   * 金额
+   */
+  amount?: number;
+
+  /**
+   * 状态(0正常 1停用)
+   */
+  status?: string;
+
+}
+
+export interface EnteralNutritionQuery extends PageQuery {
+
+  /**
+   * 结算管理id
+   */
+  settlementId?: string | number;
+
+  /**
+   * 开方日期
+   */
+  prescriptionDate?: string;
+
+  /**
+   * 组号
+   */
+  groupNo?: string;
+
+  /**
+   * 营养产品
+   */
+  nutritionProduct?: string;
+
+  /**
+   * 停嘱日期
+   */
+  stopDate?: string;
+
+  /**
+   * 处方类型
+   */
+  prescriptionType?: string;
+
+  /**
+   * 数量
+   */
+  quantity?: number;
+
+  /**
+   * 用量/次
+   */
+  dosePerTime?: string;
+
+  /**
+   * 餐次时间
+   */
+  mealTime?: string;
+
+  /**
+   * 频次
+   */
+  frequency?: string;
+
+  /**
+   * 首日
+   */
+  firstDay?: string;
+
+  /**
+   * 用量/日
+   */
+  dosePerDay?: string;
+
+  /**
+   * 使用天数
+   */
+  usageDays?: number;
+
+  /**
+   * 用量/总
+   */
+  totalDose?: string;
+
+  /**
+   * 规格
+   */
+  specification?: string;
+
+  /**
+   * 用法
+   */
+  usage?: string;
+
+  /**
+   * 制剂液量/次
+   */
+  preparationVolumePerTime?: string;
+
+  /**
+   * 制剂浓度/次
+   */
+  preparationConcentrationPerTime?: string;
+
+  /**
+   * 能量密度/次
+   */
+  energyDensityPerTime?: string;
+
+  /**
+   * 处方备注
+   */
+  prescriptionRemark?: string;
+
+  /**
+   * 每日热量
+   */
+  dailyCalories?: string;
+
+  /**
+   * 金额
+   */
+  amount?: number;
+
+  /**
+   * 状态(0正常 1停用)
+   */
+  status?: string;
+
+    /**
+     * 日期范围参数
+     */
+    params?: any;
+}
+
+
+

+ 63 - 0
src/api/patients/nutritionConsumable/index.ts

@@ -0,0 +1,63 @@
+import request from '@/utils/request';
+import { AxiosPromise } from 'axios';
+import { NutritionConsumableVO, NutritionConsumableForm, NutritionConsumableQuery } from '@/api/system/nutritionConsumable/types';
+
+/**
+ * 查询肠内营养耗材列表
+ * @param query
+ * @returns {*}
+ */
+
+export const listNutritionConsumable = (query?: NutritionConsumableQuery): AxiosPromise<NutritionConsumableVO[]> => {
+  return request({
+    url: '/system/nutritionConsumable/list',
+    method: 'get',
+    params: query
+  });
+};
+
+/**
+ * 查询肠内营养耗材详细
+ * @param id
+ */
+export const getNutritionConsumable = (id: string | number): AxiosPromise<NutritionConsumableVO> => {
+  return request({
+    url: '/system/nutritionConsumable/' + id,
+    method: 'get'
+  });
+};
+
+/**
+ * 新增肠内营养耗材
+ * @param data
+ */
+export const addNutritionConsumable = (data: NutritionConsumableForm) => {
+  return request({
+    url: '/system/nutritionConsumable',
+    method: 'post',
+    data: data
+  });
+};
+
+/**
+ * 修改肠内营养耗材
+ * @param data
+ */
+export const updateNutritionConsumable = (data: NutritionConsumableForm) => {
+  return request({
+    url: '/system/nutritionConsumable',
+    method: 'put',
+    data: data
+  });
+};
+
+/**
+ * 删除肠内营养耗材
+ * @param id
+ */
+export const delNutritionConsumable = (id: string | number | Array<string | number>) => {
+  return request({
+    url: '/system/nutritionConsumable/' + id,
+    method: 'delete'
+  });
+};

+ 222 - 0
src/api/patients/nutritionConsumable/types.ts

@@ -0,0 +1,222 @@
+export interface NutritionConsumableVO {
+  /**
+   * 主键ID
+   */
+  id: string | number;
+
+  /**
+   * 结算管理id
+   */
+  settlementId: string | number;
+
+  /**
+   * 组号
+   */
+  groupNo: string;
+
+  /**
+   * 耗材
+   */
+  consumable: string;
+
+  /**
+   * 规格
+   */
+  specification: string;
+
+  /**
+   * 用量/次
+   */
+  dosePerTime: string;
+
+  /**
+   * 频次
+   */
+  frequency: string;
+
+  /**
+   * 用量/日
+   */
+  dosePerDay: string;
+
+  /**
+   * 使用天数
+   */
+  usageDays: number;
+
+  /**
+   * 首日
+   */
+  firstDay: string;
+
+  /**
+   * 数量
+   */
+  quantity: number;
+
+  /**
+   * 处方备注
+   */
+  prescriptionRemark: string;
+
+  /**
+   * 金额
+   */
+  amount: number;
+
+  /**
+   * 状态(0正常 1停用)
+   */
+  status: string;
+
+}
+
+export interface NutritionConsumableForm extends BaseEntity {
+  /**
+   * 主键ID
+   */
+  id?: string | number;
+
+  /**
+   * 结算管理id
+   */
+  settlementId?: string | number;
+
+  /**
+   * 组号
+   */
+  groupNo?: string;
+
+  /**
+   * 耗材
+   */
+  consumable?: string;
+  consumableId?: string;
+
+  /**
+   * 规格
+   */
+  specification?: string;
+
+  /**
+   * 用量/次
+   */
+  dosePerTime?: number;
+
+  /**
+   * 频次
+   */
+  frequency?: number;
+
+  /**
+   * 用量/日
+   */
+  dosePerDay?: number;
+
+  /**
+   * 使用天数
+   */
+  usageDays?: number;
+
+  /**
+   * 首日
+   */
+  firstDay?: number;
+
+  /**
+   * 数量
+   */
+  quantity?: number;
+
+  /**
+   * 处方备注
+   */
+  prescriptionRemark?: string;
+
+  /**
+   * 金额
+   */
+  amount?: number;
+
+  /**
+   * 状态(0正常 1停用)
+   */
+  status?: string;
+
+}
+
+export interface NutritionConsumableQuery extends PageQuery {
+
+  /**
+   * 结算管理id
+   */
+  settlementId?: string | number;
+
+  /**
+   * 组号
+   */
+  groupNo?: string;
+
+  /**
+   * 耗材
+   */
+  consumable?: string;
+
+  /**
+   * 规格
+   */
+  specification?: string;
+
+  /**
+   * 用量/次
+   */
+  dosePerTime?: string;
+
+  /**
+   * 频次
+   */
+  frequency?: string;
+
+  /**
+   * 用量/日
+   */
+  dosePerDay?: string;
+
+  /**
+   * 使用天数
+   */
+  usageDays?: number;
+
+  /**
+   * 首日
+   */
+  firstDay?: string;
+
+  /**
+   * 数量
+   */
+  quantity?: number;
+
+  /**
+   * 处方备注
+   */
+  prescriptionRemark?: string;
+
+  /**
+   * 金额
+   */
+  amount?: number;
+
+  /**
+   * 状态(0正常 1停用)
+   */
+  status?: string;
+
+    /**
+     * 日期范围参数
+     */
+    params?: any;
+}
+
+
+

+ 63 - 0
src/api/patients/settlement/index.ts

@@ -0,0 +1,63 @@
+import request from '@/utils/request';
+import { AxiosPromise } from 'axios';
+import { SettlementVO, SettlementForm, SettlementQuery } from '@/api/system/settlement/types';
+
+/**
+ * 查询结算管理列表
+ * @param query
+ * @returns {*}
+ */
+
+export const listSettlement = (query?: SettlementQuery): AxiosPromise<SettlementVO[]> => {
+  return request({
+    url: '/system/settlement/list',
+    method: 'get',
+    params: query
+  });
+};
+
+/**
+ * 查询结算管理详细
+ * @param id
+ */
+export const getSettlement = (id: string | number): AxiosPromise<SettlementVO> => {
+  return request({
+    url: '/system/settlement/' + id,
+    method: 'get'
+  });
+};
+
+/**
+ * 新增结算管理
+ * @param data
+ */
+export const addSettlement = (data: SettlementForm) => {
+  return request({
+    url: '/system/settlement',
+    method: 'post',
+    data: data
+  });
+};
+
+/**
+ * 修改结算管理
+ * @param data
+ */
+export const updateSettlement = (data: SettlementForm) => {
+  return request({
+    url: '/system/settlement',
+    method: 'put',
+    data: data
+  });
+};
+
+/**
+ * 删除结算管理
+ * @param id
+ */
+export const delSettlement = (id: string | number | Array<string | number>) => {
+  return request({
+    url: '/system/settlement/' + id,
+    method: 'delete'
+  });
+};

+ 221 - 0
src/api/patients/settlement/types.ts

@@ -0,0 +1,221 @@
+export interface SettlementVO {
+  /**
+   * 主键ID
+   */
+  id: string | number;
+
+  /**
+   * 开单时间
+   */
+  orderTime: string;
+
+  /**
+   * 看诊类型
+   */
+  visitType: string;
+
+  /**
+   * 收费类型
+   */
+  chargeType: string;
+
+  /**
+   * 患者ID
+   */
+  patientId: string | number;
+
+  /**
+   * 患者姓名
+   */
+  patientName: string;
+
+  /**
+   * 患者科室
+   */
+  patientDepartment: string;
+
+  /**
+   * 门诊/住院号
+   */
+  patientNo: string;
+
+  /**
+   * 联系电话
+   */
+  phone: string;
+
+  /**
+   * 身份证号
+   */
+  idCard: string | number;
+
+  /**
+   * 应收金额
+   */
+  receivableAmount: number;
+
+  /**
+   * 支付状态(未支付/已支付/已退款)
+   */
+  paymentStatus: string;
+
+  /**
+   * 支付方式
+   */
+  paymentMethod: string;
+
+  /**
+   * 状态(0正常 1停用)
+   */
+  status: string;
+
+}
+
+export interface SettlementForm extends BaseEntity {
+  /**
+   * 主键ID
+   */
+  id?: string | number;
+
+  /**
+   * 开单时间
+   */
+  orderTime?: string;
+
+  /**
+   * 看诊类型
+   */
+  visitType?: string;
+
+  /**
+   * 收费类型
+   */
+  chargeType?: string;
+
+  /**
+   * 患者ID
+   */
+  patientId?: string | number;
+
+  /**
+   * 患者姓名
+   */
+  patientName?: string;
+
+  /**
+   * 患者科室
+   */
+  patientDepartment?: string;
+
+  /**
+   * 门诊/住院号
+   */
+  patientNo?: string;
+
+  /**
+   * 联系电话
+   */
+  phone?: string;
+
+  /**
+   * 身份证号
+   */
+  idCard?: string | number;
+
+  /**
+   * 应收金额
+   */
+  receivableAmount?: number;
+
+  /**
+   * 支付状态(未支付/已支付/已退款)
+   */
+  paymentStatus?: string;
+
+  /**
+   * 支付方式
+   */
+  paymentMethod?: string;
+
+  /**
+   * 状态(0正常 1停用)
+   */
+  status?: string;
+
+}
+
+export interface SettlementQuery extends PageQuery {
+
+  /**
+   * 开单时间
+   */
+  orderTime?: string;
+
+  /**
+   * 看诊类型
+   */
+  visitType?: string;
+
+  /**
+   * 收费类型
+   */
+  chargeType?: string;
+
+  /**
+   * 患者ID
+   */
+  patientId?: string | number;
+
+  /**
+   * 患者姓名
+   */
+  patientName?: string;
+
+  /**
+   * 患者科室
+   */
+  patientDepartment?: string;
+
+  /**
+   * 门诊/住院号
+   */
+  patientNo?: string;
+
+  /**
+   * 联系电话
+   */
+  phone?: string;
+
+  /**
+   * 身份证号
+   */
+  idCard?: string | number;
+
+  /**
+   * 应收金额
+   */
+  receivableAmount?: number;
+
+  /**
+   * 支付状态(未支付/已支付/已退款)
+   */
+  paymentStatus?: string;
+
+  /**
+   * 支付方式
+   */
+  paymentMethod?: string;
+
+  /**
+   * 状态(0正常 1停用)
+   */
+  status?: string;
+
+    /**
+     * 日期范围参数
+     */
+    params?: any;
+}
+
+
+

+ 7 - 0
src/api/warehouse/productNutrition/index.ts

@@ -16,6 +16,13 @@ export const listNutrition = (query?: NutritionQuery): AxiosPromise<NutritionVO[
   });
 };
 
+export const listAllNutrition = (): AxiosPromise<NutritionVO[]> => {
+  return request({
+    url: '/warehouse/nutrition/listAll',
+    method: 'get'
+  });
+};
+
 /**
  * 查询营养产品信息详细
  * @param id

+ 7 - 0
src/api/warehouse/suppliesManage/index.ts

@@ -16,6 +16,13 @@ export const listSuppliesManage = (query?: SuppliesManageQuery): AxiosPromise<Su
   });
 };
 
+export const listAll = ( ): AxiosPromise<SuppliesManageVO[]> => {
+  return request({
+    url: '/warehouse/suppliesManage/listAll',
+    method: 'get'     
+  });
+};
+
 /**
  * 查询耗材管理详细
  * @param id

BIN
src/assets/images/pay.png


+ 29 - 19
src/views/patients/enteralNutrition/components/LeftCard.vue

@@ -10,27 +10,22 @@
             <el-row>
               <el-col :span="10">
                 <span class="label">日期时间:</span>
-                <el-date-picker
-                  v-model="dateRange"
-                  type="daterange"
-                  range-separator="-"
-                  start-placeholder="开始日期"
-                  end-placeholder="结束日期"
-                  style="width: 280px"
-                  @keydown.enter.prevent
-                />
+                <el-date-picker v-model="dateRange" type="date"  placeholder="请选择" />
               </el-col>
               <el-col class="right_btn" :span="7">
-                <el-button type="primary" plain>打印知情同意书</el-button>
+                <!-- <el-button type="primary" plain>打印知情同意书</el-button> -->
                 <el-button type="success" @click="goHistoryPrescription">历史处方</el-button>
               </el-col>
             </el-row>
 
             <!-- 添加按钮组 -->
             <div class="add-buttons">
-              <el-button :class="['add-btn', {'is-active': prescriptionType === 'normal'}]" @click="addPrescription">添加配置处方</el-button>
-              <el-button :class="['add-btn', {'is-active': prescriptionType === 'package'}]" @click="addTemplate">添加预包装处方</el-button>
-              <el-button :class="['add-btn', {'is-active': prescriptionType === 'long-term'}]" @click="addLongTerm">添加长期医嘱处方</el-button>
+              <el-button :class="['add-btn', {'is-active': prescriptionType === 'normal'}]"
+                @click="addPrescription">添加配置处方</el-button>
+              <el-button :class="['add-btn', {'is-active': prescriptionType === 'package'}]"
+                @click="addTemplate">添加预包装处方</el-button>
+              <el-button :class="['add-btn', {'is-active': prescriptionType === 'long-term'}]"
+                @click="addLongTerm">添加长期医嘱处方</el-button>
             </div>
 
             <!-- 开方原因 -->
@@ -49,12 +44,16 @@
 
           <!-- 处方表格 -->
           <div class="prescription-tables">
-            <template v-if="tableType === 'package'">
-              <PackageTable />
+            <template v-if="tableType === 'normal'">
+              <ConfigureTable @change="updateConfigureData"/>
+              <MaterialTable v-model="configData"/>
+            </template>
+            <template v-else-if="tableType === 'package'">
+              <PackageTable/>
             </template>
             <template v-else>
-              <NutritionTable :type="tableType" />
-              <MaterialTable />
+              <NutritionTable/>
+              <MaterialTable/>
             </template>
           </div>
         </div>
@@ -71,12 +70,18 @@ import {ref} from 'vue';
 import NutritionTable from './table/NutritionTable.vue';
 import MaterialTable from './table/MaterialTable.vue';
 import PackageTable from './table/PackageTable.vue';
-import {useRouter} from 'vue-router';
-const router = useRouter();
+import ConfigureTable from './table/ConfigureTable.vue'; 
+ 
+import { listEnteralNutrition, getEnteralNutrition, delEnteralNutrition, addEnteralNutrition, updateEnteralNutrition } from '@/api/patients/nutrition';
+import { EnteralNutritionVO, EnteralNutritionQuery, EnteralNutritionForm } from '@/api/patients/nutrition/types';
+
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+ 
 const emit = defineEmits(['gotoTop']);
 
 // 顶部tab切换
 const activeTab = ref('nutrition');
+const configData= ref('');
 
 // 表格类型
 const tableType = ref<'normal' | 'package' | 'long-term'>('normal');
@@ -87,6 +92,11 @@ const dateRange = ref([]);
 // 处方类型
 const prescriptionType = ref<'normal' | 'package' | 'long-term'>('normal');
 
+const updateConfigureData = (val:string) => {  
+  configData.value=val;  
+};
+
+
 // 添加配置处方
 const addPrescription = () => {
   prescriptionType.value = 'normal';

+ 8 - 1
src/views/patients/enteralNutrition/components/history/RightCard.vue

@@ -3,7 +3,7 @@
     <!-- 顶部操作按钮 -->
     <div class="operation-buttons">
       <div class="left-buttons">
-        <el-button plain>返回</el-button>
+        <el-button plain @click="goBack">返回</el-button>
         <el-button plain>打印</el-button>
         <el-button type="success" plain>引用处方</el-button>
         <el-button type="danger" plain>处方作废</el-button>
@@ -459,6 +459,13 @@ onMounted(() => {
     chart.resize();
   });
 });
+
+
+const emit = defineEmits(['goBack']);
+const goBack = () => {
+  emit('goBack')
+};
+
 </script>
 
 <style lang="scss" scoped>

+ 635 - 0
src/views/patients/enteralNutrition/components/table/ConfigureTable.vue

@@ -0,0 +1,635 @@
+<template>
+  <div class="nutrition-table">
+    <el-table :data="tableData" border>
+      <el-table-column type="index" label="组号" width="60" align="center" />
+      <el-table-column label="营养产品" min-width="300">
+        <template #default="{row}">
+          <div class="product-group">
+            <div v-for="(product, index) in row.products" :key="index" class="product-row" style="margin-bottom:5px;">
+              <el-select v-model="product.nutritionProductId" placeholder="请选择" @change="changeProductSelect">
+                <el-option v-for="pn in productNutritionList" :key="pn.id" :label="pn.productName"
+                  :value="pn.id+'_'+row.sn+'_'+index"></el-option>
+              </el-select>
+              <div class="action-buttons">
+                <el-button class="icon-btn" @click="addProduct(row)">
+                  <el-icon>
+                    <Plus />
+                  </el-icon>
+                </el-button>
+                <el-button class="icon-btn" @click="removeProduct(row, index)">
+                  <el-icon>
+                    <Delete />
+                  </el-icon>
+                </el-button>
+              </div>
+            </div>
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column label="用量/次" width="150" align="center">
+        <template #default="{row}">
+          <div class="dosage-group">
+            <div v-for="(product, index) in row.products" :key="index" class="dosage-input">
+              <el-input v-model="product.dosePerTime" placeholder="请输入" class="input-center"  
+              @input="dosePerTimeInput(product.dosePerTime,row.sn+'_'+index)"/>
+              <span class="unit">g</span>
+            </div>
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column label="餐次时间" width="500">
+        <template #default="{row}">
+          <div class="time-slots">
+            <div class="time-row">
+              <div class="time-group">
+                <el-checkbox v-model="row.timeSlots[0].checked" @change="changeTimeSelection(row.timeSlots[0].checked,row.sn)"/>
+                <el-time-select v-model="row.timeSlots[0].time" start="00:00" step="00:30" end="23:30"
+                  placeholder="选择时间" :disabled="!row.timeSlots[0].checked" 
+                  />
+              </div>
+              <div class="time-group">
+                <el-checkbox v-model="row.timeSlots[1].checked" @change="changeTimeSelection(row.timeSlots[1].checked,row.sn)"/>
+                <el-time-select v-model="row.timeSlots[1].time" start="00:00" step="00:30" end="23:30"
+                  placeholder="选择时间" :disabled="!row.timeSlots[1].checked" 
+                  />
+              </div>
+              <div class="time-group">
+                <el-checkbox v-model="row.timeSlots[2].checked" @change="changeTimeSelection(row.timeSlots[2].checked,row.sn)"/>
+                <el-time-select v-model="row.timeSlots[2].time" start="00:00" step="00:30" end="23:30"
+                  placeholder="选择时间" :disabled="!row.timeSlots[2].checked" 
+                  />
+              </div>
+            </div>
+            <div class="time-row">
+              <div class="time-group">
+                <el-checkbox v-model="row.timeSlots[3].checked" @change="changeTimeSelection(row.timeSlots[3].checked,row.sn)"/>
+                <el-time-select v-model="row.timeSlots[3].time" start="00:00" step="00:30" end="23:30"
+                  placeholder="选择时间" :disabled="!row.timeSlots[3].checked" 
+                  />
+              </div>
+              <div class="time-group">
+                <el-checkbox v-model="row.timeSlots[4].checked" @change="changeTimeSelection(row.timeSlots[4].checked,row.sn)"/>
+                <el-time-select v-model="row.timeSlots[4].time" start="00:00" step="00:30" end="23:30"
+                  placeholder="选择时间" :disabled="!row.timeSlots[4].checked" 
+                  />
+              </div>
+              <div class="time-group">
+                <el-checkbox v-model="row.timeSlots[5].checked" @change="changeTimeSelection(row.timeSlots[5].checked,row.sn)"/>
+                <el-time-select v-model="row.timeSlots[5].time" start="00:00" step="00:30" end="23:30"
+                  placeholder="选择时间" :disabled="!row.timeSlots[5].checked" 
+                  />
+              </div>
+            </div>
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column label="频次" width="120" align="center">
+        <template #default="{row}">
+          <span>一天{{row.frequency}}次</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="首日" width="150" align="center">
+        <template #default="{row}">
+          <el-input v-model="row.firstDay" @input="firstDayInput(row.firstDay,row.sn)">
+            <template #append>次</template>
+          </el-input>
+        </template>
+      </el-table-column>
+      <el-table-column label="用量/日" width="100" align="center">
+        <template #default="{row}">
+          <div class="daily-dosage" v-for="(product, index) in row.products" :key="index">
+            <span>{{product.dosePerDay }}</span>             
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column label="使用天数" width="200" align="center">
+        <template #default="{row}">
+          <div class="daily-size">
+            <el-input-number v-model="row.usageDays" :min="1" @change="changeUsageDays(row.usageDays,row.sn)"/>
+          </div>
+        </template>
+      </el-table-column>
+
+      <el-table-column label="用量/总" width="100" align="center">
+        <template #default="{row}">
+          <div class="daily-dosage" v-for="(product, index) in row.products" :key="index">
+            <span>{{product.totalDose }}</span>            
+          </div>
+        </template>
+      </el-table-column>
+
+      <el-table-column label="规格" width="100" align="center">
+        <template #default="{row}">
+          <div class="daily-dosage" v-for="(product, index) in row.products" :key="index">
+            <span>{{product.specification }}</span>             
+          </div>
+        </template>
+      </el-table-column>
+
+      <el-table-column label="用法" width="150" align="center">
+        <template #default="{row}">
+          <el-select v-model="row.usage" placeholder="请选择" >
+            <el-option v-for="dict in default_usage" :key="dict.value" :label="dict.label"
+              :value="dict.value"></el-option>
+          </el-select>
+        </template>
+      </el-table-column>
+
+      <el-table-column label="制剂液量/次" width="170" align="center">
+        <template #default="{row}">
+          <el-input v-model="row.preparationVolumePerTime">
+            <template #append>ml</template>
+          </el-input>
+        </template>
+      </el-table-column>
+
+      <el-table-column label="制剂浓度/次" width="100" align="center">
+        <template #default="{row}">
+          <div class="daily-dosage">
+            <span>{{ row.preparationConcentrationPerTime }}</span>
+            <span class="unit">%</span>
+          </div>
+        </template>
+      </el-table-column>
+
+      <el-table-column label="能量密度/次" width="200" align="center">
+        <template #default="{row}">
+          <el-input v-model="row.energyDensityPerTime">
+            <template #append>kcal/ml</template>
+          </el-input>
+        </template>
+      </el-table-column>
+
+      <el-table-column label="处方备注" width="200" align="center">
+        <template #default="{row}">
+          <template v-for="(product, index) in row.products" >
+            <el-input v-model="product.prescriptionRemark" :maxlength="100" :show-word-limit="true" />
+          </template>          
+        </template>
+      </el-table-column>
+
+      <el-table-column label="每日热量" width="100" align="center">
+        <template #default="{row}">
+          <div class="daily-dosage" v-for="(product, index) in row.products" :key="index">
+            <span>{{product.dailyCalories }}</span>             
+          </div>
+        </template>
+      </el-table-column>
+
+
+      <el-table-column label="金额" width="100" align="center">
+        <template #default="{row}"> 
+          <div class="daily-dosage" v-for="(product, index) in row.products" :key="index">
+            <span>{{product.amount }}</span>
+          </div>
+        </template>
+      </el-table-column>
+
+      <el-table-column label="操作" width="160" align="center" fixed="right">
+        <template #default="{$index}">
+          <div class="operation-cell">
+            <el-button type="primary" link @click="copyRow($index)">复制餐次</el-button>
+            <el-button type="danger" link @click="deleteRow($index)">删除</el-button>
+          </div>
+        </template>
+      </el-table-column>
+    </el-table>
+    <div class="table-footer">
+      <el-button type="primary" class="add-prescription-btn" @click="addNewRow">
+        <el-icon>
+          <CirclePlus />
+        </el-icon>
+        开具多处方
+      </el-button>
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts">
+import {ref} from 'vue';
+import {Plus, Delete, CirclePlus} from '@element-plus/icons-vue';
+import { listEnteralNutrition, getEnteralNutrition, delEnteralNutrition, addEnteralNutrition, updateEnteralNutrition } from '@/api/patients/nutrition';
+import { EnteralNutritionVO, EnteralNutritionQuery, EnteralNutritionForm } from '@/api/patients/nutrition/types';
+import { listNutrition, listAllNutrition  } from '@/api/warehouse/productNutrition/index';
+import { NutritionVO, NutritionQuery, NutritionForm } from '@/api/warehouse/productNutrition/types';
+import { it } from 'node:test';
+
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const { default_usage } = toRefs < any > (proxy ?.useDict('default_usage'));
+
+let productNutritionList=ref<NutritionVO[]>([]);
+
+const getProductNutritionList = async () => {
+  const res = await listAllNutrition();
+  productNutritionList.value = res.rows;
+}
+
+
+interface TimeSlot {
+  checked: boolean;
+  time: string;
+} 
+
+interface TableRow  extends EnteralNutritionForm {
+  products: EnteralNutritionForm[];
+  timeSlots: TimeSlot[];
+  sn: number;
+}
+
+// 创建默认行数据的函数
+const createDefaultRow = (): TableRow => ({
+  products: [{specification:'g',totalDose:'g',dosePerDay:'g'}],
+  timeSlots: [
+    {checked: true, time: '08:00'},
+    {checked: false, time: '08:30'},
+    {checked: true, time: '12:00'},
+    {checked: false, time: '12:30'},
+    {checked: true, time: '18:00'},
+    {checked: false, time: '18:30'}
+  ],
+  usageDays:1,
+  frequency:3,
+  firstDay:1,
+  sn:0,
+});
+
+const emit = defineEmits(['change']);
+
+// 示例数据
+const tableData = ref<TableRow[]>([createDefaultRow()]);
+
+// 新增行
+const addNewRow = () => {
+  let row: TableRow = createDefaultRow();
+  row.sn = tableData.value.length ;
+  tableData.value.push(row);
+  emit('change',JSON.stringify(tableData.value))
+};
+
+const changeProductSelect = async (id: string) => {
+  let arr=id.split('_');
+  for (let item of productNutritionList.value) {
+    if (item.id.toString() != arr[0]) {
+      continue
+    }
+    
+    let row = tableData.value[Number(arr[1])];
+    let pt = row.products[Number(arr[2])];
+    pt.specification=item.productSpec;
+    pt.dosePerTime=null;     
+    pt.dailyCalories=null;
+    pt.amount=null; 
+    row.usage=item.defaultUsage;
+    pt.totalDose='0'+item.productSpecUnit;
+    pt.dosePerDay='0'+item.productSpecUnit;
+    break;
+  }
+};
+
+// 新增产品输入框
+const addProduct = (row: TableRow) => {
+  row.products.push({});
+};
+
+// 删除产品输入框
+const removeProduct = (row: TableRow, index: number) => {
+  // 如果删除后只剩一个输入框,删除整行
+  if (row.products.length <= 1) {
+    const rowIndex = tableData.value.findIndex((item) => item === row);
+    if (rowIndex !== -1) {
+      tableData.value.splice(rowIndex, 1);
+    }
+  } else {
+    // 否则只删除当前输入框
+    row.products.splice(index, 1);
+  }
+};
+ 
+
+// 复制行
+const copyRow = (index: number) => {
+  const newRow = JSON.parse(JSON.stringify(tableData.value[index]));
+  tableData.value.splice(index + 1, 0, newRow);
+  emit('change',JSON.stringify(tableData.value))
+};
+
+// 删除行
+const deleteRow = (index: number) => {
+  if (tableData.value.length === 1) return;
+  tableData.value.splice(index, 1);
+  emit('change',JSON.stringify(tableData.value))
+};
+ 
+const changeUsageDays = (value: string, sn:string) => { 
+  changeTimeSelection(value,sn);
+  emit('change',JSON.stringify(tableData.value))  
+}
+
+const firstDayInput = (value: string, sn:string) => { 
+  changeTimeSelection(value,sn);  
+  emit('change',JSON.stringify(tableData.value))
+}
+
+const changeTimeSelection = (value: string, sn:string) => {
+  let row = tableData.value[sn];
+  let frequency=0;
+  let oldFrequency=row.frequency;
+  row.timeSlots.forEach(item=>{
+    if(item.checked){
+      frequency++;
+    }
+  })
+  row.frequency=frequency;
+  if(oldFrequency!==frequency){
+    emit('change',JSON.stringify(tableData.value))
+  }
+
+  row.products.forEach(pt => {
+    if (!pt.dosePerTime || pt.dosePerTime.trim().length == 0) {
+      return;
+    }
+    let arr=pt.nutritionProductId.split('_');
+
+    for (let item of productNutritionList.value) {
+    if (item.id.toString() != arr[0]) {
+      continue
+    }    
+    
+    
+    let val=item.calorie*row.frequency*Number(pt.dosePerTime)/100.0
+    pt.dailyCalories=val.toFixed(4);
+
+    val=(row.frequency*(row.usageDays-1)+row.firstDay)*item.configSalePrice*Number(pt.dosePerTime)
+    pt.amount=Math.round(val*100)/100;
+
+    val=(row.frequency*(row.usageDays-1)+row.firstDay)*Number(pt.dosePerTime)
+    pt.totalDose=val.toFixed(4)+item.productSpecUnit;
+
+    val=row.frequency*Number(pt.dosePerTime)
+    pt.dosePerDay=val.toFixed(4)+item.productSpecUnit;
+    break;
+  }
+
+  });  
+};
+
+const dosePerTimeInput = (value: string, str:string) => {
+  let arr=str.split('_');
+  let row = tableData.value[Number(arr[0])];
+  let pt = row.products[Number(arr[1])];
+  if(!pt.dosePerTime||pt.dosePerTime.trim().length==0){
+    pt.dailyCalories=null;
+    pt.amount=null; 
+    return;
+  }
+
+  arr=pt.nutritionProductId.split('_');
+  for (let item of productNutritionList.value) {
+    if (item.id.toString() != arr[0]) {
+      continue
+    }    
+    
+    
+    let val=item.calorie*row.frequency*Number(pt.dosePerTime)/100.0
+    pt.dailyCalories=val.toFixed(4);
+
+    val=(row.frequency*(row.usageDays-1)+row.firstDay)*item.configSalePrice*Number(pt.dosePerTime)
+    pt.amount=Math.round(val*100)/100;
+
+    val=(row.frequency*(row.usageDays-1)+row.firstDay)*Number(pt.dosePerTime)
+    pt.totalDose=val.toFixed(4)+item.productSpecUnit;
+
+    val=row.frequency*Number(pt.dosePerTime)
+    pt.dosePerDay=val.toFixed(4)+item.productSpecUnit;
+    break;
+  }
+};
+
+
+onMounted(() => { 
+  getProductNutritionList();
+});
+
+</script>
+
+<style lang="scss" scoped>
+.nutrition-table {
+  :deep(.el-table) {
+    // 表头样式
+    .el-table__header {
+      th {
+        background-color: #f5f7fa;
+        color: #606266;
+        font-weight: 500;
+        padding: 8px 0;
+        height: 40px;
+      }
+    }
+
+    // 表格行样式
+    .el-table__row {
+      td {
+        padding: 4px 8px;
+      }
+    }
+  }
+
+  // 产品输入框组样式
+  .product-group {
+    display: flex;
+    flex-direction: column;
+    gap: 8px;
+
+    .product-row {
+      display: flex;
+      align-items: center;
+      gap: 8px;
+
+      .el-input {
+        flex: 1;
+      }
+
+      .action-buttons {
+        display: flex;
+        gap: 1px;
+
+        .icon-btn {
+          padding: 6px;
+          height: 32px;
+          border: 1px solid #dcdfe6;
+
+          &:hover {
+            border-color: var(--el-color-primary);
+            color: var(--el-color-primary);
+          }
+
+          .el-icon {
+            font-size: 14px;
+          }
+        }
+      }
+    }
+  }
+
+  // 用量输入框组样式
+  .dosage-group {
+    display: flex;
+    flex-direction: column;
+    gap: 8px;
+
+    .dosage-input {
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      gap: 4px;
+
+      .input-center {
+        width: 100px;
+
+        :deep(.el-input__inner) {
+          text-align: center;
+        }
+      }
+
+      .unit {
+        color: #909399;
+        font-size: 14px;
+        flex-shrink: 0;
+      }
+    }
+  }
+
+  // 餐次时间样式
+  .time-slots {
+    display: flex;
+    flex-direction: column;
+    gap: 8px;
+
+    .time-row {
+      display: flex;
+      gap: 8px;
+
+      .time-group {
+        display: flex;
+        align-items: center;
+        gap: 4px;
+
+        :deep(.el-checkbox) {
+          margin-right: 0;
+          .el-checkbox__label {
+            display: none;
+          }
+        }
+
+        :deep(.el-time-select) {
+          .el-input {
+            width: 120px;
+          }
+          .el-input__wrapper {
+            padding: 0 8px;
+            border-radius: 2px;
+            box-shadow: 0 0 0 1px #dcdfe6 inset;
+            &:hover:not(.is-disabled) {
+              box-shadow: 0 0 0 1px #c0c4cc inset;
+            }
+            &.is-disabled {
+              background-color: #f5f7fa;
+              box-shadow: 0 0 0 1px #e4e7ed inset;
+              .el-input__inner {
+                color: #909399;
+                -webkit-text-fill-color: #909399;
+              }
+            }
+          }
+          .el-input__inner {
+            height: 32px;
+            text-align: center;
+            font-size: 14px;
+            color: #606266;
+          }
+        }
+      }
+    }
+  }
+
+  .daily-dosage,
+  .days {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    gap: 4px;
+
+    .unit {
+      color: #909399;
+      font-size: 14px;
+    }
+  }
+
+  .operation-cell {
+    display: flex;
+    justify-content: center;
+    gap: 12px;
+
+    .el-button {
+      padding: 4px 8px;
+    }
+  }
+
+  .table-footer {
+    height: 50px;
+    border: 1px solid var(--el-table-border-color);
+    border-top: none;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    background-color: #f5f7fa;
+
+    .add-prescription-btn {
+      display: flex;
+      align-items: center;
+      gap: 4px;
+      height: 32px;
+      padding: 0 16px;
+      font-size: 14px;
+      background-color: var(--el-color-primary-light-8);
+      color: var(--el-color-primary);
+      border: none;
+
+      &:hover {
+        background-color: var(--el-color-primary-light-9);
+      }
+
+      .el-icon {
+        font-size: 16px;
+      }
+    }
+  }
+
+  .stop-date {
+    display: flex;
+    align-items: center;
+    gap: 8px;
+    margin-bottom: 16px;
+
+    .required {
+      color: #f56c6c;
+      font-size: 14px;
+    }
+
+    .label {
+      color: #606266;
+      font-size: 14px;
+    }
+
+    .days {
+      color: #f56c6c;
+      font-size: 14px;
+    }
+  }
+}
+
+
+:deep(.daily-size div) {
+  width: 100px;
+} 
+</style>

+ 116 - 177
src/views/patients/enteralNutrition/components/table/MaterialTable.vue

@@ -5,14 +5,11 @@
       <el-table-column label="耗材" min-width="300">
         <template #default="{row}">
           <div class="material-group">
-            <div class="material-row">
-              <el-input v-model="row.material1" placeholder="请输入" />
-            </div>
-            <div class="material-row">
-              <el-input v-model="row.material2" placeholder="请输入" />
-            </div>
-            <div class="material-row">
-              <el-input v-model="row.material3" placeholder="请输入" />
+            <div class="material-row" style="margin-bottom:10px;">
+              <el-select v-model="row.consumableId" placeholder="请选择" @change="changeConsumableSelect">
+                <el-option v-for="pn in suppliesList" :key="pn.id" :label="pn.suppliesName"
+                  :value="pn.id+'_'+row.sn"></el-option>
+              </el-select>
             </div>
           </div>
         </template>
@@ -20,126 +17,62 @@
       <el-table-column label="规格" width="100" align="center">
         <template #default="{row}">
           <div class="spec-group">
-            <span>{{ row.specification1 }}</span>
-            <span>{{ row.specification2 }}</span>
-            <span>{{ row.specification3 }}</span>
+            <span>{{ row.specification }}</span>            
           </div>
         </template>
       </el-table-column>
-      <el-table-column label="用量/次" width="150">
+      <el-table-column label="用量/次" width="200" align="center">
         <template #default="{row}">
           <div class="dosage-group">
             <div class="dosage-input">
-              <el-input v-model="row.dosage1" placeholder="请输入" class="input-center" />
-              <span class="unit">g</span>
-            </div>
-            <div class="dosage-input">
-              <el-input v-model="row.dosage2" placeholder="请输入" class="input-center" />
-              <span class="unit">g</span>
-            </div>
-            <div class="dosage-input">
-              <el-input v-model="row.dosage3" placeholder="请输入" class="input-center" />
-              <span class="unit">g</span>
-            </div>
-          </div>
-        </template>
-      </el-table-column>
-      <el-table-column label="餐次时间" width="460">
-        <template #default="{row}">
-          <div class="time-slots">
-            <div class="time-row">
-              <div class="time-group">
-                <el-checkbox v-model="row.timeSlots[0].checked" />
-                <el-time-select
-                  v-model="row.timeSlots[0].time"
-                  start="06:00"
-                  step="00:30"
-                  end="22:00"
-                  placeholder="选择时间"
-                  :disabled="!row.timeSlots[0].checked"
-                />
-              </div>
-              <div class="time-group">
-                <el-checkbox v-model="row.timeSlots[1].checked" />
-                <el-time-select
-                  v-model="row.timeSlots[1].time"
-                  start="06:00"
-                  step="00:30"
-                  end="22:00"
-                  placeholder="选择时间"
-                  :disabled="!row.timeSlots[1].checked"
-                />
-              </div>
-              <div class="time-group">
-                <el-checkbox v-model="row.timeSlots[2].checked" />
-                <el-time-select
-                  v-model="row.timeSlots[2].time"
-                  start="06:00"
-                  step="00:30"
-                  end="22:00"
-                  placeholder="选择时间"
-                  :disabled="!row.timeSlots[2].checked"
-                />
-              </div>
-            </div>
-            <div class="time-row">
-              <div class="time-group">
-                <el-checkbox v-model="row.timeSlots[3].checked" />
-                <el-time-select
-                  v-model="row.timeSlots[3].time"
-                  start="06:00"
-                  step="00:30"
-                  end="22:00"
-                  placeholder="选择时间"
-                  :disabled="!row.timeSlots[3].checked"
-                />
-              </div>
-              <div class="time-group">
-                <el-checkbox v-model="row.timeSlots[4].checked" />
-                <el-time-select
-                  v-model="row.timeSlots[4].time"
-                  start="06:00"
-                  step="00:30"
-                  end="22:00"
-                  placeholder="选择时间"
-                  :disabled="!row.timeSlots[4].checked"
-                />
-              </div>
-              <div class="time-group">
-                <el-checkbox v-model="row.timeSlots[5].checked" />
-                <el-time-select
-                  v-model="row.timeSlots[5].time"
-                  start="06:00"
-                  step="00:30"
-                  end="22:00"
-                  placeholder="选择时间"
-                  :disabled="!row.timeSlots[5].checked"
-                />
-              </div>
-            </div>
+              <el-input v-model="row.dosePerTime" placeholder="请输入" class="input-center" >
+                <template #append>袋</template>
+              </el-input>              
+            </div>             
           </div>
         </template>
       </el-table-column>
+       
       <el-table-column label="频次" width="100" align="center">
-        <template #default>
-          <span>一天3次</span>
+        <template #default="{row}">
+          <span>一天{{row.frequency}}次</span>
         </template>
       </el-table-column>
       <el-table-column label="用量/日" width="100" align="center">
         <template #default="{row}">
-          <span>{{ row.dailyDosage }}袋</span>
+          <span>{{ row.dosePerDay }}</span>
+          <span class="unit">袋</span>
         </template>
       </el-table-column>
       <el-table-column label="使用天数" width="100" align="center">
         <template #default="{row}">
-          <span>{{ row.days }}天</span>
+          <span>{{ row.usageDays }}天</span>
         </template>
       </el-table-column>
       <el-table-column label="首日" width="80" align="center">
         <template #default="{row}">
-          <span>{{ row.firstDayTimes }}次</span>
+          <span>{{ row.firstDay }}次</span>
+        </template>
+      </el-table-column>
+
+      <el-table-column label="数量" width="80" align="center">
+        <template #default="{row}">
+          <span>{{ row.quantity }}袋</span>
         </template>
       </el-table-column>
+
+      <el-table-column label="处方备注" width="200" align="center">
+        <template #default="{row}">
+          <el-input v-model="row.prescriptionRemark" :maxlength="100" :show-word-limit="true" />        
+        </template>
+      </el-table-column>
+
+      <el-table-column label="金额" width="80" align="center">
+        <template #default="{row}">
+          <span>{{ row.amount }}</span>
+        </template>
+      </el-table-column>
+
     </el-table>
     <div class="table-footer">
       <div class="left-buttons">
@@ -168,88 +101,51 @@
 </template>
 
 <script setup lang="ts">
-import {ref} from 'vue';
+import {ref,defineProps} from 'vue';
+import {  listAll  } from '@/api/warehouse/suppliesManage';
+import { SuppliesManageVO } from '@/api/warehouse/suppliesManage/types';
+import { listNutritionConsumable, getNutritionConsumable, delNutritionConsumable, addNutritionConsumable, updateNutritionConsumable } from '@/api/patients/nutritionConsumable';
+import {NutritionConsumableForm } from '@/api/patients/nutritionConsumable/types';
+import { string } from 'vue-types';
+import { json } from 'stream/consumers';
+
+const emit = defineEmits(['update:modelValue']);
+
+const prop=defineProps({
+  modelValue: {
+    type: String,
+    default: () => undefined
+  },
+});
 
-interface TimeSlot {
-  checked: boolean;
-  time: string;
-}
 
-interface TableRow {
-  material1: string;
-  material2: string;
-  material3: string;
-  specification1: string;
-  specification2: string;
-  specification3: string;
-  dosage1: string;
-  dosage2: string;
-  dosage3: string;
-  timeSlots: TimeSlot[];
-  dailyDosage: number;
-  days: number;
-  firstDayTimes: number;
+interface TableRow extends NutritionConsumableForm {  
+  sn?: number;   
 }
 
 // 示例数据
 const tableData = ref<TableRow[]>([
-  {
-    material1: '',
-    material2: '',
-    material3: '',
-    specification1: '4克/袋',
-    specification2: '4克/袋',
-    specification3: '4克/袋',
-    dosage1: '',
-    dosage2: '',
-    dosage3: '',
-    timeSlots: [
-      {checked: false, time: '08:00'},
-      {checked: false, time: '08:00'},
-      {checked: false, time: '08:00'},
-      {checked: false, time: '08:00'},
-      {checked: false, time: '08:00'},
-      {checked: false, time: '08:00'}
-    ],
-    dailyDosage: 3.0,
-    days: 1,
-    firstDayTimes: 2
-  },
-  {
-    material1: '',
-    material2: '',
-    material3: '',
-    specification1: '4克/袋',
-    specification2: '4克/袋',
-    specification3: '4克/袋',
-    dosage1: '',
-    dosage2: '',
-    dosage3: '',
-    timeSlots: [
-      {checked: false, time: '08:00'},
-      {checked: false, time: '08:00'},
-      {checked: false, time: '08:00'},
-      {checked: false, time: '08:00'},
-      {checked: false, time: '08:00'},
-      {checked: false, time: '08:00'}
-    ],
-    dailyDosage: 3.0,
-    days: 1,
-    firstDayTimes: 2
-  }
+  {           
+    firstDay:1,
+    frequency:3,
+    dosePerTime:1,
+    dosePerDay:3,
+    usageDays:1,
+    quantity:1,
+    sn: 0    
+  }     
 ]);
 
-// 选择耗材
-const selectMaterial = (row: TableRow) => {
-  // TODO: 实现耗材选择逻辑
-  console.log('选择耗材', row);
-};
 
-// 删除耗材
-const deleteMaterial = (row: TableRow) => {
-  // TODO: 实现耗材删除逻辑
-  console.log('删除耗材', row);
-};
+let suppliesList=ref<SuppliesManageVO[]>([]);
+ 
+
+const getSuppliesList = async () => {
+  const res = await listAll();
+  suppliesList.value = res.rows;
+}
+
+ 
 
 // 复制行
 const copyRow = (index: number) => {
@@ -262,6 +158,49 @@ const deleteRow = (index: number) => {
   if (tableData.value.length === 1) return;
   tableData.value.splice(index, 1);
 };
+
+const changeConsumableSelect = async (id: string) => {
+  let arr=id.split('_');
+  for (let item of suppliesList.value) {
+    if (item.id.toString() != arr[0]) {
+      continue
+    }
+    
+    
+    let row = tableData.value[Number(arr[1])];
+    row.specification=item.suppliesSpec;
+    row.amount=item.sellPrice;
+    break;
+  }
+};
+
+
+watch(
+  () => prop.modelValue,
+  async (val: string) => {
+    let configData=JSON.parse(val);
+    const tableData = ref<TableRow[]>([]);
+
+    configData.forEach((item:any) => { 
+      let row: TableRow = {        
+        frequency: item.frequency,         
+        usageDays: item.usageDays,
+        firstDay: item.firstDay,
+        sn: tableData.value.length
+      };
+      row.dosePerTime=0;
+
+      tableData.value.push(row);
+    });
+    console.log(configData, "?????*************????????????????");
+  },
+  { deep: true, immediate: true }
+);
+
+onMounted(() => { 
+  getSuppliesList();  
+});
+
 </script>
 
 <style lang="scss" scoped>

+ 9 - 1
src/views/patients/enteralNutrition/history.vue

@@ -1,13 +1,21 @@
 <template>
   <div class="history-container">
     <LeftCard />
-    <RightCard />
+    <RightCard  @goBack="goBack"/>
   </div>
 </template>
 
 <script setup lang="ts">
 import LeftCard from './components/history/LeftCard.vue';
 import RightCard from './components/history/RightCard.vue';
+const { patientInfo } = defineProps<{ patientInfo: any }>()
+
+
+const emit = defineEmits(['change']);
+const goBack = () => {
+  emit('change','enteralNutrition')
+};
+
 </script>
 
 <style lang="scss" scoped>

+ 2 - 4
src/views/patients/enteralNutrition/index.vue

@@ -13,13 +13,11 @@
 import LeftCard from './components/LeftCard.vue';
 import RightCard from './components/RightCard.vue';
 
-const { patientInfo } = defineProps<{ patientInfo: any }>()
-
 // 解决bug核心
 const emit = defineEmits(['change']);
 
-const goHistoryPrescription = () => {  
-  emit('change', 'enteralNutritionHistory',patientInfo.id)
+const goHistoryPrescription = () => {
+  emit('change', 'enteralNutritionHistory')
 };
 
 </script>

+ 4 - 2
src/views/patients/parenteralNutrition/index.vue

@@ -15,7 +15,7 @@
           </el-form-item>
 
           <el-form-item id="buttonEl">
-            <el-button type="primary">搜索</el-button>
+            <el-button type="primary" @click="handleQuery">搜索</el-button>
             <el-button @click="resetQuery">重置</el-button>
           </el-form-item>
         </el-form>
@@ -95,7 +95,8 @@ import {   ScreeningQuery  } from '@/api/patients/screening/types';
 import { FoodIngredientVO   } from '@/api/system/foodIngredient/types';
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
- 
+const emit = defineEmits(['change']);
+
 const dataList = ref([{
   screeningTime: '',
   visitType: '',
@@ -172,6 +173,7 @@ const handleMenumSelect = async (key: string, keyPath: string[]) => {
 /** 搜索按钮操作 */
 const handleQuery = () => {
   queryParams.value.pageNum = 1;   
+  getList();
 }
 
 const getList = async () => {