提交merge1.3
This commit is contained in:
@@ -10,9 +10,9 @@
|
||||
label-position="right"
|
||||
style="min-width: 500px"
|
||||
>
|
||||
<el-form-item label="患者信息" prop="condition">
|
||||
<el-form-item label="患者信息" prop="searchKey">
|
||||
<el-input
|
||||
v-model="queryParams.condition"
|
||||
v-model="queryParams.searchKey"
|
||||
placeholder="请输入姓名/证件号"
|
||||
clearable
|
||||
style="width: 160px"
|
||||
@@ -84,6 +84,7 @@
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column prop="age" label="年龄" width="80" align="center" />
|
||||
<el-table-column prop="phone" label="电话" width="80" align="center" />
|
||||
<el-table-column prop="receptionTime" label="就诊日期" align="center">
|
||||
<template #default="scope">
|
||||
{{ scope.row.receptionTime ? formatDate(scope.row.receptionTime) : "-" }}
|
||||
@@ -228,12 +229,15 @@
|
||||
:data="medicineInfoList"
|
||||
border
|
||||
style="width: 100%; height: 65vh; margin-top: 10px"
|
||||
:row-style="rowStyle"
|
||||
:span-method="spanMethod"
|
||||
:cell-class-name="cellClassName"
|
||||
@select="handleSelectionChange"
|
||||
@cell-dblclick="handleCellDbClick"
|
||||
v-loading="loading"
|
||||
ref="tableRef"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" fixed="left" />
|
||||
<<<<<<< HEAD
|
||||
<el-table-column
|
||||
prop="prescriptionNo"
|
||||
label="处方号"
|
||||
@@ -247,17 +251,80 @@
|
||||
width="100"
|
||||
align="center"
|
||||
>
|
||||
=======
|
||||
<el-table-column prop="prescriptionNo" label="处方号" width="120" align="center" />
|
||||
<el-table-column prop="conditionName" label="诊断" width="120" align="center" />
|
||||
<el-table-column prop="medTypeCode_dictText" label="处方类型" width="120" align="center" />
|
||||
<el-table-column prop="itemName" label="项目名称" width="160" align="center" />
|
||||
<el-table-column prop="merchandiseName" label="商品名称" width="160" align="center" />
|
||||
<el-table-column prop="quantity" label="发药数量" width="130" align="center">
|
||||
<template #default="scope">
|
||||
<span v-if="!scope.row.isEdit" style="color: red">
|
||||
{{ scope.row.quantity }}{{ scope.row.unitCode_dictText }}
|
||||
</span>
|
||||
<div class="lot-number-container" v-if="scope.row.isEdit">
|
||||
<el-input-number
|
||||
v-model="scope.row.quantity"
|
||||
controls-position="right"
|
||||
:controls="false"
|
||||
>
|
||||
<template #suffix>
|
||||
<span>{{ scope.row.unitCode_dictText }}</span>
|
||||
</template>
|
||||
</el-input-number>
|
||||
<el-icon
|
||||
v-if="scope.row.isEdit"
|
||||
class="editable-icon confirm-icon"
|
||||
@click="
|
||||
() => {
|
||||
handleQuantity(scope.row);
|
||||
}
|
||||
"
|
||||
>
|
||||
<Select />
|
||||
</el-icon>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="lotNumber" label="批次号" width="160" align="center">
|
||||
<template #default="scope">
|
||||
<span v-if="!scope.row.isEdit">{{ scope.row.lotNumber }}</span>
|
||||
<div class="lot-number-container" v-if="scope.row.isEdit">
|
||||
<el-select
|
||||
v-model="scope.row.lotNumber"
|
||||
@change="
|
||||
(value) => {
|
||||
scope.row.lotNumber = value;
|
||||
}
|
||||
"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in scope.row.inventoryDetailList"
|
||||
:key="item.inventoryId"
|
||||
:label="formatLotNumberLabel(scope.row, item)"
|
||||
:value="item.inventoryLotNumber"
|
||||
@click="validInventory(scope.row, item)"
|
||||
/>
|
||||
</el-select>
|
||||
<el-icon
|
||||
v-if="getAdjustPriceSwitchState && scope.row.isEdit"
|
||||
class="editable-icon confirm-icon"
|
||||
@click="handleQuantity(scope.row)"
|
||||
>
|
||||
<Select />
|
||||
</el-icon>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="statusEnum_enumText" label="发药状态" width="100" align="center">
|
||||
>>>>>>> v1.3
|
||||
<template #default="scope">
|
||||
<el-tag :type="tagType(scope.row.statusEnum)">
|
||||
{{ scope.row.statusEnum_enumText }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="quantity" label="发药数量" width="100" align="center">
|
||||
<template #default="scope">
|
||||
{{ scope.row.quantity }}{{ scope.row.unitCode_dictText }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dispensePerDuration" label="天数" width="80" align="center" />
|
||||
<!-- <el-table-column prop="flag" label="组合" width="60" align="center" /> -->
|
||||
<!-- <el-table-column prop="quantity" label="发药数量" width="100" align="center" /> -->
|
||||
<el-table-column prop="totalVolume" label="规格" width="100" align="center" />
|
||||
@@ -295,7 +362,6 @@
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="lotNumber" label="批次号" width="120" align="center" />
|
||||
<el-table-column
|
||||
prop="totalPrice"
|
||||
label="金额"
|
||||
@@ -312,9 +378,9 @@
|
||||
align="center"
|
||||
/>
|
||||
<el-table-column prop="doctorName" label="开单医生" width="100" align="center" />
|
||||
<el-table-column prop="conditionName" label="诊断" width="120" align="center" />
|
||||
<!-- <el-table-column prop="dose" label="剂量" width="100" align="center" /> -->
|
||||
<el-table-column prop="rateCode" label="频次" width="100" align="center" />
|
||||
<<<<<<< HEAD
|
||||
<el-table-column
|
||||
prop="methodCode_dictText"
|
||||
label="用法"
|
||||
@@ -327,6 +393,9 @@
|
||||
width="80"
|
||||
align="center"
|
||||
/>
|
||||
=======
|
||||
<el-table-column prop="methodCode_dictText" label="用法" width="100" align="center" />
|
||||
>>>>>>> v1.3
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
@@ -338,7 +407,7 @@
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
:disabled="scope.row.statusEnum != 2"
|
||||
:disabled="!(scope.row.statusEnum == 2 || scope.row.statusEnum == 14)"
|
||||
icon="SuccessFilled"
|
||||
@click="handleBatch(scope.row)"
|
||||
>
|
||||
@@ -404,8 +473,13 @@
|
||||
</template>
|
||||
|
||||
<script setup name="westernmedicine">
|
||||
<<<<<<< HEAD
|
||||
import { ref, computed, onMounted, onBeforeMount } from "vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
=======
|
||||
import { ref, computed, onMounted, onBeforeMount, nextTick } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
>>>>>>> v1.3
|
||||
import {
|
||||
listWesternmedicine,
|
||||
listPatient,
|
||||
@@ -418,6 +492,7 @@ import {
|
||||
deviceDispense,
|
||||
deviceInvalid,
|
||||
devicePatientList,
|
||||
<<<<<<< HEAD
|
||||
} from "./components/api";
|
||||
import { advicePrint } from "@/api/public";
|
||||
import { formatDate, formatDateStr } from "@/utils/index";
|
||||
@@ -426,14 +501,33 @@ import TraceNoDialog from "@/components/OpenHis/TraceNoDialog/index.vue";
|
||||
// 使用window.hiprint,不再从vue-plugin-hiprint导入
|
||||
import templateJson from "./components/templateJson.json";
|
||||
import disposalTemplate from "./components/disposalTemplate.json";
|
||||
=======
|
||||
medicineMatch,
|
||||
getDoctorSignature,
|
||||
} from './components/api';
|
||||
import { advicePrint, getAdjustPriceSwitchState, lotNumberMatch } from '@/api/public';
|
||||
import { formatDate, formatDateStr } from '@/utils/index';
|
||||
import { debounce } from 'lodash-es';
|
||||
import TraceNoDialog from '@/components/OpenHis/TraceNoDialog/index.vue';
|
||||
import { hiprint } from 'vue-plugin-hiprint';
|
||||
// import templateJson from './components/templateJson.json';
|
||||
import templateJson from '@/components/Print/Pharmacy.json';
|
||||
import chineseMedicineTemplateJson from '@/components/Print/ChineseMedicinePrescription.json';
|
||||
import disposalTemplate from './components/disposalTemplate.json';
|
||||
import { formatInventory } from '../../../utils/his';
|
||||
>>>>>>> v1.3
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const showSearch = ref(true);
|
||||
const total = ref(0);
|
||||
const markers = ref([]);
|
||||
const patientList = ref([]);
|
||||
const medicineInfoList = ref([]);
|
||||
const departmentList = ref([]);
|
||||
const dateRange = ref([]);
|
||||
const dateRange = ref([
|
||||
proxy.formatDateStr(new Date().setMonth(new Date().getMonth() - 1), 'YYYY-MM-DD'),
|
||||
proxy.formatDateStr(new Date(), 'YYYY-MM-DD'),
|
||||
]);
|
||||
const personInfo = ref([]);
|
||||
const dispenseStatusOptions = ref([]);
|
||||
const preparerDoctorOptions = ref([]);
|
||||
@@ -453,14 +547,19 @@ const traceNoTemp = ref("");
|
||||
const tcmFlag = ref("0");
|
||||
const openTraceNo = ref(false);
|
||||
const isManualSelection = ref(false);
|
||||
const couldSave = ref(true);
|
||||
const groups = ref({});
|
||||
const openTraceNoDialog = ref(false);
|
||||
<<<<<<< HEAD
|
||||
const ypName = ref("");
|
||||
=======
|
||||
const loading = ref(false);
|
||||
const adjustPriceSwitchState = ref(false);
|
||||
const ypName = ref('');
|
||||
>>>>>>> v1.3
|
||||
const medicineTotalPrice = ref(0);
|
||||
const projectTypeCode = ref("2");
|
||||
const selectedRow = ref(null);
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const medCategoryCode = ref([
|
||||
{
|
||||
label: "西药中成药",
|
||||
@@ -478,6 +577,7 @@ const data = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
condition: null,
|
||||
searchKey: '',
|
||||
departmentId: null,
|
||||
statusEnum: 3,
|
||||
classEnum: 2,
|
||||
@@ -487,7 +587,6 @@ const { queryParams } = toRefs(data);
|
||||
|
||||
// 在组件挂载后调用 getList
|
||||
onMounted(() => {
|
||||
setDefaultDateRange();
|
||||
getList();
|
||||
});
|
||||
function handleScan() {
|
||||
@@ -520,6 +619,7 @@ function submit(value) {
|
||||
}
|
||||
});
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
// 设置默认日期范围为当天
|
||||
function setDefaultDateRange() {
|
||||
const today = new Date();
|
||||
@@ -540,17 +640,30 @@ function getList() {
|
||||
if (projectTypeCode.value == 2) {
|
||||
listPatient(queryParams.value).then((response) => {
|
||||
console.log("Full response1:", response);
|
||||
=======
|
||||
|
||||
function getList() {
|
||||
queryParams.value.receptionTimeSTime = dateRange.value[0] + ' 00:00:00';
|
||||
queryParams.value.receptionTimeETime = dateRange.value[1] + ' 23:59:59';
|
||||
if (projectTypeCode.value == 2) {
|
||||
listPatient(queryParams.value).then((response) => {
|
||||
>>>>>>> v1.3
|
||||
patientList.value = response.data.records;
|
||||
total.value = response.data.total;
|
||||
});
|
||||
} else if (projectTypeCode.value == 3) {
|
||||
<<<<<<< HEAD
|
||||
debugger;
|
||||
devicePatientList(queryParams.value).then((response) => {
|
||||
console.log("Full response1:", response);
|
||||
=======
|
||||
devicePatientList(queryParams.value).then((response) => {
|
||||
>>>>>>> v1.3
|
||||
patientList.value = response.data.records;
|
||||
total.value = response.data.total;
|
||||
});
|
||||
} else {
|
||||
<<<<<<< HEAD
|
||||
Promise.all([
|
||||
listPatient(queryParams.value),
|
||||
devicePatientList(queryParams.value),
|
||||
@@ -575,13 +688,38 @@ function getList() {
|
||||
{ value: null, label: "全部" },
|
||||
...response.data.departmentOptions,
|
||||
];
|
||||
=======
|
||||
Promise.all([listPatient(queryParams.value), devicePatientList(queryParams.value)]).then(
|
||||
([patientRes, deviceRes]) => {
|
||||
// 合并两个接口的数据
|
||||
const patientRecords = patientRes.data.records || [];
|
||||
const deviceRecords = deviceRes.data.records || [];
|
||||
const combinedRecords = [...patientRecords, ...deviceRecords];
|
||||
// 根据 encounterId 去重
|
||||
const uniqueRecords = combinedRecords.filter(
|
||||
(item, index, self) =>
|
||||
index === self.findIndex((record) => record.encounterId === item.encounterId)
|
||||
);
|
||||
patientList.value = uniqueRecords;
|
||||
// 合并总数量(如果需要精确数量,可能需要后端支持)
|
||||
total.value = uniqueRecords.length;
|
||||
}
|
||||
);
|
||||
}
|
||||
listInit().then((response) => {
|
||||
departmentList.value = [{ value: null, label: '全部' }, ...response.data.departmentOptions];
|
||||
>>>>>>> v1.3
|
||||
backReason.value = response.data.notPerformedReasonOptions;
|
||||
dispenseStatusOptions.value = response.data.dispenseStatusOptions;
|
||||
preparerDoctorOptions.value = response.data.preparerDoctorOptions;
|
||||
preparerDoctor.value = preparerDoctorOptions.value[0].value;
|
||||
});
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
//打印中西药处方
|
||||
=======
|
||||
|
||||
>>>>>>> v1.3
|
||||
async function printPrescription() {
|
||||
const selectedRows = tableRef.value.getSelectionRows();
|
||||
if (selectedRows.length === 0) {
|
||||
@@ -601,6 +739,7 @@ async function printPrescription() {
|
||||
groupedRows[prescriptionNo].push(row);
|
||||
});
|
||||
|
||||
<<<<<<< HEAD
|
||||
console.log("按处方号分组的结果:", groupedRows);
|
||||
|
||||
// 如果您需要将分组后的数据转换为数组形式
|
||||
@@ -1136,6 +1275,109 @@ function confirmPrinter(printData) {
|
||||
showPrinterDialog.value = false;
|
||||
window.currentPrintData = null;
|
||||
}
|
||||
=======
|
||||
// 获取所有唯一的doctorId
|
||||
const uniqueDoctorIds = [...new Set(selectedRows.map((row) => row.doctorId).filter((id) => id))];
|
||||
console.log('uniqueDoctorIds:', uniqueDoctorIds);
|
||||
|
||||
// 获取所有选择数据医生的签名信息
|
||||
const doctorSignatures = {};
|
||||
for (const doctorId of uniqueDoctorIds[0]) {
|
||||
const signatureResult = await getDoctorSignature({ practitionerId: doctorId });
|
||||
doctorSignatures[doctorId] = signatureResult?.data || '';
|
||||
}
|
||||
|
||||
let requestIds = selectedRows.map((item) => item.requestId).join(',');
|
||||
const result = [];
|
||||
advicePrint({
|
||||
requestIds: requestIds,
|
||||
isPrescription: projectTypeCode.value == '3' ? undefined : '1',
|
||||
}).then((res) => {
|
||||
if (projectTypeCode.value == '3') {
|
||||
const result = res.data;
|
||||
const printElements = disposalTemplate;
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
|
||||
hiprintTemplate.print2(result, {
|
||||
height: 210,
|
||||
width: 148,
|
||||
});
|
||||
} else {
|
||||
// 将adviceItemList中的chineseHerbsDoseQuantity字段合并到selectedRows中
|
||||
if (res.data.adviceItemList && res.data.adviceItemList.length > 0) {
|
||||
selectedRows.forEach((row) => {
|
||||
// 查找匹配的adviceItem
|
||||
const matchingItem = res.data.adviceItemList.find(
|
||||
(item) =>
|
||||
item.itemName === row.itemName &&
|
||||
item.quantity === row.quantity &&
|
||||
item.prescriptionNo === row.prescriptionNo
|
||||
);
|
||||
// 如果找到匹配项,添加chineseHerbsDoseQuantity字段
|
||||
if (matchingItem && matchingItem.chineseHerbsDoseQuantity !== undefined) {
|
||||
row.chineseHerbsDoseQuantity = matchingItem.chineseHerbsDoseQuantity;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const groupedRows = {};
|
||||
selectedRows.forEach((row) => {
|
||||
const prescriptionNo = row.prescriptionNo;
|
||||
if (!groupedRows[prescriptionNo]) {
|
||||
groupedRows[prescriptionNo] = [];
|
||||
}
|
||||
row.contractName = res.data.contractName;
|
||||
groupedRows[prescriptionNo].push(row);
|
||||
});
|
||||
|
||||
// 转换为数组形式
|
||||
const groupedArray = Object.values(groupedRows);
|
||||
|
||||
groupedArray.forEach((item, index) => {
|
||||
const total = item.reduce((sum, item) => {
|
||||
return sum + (item.totalPrice || 0);
|
||||
}, 0);
|
||||
// 获取该处方对应的医生签名(使用处方中第一个项目的doctorId)
|
||||
const prescriptionDoctorId = item[0]?.doctorId;
|
||||
const doctorSignature = prescriptionDoctorId
|
||||
? doctorSignatures[prescriptionDoctorId] || ''
|
||||
: '';
|
||||
|
||||
result.push({
|
||||
...res.data,
|
||||
medTotalAmount: '¥' + total.toFixed(2) + '元',
|
||||
prescriptionList: item,
|
||||
// 医生签名图片 - 确保使用处方对应的医生签名
|
||||
doctorSignature: doctorSignature,
|
||||
});
|
||||
});
|
||||
// 从patientList.value中根据encounterNo查询idCard
|
||||
result.forEach((item) => {
|
||||
const encounterNo = item.encounterNo;
|
||||
const patient = patientList.value.find((p) => p.encounterNo === encounterNo);
|
||||
if (patient) {
|
||||
item.idCard = patient.idCard;
|
||||
}
|
||||
});
|
||||
|
||||
console.log('药房result', result);
|
||||
// 根据药品分类选择对应的打印模板
|
||||
const printElements = tcmFlag.value === '1' ? chineseMedicineTemplateJson : templateJson;
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
|
||||
hiprintTemplate.print2(result, {
|
||||
height: 210,
|
||||
width: 148,
|
||||
});
|
||||
// 发送任务到打印机成功
|
||||
hiprintTemplate.on('printSuccess', function (e) {
|
||||
console.log('打印成功');
|
||||
});
|
||||
// 发送任务到打印机失败
|
||||
hiprintTemplate.on('printError', function (e) {
|
||||
console.log('打印失败');
|
||||
});
|
||||
}
|
||||
});
|
||||
>>>>>>> v1.3
|
||||
}
|
||||
|
||||
// 取消打印机选择
|
||||
@@ -1145,7 +1387,6 @@ function cancelPrinter() {
|
||||
}
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
setDefaultDateRange();
|
||||
medicineInfoList.value = [];
|
||||
personInfo.value = [];
|
||||
proxy.resetForm("queryRef");
|
||||
@@ -1162,6 +1403,36 @@ function handleQuery() {
|
||||
}
|
||||
queryParams.value.pageNo = 1;
|
||||
getList();
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
}
|
||||
|
||||
function formatLotNumberLabel(row, item) {
|
||||
if (row.unitCode == item.maxUnitCode) {
|
||||
return (
|
||||
item.inventoryLotNumber +
|
||||
' 剩余:' +
|
||||
formatInventory(
|
||||
item.inventoryQuantity,
|
||||
item.partPercent,
|
||||
item.maxUnitCode_dictText,
|
||||
item.inventoryUnitCode_dictText
|
||||
) +
|
||||
' 有效期至:' +
|
||||
proxy.formatDateStr(item.expirationDate, 'YYYY-MM-DD')
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
item.inventoryLotNumber +
|
||||
' ' +
|
||||
item.inventoryQuantity +
|
||||
' ' +
|
||||
item.inventoryUnitCode_dictText +
|
||||
' 有效期至:' +
|
||||
proxy.formatDateStr(item.expirationDate, 'YYYY-MM-DD')
|
||||
);
|
||||
}
|
||||
>>>>>>> v1.3
|
||||
}
|
||||
|
||||
function countGroupRows(data) {
|
||||
@@ -1177,6 +1448,7 @@ function countGroupRows(data) {
|
||||
return groupCounts;
|
||||
}
|
||||
function getRowMarkers(groupCounts, data) {
|
||||
<<<<<<< HEAD
|
||||
const markers = new Array(data.length).fill("");
|
||||
|
||||
// ✅ 兼容 Map 和普通对象
|
||||
@@ -1186,6 +1458,10 @@ function getRowMarkers(groupCounts, data) {
|
||||
: Object.entries(groupCounts);
|
||||
|
||||
entries.forEach(([prescriptionNo, groupInfo]) => {
|
||||
=======
|
||||
const markers = new Array(data.length).fill('');
|
||||
groupCounts.forEach((groupInfo, prescriptionNo) => {
|
||||
>>>>>>> v1.3
|
||||
const { count, indices } = groupInfo;
|
||||
|
||||
if (count === 1) {
|
||||
@@ -1212,8 +1488,7 @@ function getRowMarkers(groupCounts, data) {
|
||||
|
||||
function spanMethod({ row, column, rowIndex, columnIndex }) {
|
||||
// 定义需要合并的列范围(前6列,包括selection列)
|
||||
const columnsToMerge = [1, 16]; // 假设selection列是第0列,其他列依次是1, 2, 3, 4, 5
|
||||
console.log(row);
|
||||
const columnsToMerge = [1, 2, 3, 17]; // 假设selection列是第0列,其他列依次是1, 2, 3, 4, 5
|
||||
// 检查当前列是否在需要合并的列范围内
|
||||
if (row.prescriptionNo) {
|
||||
if (columnsToMerge.includes(columnIndex)) {
|
||||
@@ -1241,6 +1516,26 @@ function spanMethod({ row, column, rowIndex, columnIndex }) {
|
||||
return [1, 1];
|
||||
}
|
||||
|
||||
// 单元格类名设置
|
||||
const cellClassName = ({ row, column, rowIndex, columnIndex }) => {
|
||||
if (columnIndex === 1) {
|
||||
// 要合并的行数
|
||||
const sameDeptRows = medicineInfoList.value.filter(
|
||||
(item) => item.prescriptionNo === row.prescriptionNo
|
||||
);
|
||||
// 找到当前行在列表中第一次出现的索引
|
||||
const firstIndex = medicineInfoList.value.findIndex(
|
||||
(item) => item.prescriptionNo === row.prescriptionNo
|
||||
);
|
||||
|
||||
// 如果是合并的单元格,添加特殊类名
|
||||
if (rowIndex === firstIndex && sameDeptRows.length > 1) {
|
||||
return 'merged-cell colored-cell';
|
||||
}
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
function handleSelectionChange(selectedRows, currentRow) {
|
||||
medicineInfoList.value
|
||||
.filter((item) => {
|
||||
@@ -1251,6 +1546,15 @@ function handleSelectionChange(selectedRows, currentRow) {
|
||||
});
|
||||
}
|
||||
|
||||
function handleCellDbClick(row, column, cellValue, event) {
|
||||
if (
|
||||
adjustPriceSwitchState.value &&
|
||||
(column.property == 'lotNumber' || column.property == 'quantity')
|
||||
) {
|
||||
row.isEdit = true;
|
||||
}
|
||||
}
|
||||
|
||||
function formatPrice(row, column, cellValue) {
|
||||
if (cellValue === null || cellValue === undefined) {
|
||||
return "0.00 元"; // 如果值为空,返回0.00
|
||||
@@ -1260,7 +1564,11 @@ function formatPrice(row, column, cellValue) {
|
||||
|
||||
function tagType(statusEnum) {
|
||||
if (statusEnum == 2 || statusEnum == 2) {
|
||||
<<<<<<< HEAD
|
||||
return "default";
|
||||
=======
|
||||
return 'primary';
|
||||
>>>>>>> v1.3
|
||||
} else if (statusEnum == 4) {
|
||||
return "success";
|
||||
} else if (statusEnum == 5 || statusEnum == 6 || statusEnum == 7) {
|
||||
@@ -1271,11 +1579,30 @@ function tagType(statusEnum) {
|
||||
}
|
||||
|
||||
function handleCurrentChange(row) {
|
||||
loading.value = true;
|
||||
currentRow.value = row; // 更新当前选中行的数据
|
||||
<<<<<<< HEAD
|
||||
console.log("当前选中行的数据:", currentRow.value);
|
||||
=======
|
||||
>>>>>>> v1.3
|
||||
currentRow.value.statusEnum = undefined;
|
||||
currentRow.value.dispenseStatus = queryParams.value.statusEnum;
|
||||
getMedicineList(row.encounterId);
|
||||
getAdjustPriceSwitchState().then((res) => {
|
||||
adjustPriceSwitchState.value = res.data;
|
||||
if (adjustPriceSwitchState.value) {
|
||||
lotNumberMatch({ encounterIdList: row.encounterId })
|
||||
.then((res) => {
|
||||
if (res.code == 200) {
|
||||
getMedicineList(row.encounterId);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
} else {
|
||||
getMedicineList(row.encounterId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getMedicineList(encounterId) {
|
||||
@@ -1313,10 +1640,15 @@ function getMedicineList(encounterId) {
|
||||
|
||||
// 处理合并后的数据
|
||||
processMedicineListData();
|
||||
loading.value = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
<<<<<<< HEAD
|
||||
console.error("获取数据失败:", error);
|
||||
proxy.$modal.msgError("获取数据失败");
|
||||
=======
|
||||
proxy.$modal.msgError('获取数据失败');
|
||||
>>>>>>> v1.3
|
||||
});
|
||||
} else if (projectTypeCode.value == 2) {
|
||||
// 只调用listWesternmedicine接口
|
||||
@@ -1327,7 +1659,10 @@ function getMedicineList(encounterId) {
|
||||
statusEnum: queryParams.value.statusEnum,
|
||||
tcmFlag: tcmFlag.value,
|
||||
}).then((response) => {
|
||||
<<<<<<< HEAD
|
||||
console.log("121212", response);
|
||||
=======
|
||||
>>>>>>> v1.3
|
||||
// personInfo.value = response.data.prescriptionPatientInfoDto;
|
||||
medicineInfoList.value = Array.isArray(response.data.records)
|
||||
? response.data.records
|
||||
@@ -1335,6 +1670,7 @@ function getMedicineList(encounterId) {
|
||||
|
||||
// 处理数据
|
||||
processMedicineListData();
|
||||
loading.value = false;
|
||||
});
|
||||
} else if (projectTypeCode.value == 3) {
|
||||
// 只调用getReportRegisterInit接口
|
||||
@@ -1349,6 +1685,7 @@ function getMedicineList(encounterId) {
|
||||
|
||||
// 处理数据
|
||||
processMedicineListData();
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1396,7 +1733,6 @@ function processMedicineListData() {
|
||||
}
|
||||
|
||||
function submitMedicine(saveList) {
|
||||
console.log(saveList);
|
||||
if (projectTypeCode.value == 1) {
|
||||
// 根据itemTable分类数据
|
||||
const deviceList = saveList.filter(
|
||||
@@ -1421,10 +1757,27 @@ function submitMedicine(saveList) {
|
||||
);
|
||||
}
|
||||
|
||||
let preparationList = medicineList.filter((item) => {
|
||||
return item.statusEnum == 2;
|
||||
}); // 待配药列表
|
||||
let preparedList = medicineList.filter((item) => {
|
||||
return item.statusEnum == 14;
|
||||
}); // 已配药列表
|
||||
|
||||
// 如果有药品数据,调用prepareMedicion接口
|
||||
if (medicineList.length > 0) {
|
||||
if (preparationList.length > 0) {
|
||||
promises.push(
|
||||
prepareMedicion(medicineList).then((res) => {
|
||||
prepareMedicion(preparationList).then((res) => {
|
||||
if (res.code != 200) {
|
||||
throw new Error('药品发药失败');
|
||||
}
|
||||
return res;
|
||||
})
|
||||
);
|
||||
}
|
||||
if (preparedList.length > 0) {
|
||||
promises.push(
|
||||
updateMedicion(preparedList).then((res) => {
|
||||
if (res.code != 200) {
|
||||
throw new Error("药品发药失败");
|
||||
}
|
||||
@@ -1437,8 +1790,8 @@ function submitMedicine(saveList) {
|
||||
Promise.all(promises)
|
||||
.then(() => {
|
||||
// 所有发药都成功后,调用更新接口
|
||||
if (medicineList.length > 0) {
|
||||
return updateMedicion(medicineList);
|
||||
if (preparationList.length > 0) {
|
||||
return updateMedicion(preparationList);
|
||||
}
|
||||
})
|
||||
.then((response) => {
|
||||
@@ -1447,6 +1800,7 @@ function submitMedicine(saveList) {
|
||||
getMedicineList(currentRow.value.encounterId);
|
||||
})
|
||||
.catch((error) => {
|
||||
<<<<<<< HEAD
|
||||
console.error("发药失败:", error);
|
||||
proxy.$modal.msgError("发药失败: " + error.message);
|
||||
});
|
||||
@@ -1459,6 +1813,32 @@ function submitMedicine(saveList) {
|
||||
});
|
||||
}
|
||||
});
|
||||
=======
|
||||
proxy.$modal.msgError('发药失败: ' + error.message);
|
||||
});
|
||||
} else if (projectTypeCode.value == 2) {
|
||||
let preparationList = saveList.filter((item) => {
|
||||
return item.statusEnum == 2;
|
||||
}); // 待配药列表
|
||||
let preparedList = saveList.filter((item) => {
|
||||
return item.statusEnum == 14;
|
||||
}); // 已配药列表
|
||||
if (preparedList.length > 0) {
|
||||
updateMedicion(preparedList).then((response) => {
|
||||
proxy.$modal.msgSuccess('发药成功');
|
||||
getMedicineList(currentRow.value.encounterId);
|
||||
});
|
||||
} else {
|
||||
prepareMedicion(preparationList).then((res) => {
|
||||
if (res.code == 200) {
|
||||
updateMedicion(preparationList).then((response) => {
|
||||
proxy.$modal.msgSuccess('发药成功');
|
||||
getMedicineList(currentRow.value.encounterId);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
>>>>>>> v1.3
|
||||
} else {
|
||||
deviceDispense(saveList).then((res) => {
|
||||
if (res.code == 200) {
|
||||
@@ -1468,6 +1848,43 @@ function submitMedicine(saveList) {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 校验当前批次库存是否充足
|
||||
function validInventory(row, item) {
|
||||
// 统一成小单位数量
|
||||
let quantity = row.quantity;
|
||||
if (row.unitCode == item.maxUnitCode) {
|
||||
quantity = quantity * item.partPercent;
|
||||
}
|
||||
if (quantity > item.inventoryQuantity) {
|
||||
proxy.$modal.msgError('当前批次库存不足');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 校验输入发药数量是否大于总数量
|
||||
function handleQuantity(row) {
|
||||
// 遍历全部药品列表, 计算出与当前行requestId相同的发药数量总数
|
||||
let totalQuantity = 0;
|
||||
medicineInfoList.value.forEach((item) => {
|
||||
if (item.requestId == row.requestId) {
|
||||
totalQuantity += item.quantity;
|
||||
}
|
||||
});
|
||||
if (totalQuantity > row.requestQuantity) {
|
||||
couldSave.value = false;
|
||||
proxy.$modal.msgError('发药数量不能大于总数量');
|
||||
} else if (totalQuantity < row.requestQuantity) {
|
||||
couldSave.value = false;
|
||||
proxy.$modal.msgError('发药数量不能小于总数量');
|
||||
} else {
|
||||
couldSave.value = true;
|
||||
}
|
||||
if (couldSave.value) {
|
||||
row.isEdit = false;
|
||||
}
|
||||
}
|
||||
|
||||
const throttledGetList = debounce(handelTraceNo, 500);
|
||||
const traceNoInput = debounce(handleTraceNoInput, 500);
|
||||
|
||||
@@ -1506,8 +1923,6 @@ function handelTraceNo(value) {
|
||||
traceNoTemp.value = "";
|
||||
// let saveValue = value.substring(inputValue.length + 5, value.length);
|
||||
// inputValue = value;
|
||||
// console.log(value);
|
||||
// console.log(saveValue);
|
||||
// traceNoList.value.push(saveValue);
|
||||
// traceNo.value = value + '[' + (traceNoList.value.length + 1) + ']' + ' ';
|
||||
}
|
||||
@@ -1517,7 +1932,7 @@ function handleBatch(row) {
|
||||
if (row) {
|
||||
saveList = medicineInfoList.value
|
||||
.filter((item) => {
|
||||
return item.dispenseId === row.dispenseId;
|
||||
return item.prescriptionNo === row.prescriptionNo;
|
||||
})
|
||||
.map((item) => {
|
||||
return {
|
||||
@@ -1527,6 +1942,9 @@ function handleBatch(row) {
|
||||
prescriptionNo: item.prescriptionNo,
|
||||
preparerId: preparerDoctor.value,
|
||||
itemTable: item.itemTable,
|
||||
statusEnum: item.statusEnum,
|
||||
quantity: item.quantity,
|
||||
lotNumber: item.lotNumber,
|
||||
};
|
||||
});
|
||||
} else {
|
||||
@@ -1539,12 +1957,16 @@ function handleBatch(row) {
|
||||
prescriptionNo: item.prescriptionNo,
|
||||
preparerId: preparerDoctor.value,
|
||||
itemTable: item.itemTable,
|
||||
statusEnum: item.statusEnum,
|
||||
quantity: item.quantity,
|
||||
lotNumber: item.lotNumber,
|
||||
};
|
||||
});
|
||||
} else {
|
||||
proxy.$modal.msgWarning('未选择要发药的项目,请重新选择,发药失败');
|
||||
return;
|
||||
}
|
||||
}
|
||||
console.log(saveList);
|
||||
|
||||
submitMedicine(saveList);
|
||||
}
|
||||
|
||||
@@ -1614,6 +2036,26 @@ function validate() {
|
||||
width: 74%;
|
||||
}
|
||||
|
||||
/* 表格文字颜色改为纯黑色 */
|
||||
:deep(.el-table) {
|
||||
td,
|
||||
th {
|
||||
color: #000000 !important;
|
||||
}
|
||||
|
||||
.el-table__cell {
|
||||
color: #000000 !important;
|
||||
}
|
||||
|
||||
tbody tr td {
|
||||
color: #000000 !important;
|
||||
}
|
||||
|
||||
thead tr th {
|
||||
color: #000000 !important;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-table tbody tr:hover > td) {
|
||||
background-color: inherit !important;
|
||||
}
|
||||
@@ -1624,4 +2066,57 @@ function validate() {
|
||||
::v-deep.el-textarea .el-textarea__inner {
|
||||
resize: none !important;
|
||||
}
|
||||
|
||||
/* 添加图标悬停样式 */
|
||||
.editable-icon {
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
.editable-icon:hover {
|
||||
color: #409eff; /* Element Plus 主题色,可根据需要调整 */
|
||||
cursor: pointer;
|
||||
}
|
||||
/* 批次号容器样式 */
|
||||
.lot-number-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 确认图标样式 */
|
||||
.confirm-icon {
|
||||
transition: color 0.3s ease;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.confirm-icon:hover {
|
||||
color: #409eff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* 合并单元格基础样式 */
|
||||
:deep(.merged-cell) {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
/* 变色样式 */
|
||||
:deep(.colored-cell) {
|
||||
background-color: #e6f7ff !important; /* 浅蓝色 */
|
||||
border-left: 3px solid #1890ff !important;
|
||||
}
|
||||
|
||||
::v-deep .el-table--border::after,
|
||||
::v-deep .el-table--group::after,
|
||||
::v-deep .el-table::before {
|
||||
background-color: #dddde0;
|
||||
}
|
||||
::v-deep .el-table td,
|
||||
::v-deep .el-table th.is-leaf {
|
||||
border-color: #dddde0;
|
||||
}
|
||||
::v-deep .el-table--border th,
|
||||
::v-deep .el-table--border th.gutter:last-of-type {
|
||||
border-color: #dddde0;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user