Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # openhis-server-new/openhis-application/src/main/java/com/openhis/web/consultation/appservice/impl/ConsultationAppServiceImpl.java
This commit is contained in:
@@ -725,45 +725,69 @@ public class ConsultationAppServiceImpl implements IConsultationAppService {
|
|||||||
|
|
||||||
dto.setInvitedList(invitedDtoList);
|
dto.setInvitedList(invitedDtoList);
|
||||||
|
|
||||||
// 🎯 如果会诊已完成或已签名,填充会诊记录信息(从会诊确认表中获取)
|
|
||||||
|
// 🎯 如果会诊已确认、已签名或已完成,填充会诊记录信息(从会诊确认表中获取)
|
||||||
|
// 会诊状态:20=已确认,30=已签名,40=已完成
|
||||||
if (entity.getConsultationStatus() != null &&
|
if (entity.getConsultationStatus() != null &&
|
||||||
(entity.getConsultationStatus() == ConsultationStatusEnum.SIGNED.getCode() ||
|
entity.getConsultationStatus() >= ConsultationStatusEnum.CONFIRMED.getCode()) {
|
||||||
entity.getConsultationStatus() == ConsultationStatusEnum.COMPLETED.getCode())) {
|
|
||||||
|
|
||||||
// 查询会诊确认记录
|
// 查询会诊确认记录
|
||||||
LambdaQueryWrapper<ConsultationConfirmation> confirmWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ConsultationConfirmation> confirmWrapper = new LambdaQueryWrapper<>();
|
||||||
confirmWrapper.eq(ConsultationConfirmation::getConsultationRequestId, entity.getId());
|
confirmWrapper.eq(ConsultationConfirmation::getConsultationRequestId, entity.getId());
|
||||||
ConsultationConfirmation confirmation = consultationConfirmationMapper.selectOne(confirmWrapper);
|
ConsultationConfirmation confirmation = consultationConfirmationMapper.selectOne(confirmWrapper);
|
||||||
|
|
||||||
// 查询所有已签名的医生(invited_status = 3)
|
// 查询所有已确认和已签名的医生(invited_status >= 20)
|
||||||
|
List<ConsultationInvited> confirmedAndSignedPhysicians = invitedList.stream()
|
||||||
|
.filter(inv -> inv.getInvitedStatus() != null && inv.getInvitedStatus() >= ConsultationStatusEnum.CONFIRMED.getCode())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 查询所有已签名的医生(invited_status >= 30)
|
||||||
List<ConsultationInvited> signedPhysicians = invitedList.stream()
|
List<ConsultationInvited> signedPhysicians = invitedList.stream()
|
||||||
.filter(inv -> inv.getInvitedStatus() != null && inv.getInvitedStatus() >= 3)
|
.filter(inv -> inv.getInvitedStatus() != null && inv.getInvitedStatus() >= ConsultationStatusEnum.SIGNED.getCode())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (confirmation != null) {
|
if (confirmation != null) {
|
||||||
// 1. 会诊确认参加医师:从确认表的confirming_physicians字段取值
|
// 1. 会诊确认参加医师:优先从确认表的confirming_physicians字段取值
|
||||||
if (StringUtils.hasText(confirmation.getConfirmingPhysicians())) {
|
if (StringUtils.hasText(confirmation.getConfirmingPhysicians())) {
|
||||||
dto.setInvitedPhysiciansText(confirmation.getConfirmingPhysicians());
|
dto.setInvitedPhysiciansText(confirmation.getConfirmingPhysicians());
|
||||||
log.info("从会诊确认表获取confirmingPhysicians: {}", confirmation.getConfirmingPhysicians());
|
} else if (!confirmedAndSignedPhysicians.isEmpty()) {
|
||||||
|
// 备用:从invitedList拼接
|
||||||
|
String invitedPhysiciansText = confirmedAndSignedPhysicians.stream()
|
||||||
|
.map(inv -> inv.getInvitedDepartmentName() + "-" + inv.getInvitedPhysicianName())
|
||||||
|
.collect(Collectors.joining("。"));
|
||||||
|
dto.setInvitedPhysiciansText(invitedPhysiciansText);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 会诊意见:从确认表取值
|
// 2. 会诊意见:优先从确认表取值
|
||||||
if (StringUtils.hasText(confirmation.getConsultationOpinion())) {
|
if (StringUtils.hasText(confirmation.getConsultationOpinion())) {
|
||||||
dto.setConsultationOpinion(confirmation.getConsultationOpinion());
|
dto.setConsultationOpinion(confirmation.getConsultationOpinion());
|
||||||
|
} else if (!confirmedAndSignedPhysicians.isEmpty()) {
|
||||||
|
// 备用:从invitedList汇总
|
||||||
|
String consultationOpinion = confirmedAndSignedPhysicians.stream()
|
||||||
|
.filter(inv -> StringUtils.hasText(inv.getConfirmOpinion()))
|
||||||
|
.map(ConsultationInvited::getConfirmOpinion)
|
||||||
|
.collect(Collectors.joining("\n"));
|
||||||
|
dto.setConsultationOpinion(consultationOpinion);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 签名医生信息:从确认表取值
|
// 3. 签名医生、签名时间:从确认表取值
|
||||||
dto.setSignPhysician(confirmation.getSignature());
|
dto.setSignPhysician(confirmation.getSignature());
|
||||||
dto.setSignTime(confirmation.getSignatureDate());
|
dto.setSignTime(confirmation.getSignatureDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 所属医生、代表科室:使用第一个签名的医生(向后兼容)
|
// 4. 所属医生、代表科室:使用第一个确认的医生(向后兼容)
|
||||||
if (!signedPhysicians.isEmpty()) {
|
if (!confirmedAndSignedPhysicians.isEmpty()) {
|
||||||
ConsultationInvited firstSigned = signedPhysicians.get(0);
|
ConsultationInvited firstConfirmed = confirmedAndSignedPhysicians.get(0);
|
||||||
dto.setAttendingPhysician(firstSigned.getInvitedPhysicianName());
|
dto.setAttendingPhysician(firstConfirmed.getInvitedPhysicianName());
|
||||||
dto.setRepresentDepartment(firstSigned.getInvitedDepartmentName());
|
dto.setRepresentDepartment(firstConfirmed.getInvitedDepartmentName());
|
||||||
|
|
||||||
log.info("填充会诊记录信息,已签名医生数:{}", signedPhysicians.size());
|
log.info("填充会诊记录信息,已确认和已签名医生数:{},已签名医生数:{}",
|
||||||
|
confirmedAndSignedPhysicians.size(), signedPhysicians.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("填充会诊记录信息,已确认和已签名医生数:{},已签名医生数:{}",
|
||||||
|
confirmedAndSignedPhysicians.size(), signedPhysicians.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ public class InspectionPackageDetail {
|
|||||||
private LocalDateTime updateTime;
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
/** 删除标志(false-正常,true-删除) */
|
/** 删除标志(false-正常,true-删除) */
|
||||||
|
@TableField(value = "del_flag", fill = FieldFill.INSERT)
|
||||||
@TableLogic(value = "false", delval = "true")
|
@TableLogic(value = "false", delval = "true")
|
||||||
private Boolean delFlag;
|
private Boolean delFlag = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,3 +123,15 @@ export function getConsultationActivities() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取会诊意见列表
|
||||||
|
* @param {String} consultationId 会诊申请单号
|
||||||
|
*/
|
||||||
|
export function getConsultationOpinions(consultationId) {
|
||||||
|
return request({
|
||||||
|
url: '/consultation/confirmation/opinions',
|
||||||
|
method: 'get',
|
||||||
|
params: { consultationId }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,7 @@
|
|||||||
<el-form-item label="时间类型">
|
<el-form-item label="时间类型">
|
||||||
<el-select v-model="queryParams.timeType" placeholder="请选择" style="width: 120px">
|
<el-select v-model="queryParams.timeType" placeholder="请选择" style="width: 120px">
|
||||||
<el-option label="会诊时间" value="consultation" />
|
<el-option label="会诊时间" value="consultation" />
|
||||||
<el-option label="开始时间" value="start" />
|
<el-option label="申请时间" value="request" />
|
||||||
<el-option label="结束时间" value="end" />
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@@ -69,8 +68,6 @@
|
|||||||
<el-option label="全部" value="" />
|
<el-option label="全部" value="" />
|
||||||
<el-option label="未提交" value="0" />
|
<el-option label="未提交" value="0" />
|
||||||
<el-option label="提交" value="10" />
|
<el-option label="提交" value="10" />
|
||||||
<el-option label="已确认" value="20" />
|
|
||||||
<el-option label="已签名" value="30" />
|
|
||||||
<el-option label="结束" value="40" />
|
<el-option label="结束" value="40" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -109,7 +106,7 @@
|
|||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
height="400"
|
height="400"
|
||||||
>
|
>
|
||||||
<el-table-column type="index" label="ID" width="60" align="center" />
|
<el-table-column prop="consultationId" label="ID" min-width="150" align="center" show-overflow-tooltip />
|
||||||
<el-table-column label="急" width="60" align="center">
|
<el-table-column label="急" width="60" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-checkbox :model-value="scope.row.consultationUrgency === '2'" disabled />
|
<el-checkbox :model-value="scope.row.consultationUrgency === '2'" disabled />
|
||||||
@@ -118,25 +115,25 @@
|
|||||||
<el-table-column prop="patientName" label="病人姓名" min-width="100" />
|
<el-table-column prop="patientName" label="病人姓名" min-width="100" />
|
||||||
<el-table-column prop="consultationDate" label="会诊时间" min-width="160">
|
<el-table-column prop="consultationDate" label="会诊时间" min-width="160">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ formatDateTime(scope.row.consultationDate) }}
|
{{ formatDate(scope.row.consultationDate) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="department" label="申请科室" min-width="120" />
|
<el-table-column prop="department" label="申请科室" min-width="120" />
|
||||||
<el-table-column prop="invitedObject" label="邀请对象" min-width="150" show-overflow-tooltip />
|
<el-table-column prop="invitedObject" label="邀请对象" min-width="150" show-overflow-tooltip />
|
||||||
<el-table-column prop="consultationRequestDate" label="申请时间" min-width="160">
|
<el-table-column prop="consultationRequestDate" label="申请时间" min-width="160">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ formatDateTime(scope.row.consultationRequestDate) }}
|
{{ formatDate(scope.row.consultationRequestDate) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="requestingPhysician" label="申请医师" min-width="100" />
|
<el-table-column prop="requestingPhysician" label="申请医师" min-width="100" />
|
||||||
<el-table-column label="提交" width="70" align="center">
|
<el-table-column label="提交" width="70" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-checkbox :model-value="scope.row.consultationStatus >= 10" disabled />
|
<el-checkbox :model-value="scope.row.consultationStatus >= STATUS.SUBMITTED" disabled />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="结束" width="70" align="center">
|
<el-table-column label="结束" width="70" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-checkbox :model-value="scope.row.consultationStatus === 40" disabled />
|
<el-checkbox :model-value="scope.row.consultationStatus === STATUS.ENDED" disabled />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="250" fixed="right" align="center">
|
<el-table-column label="操作" width="250" fixed="right" align="center">
|
||||||
@@ -153,7 +150,7 @@
|
|||||||
size="small"
|
size="small"
|
||||||
:icon="Edit"
|
:icon="Edit"
|
||||||
@click="handleEdit(scope.row)"
|
@click="handleEdit(scope.row)"
|
||||||
:disabled="scope.row.consultationStatus >= 40"
|
:disabled="scope.row.consultationStatus >= STATUS.ENDED"
|
||||||
title="编辑"
|
title="编辑"
|
||||||
/>
|
/>
|
||||||
<el-button
|
<el-button
|
||||||
@@ -168,7 +165,7 @@
|
|||||||
size="small"
|
size="small"
|
||||||
:icon="Delete"
|
:icon="Delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
:disabled="scope.row.consultationStatus >= 40"
|
:disabled="scope.row.consultationStatus >= STATUS.ENDED"
|
||||||
title="作废"
|
title="作废"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@@ -213,7 +210,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="申请时间">
|
<el-form-item label="申请时间">
|
||||||
<el-input :model-value="formatDateTime(formData.consultationRequestDate)" disabled />
|
<el-input :model-value="formatDate(formData.consultationRequestDate)" disabled />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -270,6 +267,14 @@
|
|||||||
<el-input v-model="formData.department" disabled />
|
<el-input v-model="formData.department" disabled />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="紧急程度">
|
||||||
|
<el-checkbox v-model="formData.isUrgent" :true-value="true" :false-value="false">紧急</el-checkbox>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row :gutter="16">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="门诊诊断">
|
<el-form-item label="门诊诊断">
|
||||||
<el-input v-model="formData.provisionalDiagnosis" />
|
<el-input v-model="formData.provisionalDiagnosis" />
|
||||||
@@ -293,8 +298,8 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="会诊邀请参加医师">
|
<el-form-item label="会诊确认参加医师">
|
||||||
<el-input placeholder="请输入参加医师姓名" disabled />
|
<el-input v-model="formData.confirmingPhysician" disabled />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -360,9 +365,9 @@
|
|||||||
import { ref, reactive, onMounted, computed } from 'vue'
|
import { ref, reactive, onMounted, computed } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { Search, Refresh, Printer, Edit, View, Delete } from '@element-plus/icons-vue'
|
import { Search, Refresh, Printer, Edit, View, Delete } from '@element-plus/icons-vue'
|
||||||
import { queryConsultationListPage, cancelConsultation, saveConsultation } from './api'
|
import { queryConsultationListPage, cancelConsultation, saveConsultation, getConsultationOpinions } from './api'
|
||||||
// 迁移到 hiprint
|
|
||||||
import { simplePrint, PRINT_TEMPLATE } from '@/utils/printUtils.js'
|
import { simplePrint, PRINT_TEMPLATE } from '@/utils/printUtils.js'
|
||||||
|
import { formatDate } from '@/utils/index.js'
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const saving = ref(false)
|
const saving = ref(false)
|
||||||
@@ -371,11 +376,10 @@ const currentRow = ref(null)
|
|||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const isViewMode = ref(false)
|
const isViewMode = ref(false)
|
||||||
const formRef = ref(null)
|
const formRef = ref(null)
|
||||||
|
const opinionList = ref([]) // 会诊意见列表
|
||||||
|
|
||||||
// 用于取消请求的控制器
|
|
||||||
let abortController = null
|
let abortController = null
|
||||||
|
|
||||||
// 分页参数
|
|
||||||
const pagination = reactive({
|
const pagination = reactive({
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@@ -393,7 +397,17 @@ const queryParams = reactive({
|
|||||||
patientName: ''
|
patientName: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
const formData = ref({
|
// 会诊状态常量
|
||||||
|
const STATUS = {
|
||||||
|
NOT_SUBMITTED: 0,
|
||||||
|
SUBMITTED: 10,
|
||||||
|
CONFIRMED: 20,
|
||||||
|
SIGNED: 30,
|
||||||
|
ENDED: 40
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始表单数据模板
|
||||||
|
const getInitialFormData = () => ({
|
||||||
id: null,
|
id: null,
|
||||||
consultationId: '',
|
consultationId: '',
|
||||||
patientId: null,
|
patientId: null,
|
||||||
@@ -415,6 +429,7 @@ const formData = ref({
|
|||||||
consultationActivityId: null,
|
consultationActivityId: null,
|
||||||
consultationActivityName: '',
|
consultationActivityName: '',
|
||||||
consultationUrgency: '',
|
consultationUrgency: '',
|
||||||
|
isUrgent: false,
|
||||||
consultationStatus: 0,
|
consultationStatus: 0,
|
||||||
consultationOpinion: '',
|
consultationOpinion: '',
|
||||||
consultingPhysicians: '',
|
consultingPhysicians: '',
|
||||||
@@ -425,9 +440,50 @@ const formData = ref({
|
|||||||
attendingPhysician: '',
|
attendingPhysician: '',
|
||||||
representDepartment: '',
|
representDepartment: '',
|
||||||
signPhysician: '',
|
signPhysician: '',
|
||||||
signTime: null
|
signTime: null,
|
||||||
|
confirmingPhysician: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 从 row 数据填充表单
|
||||||
|
const populateFormData = (row) => ({
|
||||||
|
id: row.id || null,
|
||||||
|
consultationId: row.consultationId || '',
|
||||||
|
patientId: row.patientId || null,
|
||||||
|
patientName: row.patientName || '',
|
||||||
|
genderEnum: row.genderEnum || null,
|
||||||
|
age: row.age || null,
|
||||||
|
patientBusNo: row.patientBusNo || '',
|
||||||
|
patientIdentifierNo: row.patientIdentifierNo || '',
|
||||||
|
encounterId: row.encounterId || null,
|
||||||
|
departmentId: row.departmentId || null,
|
||||||
|
department: row.department || '',
|
||||||
|
requestingPhysicianId: row.requestingPhysicianId || null,
|
||||||
|
requestingPhysician: row.requestingPhysician || '',
|
||||||
|
invitedObject: row.invitedObject || '',
|
||||||
|
consultationDate: row.consultationDate || '',
|
||||||
|
consultationRequestDate: row.consultationRequestDate || null,
|
||||||
|
consultationPurpose: row.consultationPurpose || '',
|
||||||
|
provisionalDiagnosis: row.provisionalDiagnosis || '',
|
||||||
|
consultationActivityId: row.consultationActivityId || null,
|
||||||
|
consultationActivityName: row.consultationActivityName || '',
|
||||||
|
consultationUrgency: row.consultationUrgency || '',
|
||||||
|
isUrgent: row.consultationUrgency === '2',
|
||||||
|
consultationStatus: row.consultationStatus || 0,
|
||||||
|
consultationOpinion: row.consultationOpinion || '',
|
||||||
|
consultingPhysicians: row.consultingPhysicians || '',
|
||||||
|
signingPhysicianId: row.signingPhysicianId || null,
|
||||||
|
signingPhysicianName: row.signingPhysicianName || '',
|
||||||
|
signingTime: row.signingTime || null,
|
||||||
|
invitedPhysiciansText: row.invitedPhysiciansText || '',
|
||||||
|
attendingPhysician: row.attendingPhysician || '',
|
||||||
|
representDepartment: row.representDepartment || '',
|
||||||
|
signPhysician: row.signPhysician || '',
|
||||||
|
signTime: row.signTime || null,
|
||||||
|
confirmingPhysician: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
const formData = ref(getInitialFormData())
|
||||||
|
|
||||||
const formRules = {
|
const formRules = {
|
||||||
requestingPhysician: [
|
requestingPhysician: [
|
||||||
{ required: true, message: '请输入申请医师', trigger: 'blur' }
|
{ required: true, message: '请输入申请医师', trigger: 'blur' }
|
||||||
@@ -444,23 +500,7 @@ const dialogTitle = computed(() => {
|
|||||||
return isViewMode.value ? '会诊申请查看' : '会诊申请编辑'
|
return isViewMode.value ? '会诊申请查看' : '会诊申请编辑'
|
||||||
})
|
})
|
||||||
|
|
||||||
const formatDateTime = (date) => {
|
|
||||||
if (!date) return ''
|
|
||||||
const d = new Date(date)
|
|
||||||
if (isNaN(d.getTime())) return ''
|
|
||||||
|
|
||||||
const pad = (value) => String(value).padStart(2, '0')
|
|
||||||
const yyyy = d.getFullYear()
|
|
||||||
const mm = pad(d.getMonth() + 1)
|
|
||||||
const dd = pad(d.getDate())
|
|
||||||
const hh = pad(d.getHours())
|
|
||||||
const mi = pad(d.getMinutes())
|
|
||||||
const ss = pad(d.getSeconds())
|
|
||||||
return `${yyyy}-${mm}-${dd} ${hh}:${mi}:${ss}`
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleQuery = async () => {
|
const handleQuery = async () => {
|
||||||
// 验证时间范围
|
|
||||||
if (queryParams.startTime && queryParams.endTime) {
|
if (queryParams.startTime && queryParams.endTime) {
|
||||||
const start = new Date(queryParams.startTime)
|
const start = new Date(queryParams.startTime)
|
||||||
const end = new Date(queryParams.endTime)
|
const end = new Date(queryParams.endTime)
|
||||||
@@ -469,8 +509,6 @@ const handleQuery = async () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重置到第一页
|
|
||||||
pagination.currentPage = 1
|
pagination.currentPage = 1
|
||||||
await loadData()
|
await loadData()
|
||||||
}
|
}
|
||||||
@@ -494,16 +532,12 @@ const handleSizeChange = (val) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleCurrentChange = (val) => {
|
const handleCurrentChange = (val) => {
|
||||||
// 如果正在加载,忽略此次操作
|
if (loading.value) return
|
||||||
if (loading.value) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
pagination.currentPage = val
|
pagination.currentPage = val
|
||||||
loadData()
|
loadData()
|
||||||
}
|
}
|
||||||
|
|
||||||
const handlePrint = async (row) => {
|
const handlePrint = async (row) => {
|
||||||
// 优先使用传入的 row,如果没有传入则使用 currentRow
|
|
||||||
const printRow = row || currentRow.value
|
const printRow = row || currentRow.value
|
||||||
|
|
||||||
if (!printRow) {
|
if (!printRow) {
|
||||||
@@ -512,7 +546,6 @@ const handlePrint = async (row) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 构建打印数据
|
|
||||||
const printData = {
|
const printData = {
|
||||||
patientName: printRow.patientName || '',
|
patientName: printRow.patientName || '',
|
||||||
gender: printRow.genderEnum === 1 ? '男' : '女',
|
gender: printRow.genderEnum === 1 ? '男' : '女',
|
||||||
@@ -534,137 +567,76 @@ const handleRowChange = (row) => {
|
|||||||
currentRow.value = row
|
currentRow.value = row
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleEdit = (row) => {
|
// 加载会诊意见列表
|
||||||
// 检查是否已结束
|
const loadConsultationOpinions = async (consultationId) => {
|
||||||
if (row.consultationStatus >= 40) {
|
try {
|
||||||
|
const res = await getConsultationOpinions(consultationId)
|
||||||
|
if (res.code === 200) {
|
||||||
|
opinionList.value = res.data || []
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('加载会诊意见失败', error)
|
||||||
|
opinionList.value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开弹窗的统一方法
|
||||||
|
const openDialog = async (row, viewOnly = false) => {
|
||||||
|
if (!viewOnly && row.consultationStatus >= STATUS.ENDED) {
|
||||||
ElMessage.warning('已结束的会诊申请不可编辑')
|
ElMessage.warning('已结束的会诊申请不可编辑')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
isViewMode.value = viewOnly
|
||||||
|
formData.value = populateFormData(row)
|
||||||
|
|
||||||
isViewMode.value = false
|
// 加载会诊意见列表
|
||||||
// 确保所有字段都复制到formData中
|
await loadConsultationOpinions(row.consultationId)
|
||||||
formData.value = {
|
|
||||||
id: row.id || null,
|
// 从会诊意见中填充会诊记录相关字段
|
||||||
consultationId: row.consultationId || '',
|
if (opinionList.value.length > 0) {
|
||||||
patientId: row.patientId || null,
|
// 获取所有已确认参加的医师名称
|
||||||
patientName: row.patientName || '',
|
const confirmedPhysicians = opinionList.value
|
||||||
genderEnum: row.genderEnum || null,
|
.filter(op => op.physicianName)
|
||||||
age: row.age || null,
|
.map(op => op.physicianName)
|
||||||
patientBusNo: row.patientBusNo || '',
|
.join('、')
|
||||||
patientIdentifierNo: row.patientIdentifierNo || '',
|
formData.value.confirmingPhysician = confirmedPhysicians
|
||||||
encounterId: row.encounterId || null,
|
|
||||||
departmentId: row.departmentId || null,
|
// 取第一条意见填充会诊意见字段
|
||||||
department: row.department || '',
|
const firstOpinion = opinionList.value[0]
|
||||||
requestingPhysicianId: row.requestingPhysicianId || null,
|
formData.value.consultationOpinion = firstOpinion.opinion || ''
|
||||||
requestingPhysician: row.requestingPhysician || '',
|
formData.value.attendingPhysician = firstOpinion.physicianName || ''
|
||||||
invitedObject: row.invitedObject || '',
|
formData.value.representDepartment = firstOpinion.deptName || ''
|
||||||
consultationDate: row.consultationDate || '',
|
|
||||||
consultationRequestDate: row.consultationRequestDate || null,
|
// 查找已签名的意见
|
||||||
consultationPurpose: row.consultationPurpose || '',
|
const signedOpinion = opinionList.value.find(op => op.isSigned)
|
||||||
provisionalDiagnosis: row.provisionalDiagnosis || '',
|
if (signedOpinion) {
|
||||||
consultationActivityId: row.consultationActivityId || null,
|
formData.value.signPhysician = signedOpinion.physicianName || ''
|
||||||
consultationActivityName: row.consultationActivityName || '',
|
formData.value.signTime = signedOpinion.signatureTime || null
|
||||||
consultationUrgency: row.consultationUrgency || '',
|
|
||||||
consultationStatus: row.consultationStatus || 0,
|
|
||||||
consultationOpinion: row.consultationOpinion || '',
|
|
||||||
consultingPhysicians: row.consultingPhysicians || '',
|
|
||||||
signingPhysicianId: row.signingPhysicianId || null,
|
|
||||||
signingPhysicianName: row.signingPhysicianName || '',
|
|
||||||
signingTime: row.signingTime || null,
|
|
||||||
invitedPhysiciansText: row.invitedPhysiciansText || '',
|
|
||||||
attendingPhysician: row.attendingPhysician || '',
|
|
||||||
representDepartment: row.representDepartment || '',
|
|
||||||
signPhysician: row.signPhysician || '',
|
|
||||||
signTime: row.signTime || null
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleView = (row) => {
|
const handleEdit = (row) => openDialog(row, false)
|
||||||
isViewMode.value = true
|
const handleView = (row) => openDialog(row, true)
|
||||||
// 确保所有字段都复制到formData中
|
|
||||||
formData.value = {
|
|
||||||
id: row.id || null,
|
|
||||||
consultationId: row.consultationId || '',
|
|
||||||
patientId: row.patientId || null,
|
|
||||||
patientName: row.patientName || '',
|
|
||||||
genderEnum: row.genderEnum || null,
|
|
||||||
age: row.age || null,
|
|
||||||
patientBusNo: row.patientBusNo || '',
|
|
||||||
patientIdentifierNo: row.patientIdentifierNo || '',
|
|
||||||
encounterId: row.encounterId || null,
|
|
||||||
departmentId: row.departmentId || null,
|
|
||||||
department: row.department || '',
|
|
||||||
requestingPhysicianId: row.requestingPhysicianId || null,
|
|
||||||
requestingPhysician: row.requestingPhysician || '',
|
|
||||||
invitedObject: row.invitedObject || '',
|
|
||||||
consultationDate: row.consultationDate || '',
|
|
||||||
consultationRequestDate: row.consultationRequestDate || null,
|
|
||||||
consultationPurpose: row.consultationPurpose || '',
|
|
||||||
provisionalDiagnosis: row.provisionalDiagnosis || '',
|
|
||||||
consultationActivityId: row.consultationActivityId || null,
|
|
||||||
consultationActivityName: row.consultationActivityName || '',
|
|
||||||
consultationUrgency: row.consultationUrgency || '',
|
|
||||||
consultationStatus: row.consultationStatus || 0,
|
|
||||||
consultationOpinion: row.consultationOpinion || '',
|
|
||||||
consultingPhysicians: row.consultingPhysicians || '',
|
|
||||||
signingPhysicianId: row.signingPhysicianId || null,
|
|
||||||
signingPhysicianName: row.signingPhysicianName || '',
|
|
||||||
signingTime: row.signingTime || null,
|
|
||||||
invitedPhysiciansText: row.invitedPhysiciansText || '',
|
|
||||||
attendingPhysician: row.attendingPhysician || '',
|
|
||||||
representDepartment: row.representDepartment || '',
|
|
||||||
signPhysician: row.signPhysician || '',
|
|
||||||
signTime: row.signTime || null
|
|
||||||
}
|
|
||||||
dialogVisible.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleDialogClose = () => {
|
const handleDialogClose = () => {
|
||||||
formRef.value?.clearValidate()
|
formRef.value?.clearValidate()
|
||||||
formData.value = {
|
formData.value = getInitialFormData()
|
||||||
id: null,
|
opinionList.value = []
|
||||||
consultationId: '',
|
|
||||||
patientId: null,
|
|
||||||
patientName: '',
|
|
||||||
genderEnum: null,
|
|
||||||
age: null,
|
|
||||||
patientBusNo: '',
|
|
||||||
patientIdentifierNo: '',
|
|
||||||
encounterId: null,
|
|
||||||
departmentId: null,
|
|
||||||
department: '',
|
|
||||||
requestingPhysicianId: null,
|
|
||||||
requestingPhysician: '',
|
|
||||||
invitedObject: '',
|
|
||||||
consultationDate: '',
|
|
||||||
consultationRequestDate: null,
|
|
||||||
consultationPurpose: '',
|
|
||||||
provisionalDiagnosis: '',
|
|
||||||
consultationActivityId: null,
|
|
||||||
consultationActivityName: '',
|
|
||||||
consultationUrgency: '',
|
|
||||||
consultationStatus: 0,
|
|
||||||
consultationOpinion: '',
|
|
||||||
consultingPhysicians: '',
|
|
||||||
signingPhysicianId: null,
|
|
||||||
signingPhysicianName: '',
|
|
||||||
signingTime: null,
|
|
||||||
invitedPhysiciansText: '',
|
|
||||||
attendingPhysician: '',
|
|
||||||
representDepartment: '',
|
|
||||||
signPhysician: '',
|
|
||||||
signTime: null
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSave = async () => {
|
const handleSave = async () => {
|
||||||
try {
|
try {
|
||||||
// 表单验证
|
|
||||||
await formRef.value.validate()
|
await formRef.value.validate()
|
||||||
|
|
||||||
saving.value = true
|
saving.value = true
|
||||||
const res = await saveConsultation(formData.value)
|
// 将 isUrgent 转换回 consultationUrgency
|
||||||
|
const submitData = {
|
||||||
|
...formData.value,
|
||||||
|
consultationUrgency: formData.value.isUrgent ? '2' : '1'
|
||||||
|
}
|
||||||
|
const res = await saveConsultation(submitData)
|
||||||
|
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
ElMessage.success('保存成功')
|
ElMessage.success('保存成功')
|
||||||
@@ -684,8 +656,7 @@ const handleSave = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleDelete = async (row) => {
|
const handleDelete = async (row) => {
|
||||||
// 检查是否已结束
|
if (row.consultationStatus >= STATUS.ENDED) {
|
||||||
if (row.consultationStatus >= 40) {
|
|
||||||
ElMessage.warning('已结束的会诊申请不可作废')
|
ElMessage.warning('已结束的会诊申请不可作废')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -717,18 +688,14 @@ const handleDelete = async (row) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const loadData = async () => {
|
const loadData = async () => {
|
||||||
// 如果正在加载,取消上一个请求
|
|
||||||
if (loading.value && abortController) {
|
if (loading.value && abortController) {
|
||||||
abortController.abort()
|
abortController.abort()
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
|
||||||
// 创建新的 AbortController
|
|
||||||
abortController = new AbortController()
|
abortController = new AbortController()
|
||||||
|
|
||||||
// 构建查询参数
|
|
||||||
const queryData = {
|
const queryData = {
|
||||||
department: queryParams.applyDept,
|
department: queryParams.applyDept,
|
||||||
requestingPhysician: queryParams.applyDoctor,
|
requestingPhysician: queryParams.applyDoctor,
|
||||||
@@ -738,22 +705,15 @@ const loadData = async () => {
|
|||||||
consultationUrgency: queryParams.urgency
|
consultationUrgency: queryParams.urgency
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('查询参数:', queryData, '页码:', pagination.currentPage, '每页:', pagination.pageSize)
|
|
||||||
|
|
||||||
const res = await queryConsultationListPage(queryData, pagination.currentPage, pagination.pageSize)
|
const res = await queryConsultationListPage(queryData, pagination.currentPage, pagination.pageSize)
|
||||||
|
|
||||||
console.log('查询结果:', res)
|
|
||||||
|
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
tableData.value = res.data.records || []
|
tableData.value = res.data.records || []
|
||||||
pagination.total = res.data.total || 0
|
pagination.total = res.data.total || 0
|
||||||
|
|
||||||
// 如果没有查询结果,显示提示
|
|
||||||
if (tableData.value.length === 0 && pagination.currentPage === 1) {
|
if (tableData.value.length === 0 && pagination.currentPage === 1) {
|
||||||
ElMessage.info('暂无查询结果')
|
ElMessage.info('暂无查询结果')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 忽略"数据正在处理"的错误提示
|
|
||||||
if (!res.msg || !res.msg.includes('数据正在处理')) {
|
if (!res.msg || !res.msg.includes('数据正在处理')) {
|
||||||
ElMessage.error(res.msg || '加载数据失败')
|
ElMessage.error(res.msg || '加载数据失败')
|
||||||
}
|
}
|
||||||
@@ -761,15 +721,10 @@ const loadData = async () => {
|
|||||||
pagination.total = 0
|
pagination.total = 0
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 忽略取消请求的错误
|
|
||||||
if (error.name === 'AbortError' || error.name === 'CanceledError') {
|
if (error.name === 'AbortError' || error.name === 'CanceledError') {
|
||||||
console.log('请求已取消')
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
console.error('加载数据失败:', error)
|
|
||||||
|
|
||||||
// 忽略"数据正在处理"的错误提示
|
|
||||||
const errorMsg = error.message || error.msg || '网络错误'
|
const errorMsg = error.message || error.msg || '网络错误'
|
||||||
if (!errorMsg.includes('数据正在处理')) {
|
if (!errorMsg.includes('数据正在处理')) {
|
||||||
ElMessage.error('加载数据失败: ' + errorMsg)
|
ElMessage.error('加载数据失败: ' + errorMsg)
|
||||||
|
|||||||
@@ -190,7 +190,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {computed, onMounted, ref} from 'vue';
|
import {computed, onMounted, ref} from 'vue';
|
||||||
import {useRouter} from 'vue-router';
|
import {useRouter} from 'vue-router';
|
||||||
import {ElMessage} from 'element-plus';
|
import {ElMessage, ElMessageBox} from 'element-plus';
|
||||||
import {getLocationTree} from '@/views/charge/outpatientregistration/components/outpatientregistration';
|
import {getLocationTree} from '@/views/charge/outpatientregistration/components/outpatientregistration';
|
||||||
import {listInspectionPackage, delInspectionPackage} from '@/api/system/inspectionPackage';
|
import {listInspectionPackage, delInspectionPackage} from '@/api/system/inspectionPackage';
|
||||||
import { getTenantPage } from '@/api/system/tenant';
|
import { getTenantPage } from '@/api/system/tenant';
|
||||||
|
|||||||
@@ -562,7 +562,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
<span class="form-label">lis分组</span>
|
<span class="form-label">lis分组</span>
|
||||||
<el-select v-model="selectedLisGroup" placeholder="请选择lis分组" style="width: 100%;" :disabled="isViewMode">
|
<el-select
|
||||||
|
v-model="selectedLisGroup"
|
||||||
|
placeholder="请选择lis分组"
|
||||||
|
style="width: 100%;"
|
||||||
|
:disabled="isViewMode"
|
||||||
|
:loading="loadingLisGroup"
|
||||||
|
@visible-change="handleLisGroupVisibleChange"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="group in lisGroupList"
|
v-for="group in lisGroupList"
|
||||||
:key="group.id"
|
:key="group.id"
|
||||||
@@ -841,36 +848,50 @@ const route = useRoute();
|
|||||||
const lisGroupList = ref([]);
|
const lisGroupList = ref([]);
|
||||||
// 选中的LIS分组
|
// 选中的LIS分组
|
||||||
const selectedLisGroup = ref('');
|
const selectedLisGroup = ref('');
|
||||||
|
// LIS分组加载状态
|
||||||
|
const loadingLisGroup = ref(false);
|
||||||
|
|
||||||
|
// 点击展开时才加载LIS分组数据
|
||||||
|
const handleLisGroupVisibleChange = (visible) => {
|
||||||
|
if (visible && lisGroupList.value.length === 0) {
|
||||||
|
getLisGroupList();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 获取就诊科室数据 - 与门诊挂号页面保持一致,在组件初始化时直接调用
|
// 获取就诊科室数据 - 与门诊挂号页面保持一致,在组件初始化时直接调用
|
||||||
getLocationInfo();
|
getLocationInfo();
|
||||||
|
|
||||||
// 获取LIS分组数据
|
// 获取LIS分组数据
|
||||||
const getLisGroupList = async () => {
|
const getLisGroupList = async () => {
|
||||||
|
loadingLisGroup.value = true;
|
||||||
try {
|
try {
|
||||||
const response = await listLisGroup();
|
const response = await listLisGroup({ pageNum: 1, pageSize: 200 });
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
// 适配可能的不同响应格式
|
// 适配可能的不同响应格式
|
||||||
let items = [];
|
let items = [];
|
||||||
|
|
||||||
// 检查响应数据
|
// 检查响应数据
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
// 格式1: {data: {rows: [], total: number}} - 标准分页格式
|
// 格式0: {data: {data: {records: []}}} - 三层嵌套 MyBatisPlus 分页格式(实际后端返回格式)
|
||||||
if (response.data.rows && Array.isArray(response.data.rows)) {
|
if (response.data.data && response.data.data.records && Array.isArray(response.data.data.records)) {
|
||||||
|
items = response.data.data.records;
|
||||||
|
}
|
||||||
|
// 格式1: {data: {records: [], total: number}} - MyBatisPlus 分页格式
|
||||||
|
else if (response.data.records && Array.isArray(response.data.records)) {
|
||||||
|
items = response.data.records;
|
||||||
|
}
|
||||||
|
// 格式2: {data: {rows: [], total: number}} - 标准分页格式
|
||||||
|
else if (response.data.rows && Array.isArray(response.data.rows)) {
|
||||||
items = response.data.rows;
|
items = response.data.rows;
|
||||||
}
|
}
|
||||||
// 格式2: {data: []} - 简单数组格式
|
// 格式3: {data: []} - 简单数组格式
|
||||||
else if (Array.isArray(response.data)) {
|
else if (Array.isArray(response.data)) {
|
||||||
items = response.data;
|
items = response.data;
|
||||||
}
|
}
|
||||||
// 格式3: {data: {data: []}} - 双重嵌套格式
|
// 格式4: {data: {data: []}} - 双重嵌套数组格式
|
||||||
else if (response.data.data && Array.isArray(response.data.data)) {
|
else if (response.data.data && Array.isArray(response.data.data)) {
|
||||||
items = response.data.data;
|
items = response.data.data;
|
||||||
}
|
}
|
||||||
// 格式4: {data: {data: {rows: []}}} - 双重嵌套分页格式
|
|
||||||
else if (response.data.data && response.data.data.rows && Array.isArray(response.data.data.rows)) {
|
|
||||||
items = response.data.data.rows;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lisGroupList.value = items;
|
lisGroupList.value = items;
|
||||||
@@ -878,8 +899,9 @@ const getLisGroupList = async () => {
|
|||||||
ElMessage.error('获取LIS分组数据失败');
|
ElMessage.error('获取LIS分组数据失败');
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取LIS分组数据失败:', error);
|
|
||||||
ElMessage.error('获取LIS分组数据失败');
|
ElMessage.error('获取LIS分组数据失败');
|
||||||
|
} finally {
|
||||||
|
loadingLisGroup.value = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1545,8 +1567,7 @@ const updateItemAmount = (item) => {
|
|||||||
// 更新项目金额
|
// 更新项目金额
|
||||||
item.amount = parseFloat(discountedAmount.toFixed(2));
|
item.amount = parseFloat(discountedAmount.toFixed(2));
|
||||||
|
|
||||||
// 基于折扣后的金额计算服务费
|
// 注意:serviceFee 由用户手动输入,不在此处覆盖
|
||||||
item.serviceFee = calculateItemServiceFee(item);
|
|
||||||
|
|
||||||
// 更新项目总金额
|
// 更新项目总金额
|
||||||
updateItemTotalAmount(item);
|
updateItemTotalAmount(item);
|
||||||
@@ -1624,63 +1645,27 @@ const cancelEditItem = (index) => {
|
|||||||
calculateAmounts();
|
calculateAmounts();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 计算单个项目的服务费(基于折扣后的金额)
|
|
||||||
const calculateItemServiceFee = (item) => {
|
|
||||||
if (!generateServiceFee.value) return 0;
|
|
||||||
|
|
||||||
// 服务费是项目折扣后金额的10%
|
|
||||||
return parseFloat((item.amount * 0.1).toFixed(2));
|
|
||||||
};
|
|
||||||
|
|
||||||
// 重新分配所有项目的服务费(基于折扣后的金额)
|
|
||||||
const redistributeServiceFee = () => {
|
|
||||||
if (!generateServiceFee.value) {
|
|
||||||
// 如果不生成服务费,将所有项目的服务费设为0
|
|
||||||
packageItems.value.forEach(item => {
|
|
||||||
item.serviceFee = 0;
|
|
||||||
updateItemTotalAmount(item);
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 重新计算每个项目的服务费
|
|
||||||
packageItems.value.forEach(item => {
|
|
||||||
item.serviceFee = calculateItemServiceFee(item);
|
|
||||||
updateItemTotalAmount(item);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 计算套餐金额和服务费
|
// 计算套餐金额和服务费
|
||||||
const calculateAmounts = () => {
|
const calculateAmounts = () => {
|
||||||
// 更新每个项目的折扣金额
|
// 更新每个项目的折扣金额和总金额
|
||||||
packageItems.value.forEach(item => {
|
packageItems.value.forEach(item => {
|
||||||
// 计算项目原价金额
|
|
||||||
const originalAmount = (item.quantity || 1) * (item.unitPrice || 0.00);
|
const originalAmount = (item.quantity || 1) * (item.unitPrice || 0.00);
|
||||||
|
|
||||||
// 应用折扣到项目金额
|
|
||||||
let discountedAmount = originalAmount;
|
let discountedAmount = originalAmount;
|
||||||
if (discount.value && !isNaN(parseFloat(discount.value))) {
|
if (discount.value && !isNaN(parseFloat(discount.value))) {
|
||||||
const discountRate = parseFloat(discount.value) / 100;
|
const discountRate = parseFloat(discount.value) / 100;
|
||||||
discountedAmount = originalAmount * (1 - discountRate);
|
discountedAmount = originalAmount * (1 - discountRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新项目金额
|
|
||||||
item.amount = parseFloat(discountedAmount.toFixed(2));
|
item.amount = parseFloat(discountedAmount.toFixed(2));
|
||||||
|
// serviceFee 由用户手动输入,不覆盖;只更新 totalAmount
|
||||||
|
item.totalAmount = parseFloat(((item.amount) + (item.serviceFee || 0)).toFixed(2));
|
||||||
});
|
});
|
||||||
|
|
||||||
// 重新分配所有项目的服务费
|
// 汇总各明细行服务费到基本信息服务费(只读展示)
|
||||||
redistributeServiceFee();
|
|
||||||
|
|
||||||
// 计算套餐总服务费
|
|
||||||
if (generateServiceFee.value) {
|
|
||||||
serviceFee.value = parseFloat(packageItems.value.reduce((sum, item) => sum + (item.serviceFee || 0), 0).toFixed(2));
|
serviceFee.value = parseFloat(packageItems.value.reduce((sum, item) => sum + (item.serviceFee || 0), 0).toFixed(2));
|
||||||
} else {
|
|
||||||
serviceFee.value = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 计算套餐总金额(折扣后金额 + 服务费)
|
// 套餐总金额 = 各行折扣后金额之和 + 各行服务费之和
|
||||||
const totalAmount = packageItems.value.reduce((sum, item) => sum + (item.amount || 0), 0);
|
const totalAmount = packageItems.value.reduce((sum, item) => sum + (item.amount || 0) + (item.serviceFee || 0), 0);
|
||||||
packageAmount.value = parseFloat((totalAmount + serviceFee.value).toFixed(2));
|
packageAmount.value = parseFloat(totalAmount.toFixed(2));
|
||||||
};
|
};
|
||||||
|
|
||||||
const itemNameRefs = ref([]);
|
const itemNameRefs = ref([]);
|
||||||
@@ -1890,7 +1875,6 @@ const handleAdd = (row, index) => {
|
|||||||
ElMessage.success('删除成功');
|
ElMessage.success('删除成功');
|
||||||
getInspectionTypeList();
|
getInspectionTypeList();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error('删除检验类型失败:', error);
|
|
||||||
ElMessage.error('删除失败: ' + (error.response?.data?.msg || '未知错误'));
|
ElMessage.error('删除失败: ' + (error.response?.data?.msg || '未知错误'));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -2230,14 +2214,15 @@ const handleSave = () => {
|
|||||||
unit: item.unit,
|
unit: item.unit,
|
||||||
unitPrice: item.unitPrice,
|
unitPrice: item.unitPrice,
|
||||||
amount: item.amount,
|
amount: item.amount,
|
||||||
serviceFee: item.serviceFee,
|
serviceFee: item.serviceFee || 0,
|
||||||
totalAmount: item.totalAmount,
|
totalAmount: parseFloat(((item.amount || 0) + (item.serviceFee || 0)).toFixed(2)),
|
||||||
origin: item.origin,
|
origin: item.origin,
|
||||||
createTime: new Date().toISOString(),
|
createTime: new Date().toISOString(),
|
||||||
updateTime: new Date().toISOString()
|
updateTime: new Date().toISOString()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 调用保存API(暂时使用模拟保存,后续对接真实API)
|
|
||||||
|
// 调用保存API
|
||||||
savePackageData(basicInfo, detailData);
|
savePackageData(basicInfo, detailData);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2708,7 +2693,7 @@ onMounted(async () => {
|
|||||||
// 1. 启动其他基础数据的加载(这些不需要等待,并行执行即可)
|
// 1. 启动其他基础数据的加载(这些不需要等待,并行执行即可)
|
||||||
loadParentTypes();
|
loadParentTypes();
|
||||||
getInspectionTypeList();
|
getInspectionTypeList();
|
||||||
getLisGroupList();
|
// getLisGroupList(); // 改为点击下拉框时懒加载
|
||||||
|
|
||||||
// 2. 【关键】等待机构列表加载完成
|
// 2. 【关键】等待机构列表加载完成
|
||||||
// 等函数执行完成
|
// 等函数执行完成
|
||||||
|
|||||||
@@ -482,6 +482,8 @@ const organizationOptions = ref([])
|
|||||||
const diagnosisTreatmentList = ref([])
|
const diagnosisTreatmentList = ref([])
|
||||||
// 过滤后的诊疗项目列表(用于搜索)
|
// 过滤后的诊疗项目列表(用于搜索)
|
||||||
const filteredDiagnosisList = ref([])
|
const filteredDiagnosisList = ref([])
|
||||||
|
// lis分组列表
|
||||||
|
const lisGroupOptions = ref([])
|
||||||
// 加载状态
|
// 加载状态
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
|
||||||
@@ -738,11 +740,27 @@ onMounted(async () => {
|
|||||||
// 加载卫生机构列表(只获取启用的租户)
|
// 加载卫生机构列表(只获取启用的租户)
|
||||||
await loadOrganizationList()
|
await loadOrganizationList()
|
||||||
|
|
||||||
|
// 加载lis分组列表
|
||||||
|
await loadLisGroupList()
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('✗ 初始化数据失败:', error)
|
console.error('✗ 初始化数据失败:', error)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 加载lis分组列表
|
||||||
|
async function loadLisGroupList() {
|
||||||
|
try {
|
||||||
|
const response = await listLisGroup({ pageNum: 1, pageSize: 100 })
|
||||||
|
if (response && response.code === 200 && response.data) {
|
||||||
|
const items = response.data.records || response.data.rows || (Array.isArray(response.data) ? response.data : [])
|
||||||
|
lisGroupOptions.value = items
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('✗ 获取lis分组列表失败:', error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 加载卫生机构列表(从租户列表获取,只获取启用的)
|
// 加载卫生机构列表(从租户列表获取,只获取启用的)
|
||||||
async function loadOrganizationList() {
|
async function loadOrganizationList() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user