提交merge1.3

This commit is contained in:
2025-12-27 15:30:40 +08:00
parent 088861f66e
commit 3c497417dc
167 changed files with 0 additions and 17577 deletions

View File

@@ -3,11 +3,7 @@
<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">
@@ -22,20 +18,6 @@
<plus />
</el-icon>
<el-icon
<<<<<<< HEAD
class="delete-icon"
title="删除处方单"
@click="handleDeletePrescriptionClick(pIndex)"
:class="{ 'disabled-icon': isPrescriptionDeletable(pIndex) !== true }"
style="font-size: 20px !important; margin-left: 10px; color: #f56c6c"
>
<minus />
</el-icon>
</div>
<div class="summary">
<span class="summary-item">药品数: {{ getPrescriptionMedicineCount(pIndex) }}</span>
<span class="summary-item">总价: ¥ {{ getPrescriptionTotalPrice(pIndex) }}</span>
=======
class="add-icon"
title="删除处方"
@click="deletePrescription(prescription)"
@@ -50,7 +32,6 @@
{{ prescription.prescriptionList ? prescription.prescriptionList.length : '0' }}
</span>
<span class="summary-item">总价: ¥ {{ calculatePrescriptionTotal(pIndex) }}</span>
>>>>>>> v1.3
</div>
</div>
<div>
@@ -93,15 +74,8 @@
: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"
@@ -271,23 +245,6 @@
/>
</template>
</el-select>
<<<<<<< HEAD
<span class="doctor-station"> 脚注: </span>
<el-select
v-model="footNote"
filterable
allow-create
default-first-option
style="width: 120px; margin-right: 20px"
placeholder="">
<el-option
v-for="dict in hjerbal_footnotes"
:key="dict.value"
:label="dict.label"
:value="dict.value">
</el-option>
</el-select>
=======
<!-- 单次剂量 -->
<el-form-item
label="特殊煎法"
@@ -305,7 +262,6 @@
</template>
</el-select>
</el-form-item>
>>>>>>> v1.3
</div>
<span class="total-amount">
总金额:{{
@@ -474,13 +430,9 @@ 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({});
@@ -494,10 +446,6 @@ const encounterId = ref('');
const accountId = ref('');
const encounterDiagnosisId = ref('');
<<<<<<< HEAD
const tcmPrescriptionList = ref([
{
=======
let prescriptionIdCounter = 1;
const generatePrescriptionId = () => {
return `prescription_${Date.now()}_${prescriptionIdCounter++}`;
@@ -506,7 +454,6 @@ const generatePrescriptionId = () => {
const tcmPrescriptionList = ref([
{
id: generatePrescriptionId(),
>>>>>>> v1.3
prescriptionList: [],
conditionDefinitionId: '',
accountId: '',
@@ -526,35 +473,9 @@ const tcmPrescriptionList = ref([
const unitCodeList = ref([]);
const adviceTableRef = ref([]);
const organization = ref([]);
<<<<<<< HEAD
const conditionDefinitionId = ref('');
const diagnosisName = ref('');
const diagnosisInfo = ref({});
const rateCode = ref('');
const footNote = ref('');
const decoctionMethod = ref('');
const chineseHerbsDoseQuantity = ref('');
const dispensePerDuration = ref('');
const formulaName = ref('');
const sufferingFlag = ref(false);
const methodCode = ref('');
const loading = ref(false);
const rowRules = ref({
conditionDefinitionId: [{ required: true, message: '请选择诊断', trigger: 'change' }],
minUnitQuantity: [{ required: true, message: '请输入单次剂量', trigger: 'change' }],
doseQuantity: [{ required: true, message: '请输入单次剂量单位', trigger: 'change' }],
quantity: [{ required: true, message: '请输入数量', trigger: 'change' }],
dispensePerDuration: [{ required: true, message: '请输入用药天数', trigger: 'change' }],
formulaName: [{ required: true, message: '请输入配方名称', trigger: 'change' }],
executeNum: [{ required: true, message: '请输入执行次数', trigger: 'change' }],
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',
@@ -584,39 +505,6 @@ 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',
'rate_code',
'method_of_decocting_medicine',
'hjerbal_footnotes',
'distribution_category_code'
);
const adviceTypeList = ref([
{
label: '西药',
value: 1,
},
{
label: '中成药',
value: 2,
},
{
label: '耗材',
value: 3,
},
{
label: '诊疗',
value: 4,
},
{
label: '全部',
value: '',
},
]);
=======
const { method_code, unit_code, rate_code, distribution_category_code, dosage_instruction } =
proxy.useDict(
'method_code',
@@ -626,7 +514,6 @@ const { method_code, unit_code, rate_code, distribution_category_code, dosage_in
'dosage_instruction'
);
>>>>>>> v1.3
onMounted(() => {
document.addEventListener('keydown', escKeyListener);
});
@@ -652,64 +539,6 @@ function getList() {
});
}
<<<<<<< HEAD
function getListInfo(addNewRow) {
// 确保isAdding变量存在
if (typeof isAdding !== 'undefined') {
isAdding.value = false;
}
// 确保有患者信息
if (!props.patientInfo || !props.patientInfo.encounterId) {
console.error('患者信息不完整');
return;
}
getTcmAdviceList({ encounterId: props.patientInfo.encounterId }).then((res) => {
if (res && res.data && Array.isArray(res.data)) {
// 处理返回的数据
if (res.data.length > 0) {
// 如果有数据,清空当前列表并重新添加
tcmPrescriptionList.value = [];
res.data.forEach((item) => {
try {
// 解析contentJson获取完整的医嘱数据
const contentData = item.contentJson ? JSON.parse(item.contentJson) : {};
// 创建一个新的处方对象
const newPrescription = {
...item,
...contentData,
// 确保关键显示字段存在
adviceName: contentData.adviceName || item.adviceName || '',
quantity: contentData.quantity || item.quantity || '',
totalPrice: contentData.totalPrice || item.totalPrice || '',
diagnosisName: contentData.diagnosisName || item.diagnosisName || '',
positionName: contentData.positionName || item.positionName || '',
doseUnitCode_dictText: contentData.doseUnitCode_dictText || item.doseUnitCode_dictText || '',
chineseHerbsDoseQuantity: contentData.chineseHerbsDoseQuantity || item.chineseHerbsDoseQuantity || '',
prescriptionList: [contentData]
};
// 添加到处方列表
tcmPrescriptionList.value.push(newPrescription);
} catch (error) {
console.error('解析医嘱数据失败:', error, '数据项:', item);
}
});
}
// 重新计算总金额
handleTotalAmount();
if (props.activeTab == 'prescription' && addNewRow) {
handleAddMedicine();
}
} else {
console.error('获取医嘱列表失败或数据格式错误:', res);
// 保持当前列表不变,不要清空
=======
async function getListInfo(addNewRow) {
// 重置所有处方的添加状态
tcmPrescriptionList.value.forEach((prescription) => {
@@ -785,28 +614,14 @@ async function getListInfo(addNewRow) {
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);
getContract({ encounterId: props.patientInfo.encounterId }).then((res) => {
contractList.value = res?.data || [];
}).catch(error => {
console.error('获取合同信息失败:', error);
});
accountId.value = props.patientInfo.accountId || '';
=======
tcmDiagnosisList.value = getFromDiagnosis(props.patientInfo.encounterId);
accountId.value = props.patientInfo.accountId;
>>>>>>> v1.3
}
function getDiagnosisInfo() {
@@ -822,11 +637,7 @@ function getDiagnosisInfo() {
});
});
}
<<<<<<< HEAD
// 默认选择第一个诊断
=======
// 默认选择第一个诊断
>>>>>>> v1.3
if (diagnosisList.value.length > 0) {
const firstDiagnosis = diagnosisList.value[0];
tcmPrescriptionList.value.forEach((prescription) => {
@@ -1156,18 +967,8 @@ 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);
}
=======
}
>>>>>>> v1.3
function handleNumberClick(item, index, pIndex) {
const prescription = tcmPrescriptionList.value[pIndex];
prescription.prescriptionList[index].unitPrice = item.price;
@@ -1247,117 +1048,6 @@ function handleSave(pIndex) {
}
// 单行处方保存
<<<<<<< HEAD
function handleSaveSign(row, index) {
try {
// 直接执行保存逻辑,不再进行表单验证
row.isEdit = false;
isAdding.value = false;
expandOrder.value = [];
// 确保必要的字段有值
if (props.patientInfo) {
row.patientId = props.patientInfo.patientId;
row.encounterId = props.patientInfo.encounterId;
}
row.accountId = accountId.value || '';
row.quantity = row.minUnitQuantity || 1; // 确保数量有值
row.conditionId = conditionId.value || '';
row.conditionDefinitionId = conditionDefinitionId.value || '';
row.encounterDiagnosisId = encounterDiagnosisId.value || '';
row.diagnosisName = diagnosisName.value || '';
// 计算单价
if (row.unitCodeList && row.unitCode) {
const unitItem = row.unitCodeList.find((item) => item.value === row.unitCode);
if (unitItem?.type !== 'unit' && row.unitPrice) {
row.unitPrice = new Decimal(row.unitPrice).div(row.partPercent || 1).toFixed(2);
}
}
// 计算总金额
if (row.minUnitQuantity && row.unitPrice) {
row.totalPrice = new Decimal(row.minUnitQuantity).mul(row.unitPrice).toFixed(2);
}
// 确保显示所需的字段都有值
row.adviceName = row.adviceName || '未命名药品';
row.positionName = row.positionName || '默认药房';
// 创建要保存的数据对象,避免循环引用
const saveData = {
...row,
// 排除可能导致循环引用的复杂对象
unitCodeList: undefined,
stockList: undefined,
contentJson: undefined
};
// 序列化数据用于存储
saveData.contentJson = JSON.stringify(saveData);
// 只保存当前行的数据,而不是整个列表
savePrescription({ adviceSaveList: [saveData] }).then((res) => {
if (res && res.code === 200) {
proxy.$modal.msgSuccess('保存成功');
// 此处错误调用getListInfo导致医嘱信息被覆盖从而不显示。
// getListInfo(true);
nextId.value = 1;
} else {
proxy.$modal.msgError('保存失败,请重试');
console.error('保存失败响应:', res);
}
}).catch(error => {
console.error('保存处方失败:', error);
proxy.$modal.msgError('保存失败,请检查网络或联系管理员');
});
} catch (error) {
console.error('处理保存时出错:', error);
proxy.$modal.msgError('操作异常,请重试');
}
}
function handleSaveBatch() {
// 收集所有需要保存的处方项目
let saveList = [];
// 遍历所有处方
for (const prescription of tcmPrescriptionList.value) {
if (prescription.prescriptionList) {
// 检查处方是否有必填的付数
if (!prescription.chineseHerbsDoseQuantity || prescription.chineseHerbsDoseQuantity == 0) {
proxy.$modal.msgWarning('请输入付数');
return;
}
// 收集该处方下需要保存的项目
const itemsToSave = prescription.prescriptionList
.filter((item) => 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(),
chineseHerbsDoseQuantity: prescription.chineseHerbsDoseQuantity,
dbOpType: item.requestId ? '2' : '1',
};
});
// 将项目添加到保存列表
saveList = saveList.concat(itemsToSave);
}
}
// 检查是否有可保存的项目
=======
function handleSaveSign(row, index, pIndex) {
const prescription = tcmPrescriptionList.value[pIndex];
const formRefName = 'formRef' + pIndex + '-' + index;
@@ -1408,15 +1098,10 @@ function handleSaveBatch(pIndex) {
dbOpType: item.requestId ? '2' : '1',
};
});
>>>>>>> v1.3
if (saveList.length == 0) {
proxy.$modal.msgWarning('当前没有可保存医嘱');
return;
}
<<<<<<< HEAD
// 保存处方
=======
if (
prescription.chineseHerbsDoseQuantity == undefined ||
prescription.chineseHerbsDoseQuantity == 0
@@ -1424,22 +1109,11 @@ function handleSaveBatch(pIndex) {
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 => {
if (prescription.nextId) {
prescription.nextId = 1;
}
});
=======
prescription.nextId = 1;
>>>>>>> v1.3
}
});
}
@@ -1607,21 +1281,6 @@ function validateGroups(saveList) {
return true;
}
<<<<<<< HEAD
=======
async function handlePrint(pIndex) {
const prescription = tcmPrescriptionList.value[pIndex];
const selectedRows = prescription.prescriptionList.filter((item) => item.check);
@@ -1683,7 +1342,6 @@ async function handlePrint(pIndex) {
ElMessage.error('中药处方打印失败: ' + error.message);
}
}
>>>>>>> v1.3
defineExpose({ getListInfo, getDiagnosisInfo });
</script>
@@ -1799,29 +1457,4 @@ defineExpose({ getListInfo, getDiagnosisInfo });
.add-icon:hover {
background-color: #ecf5ff;
}
<<<<<<< HEAD
.delete-icon {
cursor: pointer;
border-radius: 50%;
padding: 4px;
transition: all 0.3s ease;
}
.delete-icon:hover {
background-color: #fef0f0;
}
.delete-icon.disabled-icon {
cursor: not-allowed;
color: #c0c4cc !important;
opacity: 0.6;
}
.delete-icon.disabled-icon:hover {
background-color: transparent;
}
</style>
=======
</style>
>>>>>>> v1.3