bug 573 578 584

This commit is contained in:
Ranyunqiao
2026-06-04 17:36:48 +08:00
parent 0eaf133a8d
commit b8d719429d
12 changed files with 446 additions and 46 deletions

View File

@@ -10,8 +10,11 @@ import com.openhis.administration.domain.Patient;
import com.openhis.administration.service.IPatientService;
import com.openhis.clinical.domain.Surgery;
import com.openhis.clinical.service.ISurgeryService;
import com.openhis.common.enums.SurgeryAppStatusEnum;
import com.openhis.surgicalschedule.domain.OpSchedule;
import com.openhis.surgicalschedule.service.IOpScheduleService;
import com.openhis.workflow.domain.ServiceRequest;
import com.openhis.workflow.service.IServiceRequestService;
import com.openhis.web.clinicalmanage.appservice.ISurgicalScheduleAppService;
import com.openhis.web.clinicalmanage.dto.OpCreateScheduleDto;
import com.openhis.web.clinicalmanage.dto.OpScheduleDto;
@@ -63,6 +66,9 @@ public class SurgicalScheduleAppServiceImpl implements ISurgicalScheduleAppServi
@Resource
private RequestFormManageAppMapper requestFormManageAppMapper;
@Resource
private IServiceRequestService iServiceRequestService;
/**
* 分页查询手术安排列表
*
@@ -221,8 +227,26 @@ public class SurgicalScheduleAppServiceImpl implements ISurgicalScheduleAppServi
// 填充缺失的申请科室和主刀医生名称
fillSurgeryMissingNames(surgery);
surgeryService.updateById(surgery);
// 更新 wor_service_request 状态为已安排(5)使住院医生站手术申请tab状态同步
try {
List<ServiceRequest> serviceRequests = iServiceRequestService.list(
new LambdaQueryWrapper<ServiceRequest>()
.eq(ServiceRequest::getPrescriptionNo, opSchedule.getOperCode())
.eq(ServiceRequest::getCategoryEnum, 24)
.eq(ServiceRequest::getDeleteFlag, "0"));
if (serviceRequests != null && !serviceRequests.isEmpty()) {
List<Long> srIds = serviceRequests.stream()
.map(ServiceRequest::getId)
.collect(java.util.stream.Collectors.toList());
iServiceRequestService.updateSurgeryAppStatus(srIds, SurgeryAppStatusEnum.SCHEDULED.getCode());
log.info("更新wor_service_request状态为已安排 - operCode: {}, 更新{}条记录", opSchedule.getOperCode(), srIds.size());
}
} catch (Exception ex) {
log.error("更新wor_service_request状态失败 - operCode: {}", opSchedule.getOperCode(), ex);
}
log.info("更新手术申请单状态为已排期 - surgeryNo: {}, surgeryId: {}", opSchedule.getOperCode(), surgery.getId());
}
} catch (Exception e) {

View File

@@ -12,7 +12,14 @@ import com.core.common.utils.MessageUtils;
import com.core.common.utils.SecurityUtils;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.openhis.administration.domain.ChargeItem;
import com.openhis.administration.domain.Organization;
import com.openhis.administration.service.IChargeItemService;
import com.openhis.administration.service.IOrganizationService;
import com.openhis.administration.service.IPatientService;
import com.openhis.administration.service.IPractitionerService;
import com.openhis.administration.domain.Practitioner;
import com.openhis.clinical.domain.Surgery;
import com.openhis.clinical.service.ISurgeryService;
import com.openhis.common.constant.CommonConstants;
import com.openhis.common.constant.PromptMsgConstant;
import com.openhis.common.enums.*;
@@ -73,6 +80,18 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
@Resource
ISpecimenService iSpecimenService;
@Resource
ISurgeryService iSurgeryService;
@Resource
IOrganizationService iOrganizationService;
@Resource
IPatientService iPatientService;
@Resource
IPractitionerService iPractitionerService;
/**
* 校验当前用户是否有权操作该申请单(申请者本人或管理员)
*/
@@ -419,6 +438,106 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
throw new ServiceException("保存手术医嘱失败: " + e.getMessage());
}
// 🩹 BugFix: 创建 cli_surgery 手术记录,使住院手术申请在门诊手术安排搜索中可见
try {
// 获取申请医生和科室名称
String applyDoctorName = SecurityUtils.getLoginUser().getUser().getNickName();
String applyDeptName = null;
if (SecurityUtils.getLoginUser().getUser().getDept() != null) {
applyDeptName = SecurityUtils.getLoginUser().getUser().getDept().getDeptName();
}
if (applyDeptName == null && orgId != null) {
Organization org = iOrganizationService.getById(orgId);
if (org != null) {
applyDeptName = org.getName();
}
}
Surgery surgery = new Surgery();
surgery.setSurgeryNo(prescriptionNo); // 关键:与 doc_request_form.prescription_no 一致,确保 INNER JOIN 能关联
surgery.setPatientId(patientId);
surgery.setEncounterId(encounterId);
surgery.setApplyDoctorId(practitionerId);
surgery.setApplyDoctorName(applyDoctorName);
surgery.setApplyDeptId(orgId);
surgery.setApplyDeptName(applyDeptName);
surgery.setOrgId(orgId);
surgery.setStatusEnum(0); // 0 = 待排期(新开)
surgery.setDeleteFlag("0");
// 从 descJson 解析主刀医生ID查 adm_practitioner 填充姓名
String mainSurgeonIdStr = descMap != null ? (String) descMap.get("mainSurgeonId") : null;
if (mainSurgeonIdStr != null && !mainSurgeonIdStr.isEmpty()) {
try {
Long mainSurgeonId = Long.parseLong(mainSurgeonIdStr);
surgery.setMainSurgeonId(mainSurgeonId);
Practitioner surgeon = iPractitionerService.getById(mainSurgeonId);
if (surgeon != null && surgeon.getName() != null) {
surgery.setMainSurgeonName(surgeon.getName());
}
} catch (NumberFormatException ignored) {}
}
// 从 descJson 解析手术等级、麻醉方式
String surgeryLevelStr = descMap != null ? (String) descMap.get("surgeryLevel") : null;
if (surgeryLevelStr != null && !surgeryLevelStr.isEmpty()) {
try { surgery.setSurgeryLevel(Integer.parseInt(surgeryLevelStr)); } catch (NumberFormatException ignored) {}
}
String anesthesiaTypeStr = descMap != null ? (String) descMap.get("anesthesiaType") : null;
if (anesthesiaTypeStr != null && !anesthesiaTypeStr.isEmpty()) {
try { surgery.setAnesthesiaTypeEnum(Integer.parseInt(anesthesiaTypeStr)); } catch (NumberFormatException ignored) {}
}
// 填充患者姓名(从 adm_patient 查询)
if (patientId != null) {
try {
com.openhis.administration.domain.Patient patient = iPatientService.getById(patientId);
if (patient != null) {
surgery.setPatientName(patient.getName());
}
} catch (Exception ignored) {}
}
// 从 descJson 解析手术信息
if (descMap != null) {
surgery.setSurgeryName(surgeryName);
surgery.setSurgeryCode(surgeryCode);
surgery.setSurgeryIndication(surgeryIndication);
surgery.setPreoperativeDiagnosis(preoperativeDiagnosis);
// 解析费用
if (surgeryFee != null && !surgeryFee.isEmpty()) {
try { surgery.setSurgeryFee(new BigDecimal(surgeryFee)); } catch (NumberFormatException ignored) {}
}
if (anesthesiaFee != null && !anesthesiaFee.isEmpty()) {
try { surgery.setAnesthesiaFee(new BigDecimal(anesthesiaFee)); } catch (NumberFormatException ignored) {}
}
// 解析计划手术时间
if (plannedTime != null && !plannedTime.isEmpty()) {
try {
surgery.setPlannedTime(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(plannedTime));
} catch (Exception ignored) {}
}
}
// 兜底:若 descJson 解析为空,从 activityList 获取手术名称
if ((surgery.getSurgeryName() == null || surgery.getSurgeryName().isEmpty()) && adviceDefinitionName != null) {
surgery.setSurgeryName(adviceDefinitionName);
}
// 编辑场景:更新已有的 cli_surgery 记录;不存在则新建
Surgery existingSurgery = iSurgeryService.getOne(
new LambdaQueryWrapper<Surgery>().eq(Surgery::getSurgeryNo, prescriptionNo)
.eq(Surgery::getDeleteFlag, "0").last("LIMIT 1"));
if (existingSurgery != null) {
surgery.setId(existingSurgery.getId());
iSurgeryService.updateById(surgery);
log.info("住院手术申请 cli_surgery 记录更新成功surgeryNo={}", prescriptionNo);
} else {
iSurgeryService.save(surgery);
log.info("住院手术申请 cli_surgery 记录创建成功surgeryNo={}, surgeryId={}", prescriptionNo, surgery.getId());
}
} catch (Exception e) {
log.error("创建 cli_surgery 手术记录失败prescriptionNo={}", prescriptionNo, e);
// 不中断主流程,手术安排搜索可见性不影响申请单保存
}
// 生成手术收费项目
try {
ChargeItem surgeryChargeItem = new ChargeItem();

View File

@@ -98,4 +98,12 @@ public class RequestFormPageDto {
* 就诊卡号
*/
private String identifierNo;
/**
* 手术名称(来自 cli_surgery.surgery_name
*/
private String surgeryName;
/**
* 术前诊断(来自 cli_surgery.preoperative_diagnosis
*/
private String preoperativeDiagnosis;
}

View File

@@ -186,11 +186,13 @@
<result column="incision_level" property="incisionLevel"/>
<result column="surgery_level" property="surgeryLevel"/>
<result column="identifier_no" property="identifierNo"/>
<result column="surgery_name" property="surgeryName"/>
<result column="preoperative_diagnosis" property="preoperativeDiagnosis"/>
</resultMap>
<!-- 分页查询申请单 -->
<select id="getRequestFormPage" resultMap="RequestFormPageDtoMap">
SELECT
SELECT DISTINCT
drf.prescription_no AS surgery_no,
drf.desc_json,
drf.create_by AS apply_doctor_name,
@@ -210,6 +212,8 @@
cs.anesthesia_type_enum,
cs.incision_level,
cs.surgery_level,
cs.surgery_name,
cs.preoperative_diagnosis,
fc.contract_name AS fee_type,
COALESCE(pi.identifier_no, ap.bus_no, '') AS identifier_no
FROM doc_request_form drf

View File

@@ -48,11 +48,11 @@ public class OpSchedule extends HisBaseEntity {
private String operName;
/** 术前诊断 */
@TableField(value = "preoperative_diagnosis", insertStrategy = FieldStrategy.NEVER)
@TableField(value = "preoperative_diagnosis")
private String preoperativeDiagnosis;
/** 术后诊断 */
@TableField(value = "postoperative_diagnosis", insertStrategy = FieldStrategy.NEVER)
@TableField(value = "postoperative_diagnosis")
private String postoperativeDiagnosis;
/** 手术安排日期时间 */
@@ -95,43 +95,43 @@ public class OpSchedule extends HisBaseEntity {
private String tableNo;
/** 麻醉方式 */
@TableField(value = "anes_method", insertStrategy = FieldStrategy.NEVER)
@TableField(value = "anes_method")
private String anesMethod;
/** 麻醉医生1编码 */
@TableField(value = "anes_doctor1_code", insertStrategy = FieldStrategy.NEVER)
@TableField(value = "anes_doctor1_code")
private String anesDoctor1Code;
/** 麻醉医生2编码 */
@TableField(value = "anes_doctor2_code", insertStrategy = FieldStrategy.NEVER)
@TableField(value = "anes_doctor2_code")
private String anesDoctor2Code;
/** 麻醉医生3编码 */
@TableField(value = "anes_doctor3_code", insertStrategy = FieldStrategy.NEVER)
@TableField(value = "anes_doctor3_code")
private String anesDoctor3Code;
/** 洗手护士编码 */
@TableField(value = "scrub_nurse_code", insertStrategy = FieldStrategy.NEVER)
@TableField(value = "scrub_nurse_code")
private String scrubNurseCode;
/** 巡回护士1编码 */
@TableField(value = "circu_nurse1_code", insertStrategy = FieldStrategy.NEVER)
@TableField(value = "circu_nurse1_code")
private String circuNurse1Code;
/** 巡回护士2编码 */
@TableField(value = "circu_nurse2_code", insertStrategy = FieldStrategy.NEVER)
@TableField(value = "circu_nurse2_code")
private String circuNurse2Code;
/** 器械护士1编码 */
@TableField(value = "scrub_nurse1_code", insertStrategy = FieldStrategy.NEVER)
@TableField(value = "scrub_nurse1_code")
private String scrubNurse1Code;
/** 器械护士2编码 */
@TableField(value = "scrub_nurse2_code", insertStrategy = FieldStrategy.NEVER)
@TableField(value = "scrub_nurse2_code")
private String scrubNurse2Code;
/** 主刀医生编码 */
@TableField(value = "surgeon_code", insertStrategy = FieldStrategy.NEVER)
@TableField(value = "surgeon_code")
private String surgeonCode;
/** 助手1编码 */

View File

@@ -1509,12 +1509,13 @@ function submitForm() {
if (!form.value.identifierNo) {
form.value.typeCode = undefined;
}
form.value.address = getAddress(form);
// 拼接完整地址用于提交,但不覆写表单字段(避免弹窗关闭前显示全地址)
const submitData = { ...form.value, address: getAddress(form) };
// 判断是修改还是新增
if (form.value.busNo != undefined) {
// 修改患者
updatePatient(form.value).then((response) => {
updatePatient(submitData).then((response) => {
proxy.$modal.msgSuccess('修改成功');
visible.value = false;
// 触发提交成功事件,让父组件刷新列表
@@ -1524,7 +1525,7 @@ function submitForm() {
// console.log('患者就诊卡号:', form.value.identifierNo)
// console.log('患者就诊信息:', form.value.patientIdInfoList)
// 新增患者
addPatient(form.value).then((response) => {
addPatient(submitData).then((response) => {
proxy.$modal.msgSuccess('新增成功');
getPatientInfo(response.data.idCard);
visible.value = false;

View File

@@ -137,8 +137,8 @@ function close() {
emit('close');
}
function clickRow(row) {
selectRow.value = row;
function clickRow(params) {
selectRow.value = params.row;
}
</script>

View File

@@ -124,8 +124,8 @@ function handlePageChange(page) {
}
// 点击行选择诊断
function clickRow(row) {
emit('selectDiagnosis', row);
function clickRow(params) {
emit('selectDiagnosis', params.row);
}
</script>

View File

@@ -166,19 +166,79 @@
</vxe-column>
<vxe-column
title="操作"
min-width="100"
min-width="220"
align="center"
fixed="right"
>
<template #default="scope">
<el-button
link
type="primary"
icon="View"
@click="handleViewDetail(scope.row)"
>
详情
</el-button>
<!-- 待签发编辑 + 详情 + 删除 -->
<template v-if="canManageRow(scope.row) && isPendingStatus(scope.row)">
<el-button
link
type="primary"
@click="handleEdit(scope.row)"
>
编辑
</el-button>
<el-button
link
type="primary"
@click="handleViewDetail(scope.row)"
>
详情
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row)"
>
删除
</el-button>
</template>
<!-- 已签发撤回 + 详情 -->
<template v-else-if="canManageRow(scope.row) && isWithdrawableStatus(scope.row)">
<el-button
link
type="warning"
@click="handleWithdraw(scope.row)"
>
撤回
</el-button>
<el-button
link
type="primary"
@click="handleViewDetail(scope.row)"
>
详情
</el-button>
</template>
<!-- 已校对/已执行/已安排/已完成详情 + 打印 -->
<template v-else-if="isPrintableStatus(scope.row)">
<el-button
link
type="primary"
@click="handleViewDetail(scope.row)"
>
详情
</el-button>
<el-button
link
type="success"
@click="handlePrint(scope.row)"
>
打印
</el-button>
</template>
<!-- 已作废/其他状态仅详情 -->
<template v-else>
<el-button
link
type="primary"
@click="handleViewDetail(scope.row)"
>
详情
</el-button>
</template>
</template>
</vxe-column>
</vxe-table>
@@ -256,7 +316,7 @@
v-if="isFieldMatched(key)"
:label="getFieldLabel(key)"
>
{{ value || '-' }}
{{ getFieldValue(key, value) }}
</el-descriptions-item>
</template>
</el-descriptions>
@@ -309,17 +369,45 @@
</el-button>
</template>
</el-dialog>
<!-- 编辑弹窗 -->
<el-dialog
v-model="editDialogVisible"
title="编辑手术申请单"
width="1200px"
destroy-on-close
:close-on-click-modal="false"
@closed="editRowData = null"
>
<SurgeryForm
ref="editFormRef"
:edit-data="editRowData"
@submit-ok="handleEditSubmitOk"
/>
<template #footer>
<el-button @click="editDialogVisible = false">取消</el-button>
<el-button
type="primary"
@click="submitEditForm"
>
确认修改
</el-button>
</template>
</el-dialog>
</div>
</template>
<script setup>
import {computed, getCurrentInstance, ref, watch} from 'vue';
import {computed, getCurrentInstance, nextTick, ref, watch} from 'vue';
import {Refresh, Search} from '@element-plus/icons-vue';
import {patientInfo} from '../../store/patient.js';
import {getSurgery} from './api';
import {getSurgery, deleteRequestForm, withdrawRequestForm} from './api';
import {getDepartmentList} from '@/api/public.js';
import SurgeryForm from '../order/applicationForm/surgery.vue';
import useUserStore from '@/store/modules/user';
import auth from '@/plugins/auth';
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
const tableData = ref([]);
const loading = ref(false);
@@ -327,6 +415,9 @@ const detailDialogVisible = ref(false);
const currentDetail = ref(null);
const descJsonData = ref(null);
const orgOptions = ref([]);
const editDialogVisible = ref(false);
const editRowData = ref(null);
const editFormRef = ref(null);
// 获取默认日期范围近7天
const getDefaultDateRange = () => {
@@ -412,6 +503,101 @@ const handleRefresh = async () => {
await fetchData();
};
/** 待签发 */
const isPendingStatus = (row) => row.status === 1;
/** 已签发(可撤回) */
const isWithdrawableStatus = (row) => row.status === 2;
/** 已校对/已执行/已安排/已完成(可打印) */
const isPrintableStatus = (row) => [3, 4, 5, 6].includes(row.status);
/** 是否可管理该申请单:申请者本人或管理员 */
const canManageRow = (row) => {
if (auth.hasRole('admin')) return true;
const currentPractitionerId = userStore.practitionerId;
const requesterId = row?.requesterId;
if (!currentPractitionerId || !requesterId) return false;
return String(currentPractitionerId) === String(requesterId);
};
/**
* 编辑手术申请单(待签发状态)
*/
const handleEdit = async (row) => {
editRowData.value = row;
editDialogVisible.value = true;
await nextTick();
editFormRef.value?.getLocationInfo?.();
editFormRef.value?.getDiagnosisList?.();
editFormRef.value?.loadDoctorOptions?.();
if (row.requestFormDetailList?.length > 0) {
editFormRef.value?.fillForm?.(
JSON.parse(row.descJson || '{}'),
row.requestFormDetailList,
row.requestFormId
);
}
};
const handleEditSubmitOk = async () => {
editDialogVisible.value = false;
editRowData.value = null;
proxy.$modal?.msgSuccess?.('修改成功');
await fetchData();
};
const submitEditForm = () => {
if (editFormRef.value?.submit) {
editFormRef.value.submit();
}
};
/**
* 删除手术申请单(仅待签发状态可删除)
*/
const handleDelete = async (row) => {
try {
await proxy.$modal?.confirm?.('确认删除该笔手术申请单吗?删除后数据将无法恢复。');
} catch { return; }
try {
const res = await deleteRequestForm({ requestFormId: row.requestFormId });
if (res?.code === 200) {
proxy.$modal?.msgSuccess?.('删除成功');
await fetchData();
} else {
proxy.$modal?.msgError?.(res?.msg || '删除失败');
}
} catch { /* 响应拦截器已处理错误提示 */ }
};
/**
* 撤回手术申请单(已签发状态可撤回)
*/
const handleWithdraw = async (row) => {
try {
await proxy.$modal?.confirm?.(
'确认撤回该手术申请吗?撤回后将恢复为待签发状态,护士站医嘱校对将同步更新。'
);
} catch { return; }
try {
const res = await withdrawRequestForm({ requestFormId: row.requestFormId });
if (res?.code === 200) {
proxy.$modal?.msgSuccess?.('撤回成功');
await fetchData();
} else {
proxy.$modal?.msgError?.(res?.msg || '撤回失败');
}
} catch { /* 响应拦截器已处理错误提示 */ }
};
/**
* 打印手术申请单:打开详情弹窗后触发浏览器打印
*/
const handlePrint = async (row) => {
await handleViewDetail(row);
nextTick(() => {
window.print();
});
};
/** 手术申请单状态映射 (与后端 SurgeryAppStatusEnum 对齐) */
const statusMap = {
1: { text: '待签发', type: 'info' },
@@ -459,6 +645,20 @@ const getFieldLabel = (key) => {
return labelMap[key] || key;
};
const getFieldValue = (key, value) => {
// 主刀医生/助手优先显示姓名兜底显示ID
if (key === 'mainSurgeonId' && descJsonData.value?.mainSurgeonName) {
return descJsonData.value.mainSurgeonName;
}
if (key === 'assistant1Id' && descJsonData.value?.assistant1Name) {
return descJsonData.value.assistant1Name;
}
if (key === 'assistant2Id' && descJsonData.value?.assistant2Name) {
return descJsonData.value.assistant2Name;
}
return value || '-';
};
const hasMatchedFields = computed(() => {
if (!descJsonData.value) return false;
return Object.keys(descJsonData.value).some((key) => isFieldMatched(key));

View File

@@ -79,8 +79,8 @@ function getList() {
}
}
function clickRow(row) {
emit('selectDiagnosis', row);
function clickRow(params) {
emit('selectDiagnosis', params.row);
}
</script>

View File

@@ -343,6 +343,14 @@ import useUserStore from '@/store/modules/user';
const { proxy } = getCurrentInstance();
const emits = defineEmits(['submitOk']);
const userStore = useUserStore();
const props = defineProps({
editData: {
type: Object,
default: null,
},
});
// 当前编辑的申请单ID编辑模式时有值用于覆盖保存
const editingRequestFormId = ref('');
// 模块级缓存:避免每次打开弹窗都重新请求
let surgeryRecordsCache = null; // 原始 API 记录
let surgeryMappedCache = null; // 映射后的 el-transfer 数据
@@ -454,6 +462,27 @@ const mapToTransferItem = (item) => ({
disabled: false,
});
/**
* 填充编辑表单数据(父组件调用)
* @param {Object} descJson - row.descJson 解析后的对象
* @param {Array} details - row.requestFormDetailList
* @param {string} formId - row.requestFormId
*/
const fillForm = (descJson, details, formId) => {
editingRequestFormId.value = formId || '';
// 回填已选手术项目到穿梭框
const ids = (details || []).map((d) => String(d.adviceDefinitionId));
transferValue.value = ids;
// 回填表单字段
if (descJson) {
Object.keys(form).forEach((key) => {
if (descJson[key] !== undefined && key !== 'primaryDiagnosisList' && key !== 'otherDiagnosisList') {
form[key] = descJson[key];
}
});
}
};
const transferValue = ref([]);
const form = reactive({
// categoryType: '', // 项目类别
@@ -613,12 +642,21 @@ const submit = () => {
accountId: patientInfo.value.accountId,
};
});
// 解析主刀医生、助手姓名,确保 descJson 中存有名称而非纯ID
const surgeonDoc = doctorOptions.value.find(d => d.id === form.mainSurgeonId);
form.mainSurgeonName = surgeonDoc ? surgeonDoc.name : '';
const assistant1Doc = doctorOptions.value.find(d => d.id === form.assistant1Id);
form.assistant1Name = assistant1Doc ? assistant1Doc.name : '';
const assistant2Doc = doctorOptions.value.find(d => d.id === form.assistant2Id);
form.assistant2Name = assistant2Doc ? assistant2Doc.name : '';
saveSurgery({
activityList: applicationListAllFilter,
patientId: patientInfo.value.patientId, //患者ID
encounterId: patientInfo.value.encounterId, // 就诊ID
organizationId: patientInfo.value.inHospitalOrgId, // 医疗机构ID
requestFormId: '', // 申请单ID
requestFormId: editingRequestFormId.value || '', // 编辑时传已有ID新建时为空
name: '手术申请单',
descJson: JSON.stringify(form),
categoryEnum: '24', // 21 检验 22 检查 23 输血 24 手术(避开 adviceType 1-6 碰撞)
@@ -626,6 +664,7 @@ const submit = () => {
if (res.code === 200) {
proxy.$message.success(res.msg);
applicationList.value = [];
editingRequestFormId.value = '';
emits('submitOk');
} else {
proxy.$message.error(res.message);
@@ -681,7 +720,7 @@ function getDiagnosisList() {
}
});
}
defineExpose({ state, submit, getLocationInfo, getDiagnosisList, getList, loadDoctorOptions });
defineExpose({ state, submit, fillForm, getLocationInfo, getDiagnosisList, getList, loadDoctorOptions });
</script>
<style lang="scss" scoped>
.surgery-container {

View File

@@ -1467,7 +1467,7 @@
<vxe-column
title="手术名称"
align="center"
field="descJson.surgeryName"
field="surgeryName"
min-width="140"
show-overflow
/>
@@ -1823,6 +1823,9 @@ const rules = reactive({
anesMethod: [
{ required: true, message: '请选择麻醉方法', trigger: 'change' }
],
preoperativeDiagnosis: [
{ required: true, message: '请输入术前诊断', trigger: 'blur' }
],
surgeonCode: [
{ required: true, message: '请选择主刀医生', trigger: 'change' }
]
@@ -2915,7 +2918,9 @@ function submitForm() {
const submitData = {
...form,
orgId: userStore.orgId,
incisionLevel: form.incisionType
incisionLevel: form.incisionType,
preoperativeDiagnosis: form.preoperativeDiagnosis || '',
postoperativeDiagnosis: form.postoperativeDiagnosis || ''
}
delete submitData.incisionType
if (!form.scheduleId) {
@@ -3028,7 +3033,7 @@ function cancelApplyDialog() {
// 行点击事件处理
function handleApplyRowClick(row) {
const selectedRows = applyTableRef.value?.getSelectionRows ? applyTableRef.value.getSelectionRows() : []
const selectedRows = applyTableRef.value?.getCheckboxRecords ? applyTableRef.value.getCheckboxRecords() : []
// 如果已经有选中的行,先清除所有选择
if (selectedRows.length > 0) {
applyTableRef.value.clearCheckboxRow()
@@ -3040,14 +3045,14 @@ function handleApplyRowClick(row) {
// 表格行样式
function tableRowClassName({ row, rowIndex }) {
// 检查当前行是否被选中
const selectedRows = applyTableRef.value?.getSelectionRows ? applyTableRef.value.getSelectionRows() : []
const selectedRows = applyTableRef.value?.getCheckboxRecords ? applyTableRef.value.getCheckboxRecords() : []
const isSelected = selectedRows.some(selectedRow => selectedRow.surgeryNo === row.surgeryNo)
return isSelected ? 'selected-row' : ''
}
// 控制表格只能单选
function handleSelectable(row, rowIndex) {
const selectedRows = applyTableRef.value?.getSelectionRows ? applyTableRef.value.getSelectionRows() : []
const selectedRows = applyTableRef.value?.getCheckboxRecords ? applyTableRef.value.getCheckboxRecords() : []
// 如果还没有选中的行,或者当前行就是已经选中的行,则允许选择
return selectedRows.length === 0 || selectedRows.some(selectedRow => selectedRow.surgeryNo === row.surgeryNo)
}
@@ -3099,7 +3104,7 @@ const formattedApplyTime = computed(() => {
// 确认手术申请
function confirmApply() {
const selectedRows = applyTableRef.value?.getSelectionRows ? applyTableRef.value.getSelectionRows() : []
const selectedRows = applyTableRef.value?.getCheckboxRecords ? applyTableRef.value.getCheckboxRecords() : []
if (!selectedRows || selectedRows.length === 0) {
proxy.$modal.msgWarning('请先选择一条手术申请记录')
return
@@ -3112,8 +3117,8 @@ function confirmApply() {
form.visitId = selectedRow.encounterId // id对应填入就诊id
form.identifierNo = selectedRow.identifierNo || '' // 就诊卡号
form.operCode = selectedRow.surgeryNo // 手术单号作为手术编码
form.operName = selectedRow.descJson?.surgeryName//手术名称
form.preoperativeDiagnosis = selectedRow.preoperativeDiagnosis || selectedRow.descJson?.preoperativeDiagnosis
form.operName = selectedRow.surgeryName || selectedRow.descJson?.surgeryName//手术名称
form.preoperativeDiagnosis = selectedRow.preoperativeDiagnosis || selectedRow.descJson?.preoperativeDiagnosis || ''
form.patientName = selectedRow.name// 患者姓名对应填入患者姓名
form.gender = selectedRow.gender//患者性别
form.birthDay = selectedRow.birthDay//患者出生日期