修复医嘱保存、签发不成功
This commit is contained in:
@@ -839,7 +839,10 @@
|
||||
<el-tag v-else-if="!scope.row.requestId && scope.row.statusEnum == 1" type="warning">
|
||||
待保存
|
||||
</el-tag>
|
||||
<el-tag v-else-if="scope.row.statusEnum == 1" type="primary">待签发</el-tag>
|
||||
<el-tag v-else-if="scope.row.statusEnum == 1 && scope.row.requestId && !scope.row.isSaved" type="warning">
|
||||
待保存
|
||||
</el-tag>
|
||||
<el-tag v-else-if="scope.row.statusEnum == 1 && scope.row.isSaved" type="primary">待签发</el-tag>
|
||||
<el-tag v-else type="info">{{ scope.row.chargeStatus_enumText }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -1197,6 +1200,13 @@ function refresh() {
|
||||
function getListInfo(addNewRow) {
|
||||
isAdding.value = false;
|
||||
getPrescriptionList(props.patientInfo.encounterId).then((res) => {
|
||||
// 调试日志:显示后端返回的原始数据
|
||||
console.log('[getListInfo] 后端返回的原始数据:', res.data.map(item => ({
|
||||
adviceName: JSON.parse(item.contentJson)?.adviceName,
|
||||
requestId: item.requestId,
|
||||
statusEnum: item.statusEnum,
|
||||
contentJson_isSaved: JSON.parse(item.contentJson)?.isSaved
|
||||
})));
|
||||
prescriptionList.value = res.data.map((item) => {
|
||||
const parsedContent = JSON.parse(item.contentJson);
|
||||
// 确保 skinTestFlag 是数字类型(1 或 0)
|
||||
@@ -1217,10 +1227,17 @@ function getListInfo(addNewRow) {
|
||||
// 对于中成药类型,特别确保adviceName正确设置
|
||||
const adviceName = parsedContent?.adviceName || item?.adviceName || '';
|
||||
|
||||
// 根据后端返回的状态设置 isSaved 标识
|
||||
// statusEnum == 1 且有 requestId 且后端有 isSaved 字段,则使用后端的值
|
||||
// 否则默认为 false(待保存)
|
||||
const isSaved = item.statusEnum === 1 && item.requestId
|
||||
? (parsedContent?.isSaved !== undefined ? parsedContent.isSaved : false)
|
||||
: (item.statusEnum === 2 ? true : false);
|
||||
|
||||
return {
|
||||
...item,
|
||||
...parsedContent,
|
||||
// 确保adviceType是数字类型,以便正确显示文本
|
||||
// 确保 adviceType 是数字类型,以便正确显示文本
|
||||
adviceType: displayAdviceType,
|
||||
doseQuantity: parsedContent?.doseQuantity,
|
||||
doseUnitCode_dictText: parsedContent?.doseUnitCode_dictText,
|
||||
@@ -1230,9 +1247,22 @@ function getListInfo(addNewRow) {
|
||||
rateCode_dictText: parsedContent?.rateCode_dictText || item.rateCode_dictText,
|
||||
methodCode_dictText: parsedContent?.methodCode_dictText || item.methodCode_dictText,
|
||||
dispensePerDuration: parsedContent?.dispensePerDuration || item.dispensePerDuration,
|
||||
adviceName: adviceName, // 确保adviceName正确设置
|
||||
adviceName: adviceName, // 确保 adviceName 正确设置
|
||||
isSaved: isSaved, // 设置 isSaved 标识
|
||||
statusEnum: item.statusEnum, // 关键修复:确保使用后端返回的 statusEnum,不被 parsedContent 覆盖
|
||||
requestId: item.requestId, // 确保 requestId 不被覆盖
|
||||
};
|
||||
});
|
||||
|
||||
// 调试日志:显示所有医嘱的状态
|
||||
console.log('[getListInfo] 刷新后的医嘱列表:', prescriptionList.value.map(item => ({
|
||||
adviceName: item.adviceName,
|
||||
requestId: item.requestId,
|
||||
statusEnum: item.statusEnum,
|
||||
isSaved: item.isSaved,
|
||||
显示状态: item.statusEnum === 2 ? '已签发' : (item.statusEnum === 1 && item.isSaved ? '待签发' : '待保存')
|
||||
})));
|
||||
|
||||
groupMarkers.value = getGroupMarkers(prescriptionList.value); // 更新标记
|
||||
if (props.activeTab == 'prescription' && addNewRow) {
|
||||
handleAddPrescription();
|
||||
@@ -1287,6 +1317,7 @@ function handleAddPrescription() {
|
||||
check: false,
|
||||
isEdit: true,
|
||||
statusEnum: 1,
|
||||
isSaved: false, // 新增医嘱默认为未保存状态
|
||||
});
|
||||
groupMarkers.value = getGroupMarkers(prescriptionList.value);
|
||||
nextTick(() => {
|
||||
@@ -1729,6 +1760,12 @@ function handleOrgChange(value, index) {
|
||||
* 签发处方
|
||||
*/
|
||||
function handleSave() {
|
||||
// 验证费用性质是否已选择
|
||||
if (!accountId.value) {
|
||||
proxy.$modal.msgWarning('请先选择费用性质');
|
||||
return;
|
||||
}
|
||||
|
||||
if (expandOrder.value.length > 0) {
|
||||
proxy.$modal.msgWarning('请先保存当前医嘱');
|
||||
return;
|
||||
@@ -1743,12 +1780,15 @@ function handleSave() {
|
||||
});
|
||||
|
||||
let validList = saveList.filter((item) => {
|
||||
return !item.requestId;
|
||||
return !item.isSaved;
|
||||
});
|
||||
if (validList.length > 0) {
|
||||
proxy.$modal.msgWarning('存在未保存的医嘱,请先点击保存按钮后再执行签发');
|
||||
return;
|
||||
}
|
||||
|
||||
// 只签发已保存的医嘱
|
||||
saveList = saveList.filter((item) => item.isSaved);
|
||||
if (saveList.length == 0) {
|
||||
proxy.$modal.msgWarning('当前无可签发处方');
|
||||
return;
|
||||
@@ -1868,6 +1908,12 @@ function stockFormat(partPercent, unit, minUnit, quantity) {
|
||||
|
||||
// 单行处方保存
|
||||
function handleSaveSign(row, index) {
|
||||
// 验证费用性质是否已选择
|
||||
if (!accountId.value) {
|
||||
proxy.$modal.msgWarning('请先选择费用性质');
|
||||
return;
|
||||
}
|
||||
|
||||
proxy.$refs['formRef' + index].validate((valid) => {
|
||||
if (valid) {
|
||||
row.isEdit = false;
|
||||
@@ -1918,7 +1964,8 @@ function handleSaveSign(row, index) {
|
||||
const rowToSave = {
|
||||
...row,
|
||||
adviceType: saveAdviceType,
|
||||
contentJson: undefined // 确保contentJson不被序列化
|
||||
isSaved: false, // 确定后为待保存状态
|
||||
contentJson: undefined // 确保 contentJson不被序列化
|
||||
};
|
||||
// 对中成药类型(2)特别处理,确保adviceName被正确保存
|
||||
if (row.adviceType == 2) {
|
||||
@@ -1928,9 +1975,10 @@ function handleSaveSign(row, index) {
|
||||
// 恢复原始的adviceType供前端显示使用
|
||||
row.adviceType = row.adviceType;
|
||||
|
||||
// 确认操作应该只保存为待保存状态(DRAFT),不立即签发
|
||||
// 确认操作应该只保存为待保存状态,不设置 isSaved 标识
|
||||
// 这样用户点击保存按钮时才会变为待签发状态
|
||||
row.dbOpType = row.requestId ? '2' : '1';
|
||||
row.isSaved = false; // 确定后为待保存状态
|
||||
savePrescription({ adviceSaveList: [row] }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
proxy.$modal.msgSuccess('保存成功');
|
||||
@@ -1943,6 +1991,12 @@ function handleSaveSign(row, index) {
|
||||
}
|
||||
|
||||
function handleSaveBatch() {
|
||||
// 验证费用性质是否已选择
|
||||
if (!accountId.value) {
|
||||
proxy.$modal.msgWarning('请先选择费用性质');
|
||||
return;
|
||||
}
|
||||
|
||||
if (expandOrder.value.length > 0) {
|
||||
proxy.$modal.msgWarning('请先点击确定确认当前医嘱');
|
||||
return;
|
||||
@@ -1954,12 +2008,28 @@ function handleSaveBatch() {
|
||||
}
|
||||
let saveList = prescriptionList.value
|
||||
.filter((item) => {
|
||||
return item.statusEnum == 1 && !item.requestId;
|
||||
return item.statusEnum == 1 && !item.isSaved;
|
||||
})
|
||||
.map((item) => {
|
||||
// 将前端的耗材类型(4)转换为后端需要的类型(2)
|
||||
const saveAdviceType = item.adviceType == 4 ? 2 : item.adviceType;
|
||||
|
||||
// 创建要序列化的对象
|
||||
const itemToSave = {
|
||||
...item,
|
||||
adviceType: saveAdviceType,
|
||||
isSaved: true, // 保存后设置为待签发状态
|
||||
contentJson: undefined // 避免循环引用
|
||||
};
|
||||
|
||||
// 序列化到 contentJson
|
||||
const contentJson = JSON.stringify(itemToSave);
|
||||
|
||||
return {
|
||||
...item,
|
||||
dbOpType: item.requestId ? '2' : '1',
|
||||
isSaved: true,
|
||||
contentJson: contentJson // 使用新的 contentJson
|
||||
};
|
||||
});
|
||||
if (saveList.length == 0) {
|
||||
@@ -2115,6 +2185,7 @@ function handleSaveGroup(orderGroupList) {
|
||||
unitCode: item.unitCode,
|
||||
unitCode_dictText: item.unitCodeName ? item.unitCodeName : '',
|
||||
statusEnum: 1,
|
||||
isSaved: false, // 组套保存默认为未保存状态
|
||||
dbOpType: prescriptionList.value[rowIndex.value].requestId ? '2' : '1',
|
||||
minUnitQuantity:
|
||||
unitCodeList.value.find((k) => k.value == item.unitCode).type == 'minUnit'
|
||||
|
||||
Reference in New Issue
Block a user