Compare commits
52 Commits
bug475-fix
...
cec8a44bd9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cec8a44bd9 | ||
|
|
8157063749 | ||
|
|
41562c5bbd | ||
|
|
51fba4488e | ||
|
|
00ff4158a1 | ||
|
|
a09020a4fd | ||
|
|
f7a3f658fb | ||
|
|
dd36dc49ea | ||
|
|
1c9bb92663 | ||
|
|
6ddd9bb2dc | ||
|
|
c8ed4e5856 | ||
|
|
253ceaffc6 | ||
|
|
ed7c388d11 | ||
|
|
f581f72693 | ||
|
|
55b517c8c6 | ||
|
|
0c36230158 | ||
|
|
351a2fba2e | ||
|
|
09e5825dab | ||
|
|
1f94efa1d2 | ||
|
|
d4d9ede5d7 | ||
|
|
876e46bfea | ||
|
|
7388e01b5d | ||
|
|
4af2fc5f54 | ||
|
|
c04432e39a | ||
|
|
21e68da15e | ||
|
|
6fdf96edab | ||
|
|
2ef1ce9f35 | ||
|
|
11fd9b839c | ||
|
|
5357ddb220 | ||
|
|
79bd7c0281 | ||
|
|
4c4f01abd1 | ||
|
|
b4d452995f | ||
|
|
23c75b147e | ||
|
|
1e431d096d | ||
|
|
e1de467b68 | ||
| 53a3460092 | |||
|
|
084d04d518 | ||
|
|
d7f8a20d76 | ||
| 331fc532fc | |||
|
|
dafa5961c4 | ||
|
|
f223192ec5 | ||
|
|
c7956a116b | ||
|
|
845354e863 | ||
|
|
56ea4b6af1 | ||
|
|
703e9ead43 | ||
|
|
a43f98cc5a | ||
|
|
9215c288d3 | ||
|
|
777ba71c7d | ||
|
|
c3dfd3eb21 | ||
|
|
8093f8acda | ||
|
|
8fae6fe3d5 | ||
|
|
5af86494dd |
@@ -274,27 +274,8 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
|
|||||||
return R.fail("非就诊中患者不能完诊");
|
return R.fail("非就诊中患者不能完诊");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取 pool_id 和 slot_id:从 encounter → order_main → adm_schedule_slot 链路获取
|
// 2. 查找队列项(限定当天,避免复诊患者匹配到历史队列记录)
|
||||||
// 确保 div_log 中的值与排班主表一致,不依赖 triage_queue_item(队列项可能不存在或值错误)
|
|
||||||
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
||||||
Long divPoolId = null;
|
|
||||||
Long divSlotId = null;
|
|
||||||
if (encounter.getOrderId() != null) {
|
|
||||||
try {
|
|
||||||
Order order = iOrderService.getById(encounter.getOrderId());
|
|
||||||
if (order != null && order.getSlotId() != null) {
|
|
||||||
divSlotId = order.getSlotId();
|
|
||||||
ScheduleSlot slot = scheduleSlotMapper.selectById(divSlotId);
|
|
||||||
if (slot != null) {
|
|
||||||
divPoolId = slot.getPoolId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.warn("获取完诊div_log的pool_id/slot_id失败,encounterId={}", encounterId, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. 查找队列项(限定当天,避免复诊患者匹配到历史队列记录)
|
|
||||||
TriageQueueItem queueItem = triageQueueItemService.getOne(
|
TriageQueueItem queueItem = triageQueueItemService.getOne(
|
||||||
new LambdaQueryWrapper<TriageQueueItem>()
|
new LambdaQueryWrapper<TriageQueueItem>()
|
||||||
.eq(TriageQueueItem::getTenantId, tenantId)
|
.eq(TriageQueueItem::getTenantId, tenantId)
|
||||||
@@ -319,14 +300,41 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 3. 获取 pool_id 和 slot_id:优先使用 triage_queue_item(挂号时录入的号源信息,为权威来源)
|
||||||
|
// 队列项不存在或值缺失时,回退使用 encounter → order_main → adm_schedule_slot 链路
|
||||||
|
Long divPoolId = null;
|
||||||
|
Long divSlotId = null;
|
||||||
|
if (queueItem != null && queueItem.getPoolId() != null && queueItem.getSlotId() != null) {
|
||||||
|
divPoolId = queueItem.getPoolId();
|
||||||
|
divSlotId = queueItem.getSlotId();
|
||||||
|
} else if (encounter.getOrderId() != null) {
|
||||||
|
try {
|
||||||
|
Order order = iOrderService.getById(encounter.getOrderId());
|
||||||
|
if (order != null && order.getSlotId() != null) {
|
||||||
|
divSlotId = order.getSlotId();
|
||||||
|
ScheduleSlot slot = scheduleSlotMapper.selectById(divSlotId);
|
||||||
|
if (slot != null) {
|
||||||
|
divPoolId = slot.getPoolId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("回退获取完诊div_log的pool_id/slot_id失败,encounterId={}", encounterId, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 如果队列项存在且未完成,更新队列状态为已完成
|
// 如果队列项存在且未完成,更新队列状态为已完成
|
||||||
// 使用排除法而非白名单:只要不是"已完成"就可以完诊,覆盖跳过、等待等非标准流转状态
|
// 使用排除法而非白名单:只要不是"已完成"就可以完诊,覆盖跳过、等待等非标准流转状态
|
||||||
if (queueItem != null &&
|
if (queueItem != null &&
|
||||||
!TriageQueueStatus.COMPLETED.getValue().equals(queueItem.getStatus())) {
|
!TriageQueueStatus.COMPLETED.getValue().equals(queueItem.getStatus())) {
|
||||||
java.time.LocalDateTime nowLocal = java.time.LocalDateTime.now().truncatedTo(ChronoUnit.SECONDS);
|
java.time.LocalDateTime nowLocal = java.time.LocalDateTime.now().truncatedTo(ChronoUnit.SECONDS);
|
||||||
queueItem.setStatus(TriageQueueStatus.COMPLETED.getValue());
|
// 使用 LambdaUpdateWrapper 直接更新,确保 status 字段必定写入数据库
|
||||||
queueItem.setUpdateTime(nowLocal);
|
boolean queueUpdate = triageQueueItemService.update(new LambdaUpdateWrapper<TriageQueueItem>()
|
||||||
triageQueueItemService.updateById(queueItem);
|
.eq(TriageQueueItem::getId, queueItem.getId())
|
||||||
|
.set(TriageQueueItem::getStatus, TriageQueueStatus.COMPLETED.getValue())
|
||||||
|
.set(TriageQueueItem::getUpdateTime, nowLocal));
|
||||||
|
if (!queueUpdate) {
|
||||||
|
log.error("完诊:triage_queue_item 状态更新失败,queueItemId={}", queueItem.getId());
|
||||||
|
}
|
||||||
} else if (queueItem == null) {
|
} else if (queueItem == null) {
|
||||||
log.error("完诊:未找到任何 triage_queue_item 记录,encounterId={}, tenantId={}",
|
log.error("完诊:未找到任何 triage_queue_item 记录,encounterId={}, tenantId={}",
|
||||||
encounterId, tenantId);
|
encounterId, tenantId);
|
||||||
|
|||||||
@@ -63,4 +63,20 @@ public interface IRequestFormManageAppService {
|
|||||||
* @return 申请单
|
* @return 申请单
|
||||||
*/
|
*/
|
||||||
IPage<RequestFormPageDto> getRequestFormPage(RequestFormDto requestFormDto);
|
IPage<RequestFormPageDto> getRequestFormPage(RequestFormDto requestFormDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除申请单(仅待签发状态可删除)
|
||||||
|
*
|
||||||
|
* @param requestFormId 申请单ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
R<?> deleteRequestForm(Long requestFormId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 撤回申请单(已签发状态撤回至待签发)
|
||||||
|
*
|
||||||
|
* @param requestFormId 申请单ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
R<?> withdrawRequestForm(Long requestFormId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -91,8 +92,14 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
|||||||
return R.fail("无待签发的医嘱,该申请单不可编辑");
|
return R.fail("无待签发的医嘱,该申请单不可编辑");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 诊疗处方号
|
// 诊疗处方号 - 按申请单类型生成不同规则的单号
|
||||||
prescriptionNo = assignSeqUtil.getSeq(AssignSeqEnum.ACTIVITY_PSYCHOTROPIC_NO.getPrefix(), 8);
|
if (ActivityDefCategory.TEST.getCode().equals(typeCode)) {
|
||||||
|
// 检查申请单:JC(检查)+ Z(住院标识)+ yyMMdd(日期)+ 5位顺序号
|
||||||
|
String dateStr = new SimpleDateFormat("yyMMdd").format(new Date());
|
||||||
|
prescriptionNo = "JCZ" + dateStr + assignSeqUtil.getSeq("JCZ_" + dateStr, 5);
|
||||||
|
} else {
|
||||||
|
prescriptionNo = assignSeqUtil.getSeq(AssignSeqEnum.ACTIVITY_PSYCHOTROPIC_NO.getPrefix(), 8);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当前时间
|
// 当前时间
|
||||||
@@ -471,4 +478,68 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
|||||||
return requestFormManageAppMapper.getRequestFormPage(requestFormDto, page);
|
return requestFormManageAppMapper.getRequestFormPage(requestFormDto, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除申请单(仅待签发状态可删除)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public R<?> deleteRequestForm(Long requestFormId) {
|
||||||
|
if (requestFormId == null) {
|
||||||
|
return R.fail("申请单ID不能为空");
|
||||||
|
}
|
||||||
|
RequestForm requestForm = iRequestFormService.getById(requestFormId);
|
||||||
|
if (requestForm == null) {
|
||||||
|
return R.fail("申请单不存在");
|
||||||
|
}
|
||||||
|
if (!Integer.valueOf(0).equals(requestForm.getStatus())) {
|
||||||
|
return R.fail("仅待签发状态的申请单可删除");
|
||||||
|
}
|
||||||
|
// 删除申请单
|
||||||
|
iRequestFormService.removeById(requestFormId);
|
||||||
|
// 删除关联的诊疗项目及账单
|
||||||
|
String prescriptionNo = requestForm.getPrescriptionNo();
|
||||||
|
List<Long> serviceRequestIds = iServiceRequestService
|
||||||
|
.list(new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getPrescriptionNo, prescriptionNo))
|
||||||
|
.stream().map(ServiceRequest::getId).collect(Collectors.toList());
|
||||||
|
for (Long serviceRequestId : serviceRequestIds) {
|
||||||
|
iServiceRequestService.removeById(serviceRequestId);
|
||||||
|
iChargeItemService.deleteByServiceTableAndId(CommonConstants.TableName.WOR_SERVICE_REQUEST, serviceRequestId);
|
||||||
|
}
|
||||||
|
return R.ok(null, "删除成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 撤回申请单(已签发状态撤回至待签发)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public R<?> withdrawRequestForm(Long requestFormId) {
|
||||||
|
if (requestFormId == null) {
|
||||||
|
return R.fail("申请单ID不能为空");
|
||||||
|
}
|
||||||
|
RequestForm requestForm = iRequestFormService.getById(requestFormId);
|
||||||
|
if (requestForm == null) {
|
||||||
|
return R.fail("申请单不存在");
|
||||||
|
}
|
||||||
|
if (!Integer.valueOf(1).equals(requestForm.getStatus())) {
|
||||||
|
return R.fail("仅已签发状态的申请单可撤回");
|
||||||
|
}
|
||||||
|
// 将申请单状态回滚至待签发
|
||||||
|
RequestForm updateForm = new RequestForm();
|
||||||
|
updateForm.setId(requestFormId);
|
||||||
|
updateForm.setStatus(0);
|
||||||
|
iRequestFormService.updateById(updateForm);
|
||||||
|
// 将关联的诊疗项目状态回滚至DRAFT
|
||||||
|
String prescriptionNo = requestForm.getPrescriptionNo();
|
||||||
|
List<ServiceRequest> serviceRequests = iServiceRequestService
|
||||||
|
.list(new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getPrescriptionNo, prescriptionNo));
|
||||||
|
for (ServiceRequest serviceRequest : serviceRequests) {
|
||||||
|
ServiceRequest updateService = new ServiceRequest();
|
||||||
|
updateService.setId(serviceRequest.getId());
|
||||||
|
updateService.setStatusEnum(RequestStatus.DRAFT.getValue());
|
||||||
|
iServiceRequestService.updateById(updateService);
|
||||||
|
}
|
||||||
|
return R.ok(null, "撤回成功");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ public class RequestFormManageController {
|
|||||||
* @param startDate 开始日期(可选,格式:yyyy-MM-dd)
|
* @param startDate 开始日期(可选,格式:yyyy-MM-dd)
|
||||||
* @param endDate 结束日期(可选,格式:yyyy-MM-dd)
|
* @param endDate 结束日期(可选,格式:yyyy-MM-dd)
|
||||||
* @param status 单据状态(可选)
|
* @param status 单据状态(可选)
|
||||||
* @param keyword 关键字(可选,申请单号/检验项目模糊匹配)
|
* @param keyword 关键字(可选,申请单号/检验项目名称模糊匹配)
|
||||||
* @return 检验申请单
|
* @return 检验申请单
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/get-inspection")
|
@GetMapping(value = "/get-inspection")
|
||||||
|
|||||||
@@ -280,9 +280,17 @@
|
|||||||
aa.balance_amount
|
aa.balance_amount
|
||||||
) AS personal_account
|
) AS personal_account
|
||||||
ON personal_account.encounter_id = ae.id
|
ON personal_account.encounter_id = ae.id
|
||||||
LEFT JOIN med_medication_dispense mmd
|
LEFT JOIN (
|
||||||
|
SELECT med_req_id, status_enum
|
||||||
|
FROM (
|
||||||
|
SELECT med_req_id, status_enum,
|
||||||
|
ROW_NUMBER() OVER (PARTITION BY med_req_id ORDER BY id DESC) AS rn
|
||||||
|
FROM med_medication_dispense
|
||||||
|
WHERE delete_flag = '0'
|
||||||
|
) t
|
||||||
|
WHERE rn = 1
|
||||||
|
) mmd
|
||||||
ON mmd.med_req_id = T1.id
|
ON mmd.med_req_id = T1.id
|
||||||
AND mmd.delete_flag = '0'
|
|
||||||
WHERE T1.delete_flag = '0'
|
WHERE T1.delete_flag = '0'
|
||||||
AND T1.refund_medicine_id IS NULL
|
AND T1.refund_medicine_id IS NULL
|
||||||
AND T1.generate_source_enum = #{doctorPrescription}
|
AND T1.generate_source_enum = #{doctorPrescription}
|
||||||
|
|||||||
@@ -59,4 +59,9 @@ public class RequestForm extends HisBaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String typeCode;
|
private String typeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单据状态 0=待签发 1=已签发 2=已校对 3=待接收 4=已接收 5=已检查 6=已出报告 7=已作废
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
DELETE
|
DELETE
|
||||||
FROM adm_encounter_diagnosis
|
FROM adm_encounter_diagnosis
|
||||||
WHERE encounter_id = #{encounterId}
|
WHERE encounter_id = #{encounterId}
|
||||||
AND tcm_flag = 0
|
AND tcm_flag = 1
|
||||||
</delete>
|
</delete>
|
||||||
<select id="getEncounterDiagnosisByEncounterConDefId"
|
<select id="getEncounterDiagnosisByEncounterConDefId"
|
||||||
resultType="com.openhis.administration.domain.EncounterDiagnosis">
|
resultType="com.openhis.administration.domain.EncounterDiagnosis">
|
||||||
|
|||||||
@@ -682,7 +682,6 @@ async function handleCategoryExpand(cat) {
|
|||||||
code: m.code,
|
code: m.code,
|
||||||
price: m.price || 0,
|
price: m.price || 0,
|
||||||
packageName: m.packageName || '',
|
packageName: m.packageName || '',
|
||||||
packageId: m.packageId || null,
|
|
||||||
packagePrice: m.packagePrice || null,
|
packagePrice: m.packagePrice || null,
|
||||||
serviceFee: m.serviceFee || null
|
serviceFee: m.serviceFee || null
|
||||||
}));
|
}));
|
||||||
@@ -1026,18 +1025,12 @@ function handleRowClick(row) {
|
|||||||
code: md.code,
|
code: md.code,
|
||||||
price: m.itemFee || 0, // fallback 到已保存的价格
|
price: m.itemFee || 0, // fallback 到已保存的价格
|
||||||
packageName: md.packageName || '',
|
packageName: md.packageName || '',
|
||||||
packageId: md.packageId || null,
|
|
||||||
packagePrice: md.packagePrice || null, // Bug #384修复: 套餐价格
|
packagePrice: md.packagePrice || null, // Bug #384修复: 套餐价格
|
||||||
serviceFee: md.serviceFee || null
|
serviceFee: md.serviceFee || null
|
||||||
}));
|
}));
|
||||||
// 如果有已保存的检查方法信息,尝试匹配
|
// 如果有已保存的检查方法信息,尝试匹配
|
||||||
if (m.checkMethodId) {
|
if (m.checkMethodId) {
|
||||||
item.selectedMethod = item.methods.find(md => md.id === m.checkMethodId) || null;
|
item.selectedMethod = item.methods.find(md => md.id === m.checkMethodId) || null;
|
||||||
// 从已保存的方法中获取套餐信息
|
|
||||||
if (item.selectedMethod?.packageId) {
|
|
||||||
item.isPackage = true;
|
|
||||||
item.packageId = item.selectedMethod.packageId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -1098,13 +1091,6 @@ async function handleMethodSelect(checked, method, cat) {
|
|||||||
const existingItem = selectedItems.value.find(s => s.id === targetItem.id);
|
const existingItem = selectedItems.value.find(s => s.id === targetItem.id);
|
||||||
if (existingItem) {
|
if (existingItem) {
|
||||||
existingItem.selectedMethod = method;
|
existingItem.selectedMethod = method;
|
||||||
// 从方法中获取套餐信息
|
|
||||||
if (method.packageId) {
|
|
||||||
existingItem.isPackage = true;
|
|
||||||
existingItem.packageId = method.packageId;
|
|
||||||
// 预加载套餐明细
|
|
||||||
loadPackageDetailsForItem(existingItem);
|
|
||||||
}
|
|
||||||
updateMethodDisplay();
|
updateMethodDisplay();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1119,7 +1105,7 @@ async function handleMethodSelect(checked, method, cat) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const newItem = {
|
selectedItems.value.push({
|
||||||
id: targetItem.id, name: targetItem.name,
|
id: targetItem.id, name: targetItem.name,
|
||||||
price: targetItem.price, quantity: 1,
|
price: targetItem.price, quantity: 1,
|
||||||
serviceFee: targetItem.serviceFee || 0,
|
serviceFee: targetItem.serviceFee || 0,
|
||||||
@@ -1131,16 +1117,9 @@ async function handleMethodSelect(checked, method, cat) {
|
|||||||
methods: [method],
|
methods: [method],
|
||||||
selectedMethod: method,
|
selectedMethod: method,
|
||||||
expanded: false,
|
expanded: false,
|
||||||
// 从方法中获取套餐信息(优先级高于项目本身的 packageName)
|
isPackage: !!targetItem.packageName,
|
||||||
isPackage: !!method.packageId || !!targetItem.packageName,
|
packageId: targetItem.packageId || null
|
||||||
packageId: method.packageId || targetItem.packageId || null
|
});
|
||||||
};
|
|
||||||
selectedItems.value.push(newItem);
|
|
||||||
|
|
||||||
// 如果是套餐,预加载套餐明细
|
|
||||||
if (newItem.isPackage && newItem.packageId) {
|
|
||||||
loadPackageDetailsForItem(newItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 自动回填执行科室
|
// 自动回填执行科室
|
||||||
if (selectedItems.value.length === 1 && cat?.performDeptName) {
|
if (selectedItems.value.length === 1 && cat?.performDeptName) {
|
||||||
@@ -1185,7 +1164,6 @@ async function handleItemSelect(checked, item, cat) {
|
|||||||
code: m.code,
|
code: m.code,
|
||||||
price: m.price || item.price, // fallback 到项目价格
|
price: m.price || item.price, // fallback 到项目价格
|
||||||
packageName: m.packageName || '',
|
packageName: m.packageName || '',
|
||||||
packageId: m.packageId || null,
|
|
||||||
packagePrice: m.packagePrice || null, // Bug #384修复: 套餐价格
|
packagePrice: m.packagePrice || null, // Bug #384修复: 套餐价格
|
||||||
serviceFee: m.serviceFee || null // Bug #384修复: 服务费
|
serviceFee: m.serviceFee || null // Bug #384修复: 服务费
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -79,7 +79,7 @@
|
|||||||
<el-table-column prop="patientName" label="患者姓名" width="120" />
|
<el-table-column prop="patientName" label="患者姓名" width="120" />
|
||||||
<el-table-column prop="name" label="申请单名称" width="140" />
|
<el-table-column prop="name" label="申请单名称" width="140" />
|
||||||
<el-table-column prop="createTime" label="创建时间" width="160" />
|
<el-table-column prop="createTime" label="创建时间" width="160" />
|
||||||
<el-table-column prop="prescriptionNo" label="处方号" width="140" />
|
<el-table-column prop="prescriptionNo" label="申请单号" width="140" />
|
||||||
<el-table-column prop="requesterId_dictText" label="申请者" width="120" />
|
<el-table-column prop="requesterId_dictText" label="申请者" width="120" />
|
||||||
<el-table-column label="申请单状态" width="120" align="center">
|
<el-table-column label="申请单状态" width="120" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
@@ -118,7 +118,7 @@
|
|||||||
<el-descriptions-item label="创建时间">{{
|
<el-descriptions-item label="创建时间">{{
|
||||||
currentDetail.createTime || '-'
|
currentDetail.createTime || '-'
|
||||||
}}</el-descriptions-item>
|
}}</el-descriptions-item>
|
||||||
<el-descriptions-item label="处方号">{{
|
<el-descriptions-item label="申请单号">{{
|
||||||
currentDetail.prescriptionNo || '-'
|
currentDetail.prescriptionNo || '-'
|
||||||
}}</el-descriptions-item>
|
}}</el-descriptions-item>
|
||||||
<el-descriptions-item label="申请者">{{
|
<el-descriptions-item label="申请者">{{
|
||||||
|
|||||||
@@ -169,6 +169,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {getCurrentInstance} from 'vue'; // 添加 nextTick 导入
|
import {getCurrentInstance} from 'vue'; // 添加 nextTick 导入
|
||||||
import useUserStore from '@/store/modules/user';
|
import useUserStore from '@/store/modules/user';
|
||||||
|
import { formatDateStr } from '@/utils';
|
||||||
import {
|
import {
|
||||||
delEncounterDiagnosis,
|
delEncounterDiagnosis,
|
||||||
deleteDiagnosisBind,
|
deleteDiagnosisBind,
|
||||||
@@ -286,10 +287,22 @@ function getList() {
|
|||||||
if (obj.diagSrtNo == null) {
|
if (obj.diagSrtNo == null) {
|
||||||
obj.diagSrtNo = '1';
|
obj.diagSrtNo = '1';
|
||||||
}
|
}
|
||||||
|
// 补充缺失的元数据字段
|
||||||
|
if (!obj.diagnosisDoctor) {
|
||||||
|
obj.diagnosisDoctor = props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name;
|
||||||
|
}
|
||||||
|
if (!obj.diagnosisTime) {
|
||||||
|
obj.diagnosisTime = item.diagnosisTime || getCurrentDate();
|
||||||
|
}
|
||||||
|
if (!obj.classification) {
|
||||||
|
obj.classification = item.typeName === '中医诊断' ? '中医' : '西医';
|
||||||
|
}
|
||||||
|
if (obj.longTermFlag == null) {
|
||||||
|
obj.longTermFlag = 0;
|
||||||
|
}
|
||||||
return obj;
|
return obj;
|
||||||
});
|
});
|
||||||
form.value.diagnosisList = datas;
|
form.value.diagnosisList = datas;
|
||||||
// form.value.diagnosisList = res.data;
|
|
||||||
emits('diagnosisSave', false);
|
emits('diagnosisSave', false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -305,13 +318,16 @@ function getList() {
|
|||||||
ybNo: item.ybNo,
|
ybNo: item.ybNo,
|
||||||
medTypeCode: item.medTypeCode,
|
medTypeCode: item.medTypeCode,
|
||||||
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
|
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
|
||||||
diagnosisTime: new Date().toLocaleString('zh-CN')
|
diagnosisTime: item.diagnosisTime || getCurrentDate(),
|
||||||
|
diagSrtNo: item.diagSrtNo,
|
||||||
|
classification: '中医',
|
||||||
|
longTermFlag: item.longTermFlag || 0
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// 将新数据添加到现有列表中
|
// 将新数据添加到现有列表中
|
||||||
form.value.diagnosisList.push(...newList);
|
form.value.diagnosisList.push(...newList);
|
||||||
|
|
||||||
// 重新排序整个列表
|
// 重新排序整个列表
|
||||||
form.value.diagnosisList.sort((a, b) => {
|
form.value.diagnosisList.sort((a, b) => {
|
||||||
const aNo = typeof a.diagSrtNo === 'number' ? a.diagSrtNo : 9999;
|
const aNo = typeof a.diagSrtNo === 'number' ? a.diagSrtNo : 9999;
|
||||||
@@ -322,7 +338,7 @@ function getList() {
|
|||||||
emits('diagnosisSave', false);
|
emits('diagnosisSave', false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
getTree();
|
getTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,11 +355,12 @@ function handleImport() {
|
|||||||
if (!props.patientInfo || !props.patientInfo.encounterId) {
|
if (!props.patientInfo || !props.patientInfo.encounterId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props.patientInfo.contractName != '自费') {
|
if (props.patientInfo.contractName != '自费') {
|
||||||
// 获取患者慢性病信息
|
// 获取患者慢性病信息
|
||||||
getChronicDisease({ encounterId: props.patientInfo.encounterId }).then((res) => {
|
getChronicDisease({ encounterId: props.patientInfo.encounterId }).then((res) => {
|
||||||
if (res.data && res.data.length > 0) {
|
if (res.data && res.data.length > 0) {
|
||||||
|
const currentDate = getCurrentDate();
|
||||||
res.data.forEach((item, index) => {
|
res.data.forEach((item, index) => {
|
||||||
form.value.diagnosisList.push({
|
form.value.diagnosisList.push({
|
||||||
...item,
|
...item,
|
||||||
@@ -355,7 +372,10 @@ function handleImport() {
|
|||||||
iptDiseTypeCode: 2,
|
iptDiseTypeCode: 2,
|
||||||
diagnosisDesc: '',
|
diagnosisDesc: '',
|
||||||
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
|
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
|
||||||
diagnosisTime: new Date().toLocaleString('zh-CN'),
|
diagnosisTime: currentDate,
|
||||||
|
onsetDate: currentDate,
|
||||||
|
classification: '西医',
|
||||||
|
longTermFlag: 0,
|
||||||
//添加 patientId
|
//添加 patientId
|
||||||
patientId: props.patientInfo.patientId
|
patientId: props.patientInfo.patientId
|
||||||
},
|
},
|
||||||
@@ -470,6 +490,7 @@ function handleAddDiagnosis() {
|
|||||||
* 添加诊断项
|
* 添加诊断项
|
||||||
*/
|
*/
|
||||||
function addDiagnosisItem() {
|
function addDiagnosisItem() {
|
||||||
|
const currentDate = getCurrentDate();
|
||||||
form.value.diagnosisList.push({
|
form.value.diagnosisList.push({
|
||||||
showPopover: false,
|
showPopover: false,
|
||||||
name: undefined,
|
name: undefined,
|
||||||
@@ -479,9 +500,10 @@ function addDiagnosisItem() {
|
|||||||
iptDiseTypeCode: 2,
|
iptDiseTypeCode: 2,
|
||||||
diagnosisDesc: '',
|
diagnosisDesc: '',
|
||||||
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
|
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
|
||||||
diagnosisTime: new Date().toLocaleString('zh-CN'),
|
diagnosisTime: currentDate,
|
||||||
|
classification: '西医',
|
||||||
// 新增这一行:为每个诊断项添加 patientId
|
onsetDate: currentDate,
|
||||||
|
longTermFlag: 0,
|
||||||
patientId: props.patientInfo.patientId
|
patientId: props.patientInfo.patientId
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -558,16 +580,7 @@ function handleMaindise(value, index) {
|
|||||||
/**
|
/**
|
||||||
* 保存诊断
|
* 保存诊断
|
||||||
*/
|
*/
|
||||||
/**
|
async function handleSaveDiagnosis() {
|
||||||
* 保存诊断
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* 保存诊断
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* 保存诊断
|
|
||||||
*/
|
|
||||||
function handleSaveDiagnosis() {
|
|
||||||
for (let index = 0; index < (form.value.diagnosisList || []).length; index++) {
|
for (let index = 0; index < (form.value.diagnosisList || []).length; index++) {
|
||||||
const item = form.value.diagnosisList[index];
|
const item = form.value.diagnosisList[index];
|
||||||
if (!item.diagSrtNo) {
|
if (!item.diagSrtNo) {
|
||||||
@@ -578,7 +591,7 @@ function handleSaveDiagnosis() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
proxy.$refs.formRef.validate((valid) => {
|
proxy.$refs.formRef.validate(async (valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (form.value.diagnosisList.length === 0) {
|
if (form.value.diagnosisList.length === 0) {
|
||||||
proxy.$modal.msgWarning('诊断不能为空');
|
proxy.$modal.msgWarning('诊断不能为空');
|
||||||
@@ -591,43 +604,51 @@ function handleSaveDiagnosis() {
|
|||||||
// 设置保存标志,避免触发watch监听器
|
// 设置保存标志,避免触发watch监听器
|
||||||
isSaving.value = true;
|
isSaving.value = true;
|
||||||
|
|
||||||
// 步骤1:深拷贝并按 diagSrtNo 排序
|
try {
|
||||||
const sortedList = [...form.value.diagnosisList].sort((a, b) => {
|
// 步骤1:深拷贝并按 diagSrtNo 排序
|
||||||
const aNo = typeof a.diagSrtNo === 'number' ? a.diagSrtNo : 9999;
|
const sortedList = [...form.value.diagnosisList].sort((a, b) => {
|
||||||
const bNo = typeof b.diagSrtNo === 'number' ? b.diagSrtNo : 9999;
|
const aNo = typeof a.diagSrtNo === 'number' ? a.diagSrtNo : 9999;
|
||||||
return aNo - bNo;
|
const bNo = typeof b.diagSrtNo === 'number' ? b.diagSrtNo : 9999;
|
||||||
});
|
return aNo - bNo;
|
||||||
|
});
|
||||||
|
|
||||||
// 步骤2:重新分配连续的序号(从1开始)
|
// 步骤2:转换日期格式为后端期望的格式
|
||||||
sortedList.forEach((item, index) => {
|
const diagnosisChildList = sortedList.map(item => ({
|
||||||
item.diagSrtNo = index + 1; // 这里是关键!把“诊断排序”改成新顺序
|
...item,
|
||||||
});
|
onsetDate: item.onsetDate ? formatDateStr(item.onsetDate, 'YYYY/M/D HH:mm:ss') : null,
|
||||||
|
diagnosisTime: item.diagnosisTime ? formatDateStr(item.diagnosisTime, 'YYYY/M/D HH:mm:ss') : null
|
||||||
|
}));
|
||||||
|
|
||||||
|
// 步骤3:提交排序后的数据
|
||||||
|
const res = await saveDiagnosis({
|
||||||
|
patientId: props.patientInfo.patientId,
|
||||||
|
encounterId: props.patientInfo.encounterId,
|
||||||
|
diagnosisChildList: diagnosisChildList,
|
||||||
|
});
|
||||||
|
|
||||||
// 步骤3:提交排序后的数据
|
|
||||||
saveDiagnosis({
|
|
||||||
patientId: props.patientInfo.patientId,
|
|
||||||
encounterId: props.patientInfo.encounterId,
|
|
||||||
diagnosisChildList: sortedList,
|
|
||||||
}).then((res) => {
|
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
// 步骤4:更新本地数据,使用全新对象防止响应式问题
|
// 步骤4:从服务器刷新数据,确保获取最新的诊断信息(避免重复记录)
|
||||||
form.value.diagnosisList = sortedList.map(item => ({ ...item }));
|
await getList();
|
||||||
|
getTree();
|
||||||
emits('diagnosisSave', false);
|
emits('diagnosisSave', false);
|
||||||
proxy.$modal.msgSuccess('诊断已保存');
|
proxy.$modal.msgSuccess('诊断已保存');
|
||||||
|
|
||||||
// 食源性疾病逻辑
|
// 食源性疾病逻辑
|
||||||
isFoodDiseasesNew({ encounterId: props.patientInfo.encounterId }).then((res2) => {
|
isFoodDiseasesNew({ encounterId: props.patientInfo.encounterId }).then((res2) => {
|
||||||
if (res2.code === 20 && res2.data) {
|
if (res2.code === 200 && res2.data) {
|
||||||
window.open(res2.data, '_blank');
|
window.open(res2.data, '_blank');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).finally(() => {
|
} catch (error) {
|
||||||
|
console.error('保存诊断失败:', error);
|
||||||
|
const errorMsg = error?.response?.data?.msg || error?.message || '保存诊断失败,请稍后重试';
|
||||||
|
proxy.$modal.msgError(errorMsg);
|
||||||
|
} finally {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
isSaving.value = false;
|
isSaving.value = false;
|
||||||
}, 100);
|
}, 100);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -687,6 +708,7 @@ function handleNodeClick(data) {
|
|||||||
proxy.$modal.msgWarning('该诊断项已存在');
|
proxy.$modal.msgWarning('该诊断项已存在');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const currentDate = getCurrentDate();
|
||||||
form.value.diagnosisList.push({
|
form.value.diagnosisList.push({
|
||||||
ybNo: data.ybNo,
|
ybNo: data.ybNo,
|
||||||
name: data.name,
|
name: data.name,
|
||||||
@@ -694,9 +716,12 @@ function handleNodeClick(data) {
|
|||||||
medTypeCode: undefined,
|
medTypeCode: undefined,
|
||||||
diagSrtNo: form.value.diagnosisList.length + 1,
|
diagSrtNo: form.value.diagnosisList.length + 1,
|
||||||
definitionId: data.definitionId,
|
definitionId: data.definitionId,
|
||||||
|
classification: '西医',
|
||||||
|
onsetDate: currentDate,
|
||||||
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
|
diagnosisDoctor: props.patientInfo.practitionerName || props.patientInfo.doctorName || props.patientInfo.physicianName || userStore.name,
|
||||||
diagnosisTime: new Date().toLocaleString('zh-CN'),
|
diagnosisTime: currentDate,
|
||||||
// 添加 patientId
|
longTermFlag: 0,
|
||||||
|
selectedDiseases: data.ybNo ? [data.ybNo] : [],
|
||||||
patientId: props.patientInfo.patientId
|
patientId: props.patientInfo.patientId
|
||||||
});
|
});
|
||||||
if (form.value.diagnosisList.length == 1) {
|
if (form.value.diagnosisList.length == 1) {
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ onMounted(() => {
|
|||||||
* type(1:watch监听类型 2:点击保存类型)
|
* type(1:watch监听类型 2:点击保存类型)
|
||||||
* selectProjectIds(选中项目的id数组)
|
* selectProjectIds(选中项目的id数组)
|
||||||
* */
|
* */
|
||||||
const projectWithDepartment = (selectProjectIds, type) => {
|
const projectWithDepartment = (selectProjectIds) => {
|
||||||
//1.获取选中的项目 2.判断项目的执行科室是否相同 3.判断执行科室是否配置 4.将项目的执行科室复值到执行科室下拉选位置
|
//1.获取选中的项目 2.判断项目的执行科室是否相同 3.判断执行科室是否配置 4.将项目的执行科室复值到执行科室下拉选位置
|
||||||
let isRelease = true;
|
let isRelease = true;
|
||||||
// 选中项目的数组
|
// 选中项目的数组
|
||||||
|
|||||||
@@ -483,7 +483,7 @@ const submit = () => {
|
|||||||
encounterId: patientInfo.value.encounterId,
|
encounterId: patientInfo.value.encounterId,
|
||||||
organizationId: patientInfo.value.inHospitalOrgId,
|
organizationId: patientInfo.value.inHospitalOrgId,
|
||||||
requestFormId: '',
|
requestFormId: '',
|
||||||
name: applicationListAllFilter.map(item => item.adviceName).join('、'),
|
name: '检查申请单',
|
||||||
descJson: JSON.stringify(submitForm),
|
descJson: JSON.stringify(submitForm),
|
||||||
categoryEnum: '2',
|
categoryEnum: '2',
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user