提交merge1.3

This commit is contained in:
2025-12-27 15:30:25 +08:00
parent 8c607c8749
commit 088861f66e
1245 changed files with 220442 additions and 77616 deletions

View File

@@ -3,7 +3,11 @@
<div
class="prescription-section"
v-for="(prescription, pIndex) in tcmPrescriptionList"
<<<<<<< HEAD
:key="pIndex"
=======
:key="prescription.id"
>>>>>>> v1.3
>
<div class="section-header">
<div class="title first-prescription">
@@ -18,6 +22,7 @@
<plus />
</el-icon>
<el-icon
<<<<<<< HEAD
class="delete-icon"
title="删除处方单"
@click="handleDeletePrescriptionClick(pIndex)"
@@ -30,6 +35,22 @@
<div class="summary">
<span class="summary-item">药品数: {{ getPrescriptionMedicineCount(pIndex) }}</span>
<span class="summary-item">总价: ¥ {{ getPrescriptionTotalPrice(pIndex) }}</span>
=======
class="add-icon"
title="删除处方"
@click="deletePrescription(prescription)"
style="font-size: 26px !important; margin-left: 10px; color: red"
>
<Delete />
</el-icon>
</div>
<div class="summary">
<span class="summary-item">
药品数:
{{ prescription.prescriptionList ? prescription.prescriptionList.length : '0' }}
</span>
<span class="summary-item">总价: ¥ {{ calculatePrescriptionTotal(pIndex) }}</span>
>>>>>>> v1.3
</div>
</div>
<div>
@@ -41,6 +62,9 @@
<el-button type="danger" plain @click="handleDelete(pIndex)" :disabled="false">
删除
</el-button>
<el-button type="primary" plain @click="handlePrint(pIndex)" :disabled="false">
打印
</el-button>
</div>
<div
class="doctor-station"
@@ -69,10 +93,15 @@
:value="item.accountId"
/>
</el-select>
<<<<<<< HEAD
<span class="doctor-station"> 配方名称 </span>
<el-input v-model="formulaName" placeholder=" " style="width: 100px" />
<span class="doctor-station"> 用药途径 </span>
<el-select v-model="methodCode" placeholder="费用性质" style="width: 120px">
=======
<span class="doctor-station"> 用法 </span>
<el-select v-model="prescription.methodCode" placeholder="用法" style="width: 120px">
>>>>>>> v1.3
<el-option
v-for="dict in method_code"
:key="dict.value"
@@ -134,7 +163,6 @@
<span class="doctor-station" style="float: right"> </span>
</div>
<el-table
max-height="650"
ref="prescriptionRef"
:data="prescription.prescriptionList"
row-key="uniqueKey"
@@ -243,6 +271,7 @@
/>
</template>
</el-select>
<<<<<<< HEAD
<span class="doctor-station"> 脚注: </span>
<el-select
v-model="footNote"
@@ -258,6 +287,25 @@
:value="dict.value">
</el-option>
</el-select>
=======
<!-- 单次剂量 -->
<el-form-item
label="特殊煎法"
prop="dosageInstruction"
class="required-field"
data-prop="dosageInstruction"
>
<el-select
v-model="scope.row.dosageInstruction"
style="width: 90px; margin-right: 20px"
placeholder=" "
>
<template v-for="item in dosage_instruction" :key="item.value">
<el-option :value="item.value" :label="item.label" />
</template>
</el-select>
</el-form-item>
>>>>>>> v1.3
</div>
<span class="total-amount">
总金额:{{
@@ -360,7 +408,7 @@
? formatNumber(scope.row.quantity) +
' ' +
scope.row.doseUnitCode_dictText +
' (' +
' (' +
scope.row.chineseHerbsDoseQuantity +
'付)'
: ''
@@ -404,7 +452,7 @@
<tcmdiagnosisDialog ref="tcmDianosis" :patientInfo="props.patientInfo" @flush="getListInfo()" />
</div>
</template>
<script setup>
import {
getDiagnosisDefinitionList,
@@ -426,7 +474,13 @@ import { calculateQuantityByDays, formatNumber } from '@/utils/his';
import Decimal from 'decimal.js';
import tcmdiagnosisDialog from './tcmdiagnosisDialog';
import { Delete, Minus } from '@element-plus/icons-vue';
<<<<<<< HEAD
=======
import { ElMessage } from 'element-plus';
import printUtils, { PRINT_TEMPLATE } from '@/utils/printUtils';
import { advicePrint } from '@/api/public';
>>>>>>> v1.3
const emit = defineEmits(['selectDiagnosis']);
const total = ref(0);
const queryParams = ref({});
@@ -440,8 +494,19 @@ const encounterId = ref('');
const accountId = ref('');
const encounterDiagnosisId = ref('');
<<<<<<< HEAD
const tcmPrescriptionList = ref([
{
=======
let prescriptionIdCounter = 1;
const generatePrescriptionId = () => {
return `prescription_${Date.now()}_${prescriptionIdCounter++}`;
};
const tcmPrescriptionList = ref([
{
id: generatePrescriptionId(),
>>>>>>> v1.3
prescriptionList: [],
conditionDefinitionId: '',
accountId: '',
@@ -461,6 +526,7 @@ const tcmPrescriptionList = ref([
const unitCodeList = ref([]);
const adviceTableRef = ref([]);
const organization = ref([]);
<<<<<<< HEAD
const conditionDefinitionId = ref('');
const diagnosisName = ref('');
const diagnosisInfo = ref({});
@@ -484,6 +550,11 @@ const rowRules = ref({
rateCode: [{ required: true, message: '请选择频次', trigger: 'change' }],
methodCode: [{ required: true, message: '请选择给药途径', trigger: 'change' }],
orgId: [{ required: true, message: '请选择执行科室', trigger: 'change' }],
=======
const loading = ref(false);
const rowRules = ref({
minUnitQuantity: [{ required: true, message: '请输入单次剂量', trigger: 'change' }],
>>>>>>> v1.3
});
const unitMap = ref({
dose: 'dose',
@@ -513,6 +584,7 @@ const inputRefs = ref({}); // 存储输入框实例
const requiredProps = ref([]); // 存储必填项 prop 顺序
const totalAmount = ref(0);
const tcmDianosis = ref();
<<<<<<< HEAD
const { method_code, unit_code, rate_code, method_of_decocting_medicine,hjerbal_footnotes,distribution_category_code } = proxy.useDict(
'method_code',
'unit_code',
@@ -544,6 +616,17 @@ const adviceTypeList = ref([
value: '',
},
]);
=======
const { method_code, unit_code, rate_code, distribution_category_code, dosage_instruction } =
proxy.useDict(
'method_code',
'unit_code',
'rate_code',
'distribution_category_code',
'dosage_instruction'
);
>>>>>>> v1.3
onMounted(() => {
document.addEventListener('keydown', escKeyListener);
});
@@ -569,6 +652,7 @@ function getList() {
});
}
<<<<<<< HEAD
function getListInfo(addNewRow) {
// 确保isAdding变量存在
if (typeof isAdding !== 'undefined') {
@@ -625,11 +709,89 @@ function getListInfo(addNewRow) {
} else {
console.error('获取医嘱列表失败或数据格式错误:', res);
// 保持当前列表不变,不要清空
=======
async function getListInfo(addNewRow) {
// 重置所有处方的添加状态
tcmPrescriptionList.value.forEach((prescription) => {
prescription.isAdding = false;
});
await getTcmAdviceList({ encounterId: props.patientInfo.encounterId }).then(async (res) => {
// 按 groupId 分组数据
const groupedData = {};
res.data.forEach((item) => {
const groupId = item.groupId || 'default';
if (!groupedData[groupId]) {
groupedData[groupId] = [];
}
groupedData[groupId].push({
...item,
doseQuantity: JSON.parse(item.contentJson)?.doseQuantity,
doseUnitCode_dictText: JSON.parse(item.contentJson)?.doseUnitCode_dictText,
});
});
await getContract({ encounterId: props.patientInfo.encounterId }).then((res) => {
contractList.value = res.data;
});
// 更新处方列表
const groupIds = Object.keys(groupedData);
tcmPrescriptionList.value = groupIds.map((groupId, index) => {
const prescription = tcmPrescriptionList.value[index] || {
id: generatePrescriptionId(),
prescriptionList: [],
conditionDefinitionId: '',
accountId: contractList.value[0].accountId,
methodCode: '',
rateCode: '',
dispensePerDuration: '',
chineseHerbsDoseQuantity: '',
sufferingFlag: '0',
checkAll: false,
groupIndexList: [],
expandOrder: [],
totalAmount: 0,
nextId: 1,
isAdding: false,
};
if (!prescription.id) {
prescription.id = generatePrescriptionId();
}
prescription.prescriptionList = groupedData[groupId];
return prescription;
});
// 如果没有处方数据,确保至少有一个空处方
if (tcmPrescriptionList.value.length === 0) {
tcmPrescriptionList.value.push({
id: generatePrescriptionId(),
prescriptionList: [],
conditionDefinitionId: '',
accountId: contractList.value[0].accountId,
methodCode: '',
rateCode: '',
dispensePerDuration: '',
chineseHerbsDoseQuantity: '',
sufferingFlag: '0',
checkAll: false,
groupIndexList: [],
expandOrder: [],
totalAmount: 0,
nextId: 1,
isAdding: false,
});
}
tcmPrescriptionList.value.accountId = contractList.value[0].accountId;
if (props.activeTab == 'prescription' && addNewRow) {
handleAddMedicine(0);
>>>>>>> v1.3
}
}).catch(error => {
console.error('获取医嘱列表异常:', error);
// 保持当前列表不变,不要清空
});
<<<<<<< HEAD
tcmDiagnosisList.value = getFromDiagnosis(props.patientInfo.encounterId);
@@ -640,6 +802,11 @@ function getListInfo(addNewRow) {
});
accountId.value = props.patientInfo.accountId || '';
=======
tcmDiagnosisList.value = getFromDiagnosis(props.patientInfo.encounterId);
accountId.value = props.patientInfo.accountId;
>>>>>>> v1.3
}
function getDiagnosisInfo() {
@@ -655,7 +822,11 @@ function getDiagnosisInfo() {
});
});
}
<<<<<<< HEAD
// 默认选择第一个诊断
=======
// 默认选择第一个诊断
>>>>>>> v1.3
if (diagnosisList.value.length > 0) {
const firstDiagnosis = diagnosisList.value[0];
tcmPrescriptionList.value.forEach((prescription) => {
@@ -748,27 +919,36 @@ function handleChange(value) {
adviceQueryParams.value.searchKey = value;
}
function openDialog() {
tcmDianosis.value.openDialog();
function addNewPrescription() {
tcmPrescriptionList.value.push({
id: generatePrescriptionId(),
prescriptionList: [],
conditionDefinitionId: '',
accountId: accountId.value,
methodCode: '',
rateCode: '',
dispensePerDuration: '',
chineseHerbsDoseQuantity: '',
sufferingFlag: '0',
checkAll: false,
groupIndexList: [],
expandOrder: [],
totalAmount: 0,
nextId: 1,
isAdding: false,
});
}
function deleteDiagnosisBind(id) {
const data = localStorage.getItem(`tcmDiagnosisList_${props.patientInfo.encounterId}`);
let list = [];
list = JSON.parse(data);
// 添加到列表
const index = list.findIndex((item) => item.id === id);
if (index === -1) return;
function deletePrescription(prescription) {
if (tcmPrescriptionList.value.length <= 1) {
proxy.$modal.msgError('至少保留一张处方');
return;
}
list.splice(index, 1);
localStorage.removeItem(`tcmDiagnosisList_${props.patientInfo.encounterId}`);
// 保存到本地缓存
localStorage.setItem(`tcmDiagnosisList_${props.patientInfo.encounterId}`, JSON.stringify(list));
getListInfo();
}
function addNewPrescription(){
tcmPrescriptionList.value.push({})
const index = tcmPrescriptionList.value.findIndex((p) => p.id === prescription.id);
if (index !== -1) {
tcmPrescriptionList.value.splice(index, 1);
}
}
// 删除处方单
@@ -976,6 +1156,7 @@ function handleDelete(pIndex) {
prescription.expandOrder = [];
prescription.isAdding = false;
adviceQueryParams.value.adviceType = undefined;
<<<<<<< HEAD
// 删除行会出现组号混乱的情况,所以这里重新更新标记
const allPrescriptions = tcmPrescriptionList.value.flatMap(p => p.prescriptionList);
groupMarkers.value = getGroupMarkers(allPrescriptions);
@@ -983,6 +1164,10 @@ function handleDelete(pIndex) {
=======
}
>>>>>>> v1.3
function handleNumberClick(item, index, pIndex) {
const prescription = tcmPrescriptionList.value[pIndex];
prescription.prescriptionList[index].unitPrice = item.price;
@@ -1062,6 +1247,7 @@ function handleSave(pIndex) {
}
// 单行处方保存
<<<<<<< HEAD
function handleSaveSign(row, index) {
try {
// 直接执行保存逻辑,不再进行表单验证
@@ -1171,16 +1357,79 @@ function handleSaveBatch() {
}
// 检查是否有可保存的项目
=======
function handleSaveSign(row, index, pIndex) {
const prescription = tcmPrescriptionList.value[pIndex];
const formRefName = 'formRef' + pIndex + '-' + index;
proxy.$refs[formRefName][0].validate((valid) => {
row.isEdit = false;
prescription.isAdding = false;
prescription.expandOrder = [];
row.contentJson = undefined;
row.patientId = props.patientInfo.patientId;
row.encounterId = props.patientInfo.encounterId;
row.accountId = prescription.accountId;
row.quantity = row.minUnitQuantity;
row.conditionId = prescription.conditionId;
row.unitPrice =
row.unitCodeList.find((item) => item.value == row.unitCode).type == 'unit'
? row.unitPrice
: new Decimal(row.unitPrice).div(row.partPercent).toFixed(2);
row.conditionDefinitionId = prescription.conditionDefinitionId;
row.encounterDiagnosisId = prescription.encounterDiagnosisId;
row.diagnosisName = prescription.diagnosisName;
row.contentJson = JSON.stringify(row);
});
}
function handleSaveBatch(pIndex) {
const prescription = tcmPrescriptionList.value[pIndex];
let timestamp = new Date().getTime();
let saveList = prescription.prescriptionList
.filter((item) => {
return item.statusEnum == 1;
})
.map((item, index) => {
return {
...item,
accountId: accountId.value,
conditionId: prescription.conditionId,
encounterDiagnosisId: prescription.encounterDiagnosisId,
conditionDefinitionId: prescription.conditionDefinitionId,
encounterId: props.patientInfo.encounterId,
patientId: props.patientInfo.patientId,
requestId: item.requestId,
groupId: item.groupId ? item.groupId : timestamp.toString(),
methodCode: prescription.methodCode,
rateCode: prescription.rateCode,
dispensePerDuration: prescription.dispensePerDuration,
chineseHerbsDoseQuantity: prescription.chineseHerbsDoseQuantity,
dbOpType: item.requestId ? '2' : '1',
};
});
>>>>>>> v1.3
if (saveList.length == 0) {
proxy.$modal.msgWarning('当前没有可保存医嘱');
return;
}
<<<<<<< HEAD
// 保存处方
=======
if (
prescription.chineseHerbsDoseQuantity == undefined ||
prescription.chineseHerbsDoseQuantity == 0
) {
proxy.$modal.msgWarning('请输入付数');
return;
}
>>>>>>> v1.3
saveTcmAdvice({ adviceSaveList: saveList }).then((res) => {
if (res.code === 200) {
proxy.$modal.msgSuccess('保存成功');
getListInfo(true);
<<<<<<< HEAD
// 重置所有处方的nextId
tcmPrescriptionList.value.forEach(prescription => {
@@ -1188,6 +1437,9 @@ function handleSaveBatch() {
prescription.nextId = 1;
}
});
=======
prescription.nextId = 1;
>>>>>>> v1.3
}
});
}
@@ -1355,6 +1607,7 @@ function validateGroups(saveList) {
return true;
}
<<<<<<< HEAD
@@ -1368,13 +1621,77 @@ function validateGroups(saveList) {
=======
async function handlePrint(pIndex) {
const prescription = tcmPrescriptionList.value[pIndex];
const selectedRows = prescription.prescriptionList.filter((item) => item.check);
if (selectedRows.length === 0) {
ElMessage.warning('请先选择要打印的处方');
return;
}
// 检查是否有待签发或已退费的记录
const invalidRows = selectedRows.filter(
(item) => item.statusEnum === 1 || item.chargeStatus === 8
);
if (invalidRows.length > 0) {
ElMessage.warning('待签发和已退费的项目不能打印,请重新选择');
return;
}
try {
const performPrint = async (rows) => {
const requestIds = rows.map((item) => item.requestId).join(',');
console.log('中药处方打印开始', requestIds);
const apiParams = { requestIds, isPrescription: '1' };
const res = await advicePrint(apiParams);
const groupedRows = {};
res.data.adviceItemList.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);
const result = groupedArray.map((group) => ({
...res.data,
// 药费
medTotalAmount:
'¥' + group.reduce((sum, item) => sum + (item.totalPrice || 0), 0).toFixed(2) + '元',
prescriptionList: group,
}));
// 使用中药医生处方打印模板
return { result, template: PRINT_TEMPLATE.DOC_CHINESE_MEDICINE_PRESCRIPTION };
};
// 执行打印
const { result, template } = await performPrint(selectedRows);
printUtils.print(template, result);
ElMessage.success('中药处方打印成功');
} catch (error) {
console.error('中药处方打印过程出错:', error);
ElMessage.error('中药处方打印失败: ' + error.message);
}
}
>>>>>>> v1.3
defineExpose({ getListInfo, getDiagnosisInfo });
</script>
<style lang="scss" scoped>
:deep(.el-table__expand-icon) {
display: none !important;
}
.medicine-title {
font-size: 16px;
font-weight: 600;
@@ -1416,9 +1733,11 @@ defineExpose({ getListInfo, getDiagnosisInfo });
.el-input-number .el-input__inner {
text-align: center;
}
.el-table__cell .el-form-item--default {
margin-bottom: 0px;
}
.doctor-station {
color: #606266;
font-size: 14px;
@@ -1480,6 +1799,7 @@ defineExpose({ getListInfo, getDiagnosisInfo });
.add-icon:hover {
background-color: #ecf5ff;
}
<<<<<<< HEAD
.delete-icon {
cursor: pointer;
@@ -1501,4 +1821,7 @@ defineExpose({ getListInfo, getDiagnosisInfo });
.delete-icon.disabled-icon:hover {
background-color: transparent;
}
</style>
</style>
=======
</style>
>>>>>>> v1.3