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