fix(inpatient): 修复就诊位置更新逻辑
- 修改就诊位置表更新方式,直接更新指定ID的记录 - 添加位置ID设置功能 - 使用updateById方法替代saveOrUpdate方法提高准确性
This commit is contained in:
@@ -265,16 +265,19 @@ public class PatientHomeAppServiceImpl implements IPatientHomeAppService {
|
|||||||
encounterService.saveOrUpdateEncounter(encounter);
|
encounterService.saveOrUpdateEncounter(encounter);
|
||||||
|
|
||||||
// 2.就诊位置表变更
|
// 2.就诊位置表变更
|
||||||
// 就诊位置ID变更
|
// 直接更新指定ID的就诊位置记录
|
||||||
EncounterLocation encounterLocation = new EncounterLocation();
|
EncounterLocation encounterLocation = new EncounterLocation();
|
||||||
encounterLocation.setId(encounterLocationId)
|
encounterLocation.setId(encounterLocationId)
|
||||||
// 设置就诊ID
|
// 设置就诊ID
|
||||||
.setEncounterId(encounterId)
|
.setEncounterId(encounterId)
|
||||||
|
// 设置位置ID
|
||||||
|
.setLocationId(locationId)
|
||||||
// 设置状态枚举
|
// 设置状态枚举
|
||||||
.setStatusEnum(EncounterActivityStatus.COMPLETED.getValue())
|
.setStatusEnum(EncounterActivityStatus.COMPLETED.getValue())
|
||||||
// 设置物理枚举为 8:病床
|
// 设置物理枚举为 8:病床
|
||||||
.setFormEnum(LocationForm.BED.getValue());
|
.setFormEnum(LocationForm.BED.getValue());
|
||||||
encounterLocationService.saveOrUpdateEncounterLocation(encounterLocation);
|
// 直接更新指定ID的记录
|
||||||
|
encounterSuccess = encounterLocationService.updateById(encounterLocation);
|
||||||
|
|
||||||
// 3.位置表
|
// 3.位置表
|
||||||
// 旧病床状态变更(空闲)
|
// 旧病床状态变更(空闲)
|
||||||
|
|||||||
@@ -88,6 +88,7 @@
|
|||||||
v-for="(item, index) in tableData"
|
v-for="(item, index) in tableData"
|
||||||
:key="index"
|
:key="index"
|
||||||
:class="{ 'editing-row': item.editing, 'child-row': item.row.includes('.') }"
|
:class="{ 'editing-row': item.editing, 'child-row': item.row.includes('.') }"
|
||||||
|
@click="handleRowClick(index)"
|
||||||
>
|
>
|
||||||
<td>{{ item.row }}</td>
|
<td>{{ item.row }}</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -967,6 +968,14 @@ async function loadMenuData(menu) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 处理行点击进入编辑状态
|
||||||
|
function handleRowClick(index) {
|
||||||
|
const item = tableData.value[index];
|
||||||
|
if (!item.editing) {
|
||||||
|
item.editing = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 处理编辑按钮点击
|
// 处理编辑按钮点击
|
||||||
function handleEdit(index) {
|
function handleEdit(index) {
|
||||||
const item = tableData.value[index];
|
const item = tableData.value[index];
|
||||||
@@ -982,6 +991,25 @@ function handleCancelEdit(index) {
|
|||||||
// 处理确认按钮点击
|
// 处理确认按钮点击
|
||||||
async function handleConfirm(index) {
|
async function handleConfirm(index) {
|
||||||
const item = tableData.value[index];
|
const item = tableData.value[index];
|
||||||
|
|
||||||
|
// 必填字段验证
|
||||||
|
if (!item.code || item.code.trim() === '') {
|
||||||
|
ElMessage.error('编码不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!item.name || item.name.trim() === '') {
|
||||||
|
ElMessage.error('名称不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!item.type || item.type.trim() === '') {
|
||||||
|
ElMessage.error('检查类型不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!item.department || item.department.trim() === '') {
|
||||||
|
ElMessage.error('执行科室不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 根据当前激活的菜单调用不同的API
|
// 根据当前激活的菜单调用不同的API
|
||||||
if (activeMenu.value === '检查方法') {
|
if (activeMenu.value === '检查方法') {
|
||||||
@@ -1212,9 +1240,24 @@ function handleAddNewRow() {
|
|||||||
function handleAdd(index) {
|
function handleAdd(index) {
|
||||||
const parentRow = tableData.value[index];
|
const parentRow = tableData.value[index];
|
||||||
|
|
||||||
|
// 查找该父行的所有现有子行,确定下一个子行号
|
||||||
|
const parentRowPrefix = parentRow.row + '.';
|
||||||
|
let maxChildNum = 0;
|
||||||
|
|
||||||
|
tableData.value.forEach((item, idx) => {
|
||||||
|
if (item.row.startsWith(parentRowPrefix) && idx > index) {
|
||||||
|
const childNum = parseInt(item.row.split('.').pop());
|
||||||
|
if (childNum > maxChildNum) {
|
||||||
|
maxChildNum = childNum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const nextChildNum = maxChildNum + 1;
|
||||||
|
|
||||||
// 创建子行数据,继承父行的编码
|
// 创建子行数据,继承父行的编码
|
||||||
const childRow = {
|
const childRow = {
|
||||||
row: parentRow.row + '.1', // 子行编号
|
row: parentRow.row + '.' + nextChildNum, // 子行编号
|
||||||
code: parentRow.code, // 继承父行编码
|
code: parentRow.code, // 继承父行编码
|
||||||
name: '',
|
name: '',
|
||||||
type: '',
|
type: '',
|
||||||
|
|||||||
Reference in New Issue
Block a user