Compare commits
170 Commits
c424a37ebd
...
develop-赵云
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77374a5889 | ||
|
|
53e5ee331b | ||
|
|
571f254d0e | ||
|
|
560813d009 | ||
| 31c2acb4ef | |||
|
|
254de01d2e | ||
|
|
e21122edf0 | ||
|
|
e9576ddfa8 | ||
|
|
b435de9e7b | ||
|
|
bc13fd6968 | ||
|
|
d9ad63397b | ||
|
|
bb3e1e300d | ||
|
|
46358ea03d | ||
| b5c308d9cb | |||
|
|
adfeb8f5e5 | ||
|
|
fd9309f125 | ||
|
|
46affb424e | ||
|
|
6dcee26b54 | ||
|
|
a282234bb0 | ||
|
|
52fc64c71d | ||
|
|
0bd1277307 | ||
|
|
e0e4c2bcc6 | ||
|
|
41bea23116 | ||
|
|
12382503f4 | ||
|
|
ae50a7042e | ||
|
|
9b1ac64cd6 | ||
|
|
6367654ada | ||
|
|
360256e589 | ||
|
|
feb033b857 | ||
|
|
79cce458ee | ||
|
|
1140912f3a | ||
| 250f9ce258 | |||
| 0d6f891b47 | |||
|
|
e68be3be79 | ||
|
|
eab0119c19 | ||
|
|
3ad9ff85d4 | ||
|
|
ab2f580d60 | ||
|
|
665d4ae47a | ||
|
|
d43a06c343 | ||
|
|
a7a33eb5f6 | ||
|
|
444397e868 | ||
|
|
d964155fb8 | ||
|
|
b88e011459 | ||
|
|
492a51d282 | ||
|
|
34774411eb | ||
|
|
0f1b29fcea | ||
|
|
d64ca5b8ee | ||
|
|
faa0b1a61f | ||
|
|
33c76c786c | ||
|
|
1a770ca0ee | ||
|
|
ba9c18b6a4 | ||
|
|
ecc5c75418 | ||
|
|
164ac604fb | ||
|
|
d19ceab70f | ||
|
|
753768a1f0 | ||
|
|
49889e9140 | ||
|
|
3c3428e0b1 | ||
|
|
db05a30795 | ||
|
|
e2feb4850c | ||
|
|
02f2a14178 | ||
|
|
1c87c39473 | ||
|
|
7c28a98d02 | ||
|
|
8e042cae93 | ||
|
|
415a76af49 | ||
|
|
6dc9788d8c | ||
|
|
319224cdac | ||
|
|
66d42f415a | ||
|
|
fd0132ba80 | ||
|
|
6907c7dbc8 | ||
|
|
487b05c845 | ||
|
|
71f99da69a | ||
|
|
15a65063a3 | ||
|
|
72fdafb032 | ||
|
|
56b8d0e98d | ||
|
|
f13734a19c | ||
|
|
6081412072 | ||
|
|
4a2f13cb19 | ||
|
|
522bc238aa | ||
|
|
bea2f27b15 | ||
|
|
95da4c2a57 | ||
|
|
53e3e9c4c0 | ||
|
|
55eba1a0b1 | ||
|
|
1525740ab5 | ||
|
|
96102e8b64 | ||
|
|
49df72121f | ||
|
|
65d1716ca9 | ||
|
|
509a0a788f | ||
|
|
6c4a8e3c14 | ||
|
|
7ada54510d | ||
|
|
1602615820 | ||
|
|
af15f2ae06 | ||
|
|
b1d5ae97b1 | ||
|
|
e5cd7bd792 | ||
|
|
294d7a5d11 | ||
|
|
e78a32a5ec | ||
|
|
dc9f47c534 | ||
|
|
5bf1e4151c | ||
|
|
b7365b6b06 | ||
|
|
c5c3bcae34 | ||
|
|
bacddc6d3f | ||
|
|
31cac09126 | ||
|
|
abc3bdd0c0 | ||
|
|
0f85e95d24 | ||
|
|
deb6ade97b | ||
|
|
2d7228ca5d | ||
|
|
a447e55d43 | ||
| 1be0dc2417 | |||
| a4b4d36d93 | |||
|
|
940fad5c7d | ||
|
|
ead3733aac | ||
|
|
28bf385ec2 | ||
|
|
31f7c4f32a | ||
|
|
480663f716 | ||
|
|
cc484d5f10 | ||
|
|
30f8cdbd80 | ||
|
|
f4c6c12ef8 | ||
|
|
8cf98008ae | ||
|
|
062c8d9dee | ||
|
|
ffdfebaacf | ||
|
|
9ed52b7c48 | ||
|
|
fc1ed6c4ce | ||
|
|
818564f5ba | ||
|
|
78adbddfde | ||
|
|
861db6b0f5 | ||
|
|
b7df71fd0b | ||
|
|
5bc8a8e517 | ||
| 0264fa9d58 | |||
| cd12dd7a22 | |||
|
|
bfddf87b2c | ||
|
|
84499d4ec1 | ||
|
|
01c5b62024 | ||
|
|
559821e4d3 | ||
|
|
0dd4c25c12 | ||
|
|
3590a18adc | ||
|
|
b96acc2402 | ||
|
|
e83c35c3f1 | ||
|
|
b5d876be36 | ||
|
|
5539d4cc03 | ||
|
|
982e905990 | ||
|
|
0d46f03e68 | ||
|
|
3cab8306c2 | ||
|
|
0600bbecbc | ||
|
|
ac57ac21e9 | ||
|
|
d38efd15b3 | ||
|
|
c7404e9d3f | ||
|
|
69b28c59f6 | ||
|
|
4e71b861ab | ||
|
|
7c471205a3 | ||
|
|
dc8661c3d0 | ||
|
|
c634551fdb | ||
|
|
c556d51eaf | ||
|
|
9280065c5b | ||
|
|
220982fa34 | ||
|
|
460890e3c2 | ||
|
|
6a0a2ca711 | ||
|
|
fbbe0e9248 | ||
|
|
b6df124e1b | ||
|
|
a0162686f4 | ||
|
|
23561cc9b1 | ||
|
|
cdb676c859 | ||
|
|
1b159cdfab | ||
|
|
01d48c75a5 | ||
|
|
c8fa9b4bf0 | ||
|
|
349c587386 | ||
|
|
656079b27b | ||
| ede6180c97 | |||
|
|
8de1f933e5 | ||
|
|
3f35b4f2bb | ||
| eb3d0ee608 | |||
|
|
dfe300cc1f |
@@ -25,7 +25,7 @@ public class SysTenantController extends BaseController {
|
|||||||
private ISysTenantService sysTenantService;
|
private ISysTenantService sysTenantService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询租户分页列表
|
* 查询租户分页列表(只读操作,不限制租户管理权限)
|
||||||
*
|
*
|
||||||
* @param tenantId 租户ID查询
|
* @param tenantId 租户ID查询
|
||||||
* @param tenantCode 租户编码模糊查询
|
* @param tenantCode 租户编码模糊查询
|
||||||
@@ -35,7 +35,7 @@ public class SysTenantController extends BaseController {
|
|||||||
* @param pageSize 每页多少条
|
* @param pageSize 每页多少条
|
||||||
* @return 租户分页列表
|
* @return 租户分页列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
@PreAuthorize("@ss.hasPermi('system:tenant:list')")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public R<IPage<SysTenant>> getTenantPage(@RequestParam(required = false) Integer tenantId,
|
public R<IPage<SysTenant>> getTenantPage(@RequestParam(required = false) Integer tenantId,
|
||||||
@RequestParam(required = false) String tenantCode, @RequestParam(required = false) String tenantName,
|
@RequestParam(required = false) String tenantCode, @RequestParam(required = false) String tenantName,
|
||||||
@@ -45,19 +45,19 @@ public class SysTenantController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询租户详情
|
* 查询租户详情(只读操作)
|
||||||
*
|
*
|
||||||
* @param tenantId 租户ID
|
* @param tenantId 租户ID
|
||||||
* @return 租户分页列表
|
* @return 租户分页列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
@PreAuthorize("@ss.hasPermi('system:tenant:list')")
|
||||||
@GetMapping("/{tenantId}")
|
@GetMapping("/{tenantId}")
|
||||||
public R<SysTenant> getTenantDetail(@PathVariable Integer tenantId) {
|
public R<SysTenant> getTenantDetail(@PathVariable Integer tenantId) {
|
||||||
return R.ok(sysTenantService.getById(tenantId));
|
return R.ok(sysTenantService.getById(tenantId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询租户所属用户分页列表
|
* 查询租户所属用户分页列表(只读操作)
|
||||||
*
|
*
|
||||||
* @param tenantId 租户ID查询
|
* @param tenantId 租户ID查询
|
||||||
* @param userName 用户昵称模糊查询
|
* @param userName 用户昵称模糊查询
|
||||||
@@ -67,7 +67,7 @@ public class SysTenantController extends BaseController {
|
|||||||
* @param pageSize 每页多少条
|
* @param pageSize 每页多少条
|
||||||
* @return 租户所属用户分页列表
|
* @return 租户所属用户分页列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
@PreAuthorize("@ss.hasPermi('system:tenant:list')")
|
||||||
@GetMapping("/user/page")
|
@GetMapping("/user/page")
|
||||||
public R<IPage<SysUser>> getTenantUserPage(@RequestParam(required = false) Integer tenantId,
|
public R<IPage<SysUser>> getTenantUserPage(@RequestParam(required = false) Integer tenantId,
|
||||||
@RequestParam(required = false) String userName, @RequestParam(required = false) String nickName,
|
@RequestParam(required = false) String userName, @RequestParam(required = false) String nickName,
|
||||||
@@ -141,14 +141,14 @@ public class SysTenantController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询租户未绑定的用户列表
|
* 查询租户未绑定的用户列表(只读操作)
|
||||||
*
|
*
|
||||||
* @param tenantId 租户ID
|
* @param tenantId 租户ID
|
||||||
* @param pageNum 当前页
|
* @param pageNum 当前页
|
||||||
* @param pageSize 每页多少条
|
* @param pageSize 每页多少条
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:tenant:operate')")
|
@PreAuthorize("@ss.hasPermi('system:tenant:list')")
|
||||||
@GetMapping("/{tenantId}/unbind-users")
|
@GetMapping("/{tenantId}/unbind-users")
|
||||||
public R<IPage<SysUser>> getUnbindTenantUserList(@PathVariable Integer tenantId,
|
public R<IPage<SysUser>> getUnbindTenantUserList(@PathVariable Integer tenantId,
|
||||||
@RequestParam(required = false) String userName, @RequestParam(required = false) String nickName,
|
@RequestParam(required = false) String userName, @RequestParam(required = false) String nickName,
|
||||||
|
|||||||
@@ -86,17 +86,12 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService {
|
|||||||
return dictDataMapper.selectDictDataByTypeWithSearch(dictType, trimmedKey);
|
return dictDataMapper.selectDictDataByTypeWithSearch(dictType, trimmedKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 否则使用原有方法(带缓存)
|
// 直接查询数据库,避免缓存中为空数据导致前端下拉框显示"无数据"
|
||||||
List<SysDictData> dictDatas = DictUtils.getDictCache(dictType);
|
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dictType);
|
||||||
if (StringUtils.isNotEmpty(dictDatas)) {
|
|
||||||
return dictDatas;
|
|
||||||
}
|
|
||||||
dictDatas = dictDataMapper.selectDictDataByType(dictType);
|
|
||||||
if (StringUtils.isNotEmpty(dictDatas)) {
|
if (StringUtils.isNotEmpty(dictDatas)) {
|
||||||
DictUtils.setDictCache(dictType, dictDatas);
|
DictUtils.setDictCache(dictType, dictDatas);
|
||||||
return dictDatas;
|
|
||||||
}
|
}
|
||||||
return null;
|
return dictDatas;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.core.common.utils.MessageUtils;
|
|||||||
import com.openhis.administration.domain.Location;
|
import com.openhis.administration.domain.Location;
|
||||||
import com.openhis.administration.domain.Organization;
|
import com.openhis.administration.domain.Organization;
|
||||||
import com.openhis.administration.domain.OrganizationLocation;
|
import com.openhis.administration.domain.OrganizationLocation;
|
||||||
|
import com.openhis.workflow.domain.ActivityDefinition;
|
||||||
import com.openhis.administration.mapper.OrganizationLocationMapper;
|
import com.openhis.administration.mapper.OrganizationLocationMapper;
|
||||||
import com.openhis.administration.service.ILocationService;
|
import com.openhis.administration.service.ILocationService;
|
||||||
import com.openhis.administration.service.IOrganizationLocationService;
|
import com.openhis.administration.service.IOrganizationLocationService;
|
||||||
@@ -70,6 +71,7 @@ public class OrganizationLocationAppServiceImpl implements IOrganizationLocation
|
|||||||
// 获取科室下拉选列表
|
// 获取科室下拉选列表
|
||||||
List<Organization> organizationList = organizationService.getList(OrganizationType.DEPARTMENT.getValue(), null);
|
List<Organization> organizationList = organizationService.getList(OrganizationType.DEPARTMENT.getValue(), null);
|
||||||
List<OrgLocInitDto.departmentOption> organizationOptions = organizationList.stream()
|
List<OrgLocInitDto.departmentOption> organizationOptions = organizationList.stream()
|
||||||
|
.filter(organization -> organization != null && organization.getName() != null)
|
||||||
.map(organization -> new OrgLocInitDto.departmentOption(organization.getId(), organization.getName()))
|
.map(organization -> new OrgLocInitDto.departmentOption(organization.getId(), organization.getName()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
initDto.setLocationFormOptions(chargeItemStatusOptions).setDepartmentOptions(organizationOptions);
|
initDto.setLocationFormOptions(chargeItemStatusOptions).setDepartmentOptions(organizationOptions);
|
||||||
@@ -131,12 +133,18 @@ public class OrganizationLocationAppServiceImpl implements IOrganizationLocation
|
|||||||
@Override
|
@Override
|
||||||
public R<?> addOrEditOrgLoc(OrgLocQueryDto orgLocQueryDto) {
|
public R<?> addOrEditOrgLoc(OrgLocQueryDto orgLocQueryDto) {
|
||||||
|
|
||||||
|
// Validate required fields before processing
|
||||||
|
if (orgLocQueryDto.getOrganizationId() == null) {
|
||||||
|
return R.fail("请选择执行科室");
|
||||||
|
}
|
||||||
|
|
||||||
OrganizationLocation orgLoc = new OrganizationLocation();
|
OrganizationLocation orgLoc = new OrganizationLocation();
|
||||||
BeanUtils.copyProperties(orgLocQueryDto, orgLoc);
|
BeanUtils.copyProperties(orgLocQueryDto, orgLoc);
|
||||||
|
|
||||||
Long activityDefinitionId = orgLoc.getActivityDefinitionId();
|
Long activityDefinitionId = orgLoc.getActivityDefinitionId();
|
||||||
String activityName = activityDefinitionId != null
|
ActivityDefinition activityDef = activityDefinitionId != null
|
||||||
? activityDefinitionMapper.selectById(activityDefinitionId).getName() : "";
|
? activityDefinitionMapper.selectById(activityDefinitionId) : null;
|
||||||
|
String activityName = activityDef != null ? activityDef.getName() : "";
|
||||||
|
|
||||||
List<OrganizationLocation> organizationLocationList =
|
List<OrganizationLocation> organizationLocationList =
|
||||||
organizationLocationService.getOrgLocListByOrgIdAndActivityDefinitionId(orgLoc.getActivityDefinitionId());
|
organizationLocationService.getOrgLocListByOrgIdAndActivityDefinitionId(orgLoc.getActivityDefinitionId());
|
||||||
|
|||||||
@@ -366,7 +366,7 @@ public class SurgeryAppServiceImpl implements ISurgeryAppService {
|
|||||||
serviceRequest.setTherapyEnum(TherapyTimeType.TEMPORARY.getValue());// 治疗类型
|
serviceRequest.setTherapyEnum(TherapyTimeType.TEMPORARY.getValue());// 治疗类型
|
||||||
serviceRequest.setQuantity(BigDecimal.valueOf(1)); // 请求数量
|
serviceRequest.setQuantity(BigDecimal.valueOf(1)); // 请求数量
|
||||||
serviceRequest.setUnitCode("次"); // 请求单位编码
|
serviceRequest.setUnitCode("次"); // 请求单位编码
|
||||||
serviceRequest.setCategoryEnum(4); // 请求类型:4-手术
|
serviceRequest.setCategoryEnum(24); // 请求类型:24-手术(新值域,避开 adviceType 碰撞)
|
||||||
serviceRequest.setActivityId(surgeryId); // 手术ID作为诊疗定义id
|
serviceRequest.setActivityId(surgeryId); // 手术ID作为诊疗定义id
|
||||||
serviceRequest.setPatientId(surgeryDto.getPatientId()); // 患者
|
serviceRequest.setPatientId(surgeryDto.getPatientId()); // 患者
|
||||||
serviceRequest.setRequesterId(practitionerId); // 开方医生
|
serviceRequest.setRequesterId(practitionerId); // 开方医生
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import com.core.common.core.domain.R;
|
|||||||
import com.core.common.core.domain.model.LoginUser;
|
import com.core.common.core.domain.model.LoginUser;
|
||||||
import com.core.common.utils.SecurityUtils;
|
import com.core.common.utils.SecurityUtils;
|
||||||
import com.openhis.administration.domain.Patient;
|
import com.openhis.administration.domain.Patient;
|
||||||
import com.openhis.administration.service.IOrganizationService;
|
|
||||||
import com.openhis.administration.service.IPatientService;
|
import com.openhis.administration.service.IPatientService;
|
||||||
import com.openhis.clinical.domain.Surgery;
|
import com.openhis.clinical.domain.Surgery;
|
||||||
import com.openhis.clinical.service.ISurgeryService;
|
import com.openhis.clinical.service.ISurgeryService;
|
||||||
@@ -28,7 +27,6 @@ import java.io.IOException;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -204,6 +202,8 @@ public class SurgicalScheduleAppServiceImpl implements ISurgicalScheduleAppServi
|
|||||||
return R.fail("新增手术安排失败");
|
return R.fail("新增手术安排失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
syncSurgeryIncisionLevel(opSchedule.getOperCode(), opCreateScheduleDto.getIncisionLevel());
|
||||||
|
|
||||||
// Bug #247 修复:更新手术申请单状态为已排期 (1)
|
// Bug #247 修复:更新手术申请单状态为已排期 (1)
|
||||||
if (opCreateScheduleDto.getApplyId() != null) {
|
if (opCreateScheduleDto.getApplyId() != null) {
|
||||||
try {
|
try {
|
||||||
@@ -300,6 +300,8 @@ public class SurgicalScheduleAppServiceImpl implements ISurgicalScheduleAppServi
|
|||||||
return R.fail("修改手术安排失败");
|
return R.fail("修改手术安排失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
syncSurgeryIncisionLevel(opScheduleDto.getOperCode(), opScheduleDto.getIncisionLevel());
|
||||||
|
|
||||||
return R.ok("修改手术安排成功");
|
return R.ok("修改手术安排成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -433,6 +435,28 @@ public class SurgicalScheduleAppServiceImpl implements ISurgicalScheduleAppServi
|
|||||||
return scheduleDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
return scheduleDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步手术申请表中的切口类型
|
||||||
|
*/
|
||||||
|
private void syncSurgeryIncisionLevel(String surgeryNo, Integer incisionLevel) {
|
||||||
|
if (surgeryNo == null || surgeryNo.isEmpty() || incisionLevel == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LambdaQueryWrapper<Surgery> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(Surgery::getSurgeryNo, surgeryNo)
|
||||||
|
.eq(Surgery::getDeleteFlag, "0");
|
||||||
|
Surgery surgery = surgeryService.getOne(queryWrapper);
|
||||||
|
if (surgery == null) {
|
||||||
|
log.warn("未找到需要同步切口类型的手术申请记录 - surgeryNo: {}", surgeryNo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
surgery.setIncisionLevel(incisionLevel);
|
||||||
|
surgery.setUpdateTime(new Date());
|
||||||
|
surgeryService.updateById(surgery);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 填充手术申请中缺失的名称字段
|
* 填充手术申请中缺失的名称字段
|
||||||
* 在创建手术安排时调用,确保关联的cli_surgery表中的名称字段有值
|
* 在创建手术安排时调用,确保关联的cli_surgery表中的名称字段有值
|
||||||
|
|||||||
@@ -2,9 +2,13 @@ package com.openhis.web.clinicalmanage.controller;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.core.common.core.domain.R;
|
import com.core.common.core.domain.R;
|
||||||
|
import com.openhis.common.enums.ActivityDefCategory;
|
||||||
import com.openhis.web.clinicalmanage.appservice.ISurgicalScheduleAppService;
|
import com.openhis.web.clinicalmanage.appservice.ISurgicalScheduleAppService;
|
||||||
import com.openhis.web.clinicalmanage.dto.OpCreateScheduleDto;
|
import com.openhis.web.clinicalmanage.dto.OpCreateScheduleDto;
|
||||||
import com.openhis.web.clinicalmanage.dto.OpScheduleDto;
|
import com.openhis.web.clinicalmanage.dto.OpScheduleDto;
|
||||||
|
import com.openhis.web.regdoctorstation.appservice.IRequestFormManageAppService;
|
||||||
|
import com.openhis.web.regdoctorstation.dto.RequestFormDto;
|
||||||
|
import com.openhis.web.regdoctorstation.dto.RequestFormPageDto;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -26,6 +30,7 @@ import java.util.Map;
|
|||||||
public class SurgicalScheduleController {
|
public class SurgicalScheduleController {
|
||||||
|
|
||||||
private final ISurgicalScheduleAppService surgicalScheduleAppService;
|
private final ISurgicalScheduleAppService surgicalScheduleAppService;
|
||||||
|
private final IRequestFormManageAppService requestFormManageAppService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询手术安排列表
|
* 分页查询手术安排列表
|
||||||
@@ -87,6 +92,27 @@ public class SurgicalScheduleController {
|
|||||||
return surgicalScheduleAppService.deleteSurgerySchedule(scheduleId);
|
return surgicalScheduleAppService.deleteSurgerySchedule(scheduleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询待排期手术申请列表
|
||||||
|
*
|
||||||
|
* @param requestFormDto 查询条件
|
||||||
|
* @return 手术申请列表
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/apply-list")
|
||||||
|
public R<IPage<RequestFormPageDto>> getSurgeryApplyList(@RequestBody RequestFormDto requestFormDto) {
|
||||||
|
if (requestFormDto.getPageNo() == null) {
|
||||||
|
requestFormDto.setPageNo(1);
|
||||||
|
}
|
||||||
|
if (requestFormDto.getPageSize() == null) {
|
||||||
|
requestFormDto.setPageSize(10);
|
||||||
|
}
|
||||||
|
//虽然很想这么写,但是库里的手术申请单的type_code都是直接写的SURGERY
|
||||||
|
// requestFormDto.setTypeCode(ActivityDefCategory.PROCEDURE.getCode());
|
||||||
|
//只查询手术申请单
|
||||||
|
requestFormDto.setTypeCode("SURGERY");
|
||||||
|
return R.ok(requestFormManageAppService.getRequestFormPage(requestFormDto));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出手术安排列表
|
* 导出手术安排列表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -85,6 +84,11 @@ public class OpCreateScheduleDto {
|
|||||||
*/
|
*/
|
||||||
private String surgerySite;
|
private String surgerySite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 切口类型
|
||||||
|
*/
|
||||||
|
private Integer incisionLevel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 入院时间
|
* 入院时间
|
||||||
*/
|
*/
|
||||||
@@ -246,11 +250,26 @@ public class OpCreateScheduleDto {
|
|||||||
*/
|
*/
|
||||||
private String communicationInfo;
|
private String communicationInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否外请专家 1-是 0-否
|
||||||
|
*/
|
||||||
|
private Integer isExternalExpert;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 外请专家姓名
|
||||||
|
*/
|
||||||
|
private String externalExpertName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 费用类别
|
||||||
|
*/
|
||||||
|
private String feeType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
|||||||
import com.openhis.surgicalschedule.domain.OpSchedule;
|
import com.openhis.surgicalschedule.domain.OpSchedule;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@@ -93,6 +94,12 @@ public class OpScheduleDto extends OpSchedule {
|
|||||||
* 手术类型
|
* 手术类型
|
||||||
*/
|
*/
|
||||||
private String surgeryType;
|
private String surgeryType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 切口类型
|
||||||
|
*/
|
||||||
|
private Integer incisionLevel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 申请科室
|
* 申请科室
|
||||||
*/
|
*/
|
||||||
@@ -106,4 +113,5 @@ public class OpScheduleDto extends OpSchedule {
|
|||||||
* 创建人名称
|
* 创建人名称
|
||||||
*/
|
*/
|
||||||
private String createByName;
|
private String createByName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,16 @@ public interface IDoctorStationAdviceAppService {
|
|||||||
*/
|
*/
|
||||||
R<?> getRequestBaseInfo(Long encounterId);
|
R<?> getRequestBaseInfo(Long encounterId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询医嘱请求数据(支持按生成来源和来源单据号过滤)
|
||||||
|
*
|
||||||
|
* @param encounterId 就诊id
|
||||||
|
* @param generateSourceEnum 生成来源(可选,如手术计费=6)
|
||||||
|
* @param sourceBillNo 来源业务单据号(可选)
|
||||||
|
* @return 医嘱请求数据
|
||||||
|
*/
|
||||||
|
R<?> getRequestBaseInfo(Long encounterId, Integer generateSourceEnum, String sourceBillNo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 门诊签退医嘱
|
* 门诊签退医嘱
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import com.openhis.medication.service.IMedicationDispenseService;
|
|||||||
import com.openhis.medication.service.IMedicationRequestService;
|
import com.openhis.medication.service.IMedicationRequestService;
|
||||||
import com.openhis.web.chargemanage.mapper.OutpatientRegistrationAppMapper;
|
import com.openhis.web.chargemanage.mapper.OutpatientRegistrationAppMapper;
|
||||||
import com.openhis.web.doctorstation.appservice.IDoctorStationAdviceAppService;
|
import com.openhis.web.doctorstation.appservice.IDoctorStationAdviceAppService;
|
||||||
|
import com.openhis.web.doctorstation.appservice.IDoctorStationInspectionLabApplyService;
|
||||||
import com.openhis.web.doctorstation.dto.*;
|
import com.openhis.web.doctorstation.dto.*;
|
||||||
import com.openhis.web.doctorstation.mapper.DoctorStationAdviceAppMapper;
|
import com.openhis.web.doctorstation.mapper.DoctorStationAdviceAppMapper;
|
||||||
import com.openhis.web.doctorstation.utils.AdviceUtils;
|
import com.openhis.web.doctorstation.utils.AdviceUtils;
|
||||||
@@ -47,12 +48,15 @@ import com.openhis.workflow.domain.InventoryItem;
|
|||||||
import com.openhis.workflow.domain.ServiceRequest;
|
import com.openhis.workflow.domain.ServiceRequest;
|
||||||
import com.openhis.workflow.service.*;
|
import com.openhis.workflow.service.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -62,6 +66,9 @@ import java.util.stream.Collectors;
|
|||||||
@Service
|
@Service
|
||||||
public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAppService {
|
public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAppService {
|
||||||
|
|
||||||
|
private static final Pattern INSPECTION_APPLY_NO_JSON =
|
||||||
|
Pattern.compile("\"applyNo\"\\s*:\\s*\"([^\"]+)\"");
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
AssignSeqUtil assignSeqUtil;
|
AssignSeqUtil assignSeqUtil;
|
||||||
|
|
||||||
@@ -118,6 +125,13 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
|||||||
@Resource
|
@Resource
|
||||||
IInventoryItemService inventoryItemService;
|
IInventoryItemService inventoryItemService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 与检验申请实现存在循环依赖,需延迟注入;删除诊疗医嘱时按 contentJson 级联作废检验申请单。
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
|
@Lazy
|
||||||
|
private IDoctorStationInspectionLabApplyService iDoctorStationInspectionLabApplyService;
|
||||||
|
|
||||||
// 缓存 key 前缀
|
// 缓存 key 前缀
|
||||||
private static final String ADVICE_BASE_INFO_CACHE_PREFIX = "advice:base:info:";
|
private static final String ADVICE_BASE_INFO_CACHE_PREFIX = "advice:base:info:";
|
||||||
// 缓存过期时间(小时)
|
// 缓存过期时间(小时)
|
||||||
@@ -228,36 +242,58 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
|||||||
// 医嘱定义ID集合
|
// 医嘱定义ID集合
|
||||||
List<Long> adviceDefinitionIdList = adviceBaseDtoList.stream().map(AdviceBaseDto::getAdviceDefinitionId)
|
List<Long> adviceDefinitionIdList = adviceBaseDtoList.stream().map(AdviceBaseDto::getAdviceDefinitionId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
// 费用定价主表ID集合
|
// 费用定价主表ID集合(过滤null值,手术项目无定价定义)
|
||||||
List<Long> chargeItemDefinitionIdList = adviceBaseDtoList.stream().map(AdviceBaseDto::getChargeItemDefinitionId)
|
List<Long> chargeItemDefinitionIdList = adviceBaseDtoList.stream()
|
||||||
|
.map(AdviceBaseDto::getChargeItemDefinitionId)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
// 医嘱库存集合
|
|
||||||
List<AdviceInventoryDto> adviceInventoryList = doctorStationAdviceAppMapper.getAdviceInventory(locationId,
|
// 判断是否包含药品或耗材类型(只有这些类型才需要库存相关查询)
|
||||||
adviceDefinitionIdList,
|
boolean hasMedOrDevice = adviceTypes != null
|
||||||
CommonConstants.SqlCondition.ABOUT_INVENTORY_TABLE_STR, PublicationStatus.ACTIVE.getValue());
|
&& (adviceTypes.contains(1) || adviceTypes.contains(2));
|
||||||
// 待发放个数信息
|
|
||||||
List<AdviceInventoryDto> adviceDraftInventoryList = doctorStationAdviceAppMapper.getAdviceDraftInventory(
|
// 医嘱库存集合 — 仅药品/耗材需要库存查询,手术/诊疗(3,6)无库存概念,跳过以减少数据库开销
|
||||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
|
List<AdviceInventoryDto> adviceInventoryList;
|
||||||
DispenseStatus.DRAFT.getValue(), DispenseStatus.PREPARATION.getValue());
|
List<AdviceInventoryDto> adviceDraftInventoryList;
|
||||||
// 预减库存
|
List<AdviceInventoryDto> adviceInventory;
|
||||||
List<AdviceInventoryDto> adviceInventory = adviceUtils.subtractInventory(adviceInventoryList,
|
if (hasMedOrDevice) {
|
||||||
adviceDraftInventoryList);
|
adviceInventoryList = doctorStationAdviceAppMapper.getAdviceInventory(locationId,
|
||||||
// 查询取药科室配置
|
adviceDefinitionIdList,
|
||||||
List<AdviceInventoryDto> medLocationConfig = doctorStationAdviceAppMapper.getMedLocationConfig(organizationId);
|
CommonConstants.SqlCondition.ABOUT_INVENTORY_TABLE_STR, PublicationStatus.ACTIVE.getValue());
|
||||||
// 将配置转为 {categoryCode -> 允许的locationId集合}
|
// 待发放个数信息
|
||||||
Map<String, Set<Long>> allowedLocByCategory = new HashMap<>();
|
adviceDraftInventoryList = doctorStationAdviceAppMapper.getAdviceDraftInventory(
|
||||||
if (medLocationConfig != null && !medLocationConfig.isEmpty()) {
|
CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION,
|
||||||
for (AdviceInventoryDto cfg : medLocationConfig) {
|
DispenseStatus.DRAFT.getValue(), DispenseStatus.PREPARATION.getValue());
|
||||||
if (cfg.getCategoryCode() == null || cfg.getLocationId() == null) {
|
// 预减库存
|
||||||
continue;
|
adviceInventory = adviceUtils.subtractInventory(adviceInventoryList, adviceDraftInventoryList);
|
||||||
}
|
} else {
|
||||||
allowedLocByCategory.computeIfAbsent(String.valueOf(cfg.getCategoryCode()), k -> new HashSet<>())
|
adviceInventoryList = Collections.emptyList();
|
||||||
.add(cfg.getLocationId());
|
adviceDraftInventoryList = Collections.emptyList();
|
||||||
}
|
adviceInventory = Collections.emptyList();
|
||||||
}
|
}
|
||||||
// 费用定价子表信息 - 使用分批处理避免大量参数问题
|
// 查询取药科室配置 — 仅药品开单场景需要
|
||||||
|
List<AdviceInventoryDto> medLocationConfig;
|
||||||
|
Map<String, Set<Long>> allowedLocByCategory;
|
||||||
|
if (hasMedOrDevice) {
|
||||||
|
medLocationConfig = doctorStationAdviceAppMapper.getMedLocationConfig(organizationId);
|
||||||
|
// 将配置转为 {categoryCode -> 允许的locationId集合}
|
||||||
|
allowedLocByCategory = new HashMap<>();
|
||||||
|
if (medLocationConfig != null && !medLocationConfig.isEmpty()) {
|
||||||
|
for (AdviceInventoryDto cfg : medLocationConfig) {
|
||||||
|
if (cfg.getCategoryCode() == null || cfg.getLocationId() == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
allowedLocByCategory.computeIfAbsent(String.valueOf(cfg.getCategoryCode()), k -> new HashSet<>())
|
||||||
|
.add(cfg.getLocationId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
medLocationConfig = Collections.emptyList();
|
||||||
|
allowedLocByCategory = Collections.emptyMap();
|
||||||
|
}
|
||||||
|
// 费用定价子表信息 - 仅药品/耗材需要批次定价查询,手术/诊疗无库存概念不需要
|
||||||
List<AdvicePriceDto> childCharge = new ArrayList<>();
|
List<AdvicePriceDto> childCharge = new ArrayList<>();
|
||||||
if (chargeItemDefinitionIdList != null && !chargeItemDefinitionIdList.isEmpty()) {
|
if (hasMedOrDevice && chargeItemDefinitionIdList != null && !chargeItemDefinitionIdList.isEmpty()) {
|
||||||
// 分批处理,每批最多1000个ID,增加批次大小以减少查询次数
|
// 分批处理,每批最多1000个ID,增加批次大小以减少查询次数
|
||||||
int batchSize = 1000;
|
int batchSize = 1000;
|
||||||
for (int i = 0; i < chargeItemDefinitionIdList.size(); i += batchSize) {
|
for (int i = 0; i < chargeItemDefinitionIdList.size(); i += batchSize) {
|
||||||
@@ -937,11 +973,16 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (AdviceSaveDto adviceSaveDto : deleteList) {
|
for (AdviceSaveDto adviceSaveDto : deleteList) {
|
||||||
iMedicationRequestService.removeById(adviceSaveDto.getRequestId());
|
Long requestId = adviceSaveDto.getRequestId();
|
||||||
|
// 🔧 Bug #442: 跳过 requestId 为 null 的记录,避免删除不存在的药品请求
|
||||||
|
if (requestId == null) {
|
||||||
|
log.warn("BugFix#442: handMedication - 跳过 requestId 为 null 的删除请求");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
iMedicationRequestService.removeById(requestId);
|
||||||
// 删除已经产生的药品发放信息
|
// 删除已经产生的药品发放信息
|
||||||
iMedicationDispenseService.deleteMedicationDispense(adviceSaveDto.getRequestId());
|
iMedicationDispenseService.deleteMedicationDispense(adviceSaveDto.getRequestId());
|
||||||
// 🔧 Bug Fix #219: 删除费用项
|
// 🔧 Bug Fix #219: 删除费用项
|
||||||
Long requestId = adviceSaveDto.getRequestId();
|
|
||||||
String serviceTable = CommonConstants.TableName.MED_MEDICATION_REQUEST;
|
String serviceTable = CommonConstants.TableName.MED_MEDICATION_REQUEST;
|
||||||
// 直接删除费用项
|
// 直接删除费用项
|
||||||
iChargeItemService.deleteByServiceTableAndId(serviceTable, requestId);
|
iChargeItemService.deleteByServiceTableAndId(serviceTable, requestId);
|
||||||
@@ -1397,6 +1438,11 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
|||||||
log.info("BugFix#219: handDevice - 开始删除循环, deleteList.size={}", deleteList.size());
|
log.info("BugFix#219: handDevice - 开始删除循环, deleteList.size={}", deleteList.size());
|
||||||
for (AdviceSaveDto adviceSaveDto : deleteList) {
|
for (AdviceSaveDto adviceSaveDto : deleteList) {
|
||||||
Long requestId = adviceSaveDto.getRequestId();
|
Long requestId = adviceSaveDto.getRequestId();
|
||||||
|
// 🔧 Bug #442: 跳过 requestId 为 null 的记录,避免删除不存在的耗材请求
|
||||||
|
if (requestId == null) {
|
||||||
|
log.warn("BugFix#442: handDevice - 跳过 requestId 为 null 的删除请求");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
log.info("BugFix#219: handDevice - 删除开始: requestId={}", requestId);
|
log.info("BugFix#219: handDevice - 删除开始: requestId={}", requestId);
|
||||||
|
|
||||||
// 1. 删除耗材请求
|
// 1. 删除耗材请求
|
||||||
@@ -1497,21 +1543,44 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
|||||||
deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4));
|
deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4));
|
||||||
}
|
}
|
||||||
deviceRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
|
deviceRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
|
||||||
|
deviceRequest.setPrescriptionNo(adviceSaveDto.getSourceBillNo()); // 来源业务单据号(手术单号)
|
||||||
deviceRequest.setQuantity(adviceSaveDto.getQuantity()); // 请求数量
|
deviceRequest.setQuantity(adviceSaveDto.getQuantity()); // 请求数量
|
||||||
deviceRequest.setUnitCode(adviceSaveDto.getUnitCode()); // 请求单位编码
|
deviceRequest.setUnitCode(adviceSaveDto.getUnitCode()); // 请求单位编码
|
||||||
deviceRequest.setLotNumber(adviceSaveDto.getLotNumber());// 产品批号
|
deviceRequest.setLotNumber(adviceSaveDto.getLotNumber());// 产品批号
|
||||||
|
|
||||||
deviceRequest.setCategoryEnum(adviceSaveDto.getCategoryEnum()); // 请求类型
|
deviceRequest.setCategoryEnum(adviceSaveDto.getCategoryEnum()); // 请求类型
|
||||||
deviceRequest.setDeviceDefId(adviceSaveDto.getAdviceDefinitionId());// 耗材定义id
|
// 🔧 BugFix #498: categoryEnum=22(检查) 走 ServiceRequest,不走 DeviceRequest
|
||||||
|
// 检查申请单的诊疗定义ID存在 activityId,不在 adviceDefinitionId
|
||||||
|
// deviceDefId 对应耗材定义ID,不能用诊疗定义ID填充
|
||||||
|
if (adviceSaveDto.getCategoryEnum() == 22) {
|
||||||
|
log.info("handDevice skip - 检查申请单(categoryEnum=22) 走 ServiceRequest 路径,跳过 DeviceRequest 保存");
|
||||||
|
continue; // 跳过本次循环,不走耗材请求路径
|
||||||
|
} else if (adviceSaveDto.getAdviceDefinitionId() != null) {
|
||||||
|
deviceRequest.setDeviceDefId(adviceSaveDto.getAdviceDefinitionId());// 耗材定义id
|
||||||
|
} else {
|
||||||
|
log.warn("handDevice - deviceDefId 为空,adviceDefinitionId=null, categoryEnum={}", adviceSaveDto.getCategoryEnum());
|
||||||
|
}
|
||||||
|
|
||||||
deviceRequest.setPatientId(adviceSaveDto.getPatientId()); // 患者
|
deviceRequest.setPatientId(adviceSaveDto.getPatientId()); // 患者
|
||||||
deviceRequest.setRequesterId(adviceSaveDto.getPractitionerId()); // 开方医生
|
deviceRequest.setRequesterId(adviceSaveDto.getPractitionerId()); // 开方医生
|
||||||
deviceRequest.setOrgId(adviceSaveDto.getFounderOrgId());// 开方人科室
|
deviceRequest.setOrgId(adviceSaveDto.getFounderOrgId());// 开方人科室
|
||||||
deviceRequest.setReqAuthoredTime(curDate); // 请求开始时间
|
deviceRequest.setReqAuthoredTime(curDate); // 请求开始时间
|
||||||
// 发放耗材房(若前端未传locationId,使用登录用户的科室作为默认值)
|
// 发放耗材房(若前端未传locationId,优先沿用已有DeviceRequest的performLocation,否则使用登录用户科室)
|
||||||
Long locId = adviceSaveDto.getLocationId();
|
Long locId = adviceSaveDto.getLocationId();
|
||||||
if (locId == null) {
|
if (locId == null) {
|
||||||
locId = SecurityUtils.getLoginUser().getOrgId();
|
// 尝试从已有DeviceRequest获取原始的performLocation
|
||||||
log.info("耗材locationId为空,使用登录用户科室作为默认值: locationId={}", locId);
|
if (adviceSaveDto.getRequestId() != null) {
|
||||||
|
DeviceRequest existingDevice = iDeviceRequestService.getById(adviceSaveDto.getRequestId());
|
||||||
|
if (existingDevice != null && existingDevice.getPerformLocation() != null) {
|
||||||
|
locId = existingDevice.getPerformLocation();
|
||||||
|
log.info("耗材locationId为空,使用已有DeviceRequest的performLocation: locationId={}", locId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 如果已有记录也没有performLocation,则使用登录用户科室作为兜底
|
||||||
|
if (locId == null) {
|
||||||
|
locId = SecurityUtils.getLoginUser().getOrgId();
|
||||||
|
log.info("耗材locationId为空且无已有记录,使用登录用户科室作为默认值: locationId={}", locId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
deviceRequest.setPerformLocation(locId);
|
deviceRequest.setPerformLocation(locId);
|
||||||
deviceRequest.setEncounterId(adviceSaveDto.getEncounterId()); // 就诊id
|
deviceRequest.setEncounterId(adviceSaveDto.getEncounterId()); // 就诊id
|
||||||
@@ -1652,6 +1721,21 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从诊疗医嘱 contentJson 中解析检验申请单号(检验保存时写入形如 {"applyNo":"..."})。
|
||||||
|
*/
|
||||||
|
private String extractInspectionApplyNoFromContentJson(String contentJson) {
|
||||||
|
if (StringUtils.isBlank(contentJson) || !contentJson.contains("applyNo")) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Matcher m = INSPECTION_APPLY_NO_JSON.matcher(contentJson);
|
||||||
|
if (!m.find()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String applyNo = m.group(1).trim();
|
||||||
|
return StringUtils.isBlank(applyNo) ? null : applyNo;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理诊疗
|
* 处理诊疗
|
||||||
*/
|
*/
|
||||||
@@ -1700,13 +1784,49 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 检验申请单在医嘱 contentJson 中写入 applyNo;从医嘱删除时需先级联作废检验单,避免检验页签仍显示孤儿申请
|
||||||
|
Map<String, List<Long>> labApplyNoToRequestIds = new LinkedHashMap<>();
|
||||||
for (AdviceSaveDto adviceSaveDto : deleteList) {
|
for (AdviceSaveDto adviceSaveDto : deleteList) {
|
||||||
iServiceRequestService.removeById(adviceSaveDto.getRequestId());// 删除诊疗
|
Long requestId = adviceSaveDto.getRequestId();
|
||||||
|
// 🔧 Bug #442: 跳过 requestId 为 null 的记录,避免删除不存在的诊疗请求
|
||||||
|
if (requestId == null) {
|
||||||
|
log.warn("BugFix#442: handService - 跳过 requestId 为 null 的删除请求");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
iServiceRequestService.removeById(requestId);// 删除诊疗
|
||||||
|
ServiceRequest existing = iServiceRequestService.getById(adviceSaveDto.getRequestId());
|
||||||
|
if (existing == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String applyNo = extractInspectionApplyNoFromContentJson(existing.getContentJson());
|
||||||
|
if (StringUtils.isNotBlank(applyNo)) {
|
||||||
|
labApplyNoToRequestIds.computeIfAbsent(applyNo, k -> new ArrayList<>())
|
||||||
|
.add(adviceSaveDto.getRequestId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Set<Long> labCascadeSkippedRequestIds = new HashSet<>();
|
||||||
|
for (Map.Entry<String, List<Long>> e : labApplyNoToRequestIds.entrySet()) {
|
||||||
|
R<?> delLab = iDoctorStationInspectionLabApplyService.deleteInspectionLabApply(e.getKey());
|
||||||
|
if (delLab != null && R.isSuccess(delLab)) {
|
||||||
|
labCascadeSkippedRequestIds.addAll(e.getValue());
|
||||||
|
log.info("handService - 级联作废检验申请单 applyNo={},已跳过重复删除的医嘱 requestIds={}",
|
||||||
|
e.getKey(), e.getValue());
|
||||||
|
} else {
|
||||||
|
String msg = delLab != null && StringUtils.isNotEmpty(delLab.getMsg()) ? delLab.getMsg() : "删除检验申请单失败";
|
||||||
|
log.warn("handService - 级联作废检验申请单未成功 applyNo={} msg={},将回退为仅删除当前医嘱记录",
|
||||||
|
e.getKey(), msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (AdviceSaveDto adviceSaveDto : deleteList) {
|
||||||
|
if (labCascadeSkippedRequestIds.contains(adviceSaveDto.getRequestId())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Long requestId = adviceSaveDto.getRequestId();
|
||||||
|
iServiceRequestService.removeById(requestId);// 删除诊疗
|
||||||
iServiceRequestService.remove(
|
iServiceRequestService.remove(
|
||||||
new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getParentId,
|
new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getParentId,
|
||||||
adviceSaveDto.getRequestId()));// 删除诊疗套餐对应的子项
|
requestId));// 删除诊疗套餐对应的子项
|
||||||
// 🔧 Bug Fix #219: 删除费用项
|
// 🔧 Bug Fix #219: 删除费用项
|
||||||
Long requestId = adviceSaveDto.getRequestId();
|
|
||||||
String serviceTable = CommonConstants.TableName.WOR_SERVICE_REQUEST;
|
String serviceTable = CommonConstants.TableName.WOR_SERVICE_REQUEST;
|
||||||
// 直接删除费用项
|
// 直接删除费用项
|
||||||
iChargeItemService.deleteByServiceTableAndId(serviceTable, requestId);
|
iChargeItemService.deleteByServiceTableAndId(serviceTable, requestId);
|
||||||
@@ -1763,8 +1883,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
|||||||
log.info("handService - 自动补全founderOrgId: founderOrgId={}", adviceSaveDto.getFounderOrgId());
|
log.info("handService - 自动补全founderOrgId: founderOrgId={}", adviceSaveDto.getFounderOrgId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 🔧 Bug Fix #238: 诊疗项目执行科室非空校验
|
// 🔧 Bug Fix #238/#454: 诊疗项目执行科室非空校验(删除操作跳过校验)
|
||||||
if (adviceSaveDto.getAdviceType() != null && adviceSaveDto.getAdviceType() == 3) {
|
if (adviceSaveDto.getAdviceType() != null && adviceSaveDto.getAdviceType() == 3
|
||||||
|
&& !DbOpType.DELETE.getCode().equals(adviceSaveDto.getDbOpType())) {
|
||||||
Long effectiveOrgId = adviceSaveDto.getEffectiveOrgId();
|
Long effectiveOrgId = adviceSaveDto.getEffectiveOrgId();
|
||||||
if (effectiveOrgId == null) {
|
if (effectiveOrgId == null) {
|
||||||
throw new ServiceException("诊疗项目必须选择执行科室");
|
throw new ServiceException("诊疗项目必须选择执行科室");
|
||||||
@@ -1786,6 +1907,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
|||||||
serviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.SERVICE_RES_NO.getPrefix(), 4));
|
serviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.SERVICE_RES_NO.getPrefix(), 4));
|
||||||
}
|
}
|
||||||
serviceRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
|
serviceRequest.setGenerateSourceEnum(GenerateSource.DOCTOR_PRESCRIPTION.getValue()); // 生成来源
|
||||||
|
serviceRequest.setPrescriptionNo(adviceSaveDto.getSourceBillNo()); // 来源业务单据号(手术单号)
|
||||||
serviceRequest.setQuantity(adviceSaveDto.getQuantity()); // 请求数量
|
serviceRequest.setQuantity(adviceSaveDto.getQuantity()); // 请求数量
|
||||||
serviceRequest.setUnitCode(adviceSaveDto.getUnitCode()); // 请求单位编码
|
serviceRequest.setUnitCode(adviceSaveDto.getUnitCode()); // 请求单位编码
|
||||||
|
|
||||||
@@ -1967,13 +2089,25 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public R<?> getRequestBaseInfo(Long encounterId) {
|
public R<?> getRequestBaseInfo(Long encounterId) {
|
||||||
|
return this.getRequestBaseInfo(encounterId, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<?> getRequestBaseInfo(Long encounterId, Integer generateSourceEnum, String sourceBillNo) {
|
||||||
// 当前账号的参与者id
|
// 当前账号的参与者id
|
||||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||||
|
// 未指定generateSourceEnum时,默认只查询医生开立的医嘱
|
||||||
|
int sourceEnum = (generateSourceEnum != null) ? generateSourceEnum : GenerateSource.DOCTOR_PRESCRIPTION.getValue();
|
||||||
// 医嘱请求数据
|
// 医嘱请求数据
|
||||||
List<RequestBaseDto> requestBaseInfo = doctorStationAdviceAppMapper.getRequestBaseInfo(encounterId, null,
|
List<RequestBaseDto> requestBaseInfo = doctorStationAdviceAppMapper.getRequestBaseInfo(encounterId, null,
|
||||||
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
|
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
|
||||||
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.NO.getCode(),
|
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.NO.getCode(),
|
||||||
GenerateSource.DOCTOR_PRESCRIPTION.getValue());
|
sourceEnum, sourceBillNo);
|
||||||
|
// 手术计费场景:sourceBillNo 不为空时,过滤掉药品(1),保留耗材(2)和诊疗(3/6)
|
||||||
|
if (sourceBillNo != null && !sourceBillNo.isEmpty()) {
|
||||||
|
requestBaseInfo.removeIf(dto -> dto.getAdviceType() != null
|
||||||
|
&& dto.getAdviceType() == 1);
|
||||||
|
}
|
||||||
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
|
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
|
||||||
// 请求状态
|
// 请求状态
|
||||||
requestBaseDto
|
requestBaseDto
|
||||||
@@ -2094,7 +2228,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp
|
|||||||
List<RequestBaseDto> requestBaseInfo = doctorStationAdviceAppMapper.getRequestBaseInfo(encounterId, patientId,
|
List<RequestBaseDto> requestBaseInfo = doctorStationAdviceAppMapper.getRequestBaseInfo(encounterId, patientId,
|
||||||
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
|
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST,
|
||||||
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.YES.getCode(),
|
CommonConstants.TableName.WOR_SERVICE_REQUEST, practitionerId, Whether.YES.getCode(),
|
||||||
GenerateSource.DOCTOR_PRESCRIPTION.getValue());
|
GenerateSource.DOCTOR_PRESCRIPTION.getValue(), null);
|
||||||
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
|
for (RequestBaseDto requestBaseDto : requestBaseInfo) {
|
||||||
// 请求状态
|
// 请求状态
|
||||||
requestBaseDto
|
requestBaseDto
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -261,8 +264,10 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
|
|||||||
// 设置创建时间,避免数据库约束错误
|
// 设置创建时间,避免数据库约束错误
|
||||||
encounterDiagnosis.setCreateTime(new Date());
|
encounterDiagnosis.setCreateTime(new Date());
|
||||||
iEncounterDiagnosisService.saveOrUpdate(encounterDiagnosis);
|
iEncounterDiagnosisService.saveOrUpdate(encounterDiagnosis);
|
||||||
|
// 回写就诊诊断ID,供前端后续更新使用
|
||||||
|
saveDiagnosisChildParam.setEncounterDiagnosisId(encounterDiagnosis.getId());
|
||||||
}
|
}
|
||||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊断"}));
|
return R.ok(saveDiagnosisParam, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊断"}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -580,7 +585,11 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
|
|||||||
@Override
|
@Override
|
||||||
public R<?> saveInfectiousDiseaseReport(InfectiousDiseaseReportDto infectiousDiseaseReportDto) {
|
public R<?> saveInfectiousDiseaseReport(InfectiousDiseaseReportDto infectiousDiseaseReportDto) {
|
||||||
// 检查卡片编号唯一性(新增时检查,编辑时排除当前记录)
|
// 检查卡片编号唯一性(新增时检查,编辑时排除当前记录)
|
||||||
String cardNo = infectiousDiseaseReportDto.getCardNo().trim();
|
String cardNo = infectiousDiseaseReportDto.getCardNo();
|
||||||
|
if (cardNo == null || cardNo.trim().isEmpty()) {
|
||||||
|
return R.fail("卡片编号不能为空");
|
||||||
|
}
|
||||||
|
cardNo = cardNo.trim();
|
||||||
LambdaQueryWrapper<InfectiousDiseaseReport> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<InfectiousDiseaseReport> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(InfectiousDiseaseReport::getCardNo, cardNo);
|
queryWrapper.eq(InfectiousDiseaseReport::getCardNo, cardNo);
|
||||||
long count = iInfectiousDiseaseReportService.count(queryWrapper);
|
long count = iInfectiousDiseaseReportService.count(queryWrapper);
|
||||||
@@ -592,6 +601,25 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn
|
|||||||
InfectiousDiseaseReport infectiousDiseaseReport = new InfectiousDiseaseReport();
|
InfectiousDiseaseReport infectiousDiseaseReport = new InfectiousDiseaseReport();
|
||||||
BeanUtils.copyProperties(infectiousDiseaseReportDto, infectiousDiseaseReport);
|
BeanUtils.copyProperties(infectiousDiseaseReportDto, infectiousDiseaseReport);
|
||||||
|
|
||||||
|
// BeanUtils.copyProperties 不支持 LocalDate/LocalDateTime 到 java.util.Date 的类型转换,需手动处理
|
||||||
|
if (infectiousDiseaseReportDto.getOnsetDate() != null) {
|
||||||
|
infectiousDiseaseReport.setOnsetDate(
|
||||||
|
Date.from(infectiousDiseaseReportDto.getOnsetDate().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||||
|
}
|
||||||
|
if (infectiousDiseaseReportDto.getDiagDate() != null) {
|
||||||
|
infectiousDiseaseReport.setDiagDate(
|
||||||
|
Date.from(infectiousDiseaseReportDto.getDiagDate().atZone(ZoneId.systemDefault()).toInstant()));
|
||||||
|
}
|
||||||
|
// deathDate / reportDate 同理
|
||||||
|
if (infectiousDiseaseReportDto.getDeathDate() != null) {
|
||||||
|
infectiousDiseaseReport.setDeathDate(
|
||||||
|
Date.from(infectiousDiseaseReportDto.getDeathDate().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||||
|
}
|
||||||
|
if (infectiousDiseaseReportDto.getReportDate() != null) {
|
||||||
|
infectiousDiseaseReport.setReportDate(
|
||||||
|
Date.from(infectiousDiseaseReportDto.getReportDate().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置创建人、删除状态、租户ID
|
* 设置创建人、删除状态、租户ID
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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,33 +300,68 @@ 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();
|
||||||
|
}
|
||||||
|
// 队列项 poolId/slotId 缺失时,通过 encounter.orderId → order_main.slot_id → adm_schedule_slot.pool_id 回退获取
|
||||||
|
if ((divPoolId == null || divSlotId == null) && encounter.getOrderId() != null) {
|
||||||
|
try {
|
||||||
|
Order order = iOrderService.getById(encounter.getOrderId());
|
||||||
|
if (order != null && order.getSlotId() != null) {
|
||||||
|
ScheduleSlot slot = scheduleSlotMapper.selectById(order.getSlotId());
|
||||||
|
if (slot != null) {
|
||||||
|
divSlotId = slot.getId();
|
||||||
|
divPoolId = slot.getPoolId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("回退获取完诊div_log的pool_id/slot_id失败,encounterId={}", encounterId, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 如果队列项存在且未完成,更新队列状态为已完成
|
// 如果队列项存在且未完成,更新队列状态为已完成
|
||||||
// 使用排除法而非白名单:只要不是"已完成"就可以完诊,覆盖跳过、等待等非标准流转状态
|
// 使用排除法而非白名单:只要不是"已完成"就可以完诊,覆盖跳过、等待等非标准流转状态
|
||||||
|
// Bug #401:在更新前记录队列原始完成状态,用于判断是否需要写入 div_log
|
||||||
|
boolean queueWasAlreadyCompleted = queueItem != null
|
||||||
|
&& TriageQueueStatus.COMPLETED.getValue().equals(queueItem.getStatus());
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 写入 div_log 审计日志(独立于队列项,确保每次完诊都生成记录)
|
// 写入 div_log 审计日志(独立于队列项,确保每次完诊都生成记录)
|
||||||
try {
|
// Bug #401:使用更新前记录的原始状态判断,避免自身更新后将状态改为 COMPLETED 导致误判为"已完成"
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
if (!queueWasAlreadyCompleted) {
|
||||||
DivLog divLog = new DivLog()
|
try {
|
||||||
.setPoolId(divPoolId)
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
.setSlotId(divSlotId)
|
DivLog divLog = new DivLog()
|
||||||
.setOpUserId(loginUser != null ? loginUser.getUserId() : null)
|
.setPoolId(divPoolId)
|
||||||
.setAction("COMPLETE")
|
.setSlotId(divSlotId)
|
||||||
.setCreateTime(LocalDateTime.now())
|
.setOpUserId(loginUser != null ? loginUser.getUserId() : null)
|
||||||
.setUpdateAt(LocalDateTime.now())
|
.setAction("COMPLETE")
|
||||||
.setCreatedAt(LocalDateTime.now());
|
.setCreateTime(LocalDateTime.now())
|
||||||
divLogService.save(divLog);
|
.setUpdateAt(LocalDateTime.now())
|
||||||
} catch (Exception e) {
|
.setCreatedAt(LocalDateTime.now());
|
||||||
log.error("写入div_log审计日志失败", e);
|
divLogService.save(divLog);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("写入div_log审计日志失败", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 更新状态、完成时间以及初复诊标识
|
// 4. 更新状态、完成时间以及初复诊标识
|
||||||
|
|||||||
@@ -112,11 +112,16 @@ public class DoctorStationAdviceController {
|
|||||||
* 查询医嘱请求数据
|
* 查询医嘱请求数据
|
||||||
*
|
*
|
||||||
* @param encounterId 就诊id
|
* @param encounterId 就诊id
|
||||||
|
* @param generateSourceEnum 生成来源(可选,用于按来源过滤,如手术计费=6)
|
||||||
|
* @param sourceBillNo 来源业务单据号(可选,用于按来源单据过滤)
|
||||||
* @return 医嘱请求数据
|
* @return 医嘱请求数据
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/request-base-info")
|
@GetMapping(value = "/request-base-info")
|
||||||
public R<?> getRequestBaseInfo(@RequestParam(required = false) Long encounterId) {
|
public R<?> getRequestBaseInfo(
|
||||||
return iDoctorStationAdviceAppService.getRequestBaseInfo(encounterId);
|
@RequestParam(required = false) Long encounterId,
|
||||||
|
@RequestParam(required = false) Integer generateSourceEnum,
|
||||||
|
@RequestParam(required = false) String sourceBillNo) {
|
||||||
|
return iDoctorStationAdviceAppService.getRequestBaseInfo(encounterId, generateSourceEnum, sourceBillNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -96,4 +96,9 @@ public class DiagnosisQueryDto {
|
|||||||
*/
|
*/
|
||||||
private String diagnosisDoctor;
|
private String diagnosisDoctor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否已有传染病报卡(0-无,1-有)
|
||||||
|
*/
|
||||||
|
private Integer hasInfectiousReport;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.openhis.web.doctorstation.dto;
|
package com.openhis.web.doctorstation.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -55,6 +56,7 @@ public class InfectiousDiseaseReportDto {
|
|||||||
private String sex;
|
private String sex;
|
||||||
|
|
||||||
/** 出生日期 */
|
/** 出生日期 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
private Date birthday;
|
private Date birthday;
|
||||||
|
|
||||||
/** 实足年龄 */
|
/** 实足年龄 */
|
||||||
|
|||||||
@@ -122,7 +122,8 @@ public interface DoctorStationAdviceAppMapper {
|
|||||||
@Param("MED_MEDICATION_REQUEST") String MED_MEDICATION_REQUEST,
|
@Param("MED_MEDICATION_REQUEST") String MED_MEDICATION_REQUEST,
|
||||||
@Param("WOR_DEVICE_REQUEST") String WOR_DEVICE_REQUEST,
|
@Param("WOR_DEVICE_REQUEST") String WOR_DEVICE_REQUEST,
|
||||||
@Param("WOR_SERVICE_REQUEST") String WOR_SERVICE_REQUEST, @Param("practitionerId") Long practitionerId,
|
@Param("WOR_SERVICE_REQUEST") String WOR_SERVICE_REQUEST, @Param("practitionerId") Long practitionerId,
|
||||||
@Param("historyFlag") String historyFlag, @Param("generateSourceEnum") Integer generateSourceEnum);
|
@Param("historyFlag") String historyFlag, @Param("generateSourceEnum") Integer generateSourceEnum,
|
||||||
|
@Param("sourceBillNo") String sourceBillNo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询就诊费用性质
|
* 查询就诊费用性质
|
||||||
|
|||||||
@@ -178,15 +178,26 @@ public class AdviceUtils {
|
|||||||
// 生命提示信息集合
|
// 生命提示信息集合
|
||||||
List<String> tipsList = new ArrayList<>();
|
List<String> tipsList = new ArrayList<>();
|
||||||
for (MedicationRequestUseExe medicationRequestUseExe : medUseExeList) {
|
for (MedicationRequestUseExe medicationRequestUseExe : medUseExeList) {
|
||||||
// 聚合同一位置所有批次的库存总量
|
// 第一步:按 performLocation 匹配指定药房的库存
|
||||||
List<AdviceInventoryDto> matchedInventories = adviceInventory.stream()
|
List<AdviceInventoryDto> matchedInventories = adviceInventory.stream()
|
||||||
.filter(inventoryDto -> medicationRequestUseExe.getMedicationId().equals(inventoryDto.getItemId())
|
.filter(inventoryDto -> medicationRequestUseExe.getMedicationId().equals(inventoryDto.getItemId())
|
||||||
&& CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(inventoryDto.getItemTable())
|
&& CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(inventoryDto.getItemTable())
|
||||||
&& medicationRequestUseExe.getPerformLocation().equals(inventoryDto.getLocationId())
|
&& (medicationRequestUseExe.getPerformLocation() == null
|
||||||
|
|| medicationRequestUseExe.getPerformLocation().equals(inventoryDto.getLocationId()))
|
||||||
// 如果选择了具体的批次号,校验库存时需要加上批次号的匹配条件
|
// 如果选择了具体的批次号,校验库存时需要加上批次号的匹配条件
|
||||||
&& (StringUtils.isEmpty(medicationRequestUseExe.getLotNumber())
|
&& (StringUtils.isEmpty(medicationRequestUseExe.getLotNumber())
|
||||||
|| medicationRequestUseExe.getLotNumber().equals(inventoryDto.getLotNumber())))
|
|| medicationRequestUseExe.getLotNumber().equals(inventoryDto.getLotNumber())))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
// 第二步:如果指定药房没有匹配到库存,则放宽条件查询所有药房的库存
|
||||||
|
if (matchedInventories.isEmpty()) {
|
||||||
|
matchedInventories = adviceInventory.stream()
|
||||||
|
.filter(inventoryDto -> medicationRequestUseExe.getMedicationId().equals(inventoryDto.getItemId())
|
||||||
|
&& CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(inventoryDto.getItemTable())
|
||||||
|
// 如果选择了具体的批次号,校验库存时需要加上批次号的匹配条件
|
||||||
|
&& (StringUtils.isEmpty(medicationRequestUseExe.getLotNumber())
|
||||||
|
|| medicationRequestUseExe.getLotNumber().equals(inventoryDto.getLotNumber())))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
// 匹配到库存信息
|
// 匹配到库存信息
|
||||||
if (!matchedInventories.isEmpty()) {
|
if (!matchedInventories.isEmpty()) {
|
||||||
// 聚合所有批次的可用库存
|
// 聚合所有批次的可用库存
|
||||||
|
|||||||
@@ -178,6 +178,8 @@ public class AdviceProcessAppServiceImpl implements IAdviceProcessAppService {
|
|||||||
inpatientAdviceParam.setEncounterIds(null);
|
inpatientAdviceParam.setEncounterIds(null);
|
||||||
Integer exeStatus = inpatientAdviceParam.getExeStatus();
|
Integer exeStatus = inpatientAdviceParam.getExeStatus();
|
||||||
inpatientAdviceParam.setExeStatus(null);
|
inpatientAdviceParam.setExeStatus(null);
|
||||||
|
// requestStatus由前端tab控制,后端SQL已通过CASE条件处理校对状态过滤,无需再作为SQL条件
|
||||||
|
inpatientAdviceParam.setRequestStatus(null);
|
||||||
// 构建查询条件
|
// 构建查询条件
|
||||||
QueryWrapper<InpatientAdviceParam> queryWrapper
|
QueryWrapper<InpatientAdviceParam> queryWrapper
|
||||||
= HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null);
|
= HisQueryUtils.buildQueryWrapper(inpatientAdviceParam, null, null, null);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ public class NursingRecordController {
|
|||||||
* 获取住院患者信息 分页显示
|
* 获取住院患者信息 分页显示
|
||||||
*
|
*
|
||||||
* @param nursingSearchParam 查询参数
|
* @param nursingSearchParam 查询参数
|
||||||
|
*
|
||||||
* @param searchKey 模糊查询
|
* @param searchKey 模糊查询
|
||||||
* @param pageNo 当前页码
|
* @param pageNo 当前页码
|
||||||
* @param pageSize 查询条数
|
* @param pageSize 查询条数
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ import com.openhis.common.constant.PromptMsgConstant;
|
|||||||
import com.openhis.common.enums.*;
|
import com.openhis.common.enums.*;
|
||||||
import com.openhis.common.utils.EnumUtils;
|
import com.openhis.common.utils.EnumUtils;
|
||||||
import com.openhis.common.utils.HisQueryUtils;
|
import com.openhis.common.utils.HisQueryUtils;
|
||||||
|
import com.core.common.utils.SecurityUtils;
|
||||||
|
import com.openhis.workflow.domain.InventoryItem;
|
||||||
|
import com.openhis.workflow.service.IInventoryItemService;
|
||||||
import com.openhis.web.basedatamanage.dto.LocationDto;
|
import com.openhis.web.basedatamanage.dto.LocationDto;
|
||||||
import com.openhis.web.common.dto.UnitDto;
|
import com.openhis.web.common.dto.UnitDto;
|
||||||
import com.openhis.web.inventorymanage.appservice.IProductTransferAppService;
|
import com.openhis.web.inventorymanage.appservice.IProductTransferAppService;
|
||||||
@@ -57,6 +60,9 @@ public class ProductTransferAppServiceImpl implements IProductTransferAppService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IPractitionerService practitionerService;
|
private IPractitionerService practitionerService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IInventoryItemService inventoryItemService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品调拨页面初始化
|
* 商品调拨页面初始化
|
||||||
*
|
*
|
||||||
@@ -196,6 +202,23 @@ public class ProductTransferAppServiceImpl implements IProductTransferAppService
|
|||||||
@Override
|
@Override
|
||||||
public R<?> addOrEditBatchTransferReceipt(List<ProductTransferDto> productTransferDtoList, Boolean flag) {
|
public R<?> addOrEditBatchTransferReceipt(List<ProductTransferDto> productTransferDtoList, Boolean flag) {
|
||||||
|
|
||||||
|
// 校验调拨数量:必须 > 0 且不超过源库存数量(从数据库查实时库存)
|
||||||
|
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
||||||
|
for (ProductTransferDto dto : productTransferDtoList) {
|
||||||
|
if (dto.getItemQuantity() == null || dto.getItemQuantity().compareTo(java.math.BigDecimal.ZERO) <= 0) {
|
||||||
|
return R.fail("调拨数量必须大于0");
|
||||||
|
}
|
||||||
|
// 查询该药品在源仓库的实时库存总量
|
||||||
|
List<InventoryItem> inventoryList = inventoryItemService.selectInventoryByItemId(
|
||||||
|
dto.getItemId(), dto.getLotNumber(), dto.getSourceLocationId(), tenantId);
|
||||||
|
java.math.BigDecimal actualStock = inventoryList.stream()
|
||||||
|
.map(InventoryItem::getQuantity)
|
||||||
|
.reduce(java.math.BigDecimal.ZERO, java.math.BigDecimal::add);
|
||||||
|
if (dto.getItemQuantity().compareTo(actualStock) > 0) {
|
||||||
|
return R.fail("调拨数量不可超出源库存数量(当前库存:" + actualStock + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<String> idList = new ArrayList<>();
|
List<String> idList = new ArrayList<>();
|
||||||
if (flag) {
|
if (flag) {
|
||||||
// 批量保存按钮
|
// 批量保存按钮
|
||||||
@@ -309,6 +332,22 @@ public class ProductTransferAppServiceImpl implements IProductTransferAppService
|
|||||||
@Override
|
@Override
|
||||||
public R<?> addOrEditTransferReceipt(List<ProductTransferDto> productTransferDtoList) {
|
public R<?> addOrEditTransferReceipt(List<ProductTransferDto> productTransferDtoList) {
|
||||||
|
|
||||||
|
// 校验调拨数量:必须 > 0 且不超过源库存数量(从数据库查实时库存)
|
||||||
|
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
||||||
|
for (ProductTransferDto dto : productTransferDtoList) {
|
||||||
|
if (dto.getItemQuantity() == null || dto.getItemQuantity().compareTo(java.math.BigDecimal.ZERO) <= 0) {
|
||||||
|
return R.fail("调拨数量必须大于0");
|
||||||
|
}
|
||||||
|
List<InventoryItem> inventoryList = inventoryItemService.selectInventoryByItemId(
|
||||||
|
dto.getItemId(), dto.getLotNumber(), dto.getSourceLocationId(), tenantId);
|
||||||
|
java.math.BigDecimal actualStock = inventoryList.stream()
|
||||||
|
.map(InventoryItem::getQuantity)
|
||||||
|
.reduce(java.math.BigDecimal.ZERO, java.math.BigDecimal::add);
|
||||||
|
if (dto.getItemQuantity().compareTo(actualStock) > 0) {
|
||||||
|
return R.fail("调拨数量不可超出源库存数量(当前库存:" + actualStock + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<String> idList = new ArrayList<>();
|
List<String> idList = new ArrayList<>();
|
||||||
|
|
||||||
// 单据号取得
|
// 单据号取得
|
||||||
@@ -380,6 +419,25 @@ public class ProductTransferAppServiceImpl implements IProductTransferAppService
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public R<?> submitApproval(String busNo) {
|
public R<?> submitApproval(String busNo) {
|
||||||
|
// 提交前再次校验调拨数量(从数据库查实时库存)
|
||||||
|
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(busNo);
|
||||||
|
if (requestList != null && !requestList.isEmpty()) {
|
||||||
|
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
||||||
|
for (SupplyRequest request : requestList) {
|
||||||
|
if (request.getItemQuantity() == null || request.getItemQuantity().compareTo(java.math.BigDecimal.ZERO) <= 0) {
|
||||||
|
return R.fail("调拨数量必须大于0,请检查后重新保存");
|
||||||
|
}
|
||||||
|
// 查询该药品在源仓库的实时库存总量
|
||||||
|
List<InventoryItem> inventoryList = inventoryItemService.selectInventoryByItemId(
|
||||||
|
request.getItemId(), request.getLotNumber(), request.getSourceLocationId(), tenantId);
|
||||||
|
java.math.BigDecimal actualStock = inventoryList.stream()
|
||||||
|
.map(InventoryItem::getQuantity)
|
||||||
|
.reduce(java.math.BigDecimal.ZERO, java.math.BigDecimal::add);
|
||||||
|
if (request.getItemQuantity().compareTo(actualStock) > 0) {
|
||||||
|
return R.fail("调拨数量不可超出源库存数量(当前库存:" + actualStock + "),请检查后重新保存");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// 单据提交审核
|
// 单据提交审核
|
||||||
boolean result = supplyRequestService.submitApproval(busNo);
|
boolean result = supplyRequestService.submitApproval(busNo);
|
||||||
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
|
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
|
||||||
|
|||||||
@@ -3,29 +3,38 @@
|
|||||||
*/
|
*/
|
||||||
package com.openhis.web.inventorymanage.appservice.impl;
|
package com.openhis.web.inventorymanage.appservice.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.core.common.core.domain.R;
|
import com.core.common.core.domain.R;
|
||||||
|
import com.core.common.exception.ServiceException;
|
||||||
import com.core.common.utils.*;
|
import com.core.common.utils.*;
|
||||||
import com.core.common.utils.bean.BeanUtils;
|
import com.core.common.utils.bean.BeanUtils;
|
||||||
|
import com.openhis.administration.domain.DeviceDefinition;
|
||||||
import com.openhis.administration.domain.Practitioner;
|
import com.openhis.administration.domain.Practitioner;
|
||||||
|
import com.openhis.administration.service.IDeviceDefinitionService;
|
||||||
import com.openhis.administration.service.IPractitionerService;
|
import com.openhis.administration.service.IPractitionerService;
|
||||||
import com.openhis.common.constant.CommonConstants;
|
import com.openhis.common.constant.CommonConstants;
|
||||||
import com.openhis.common.constant.PromptMsgConstant;
|
import com.openhis.common.constant.PromptMsgConstant;
|
||||||
import com.openhis.common.enums.*;
|
import com.openhis.common.enums.*;
|
||||||
import com.openhis.common.utils.EnumUtils;
|
import com.openhis.common.utils.EnumUtils;
|
||||||
import com.openhis.common.utils.HisQueryUtils;
|
import com.openhis.common.utils.HisQueryUtils;
|
||||||
|
import com.openhis.medication.domain.MedicationDefinition;
|
||||||
|
import com.openhis.medication.service.IMedicationDefinitionService;
|
||||||
import com.openhis.web.common.dto.UnitDto;
|
import com.openhis.web.common.dto.UnitDto;
|
||||||
import com.openhis.web.inventorymanage.appservice.IRequisitionIssueAppService;
|
import com.openhis.web.inventorymanage.appservice.IRequisitionIssueAppService;
|
||||||
import com.openhis.web.inventorymanage.dto.*;
|
import com.openhis.web.inventorymanage.dto.*;
|
||||||
import com.openhis.web.inventorymanage.mapper.RequisitionIssueMapper;
|
import com.openhis.web.inventorymanage.mapper.RequisitionIssueMapper;
|
||||||
|
import com.openhis.workflow.domain.InventoryItem;
|
||||||
import com.openhis.workflow.domain.SupplyRequest;
|
import com.openhis.workflow.domain.SupplyRequest;
|
||||||
|
import com.openhis.workflow.service.IInventoryItemService;
|
||||||
import com.openhis.workflow.service.ISupplyRequestService;
|
import com.openhis.workflow.service.ISupplyRequestService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@@ -48,6 +57,15 @@ public class RequisitionIssueAppServiceImpl implements IRequisitionIssueAppServi
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IPractitionerService practitionerService;
|
private IPractitionerService practitionerService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IInventoryItemService inventoryItemService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMedicationDefinitionService medicationDefinitionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IDeviceDefinitionService deviceDefinitionService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AssignSeqUtil assignSeqUtil;
|
private AssignSeqUtil assignSeqUtil;
|
||||||
|
|
||||||
@@ -167,6 +185,10 @@ public class RequisitionIssueAppServiceImpl implements IRequisitionIssueAppServi
|
|||||||
|
|
||||||
// 单据号取得
|
// 单据号取得
|
||||||
List<String> busNoList = requisitionIssueDtoList.stream().map(IssueDto::getBusNo).collect(Collectors.toList());
|
List<String> busNoList = requisitionIssueDtoList.stream().map(IssueDto::getBusNo).collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 库存校验:领用数量不能超过源仓库实际库存
|
||||||
|
this.validateRequisitionStock(requisitionIssueDtoList);
|
||||||
|
|
||||||
// 请求数据取得
|
// 请求数据取得
|
||||||
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(busNoList.get(0));
|
List<SupplyRequest> requestList = supplyRequestService.getSupplyByBusNo(busNoList.get(0));
|
||||||
if (!requestList.isEmpty()) {
|
if (!requestList.isEmpty()) {
|
||||||
@@ -328,4 +350,73 @@ public class RequisitionIssueAppServiceImpl implements IRequisitionIssueAppServi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验领用数量是否超过源仓库实际库存
|
||||||
|
*
|
||||||
|
* @param requisitionIssueDtoList 领用出库单据列表
|
||||||
|
*/
|
||||||
|
private void validateRequisitionStock(List<IssueDto> requisitionIssueDtoList) {
|
||||||
|
Integer tenantId = SecurityUtils.getLoginUser().getTenantId();
|
||||||
|
for (IssueDto issueDto : requisitionIssueDtoList) {
|
||||||
|
Long itemId = issueDto.getItemId();
|
||||||
|
String lotNumber = issueDto.getLotNumber();
|
||||||
|
Long sourceLocationId = issueDto.getSourceLocationId();
|
||||||
|
BigDecimal reqQuantity = issueDto.getItemQuantity();
|
||||||
|
String itemUnit = issueDto.getUnitCode();
|
||||||
|
String itemTable = issueDto.getItemTable();
|
||||||
|
|
||||||
|
// 根据物品类型查询定义信息(拆零比、常规单位、最小单位)
|
||||||
|
BigDecimal partPercent = BigDecimal.ONE;
|
||||||
|
String unitCode = itemUnit;
|
||||||
|
String minUnitCode = itemUnit;
|
||||||
|
|
||||||
|
if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(itemTable)) {
|
||||||
|
MedicationDefinition medDef = medicationDefinitionService.getById(itemId);
|
||||||
|
if (medDef != null) {
|
||||||
|
unitCode = medDef.getUnitCode();
|
||||||
|
minUnitCode = medDef.getMinUnitCode();
|
||||||
|
if (medDef.getPartPercent() != null) {
|
||||||
|
partPercent = medDef.getPartPercent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(itemTable)) {
|
||||||
|
DeviceDefinition devDef = deviceDefinitionService.getById(itemId);
|
||||||
|
if (devDef != null) {
|
||||||
|
unitCode = devDef.getUnitCode();
|
||||||
|
minUnitCode = devDef.getMinUnitCode();
|
||||||
|
if (devDef.getPartPercent() != null) {
|
||||||
|
partPercent = devDef.getPartPercent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算领用数量折合最小单位的值
|
||||||
|
BigDecimal reqQuantityInMinUnit;
|
||||||
|
if (itemUnit.equals(unitCode)) {
|
||||||
|
// 领用单位 = 包装单位,需乘以拆零比
|
||||||
|
reqQuantityInMinUnit = reqQuantity.multiply(partPercent);
|
||||||
|
} else {
|
||||||
|
// 领用单位 = 最小单位,无需换算
|
||||||
|
reqQuantityInMinUnit = reqQuantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询源仓库实际库存(按物品编号、批号、仓库匹配)
|
||||||
|
List<InventoryItem> inventoryItemList = inventoryItemService.selectInventoryByItemId(
|
||||||
|
itemId, lotNumber, sourceLocationId, tenantId);
|
||||||
|
|
||||||
|
// 累加匹配批号的总库存(库存表quantity字段为最小单位)
|
||||||
|
BigDecimal totalStock = BigDecimal.ZERO;
|
||||||
|
for (InventoryItem inventoryItem : inventoryItemList) {
|
||||||
|
if (inventoryItem.getLocationId().equals(sourceLocationId)) {
|
||||||
|
totalStock = totalStock.add(inventoryItem.getQuantity());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 比较领用数量与库存
|
||||||
|
if (reqQuantityInMinUnit.compareTo(totalStock) > 0) {
|
||||||
|
throw new ServiceException("操作失败,库存数量不足");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,10 +39,22 @@ public interface IRequestFormManageAppService {
|
|||||||
* @param typeCode 申请单类型
|
* @param typeCode 申请单类型
|
||||||
* @param startDate 开始日期(可选,格式:yyyy-MM-dd)
|
* @param startDate 开始日期(可选,格式:yyyy-MM-dd)
|
||||||
* @param endDate 结束日期(可选,格式:yyyy-MM-dd)
|
* @param endDate 结束日期(可选,格式:yyyy-MM-dd)
|
||||||
* @param status 单据状态(可选)
|
|
||||||
* @return 申请单列表
|
* @return 申请单列表
|
||||||
*/
|
*/
|
||||||
List<RequestFormQueryDto> getRequestForm(Long encounterId, String typeCode, String startDate, String endDate, String status);
|
List<RequestFormQueryDto> getRequestForm(Long encounterId, String typeCode, String startDate, String endDate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询申请单(支持筛选+状态+关键字)
|
||||||
|
*
|
||||||
|
* @param encounterId 就诊id
|
||||||
|
* @param typeCode 申请单类型
|
||||||
|
* @param startDate 开始日期(可选,格式:yyyy-MM-dd)
|
||||||
|
* @param endDate 结束日期(可选,格式:yyyy-MM-dd)
|
||||||
|
* @param status 单据状态(可选)
|
||||||
|
* @param keyword 关键字(可选,申请单号/项目名称模糊匹配)
|
||||||
|
* @return 申请单列表
|
||||||
|
*/
|
||||||
|
List<RequestFormQueryDto> getRequestForm(Long encounterId, String typeCode, String startDate, String endDate, String status, String keyword);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询申请单
|
* 分页查询申请单
|
||||||
@@ -51,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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -341,6 +341,28 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
|
|||||||
&& (DbOpType.INSERT.getCode().equals(e.getDbOpType()) || DbOpType.UPDATE.getCode().equals(e.getDbOpType())))
|
&& (DbOpType.INSERT.getCode().equals(e.getDbOpType()) || DbOpType.UPDATE.getCode().equals(e.getDbOpType())))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 防重复保存:对所有医嘱进行去重(包括 INSERT 和 UPDATE 混合场景),避免签发单条医嘱时产生重复记录
|
||||||
|
Set<String> longUniqueKeySet = new HashSet<>();
|
||||||
|
List<RegAdviceSaveDto> longUniqueList = new ArrayList<>();
|
||||||
|
for (RegAdviceSaveDto adviceSaveDto : longInsertOrUpdateList) {
|
||||||
|
String uniqueKey = adviceSaveDto.getPatientId() + "_"
|
||||||
|
+ adviceSaveDto.getEncounterId() + "_"
|
||||||
|
+ adviceSaveDto.getAdviceDefinitionId() + "_"
|
||||||
|
+ adviceSaveDto.getDose() + "_"
|
||||||
|
+ adviceSaveDto.getMethodCode() + "_"
|
||||||
|
+ adviceSaveDto.getRateCode();
|
||||||
|
if (longUniqueKeySet.contains(uniqueKey)) {
|
||||||
|
log.warn("防重复保存:检测到重复长期医嘱(跨操作类型),跳过 - patientId={}, encounterId={}, adviceDefinitionId={}, dbOpType={}",
|
||||||
|
adviceSaveDto.getPatientId(), adviceSaveDto.getEncounterId(),
|
||||||
|
adviceSaveDto.getAdviceDefinitionId(), adviceSaveDto.getDbOpType());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
longUniqueKeySet.add(uniqueKey);
|
||||||
|
longUniqueList.add(adviceSaveDto);
|
||||||
|
}
|
||||||
|
log.info("防重复保存(长期):去重前{}条,去重后{}条", longInsertOrUpdateList.size(), longUniqueList.size());
|
||||||
|
longInsertOrUpdateList = longUniqueList;
|
||||||
|
|
||||||
for (RegAdviceSaveDto regAdviceSaveDto : longInsertOrUpdateList) {
|
for (RegAdviceSaveDto regAdviceSaveDto : longInsertOrUpdateList) {
|
||||||
boolean firstTimeSave = false;// 第一次保存
|
boolean firstTimeSave = false;// 第一次保存
|
||||||
longMedicationRequest = new MedicationRequest();
|
longMedicationRequest = new MedicationRequest();
|
||||||
@@ -406,6 +428,29 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
|
|||||||
.getValue().equals(e.getTherapyEnum())
|
.getValue().equals(e.getTherapyEnum())
|
||||||
&& (DbOpType.INSERT.getCode().equals(e.getDbOpType()) || DbOpType.UPDATE.getCode().equals(e.getDbOpType())))
|
&& (DbOpType.INSERT.getCode().equals(e.getDbOpType()) || DbOpType.UPDATE.getCode().equals(e.getDbOpType())))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 防重复保存:对所有医嘱进行去重(包括 INSERT 和 UPDATE 混合场景),避免签发时产生重复记录
|
||||||
|
Set<String> tempUniqueKeySet = new HashSet<>();
|
||||||
|
List<RegAdviceSaveDto> tempUniqueList = new ArrayList<>();
|
||||||
|
for (RegAdviceSaveDto adviceSaveDto : tempInsertOrUpdateList) {
|
||||||
|
String uniqueKey = adviceSaveDto.getPatientId() + "_"
|
||||||
|
+ adviceSaveDto.getEncounterId() + "_"
|
||||||
|
+ adviceSaveDto.getAdviceDefinitionId() + "_"
|
||||||
|
+ adviceSaveDto.getDose() + "_"
|
||||||
|
+ adviceSaveDto.getMethodCode() + "_"
|
||||||
|
+ adviceSaveDto.getRateCode();
|
||||||
|
if (tempUniqueKeySet.contains(uniqueKey)) {
|
||||||
|
log.warn("防重复保存:检测到重复临时医嘱(跨操作类型),跳过 - patientId={}, encounterId={}, adviceDefinitionId={}, dbOpType={}",
|
||||||
|
adviceSaveDto.getPatientId(), adviceSaveDto.getEncounterId(),
|
||||||
|
adviceSaveDto.getAdviceDefinitionId(), adviceSaveDto.getDbOpType());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
tempUniqueKeySet.add(uniqueKey);
|
||||||
|
tempUniqueList.add(adviceSaveDto);
|
||||||
|
}
|
||||||
|
log.info("防重复保存(临时):去重前{}条,去重后{}条", tempInsertOrUpdateList.size(), tempUniqueList.size());
|
||||||
|
tempInsertOrUpdateList = tempUniqueList;
|
||||||
|
|
||||||
for (RegAdviceSaveDto regAdviceSaveDto : tempInsertOrUpdateList) {
|
for (RegAdviceSaveDto regAdviceSaveDto : tempInsertOrUpdateList) {
|
||||||
boolean firstTimeSave = false;// 第一次保存
|
boolean firstTimeSave = false;// 第一次保存
|
||||||
tempMedicationRequest = new MedicationRequest();
|
tempMedicationRequest = new MedicationRequest();
|
||||||
@@ -665,11 +710,21 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
|
|||||||
|
|
||||||
// 批量更新诊疗医嘱状态(使用 update 确保状态字段必定更新)
|
// 批量更新诊疗医嘱状态(使用 update 确保状态字段必定更新)
|
||||||
if (!processedRequestIds.isEmpty()) {
|
if (!processedRequestIds.isEmpty()) {
|
||||||
iServiceRequestService.update(null,
|
// 🔧 Bug #487 修复:签发时额外设置 authoredTime,确保签发时间被记录
|
||||||
new LambdaUpdateWrapper<ServiceRequest>()
|
if (is_sign) {
|
||||||
.set(ServiceRequest::getStatusEnum,
|
iServiceRequestService.update(null,
|
||||||
is_save ? RequestStatus.DRAFT.getValue() : RequestStatus.ACTIVE.getValue())
|
new LambdaUpdateWrapper<ServiceRequest>()
|
||||||
.in(ServiceRequest::getId, processedRequestIds));
|
.set(ServiceRequest::getStatusEnum, RequestStatus.ACTIVE.getValue())
|
||||||
|
.set(ServiceRequest::getAuthoredTime, authoredTime)
|
||||||
|
.set(ServiceRequest::getSignCode, signCode)
|
||||||
|
.in(ServiceRequest::getId, processedRequestIds));
|
||||||
|
log.info("签发诊疗医嘱成功,requestIds: {}, signCode: {}", processedRequestIds, signCode);
|
||||||
|
} else {
|
||||||
|
iServiceRequestService.update(null,
|
||||||
|
new LambdaUpdateWrapper<ServiceRequest>()
|
||||||
|
.set(ServiceRequest::getStatusEnum, RequestStatus.DRAFT.getValue())
|
||||||
|
.in(ServiceRequest::getId, processedRequestIds));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -706,6 +761,8 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
|
|||||||
if (is_sign) {
|
if (is_sign) {
|
||||||
deviceRequest.setReqAuthoredTime(authoredTime); // 医嘱签发时间
|
deviceRequest.setReqAuthoredTime(authoredTime); // 医嘱签发时间
|
||||||
}
|
}
|
||||||
|
// 保存或签发时都需要设置耗材定义ID(防止 sign 分支 deviceDefId 为空触发 NOT NULL 约束)
|
||||||
|
deviceRequest.setDeviceDefId(regAdviceSaveDto.getAdviceDefinitionId());
|
||||||
// 保存时处理的字段属性
|
// 保存时处理的字段属性
|
||||||
if (is_save) {
|
if (is_save) {
|
||||||
deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4));
|
deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4));
|
||||||
@@ -743,6 +800,8 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService {
|
|||||||
if (is_sign) {
|
if (is_sign) {
|
||||||
deviceRequest.setReqAuthoredTime(authoredTime); // 医嘱签发时间
|
deviceRequest.setReqAuthoredTime(authoredTime); // 医嘱签发时间
|
||||||
}
|
}
|
||||||
|
// 保存或签发时都需要设置耗材定义ID(防止 sign 分支 deviceDefId 为空触发 NOT NULL 约束)
|
||||||
|
deviceRequest.setDeviceDefId(regAdviceSaveDto.getAdviceDefinitionId());
|
||||||
// 保存时处理的字段属性
|
// 保存时处理的字段属性
|
||||||
if (is_save) {
|
if (is_save) {
|
||||||
deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4));
|
deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4));
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.openhis.web.regdoctorstation.appservice.impl;
|
package com.openhis.web.regdoctorstation.appservice.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.core.common.core.domain.R;
|
import com.core.common.core.domain.R;
|
||||||
@@ -31,6 +32,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;
|
||||||
@@ -75,12 +77,46 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public R<?> saveRequestForm(RequestFormSaveDto requestFormSaveDto, String typeCode) {
|
public R<?> saveRequestForm(RequestFormSaveDto requestFormSaveDto, String typeCode) {
|
||||||
|
// 申请单ID(前端空字符串可能反序列化为0L,需同时判0)
|
||||||
|
Long requestFormId = requestFormSaveDto.getRequestFormId();
|
||||||
|
boolean isEdit = requestFormId != null && requestFormId != 0L;
|
||||||
|
|
||||||
|
// 诊疗执行科室配置校验(必须在任何数据库操作之前)
|
||||||
|
List<ActivityOrganizationConfigDto> activityOrganizationConfig =
|
||||||
|
requestFormManageAppMapper.getActivityOrganizationConfig(typeCode);
|
||||||
|
if (activityOrganizationConfig.isEmpty()) {
|
||||||
|
throw new ServiceException("请先配置当前时间段的执行科室");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 逐个校验activityList中的项目是否都配置了执行科室,并收集positionId供后续使用
|
||||||
|
// 必须在任何数据库操作之前完成全部校验,避免部分保存后异常导致脏数据
|
||||||
|
// 🔧 Bug #516: 优先使用前端传入的positionId(用户手动选择的发往科室),仅在未选择时使用配置的执行科室
|
||||||
|
List<ActivitySaveDto> activityList = requestFormSaveDto.getActivityList();
|
||||||
|
// 缓存校验结果,避免主循环中重复查询和可能出现的数据不一致
|
||||||
|
java.util.Map<Long, Long> activityIdToPositionIdMap = new java.util.HashMap<>();
|
||||||
|
if (activityList != null && !activityList.isEmpty()) {
|
||||||
|
for (ActivitySaveDto activitySaveDto : activityList) {
|
||||||
|
// 优先使用前端传入的positionId(用户手动选择的科室)
|
||||||
|
Long frontendPositionId = activitySaveDto.getPositionId();
|
||||||
|
if (frontendPositionId != null) {
|
||||||
|
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), frontendPositionId);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 前端未传入时,使用配置的执行科室
|
||||||
|
Long configPositionId = activityOrganizationConfig.stream()
|
||||||
|
.filter(dto -> activitySaveDto.getAdviceDefinitionId().equals(dto.getActivityDefinitionId()))
|
||||||
|
.map(ActivityOrganizationConfigDto::getOrganizationId).findFirst().orElse(null);
|
||||||
|
if (configPositionId == null) {
|
||||||
|
throw new ServiceException(activitySaveDto.getAdviceDefinitionName() + "未配置当前时间段的执行科室");
|
||||||
|
}
|
||||||
|
activityIdToPositionIdMap.put(activitySaveDto.getAdviceDefinitionId(), configPositionId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 诊疗处方号
|
// 诊疗处方号
|
||||||
String prescriptionNo;
|
String prescriptionNo;
|
||||||
// 申请单ID
|
|
||||||
Long requestFormId = requestFormSaveDto.getRequestFormId();
|
|
||||||
// 编辑场景
|
// 编辑场景
|
||||||
if (requestFormId != null) {
|
if (isEdit) {
|
||||||
RequestForm requestFormInfo = iRequestFormService.getById(requestFormId);
|
RequestForm requestFormInfo = iRequestFormService.getById(requestFormId);
|
||||||
prescriptionNo = requestFormInfo.getPrescriptionNo();
|
prescriptionNo = requestFormInfo.getPrescriptionNo();
|
||||||
// 该申请单存在的待发送医嘱个数
|
// 该申请单存在的待发送医嘱个数
|
||||||
@@ -91,8 +127,10 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
|||||||
return R.fail("无待签发的医嘱,该申请单不可编辑");
|
return R.fail("无待签发的医嘱,该申请单不可编辑");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 诊疗处方号
|
// 检查申请单号:JC(检查)+ Z(住院标识)+ yyMMdd(日期)+ 5位顺序号
|
||||||
prescriptionNo = assignSeqUtil.getSeq(AssignSeqEnum.ACTIVITY_PSYCHOTROPIC_NO.getPrefix(), 8);
|
String dateStr = new java.text.SimpleDateFormat("yyMMdd").format(new Date());
|
||||||
|
int seq = assignSeqUtil.getSeqNoByDay(AssignSeqEnum.CHECK_APPLY_NO.getPrefix());
|
||||||
|
prescriptionNo = "JCZ" + dateStr + String.format("%05d", seq);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当前时间
|
// 当前时间
|
||||||
@@ -122,7 +160,7 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
|||||||
iRequestFormService.saveOrUpdate(requestForm);
|
iRequestFormService.saveOrUpdate(requestForm);
|
||||||
|
|
||||||
// 编辑场景时,先删除掉原有诊疗项目及账单再新增
|
// 编辑场景时,先删除掉原有诊疗项目及账单再新增
|
||||||
if (requestFormId != null) {
|
if (isEdit) {
|
||||||
List<Long> serviceRequestIds = iServiceRequestService
|
List<Long> serviceRequestIds = iServiceRequestService
|
||||||
.list(new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getPrescriptionNo, prescriptionNo))
|
.list(new LambdaQueryWrapper<ServiceRequest>().eq(ServiceRequest::getPrescriptionNo, prescriptionNo))
|
||||||
.stream().map(ServiceRequest::getId).collect(Collectors.toList());
|
.stream().map(ServiceRequest::getId).collect(Collectors.toList());
|
||||||
@@ -136,15 +174,7 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
|||||||
|
|
||||||
ServiceRequest serviceRequest;
|
ServiceRequest serviceRequest;
|
||||||
ChargeItem chargeItem;
|
ChargeItem chargeItem;
|
||||||
// 诊疗集合
|
|
||||||
List<ActivitySaveDto> activityList = requestFormSaveDto.getActivityList();
|
|
||||||
log.info("保存申请单,typeCode={}, activityListSize={}, encounterId={}", typeCode, activityList != null ? activityList.size() : 0, encounterId);
|
log.info("保存申请单,typeCode={}, activityListSize={}, encounterId={}", typeCode, activityList != null ? activityList.size() : 0, encounterId);
|
||||||
// 诊疗执行科室配置
|
|
||||||
List<ActivityOrganizationConfigDto> activityOrganizationConfig =
|
|
||||||
requestFormManageAppMapper.getActivityOrganizationConfig(typeCode);
|
|
||||||
if (activityOrganizationConfig.isEmpty()) {
|
|
||||||
throw new ServiceException("请先配置当前时间段的执行科室");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (ActivitySaveDto activitySaveDto : activityList) {
|
for (ActivitySaveDto activitySaveDto : activityList) {
|
||||||
serviceRequest = new ServiceRequest();
|
serviceRequest = new ServiceRequest();
|
||||||
@@ -162,9 +192,7 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
|||||||
serviceRequest.setEncounterId(encounterId); // 就诊id
|
serviceRequest.setEncounterId(encounterId); // 就诊id
|
||||||
serviceRequest.setAuthoredTime(curDate); // 请求签发时间
|
serviceRequest.setAuthoredTime(curDate); // 请求签发时间
|
||||||
|
|
||||||
Long positionId = activityOrganizationConfig.stream()
|
Long positionId = activityIdToPositionIdMap.get(activitySaveDto.getAdviceDefinitionId());
|
||||||
.filter(dto -> activitySaveDto.getAdviceDefinitionId().equals(dto.getActivityDefinitionId()))
|
|
||||||
.map(ActivityOrganizationConfigDto::getOrganizationId).findFirst().orElse(null);
|
|
||||||
if (positionId == null) {
|
if (positionId == null) {
|
||||||
throw new ServiceException(activitySaveDto.getAdviceDefinitionName() + "未配置当前时间段的执行科室");
|
throw new ServiceException(activitySaveDto.getAdviceDefinitionName() + "未配置当前时间段的执行科室");
|
||||||
}
|
}
|
||||||
@@ -275,7 +303,7 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
|||||||
surgeryServiceRequest.setTherapyEnum(TherapyTimeType.TEMPORARY.getValue());
|
surgeryServiceRequest.setTherapyEnum(TherapyTimeType.TEMPORARY.getValue());
|
||||||
surgeryServiceRequest.setQuantity(BigDecimal.valueOf(1));
|
surgeryServiceRequest.setQuantity(BigDecimal.valueOf(1));
|
||||||
surgeryServiceRequest.setUnitCode("次");
|
surgeryServiceRequest.setUnitCode("次");
|
||||||
surgeryServiceRequest.setCategoryEnum(4); // 4-手术
|
surgeryServiceRequest.setCategoryEnum(24); // 24-手术(新值域,避开 adviceType 碰撞)
|
||||||
// 优先从 activityList 获取手术 ID
|
// 优先从 activityList 获取手术 ID
|
||||||
if (activityList != null && !activityList.isEmpty()) {
|
if (activityList != null && !activityList.isEmpty()) {
|
||||||
Long activityId = activityList.get(0).getAdviceDefinitionId();
|
Long activityId = activityList.get(0).getAdviceDefinitionId();
|
||||||
@@ -414,7 +442,7 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
|||||||
@Override
|
@Override
|
||||||
public List<RequestFormQueryDto> getRequestForm(Long encounterId, String typeCode) {
|
public List<RequestFormQueryDto> getRequestForm(Long encounterId, String typeCode) {
|
||||||
// 调用重载方法,不传筛选参数
|
// 调用重载方法,不传筛选参数
|
||||||
return getRequestForm(encounterId, typeCode, null, null, null);
|
return getRequestForm(encounterId, typeCode, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -424,17 +452,32 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
|||||||
* @param typeCode 申请单类型
|
* @param typeCode 申请单类型
|
||||||
* @param startDate 开始日期(可选,格式:yyyy-MM-dd)
|
* @param startDate 开始日期(可选,格式:yyyy-MM-dd)
|
||||||
* @param endDate 结束日期(可选,格式:yyyy-MM-dd)
|
* @param endDate 结束日期(可选,格式:yyyy-MM-dd)
|
||||||
* @param status 单据状态(可选)
|
|
||||||
* @return 申请单列表
|
* @return 申请单列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<RequestFormQueryDto> getRequestForm(Long encounterId, String typeCode, String startDate, String endDate, String status) {
|
public List<RequestFormQueryDto> getRequestForm(Long encounterId, String typeCode, String startDate, String endDate) {
|
||||||
|
return getRequestForm(encounterId, typeCode, startDate, endDate, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询申请单(支持筛选+状态+关键字)
|
||||||
|
*
|
||||||
|
* @param encounterId 就诊id
|
||||||
|
* @param typeCode 申请单类型
|
||||||
|
* @param startDate 开始日期(可选,格式:yyyy-MM-dd)
|
||||||
|
* @param endDate 结束日期(可选,格式:yyyy-MM-dd)
|
||||||
|
* @param status 单据状态(可选)
|
||||||
|
* @param keyword 关键字(可选,申请单号/项目名称模糊匹配)
|
||||||
|
* @return 申请单列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<RequestFormQueryDto> getRequestForm(Long encounterId, String typeCode, String startDate, String endDate, String status, String keyword) {
|
||||||
// 检查参数
|
// 检查参数
|
||||||
if (encounterId == null) {
|
if (encounterId == null) {
|
||||||
return new java.util.ArrayList<>(); // 返回空列表而不是查询数据库
|
return new java.util.ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<RequestFormQueryDto> requestFormList = requestFormManageAppMapper.getRequestForm(encounterId, typeCode, startDate, endDate, status, null);
|
List<RequestFormQueryDto> requestFormList = requestFormManageAppMapper.getRequestForm(encounterId, typeCode, startDate, endDate, status, keyword);
|
||||||
for (RequestFormQueryDto requestFormQueryDto : requestFormList) {
|
for (RequestFormQueryDto requestFormQueryDto : requestFormList) {
|
||||||
// 查询处方详情
|
// 查询处方详情
|
||||||
List<RequestFormDetailQueryDto> requestFormDetail =
|
List<RequestFormDetailQueryDto> requestFormDetail =
|
||||||
@@ -456,4 +499,90 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
|||||||
return requestFormManageAppMapper.getRequestFormPage(requestFormDto, page);
|
return requestFormManageAppMapper.getRequestFormPage(requestFormDto, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<?> deleteRequestForm(Long requestFormId) {
|
||||||
|
if (requestFormId == null) {
|
||||||
|
return R.fail("申请单ID不能为空");
|
||||||
|
}
|
||||||
|
RequestForm requestForm = iRequestFormService.getById(requestFormId);
|
||||||
|
if (requestForm == null) {
|
||||||
|
return R.fail("申请单不存在");
|
||||||
|
}
|
||||||
|
String prescriptionNo = requestForm.getPrescriptionNo();
|
||||||
|
|
||||||
|
// 查询该申请单下所有 ServiceRequest(含子项)
|
||||||
|
List<ServiceRequest> serviceRequests = iServiceRequestService.list(
|
||||||
|
new LambdaQueryWrapper<ServiceRequest>()
|
||||||
|
.eq(ServiceRequest::getPrescriptionNo, prescriptionNo));
|
||||||
|
if (serviceRequests == null || serviceRequests.isEmpty()) {
|
||||||
|
return R.fail("未找到关联的诊疗医嘱");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验:只有待签发(status=0)的申请单可删除
|
||||||
|
boolean allDraft = serviceRequests.stream()
|
||||||
|
.allMatch(sr -> RequestStatus.DRAFT.getValue().equals(sr.getStatusEnum()));
|
||||||
|
if (!allDraft) {
|
||||||
|
return R.fail("只有待签发状态的申请单可删除");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Long> serviceRequestIds = serviceRequests.stream()
|
||||||
|
.map(ServiceRequest::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 1. 删除关联的费用项
|
||||||
|
for (Long srId : serviceRequestIds) {
|
||||||
|
iChargeItemService.deleteByServiceTableAndId(
|
||||||
|
CommonConstants.TableName.WOR_SERVICE_REQUEST, srId);
|
||||||
|
}
|
||||||
|
// 2. 删除子项 ServiceRequest(parentId 非空)
|
||||||
|
iServiceRequestService.remove(
|
||||||
|
new LambdaQueryWrapper<ServiceRequest>()
|
||||||
|
.in(ServiceRequest::getId, serviceRequestIds)
|
||||||
|
.isNotNull(ServiceRequest::getParentId));
|
||||||
|
// 3. 删除主项 ServiceRequest
|
||||||
|
iServiceRequestService.removeByIds(serviceRequestIds);
|
||||||
|
// 4. 删除申请单
|
||||||
|
iRequestFormService.removeById(requestFormId);
|
||||||
|
|
||||||
|
log.info("检查申请单删除成功,requestFormId={}, prescriptionNo={}", requestFormId, prescriptionNo);
|
||||||
|
return R.ok("删除成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<?> withdrawRequestForm(Long requestFormId) {
|
||||||
|
if (requestFormId == null) {
|
||||||
|
return R.fail("申请单ID不能为空");
|
||||||
|
}
|
||||||
|
RequestForm requestForm = iRequestFormService.getById(requestFormId);
|
||||||
|
if (requestForm == null) {
|
||||||
|
return R.fail("申请单不存在");
|
||||||
|
}
|
||||||
|
String prescriptionNo = requestForm.getPrescriptionNo();
|
||||||
|
|
||||||
|
// 查询该申请单下所有 ServiceRequest
|
||||||
|
List<ServiceRequest> serviceRequests = iServiceRequestService.list(
|
||||||
|
new LambdaQueryWrapper<ServiceRequest>()
|
||||||
|
.eq(ServiceRequest::getPrescriptionNo, prescriptionNo));
|
||||||
|
if (serviceRequests == null || serviceRequests.isEmpty()) {
|
||||||
|
return R.fail("未找到关联的诊疗医嘱");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验:只有已签发(status=2)的申请单可撤回
|
||||||
|
boolean allActive = serviceRequests.stream()
|
||||||
|
.allMatch(sr -> RequestStatus.ACTIVE.getValue().equals(sr.getStatusEnum()));
|
||||||
|
if (!allActive) {
|
||||||
|
return R.fail("只有已签发状态的申请单可撤回");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将所有 ServiceRequest 状态改回待签发(DRAFT=0)
|
||||||
|
List<Long> serviceRequestIds = serviceRequests.stream()
|
||||||
|
.map(ServiceRequest::getId).collect(Collectors.toList());
|
||||||
|
iServiceRequestService.update(
|
||||||
|
new ServiceRequest().setStatusEnum(RequestStatus.DRAFT.getValue()),
|
||||||
|
new LambdaUpdateWrapper<ServiceRequest>()
|
||||||
|
.in(ServiceRequest::getId, serviceRequestIds));
|
||||||
|
|
||||||
|
log.info("检查申请单撤回成功,requestFormId={}, prescriptionNo={}", requestFormId, prescriptionNo);
|
||||||
|
return R.ok("撤回成功");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 申请单管理 controller
|
* 申请单管理 controller
|
||||||
@@ -81,14 +83,23 @@ public class RequestFormManageController {
|
|||||||
* 查询检查申请单
|
* 查询检查申请单
|
||||||
*
|
*
|
||||||
* @param encounterId 就诊id
|
* @param encounterId 就诊id
|
||||||
|
* @param startDate 开始日期(可选,格式:yyyy-MM-dd)
|
||||||
|
* @param endDate 结束日期(可选,格式:yyyy-MM-dd)
|
||||||
|
* @param status 单据状态(可选)
|
||||||
|
* @param keyword 关键字(可选,申请单号/检查项目名称模糊匹配)
|
||||||
* @return 检查申请单
|
* @return 检查申请单
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/get-check")
|
@GetMapping(value = "/get-check")
|
||||||
public R<?> getCheckRequestForm(@RequestParam(required = false) Long encounterId) {
|
public R<?> getCheckRequestForm(
|
||||||
|
@RequestParam(required = false) Long encounterId,
|
||||||
|
@RequestParam(required = false) String startDate,
|
||||||
|
@RequestParam(required = false) String endDate,
|
||||||
|
@RequestParam(required = false) String status,
|
||||||
|
@RequestParam(required = false) String keyword) {
|
||||||
if (encounterId == null) {
|
if (encounterId == null) {
|
||||||
return R.fail("就诊ID不能为空");
|
return R.fail("就诊ID不能为空");
|
||||||
}
|
}
|
||||||
return R.ok(iRequestFormManageAppService.getRequestForm(encounterId, ActivityDefCategory.TEST.getCode()));
|
return R.ok(iRequestFormManageAppService.getRequestForm(encounterId, ActivityDefCategory.TEST.getCode(), startDate, endDate, status, keyword));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -98,6 +109,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 关键字(可选,申请单号/检验项目模糊匹配)
|
||||||
* @return 检验申请单
|
* @return 检验申请单
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/get-inspection")
|
@GetMapping(value = "/get-inspection")
|
||||||
@@ -105,11 +117,12 @@ public class RequestFormManageController {
|
|||||||
@RequestParam(required = false) Long encounterId,
|
@RequestParam(required = false) Long encounterId,
|
||||||
@RequestParam(required = false) String startDate,
|
@RequestParam(required = false) String startDate,
|
||||||
@RequestParam(required = false) String endDate,
|
@RequestParam(required = false) String endDate,
|
||||||
@RequestParam(required = false) String status) {
|
@RequestParam(required = false) String status,
|
||||||
|
@RequestParam(required = false) String keyword) {
|
||||||
if (encounterId == null) {
|
if (encounterId == null) {
|
||||||
return R.fail("就诊ID不能为空");
|
return R.fail("就诊ID不能为空");
|
||||||
}
|
}
|
||||||
return R.ok(iRequestFormManageAppService.getRequestForm(encounterId, ActivityDefCategory.PROOF.getCode(), startDate, endDate, status));
|
return R.ok(iRequestFormManageAppService.getRequestForm(encounterId, ActivityDefCategory.PROOF.getCode(), startDate, endDate, status, keyword));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -140,6 +153,32 @@ public class RequestFormManageController {
|
|||||||
return R.ok(iRequestFormManageAppService.getRequestForm(encounterId, ActivityDefCategory.PROCEDURE.getCode()));
|
return R.ok(iRequestFormManageAppService.getRequestForm(encounterId, ActivityDefCategory.PROCEDURE.getCode()));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
* 分页查询手术申请单(全局,不需要encounterId,用于门诊手术安排查找弹窗)
|
||||||
|
*
|
||||||
|
* @param surgeryNo 手术单号(模糊查询,可选)
|
||||||
|
* @param applyTimeStart 申请时间起始(可选)
|
||||||
|
* @param applyTimeEnd 申请时间截止(可选)
|
||||||
|
* @param mainDoctorId 主刀医生ID(可选)
|
||||||
|
* @param applyDeptId 申请科室ID(可选)
|
||||||
|
* @param pageNo 页码,默认1
|
||||||
|
* @param pageSize 每页数量,默认10
|
||||||
|
* @return 分页手术申请单列表
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/get-surgery-page")
|
||||||
|
public R<IPage<RequestFormPageDto>> getSurgeryRequestFormPage(
|
||||||
|
@RequestParam(required = false) String surgeryNo,
|
||||||
|
@RequestParam(required = false) LocalDate applyTimeStart,
|
||||||
|
@RequestParam(required = false) LocalDate applyTimeEnd,
|
||||||
|
@RequestParam(required = false) Long mainDoctorId,
|
||||||
|
@RequestParam(required = false) Long applyDeptId,
|
||||||
|
@RequestParam(defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||||
|
RequestFormDto dto = new RequestFormDto(surgeryNo, ActivityDefCategory.PROCEDURE.getCode(), applyTimeStart, applyTimeEnd,
|
||||||
|
mainDoctorId, applyDeptId, pageNo, pageSize);
|
||||||
|
return R.ok(iRequestFormManageAppService.getRequestFormPage(dto));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* 分页查询申请单
|
* 分页查询申请单
|
||||||
* @return 申请单
|
* @return 申请单
|
||||||
*/
|
*/
|
||||||
@@ -147,4 +186,26 @@ public class RequestFormManageController {
|
|||||||
public R<IPage<RequestFormPageDto>> getRequestFormPage(@RequestBody RequestFormDto requestFormDto) {
|
public R<IPage<RequestFormPageDto>> getRequestFormPage(@RequestBody RequestFormDto requestFormDto) {
|
||||||
return R.ok(iRequestFormManageAppService.getRequestFormPage(requestFormDto));
|
return R.ok(iRequestFormManageAppService.getRequestFormPage(requestFormDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除申请单(仅待签发状态可删除)
|
||||||
|
*
|
||||||
|
* @param data 包含 requestFormId 的请求体
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/delete")
|
||||||
|
public R<?> deleteRequestForm(@RequestBody Map<String, Long> data) {
|
||||||
|
return iRequestFormManageAppService.deleteRequestForm(data.get("requestFormId"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 撤回申请单(已签发状态撤回至待签发)
|
||||||
|
*
|
||||||
|
* @param data 包含 requestFormId 的请求体
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@PostMapping(value = "/withdraw")
|
||||||
|
public R<?> withdrawRequestForm(@RequestBody Map<String, Long> data) {
|
||||||
|
return iRequestFormManageAppService.withdrawRequestForm(data.get("requestFormId"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ public class RequestFormDto {
|
|||||||
* 手术单号
|
* 手术单号
|
||||||
*/
|
*/
|
||||||
private String surgeryNo;
|
private String surgeryNo;
|
||||||
|
/**
|
||||||
|
* 申请单类型编码
|
||||||
|
*/
|
||||||
|
private String typeCode;
|
||||||
/**
|
/**
|
||||||
* 申请时间开始
|
* 申请时间开始
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -138,4 +138,12 @@ public class CurrentDayEncounterTencentDto {
|
|||||||
*/
|
*/
|
||||||
private String englishName;
|
private String englishName;
|
||||||
|
|
||||||
|
/** 号源池ID(用于分诊队列 div_log 审计日志) */
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long poolId;
|
||||||
|
|
||||||
|
/** 号源槽位ID(用于分诊队列 div_log 审计日志) */
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long slotId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
url: jdbc:postgresql://192.168.110.252:15432/postgresql?currentSchema=histest&characterEncoding=UTF-8&client_encoding=UTF-8
|
url: jdbc:postgresql://192.168.110.252:15432/postgresql?currentSchema=histest1&characterEncoding=UTF-8&client_encoding=UTF-8
|
||||||
username: postgresql
|
username: postgresql
|
||||||
password: Jchl1528
|
password: Jchl1528
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
|
|||||||
@@ -97,9 +97,14 @@
|
|||||||
CASE
|
CASE
|
||||||
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.surgery_name
|
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.surgery_name
|
||||||
WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN T9.surgery_name
|
WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN T9.surgery_name
|
||||||
|
WHEN T1.context_enum = 6 AND T1.service_table = 'wor_service_request' THEN COALESCE(
|
||||||
|
wsr.content_json::json->>'surgeryName',
|
||||||
|
wsr.content_json::json->>'adviceName',
|
||||||
|
T9sr.surgery_name)
|
||||||
WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name")
|
WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name")
|
||||||
WHEN T1.context_enum = 6 THEN T2."name"
|
WHEN T1.context_enum = 6 THEN T2."name"
|
||||||
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name")
|
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name")
|
||||||
|
WHEN T1.context_enum = #{activity} AND T1.service_table = 'wor_service_request' THEN COALESCE(T9.surgery_name, wsr.content_json::json->>'surgeryName', wsr.content_json::json->>'adviceName', T2."name")
|
||||||
WHEN T1.context_enum = #{activity} THEN COALESCE(wsr.content_json::json->>'surgeryName', wsr.content_json::json->>'adviceName', T2."name")
|
WHEN T1.context_enum = #{activity} THEN COALESCE(wsr.content_json::json->>'surgeryName', wsr.content_json::json->>'adviceName', T2."name")
|
||||||
WHEN T1.context_enum = #{medication} THEN T3."name"
|
WHEN T1.context_enum = #{medication} THEN T3."name"
|
||||||
WHEN T1.context_enum = #{device} THEN T4."name"
|
WHEN T1.context_enum = #{device} THEN T4."name"
|
||||||
@@ -107,6 +112,7 @@
|
|||||||
CASE
|
CASE
|
||||||
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN NULL
|
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN NULL
|
||||||
WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN NULL
|
WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN NULL
|
||||||
|
WHEN T1.context_enum = 6 AND T1.service_table = 'wor_service_request' THEN NULL
|
||||||
WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL
|
WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL
|
||||||
WHEN T1.context_enum = 6 THEN T2.yb_no
|
WHEN T1.context_enum = 6 THEN T2.yb_no
|
||||||
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL
|
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL
|
||||||
@@ -117,6 +123,7 @@
|
|||||||
CASE
|
CASE
|
||||||
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.id
|
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.id
|
||||||
WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN T9.id
|
WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN T9.id
|
||||||
|
WHEN T1.context_enum = 6 AND T1.service_table = 'wor_service_request' THEN COALESCE(T9sr.id, wsr.activity_id)
|
||||||
WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0
|
WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0
|
||||||
WHEN T1.context_enum = 6 THEN T2.id
|
WHEN T1.context_enum = 6 THEN T2.id
|
||||||
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0
|
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0
|
||||||
@@ -158,6 +165,11 @@
|
|||||||
LEFT JOIN med_medication_request AS mmr ON mmr.id = T1.service_id AND mmr.delete_flag = '0'
|
LEFT JOIN med_medication_request AS mmr ON mmr.id = T1.service_id AND mmr.delete_flag = '0'
|
||||||
LEFT JOIN wor_device_request AS wdr ON wdr.id = T1.service_id AND wdr.delete_flag = '0'
|
LEFT JOIN wor_device_request AS wdr ON wdr.id = T1.service_id AND wdr.delete_flag = '0'
|
||||||
LEFT JOIN wor_service_request AS wsr ON wsr.id = T1.service_id AND wsr.delete_flag = '0'
|
LEFT JOIN wor_service_request AS wsr ON wsr.id = T1.service_id AND wsr.delete_flag = '0'
|
||||||
|
LEFT JOIN cli_surgery AS T9sr ON T1.context_enum = 6
|
||||||
|
AND T1.service_table = 'wor_service_request'
|
||||||
|
AND wsr.activity_id IS NOT NULL
|
||||||
|
AND wsr.activity_id = T9sr.id
|
||||||
|
AND T9sr.delete_flag = '0'
|
||||||
LEFT JOIN wor_service_request AS wsrp ON wsrp.id = wsr.parent_id AND wsrp.delete_flag = '0'
|
LEFT JOIN wor_service_request AS wsrp ON wsrp.id = wsr.parent_id AND wsrp.delete_flag = '0'
|
||||||
WHERE T1.encounter_id = #{encounterId}
|
WHERE T1.encounter_id = #{encounterId}
|
||||||
AND T1.status_enum IN (0
|
AND T1.status_enum IN (0
|
||||||
@@ -222,9 +234,14 @@
|
|||||||
CASE
|
CASE
|
||||||
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.surgery_name
|
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.surgery_name
|
||||||
WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN T9.surgery_name
|
WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN T9.surgery_name
|
||||||
|
WHEN T1.context_enum = 6 AND T1.service_table = 'wor_service_request' THEN COALESCE(
|
||||||
|
wsr.content_json::json->>'surgeryName',
|
||||||
|
wsr.content_json::json->>'adviceName',
|
||||||
|
T9sr.surgery_name)
|
||||||
WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name")
|
WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name")
|
||||||
WHEN T1.context_enum = 6 THEN T2."name"
|
WHEN T1.context_enum = 6 THEN T2."name"
|
||||||
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name")
|
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN COALESCE(wsr.content_json::json->>'adviceName', T2."name")
|
||||||
|
WHEN T1.context_enum = #{activity} AND T1.service_table = 'wor_service_request' THEN COALESCE(T9.surgery_name, wsr.content_json::json->>'surgeryName', wsr.content_json::json->>'adviceName', T2."name")
|
||||||
WHEN T1.context_enum = #{activity} THEN COALESCE(wsr.content_json::json->>'surgeryName', wsr.content_json::json->>'adviceName', T2."name")
|
WHEN T1.context_enum = #{activity} THEN COALESCE(wsr.content_json::json->>'surgeryName', wsr.content_json::json->>'adviceName', T2."name")
|
||||||
WHEN T1.context_enum = #{medication} THEN T3."name"
|
WHEN T1.context_enum = #{medication} THEN T3."name"
|
||||||
WHEN T1.context_enum = #{device} THEN T4."name"
|
WHEN T1.context_enum = #{device} THEN T4."name"
|
||||||
@@ -232,6 +249,7 @@
|
|||||||
CASE
|
CASE
|
||||||
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN NULL
|
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN NULL
|
||||||
WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN NULL
|
WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN NULL
|
||||||
|
WHEN T1.context_enum = 6 AND T1.service_table = 'wor_service_request' THEN NULL
|
||||||
WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL
|
WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL
|
||||||
WHEN T1.context_enum = 6 THEN T2.yb_no
|
WHEN T1.context_enum = 6 THEN T2.yb_no
|
||||||
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL
|
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN NULL
|
||||||
@@ -242,6 +260,7 @@
|
|||||||
CASE
|
CASE
|
||||||
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.id
|
WHEN T1.context_enum = #{activity} AND T1.product_table = 'cli_surgery' THEN T9.id
|
||||||
WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN T9.id
|
WHEN T1.context_enum = 6 AND T1.product_table = 'cli_surgery' THEN T9.id
|
||||||
|
WHEN T1.context_enum = 6 AND T1.service_table = 'wor_service_request' THEN COALESCE(T9sr.id, wsr.activity_id)
|
||||||
WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0
|
WHEN T1.context_enum = 6 AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0
|
||||||
WHEN T1.context_enum = 6 THEN T2.id
|
WHEN T1.context_enum = 6 THEN T2.id
|
||||||
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0
|
WHEN T1.context_enum = #{activity} AND T1.product_id = 0 AND T1.service_table = 'wor_service_request' THEN 0
|
||||||
@@ -284,6 +303,11 @@
|
|||||||
LEFT JOIN med_medication_request AS mmr ON mmr.id = T1.service_id AND mmr.delete_flag = '0'
|
LEFT JOIN med_medication_request AS mmr ON mmr.id = T1.service_id AND mmr.delete_flag = '0'
|
||||||
LEFT JOIN wor_device_request AS wdr ON wdr.id = T1.service_id AND wdr.delete_flag = '0'
|
LEFT JOIN wor_device_request AS wdr ON wdr.id = T1.service_id AND wdr.delete_flag = '0'
|
||||||
LEFT JOIN wor_service_request AS wsr ON wsr.id = T1.service_id AND wsr.delete_flag = '0'
|
LEFT JOIN wor_service_request AS wsr ON wsr.id = T1.service_id AND wsr.delete_flag = '0'
|
||||||
|
LEFT JOIN cli_surgery AS T9sr ON T1.context_enum = 6
|
||||||
|
AND T1.service_table = 'wor_service_request'
|
||||||
|
AND wsr.activity_id IS NOT NULL
|
||||||
|
AND wsr.activity_id = T9sr.id
|
||||||
|
AND T9sr.delete_flag = '0'
|
||||||
WHERE T1.encounter_id = #{encounterId}
|
WHERE T1.encounter_id = #{encounterId}
|
||||||
AND T1.status_enum IN (0
|
AND T1.status_enum IN (0
|
||||||
, #{planned}
|
, #{planned}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
</if>
|
</if>
|
||||||
AND os.delete_flag = '0'
|
AND os.delete_flag = '0'
|
||||||
</where>
|
</where>
|
||||||
ORDER BY os.create_time DESC
|
ORDER BY os.create_time DESC, os.schedule_id DESC
|
||||||
</select>
|
</select>
|
||||||
<!-- 根据ID查询手术安排详情-->
|
<!-- 根据ID查询手术安排详情-->
|
||||||
<select id="getSurgeryScheduleDetail" resultType="com.openhis.web.clinicalmanage.dto.OpScheduleDto">
|
<select id="getSurgeryScheduleDetail" resultType="com.openhis.web.clinicalmanage.dto.OpScheduleDto">
|
||||||
@@ -89,12 +89,17 @@
|
|||||||
cs.apply_doctor_name AS apply_doctor_name,
|
cs.apply_doctor_name AS apply_doctor_name,
|
||||||
drf.create_time AS apply_time,
|
drf.create_time AS apply_time,
|
||||||
os.surgery_nature AS surgeryType,
|
os.surgery_nature AS surgeryType,
|
||||||
|
cs.incision_level AS incisionLevel,
|
||||||
|
fc.contract_name AS feeType,
|
||||||
COALESCE(pi.identifier_no, ap.bus_no, '') AS identifierNo
|
COALESCE(pi.identifier_no, ap.bus_no, '') AS identifierNo
|
||||||
FROM op_schedule os
|
FROM op_schedule os
|
||||||
LEFT JOIN adm_patient ap ON os.patient_id = ap.id
|
LEFT JOIN adm_patient ap ON os.patient_id = ap.id
|
||||||
INNER JOIN cli_surgery cs ON os.oper_code = cs.surgery_no AND cs.delete_flag = '0'
|
INNER JOIN cli_surgery cs ON os.oper_code = cs.surgery_no AND cs.delete_flag = '0'
|
||||||
LEFT JOIN adm_organization o ON cs.org_id = o.id
|
LEFT JOIN adm_organization o ON cs.org_id = o.id
|
||||||
LEFT JOIN doc_request_form drf ON drf.prescription_no=cs.surgery_no
|
LEFT JOIN doc_request_form drf ON drf.prescription_no=cs.surgery_no
|
||||||
|
LEFT JOIN adm_encounter ae ON ae.id = os.visit_id AND ae.delete_flag = '0'
|
||||||
|
LEFT JOIN adm_account aa ON aa.encounter_id = ae.id AND aa.delete_flag = '0'
|
||||||
|
LEFT JOIN fin_contract fc ON fc.bus_no = aa.contract_no AND fc.delete_flag = '0'
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT patient_id, identifier_no
|
SELECT patient_id, identifier_no
|
||||||
FROM (
|
FROM (
|
||||||
@@ -182,7 +187,7 @@
|
|||||||
<if test="dto.applyDeptId != null and dto.applyDeptId != ''"> AND cs.apply_dept_id = #{dto.applyDeptId}</if>
|
<if test="dto.applyDeptId != null and dto.applyDeptId != ''"> AND cs.apply_dept_id = #{dto.applyDeptId}</if>
|
||||||
<if test="dto.patientName != null and dto.patientName != ''"> AND ap.name LIKE CONCAT('%', #{dto.patientName}, '%')</if>
|
<if test="dto.patientName != null and dto.patientName != ''"> AND ap.name LIKE CONCAT('%', #{dto.patientName}, '%')</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY os.create_time DESC
|
ORDER BY os.create_time DESC, os.schedule_id DESC
|
||||||
</select>
|
</select>
|
||||||
<!-- 查询时间段内该手术室是否被占用-->
|
<!-- 查询时间段内该手术室是否被占用-->
|
||||||
<select id="isScheduleConflict" resultType="java.lang.Boolean">
|
<select id="isScheduleConflict" resultType="java.lang.Boolean">
|
||||||
|
|||||||
@@ -98,9 +98,6 @@
|
|||||||
INNER JOIN adm_organization_location AS T6 ON T6.distribution_category_code = t1.category_code AND T6.delete_flag = '0' AND T6.item_code = '1' AND T6.organization_id = #{organizationId} AND (CURRENT_TIME :: time (6) BETWEEN T6.start_time AND T6.end_time)
|
INNER JOIN adm_organization_location AS T6 ON T6.distribution_category_code = t1.category_code AND T6.delete_flag = '0' AND T6.item_code = '1' AND T6.organization_id = #{organizationId} AND (CURRENT_TIME :: time (6) BETWEEN T6.start_time AND T6.end_time)
|
||||||
WHERE t1.delete_flag = '0'
|
WHERE t1.delete_flag = '0'
|
||||||
AND T2.status_enum = #{statusEnum}
|
AND T2.status_enum = #{statusEnum}
|
||||||
<if test="pricingFlag == 1">
|
|
||||||
AND 1 = 2
|
|
||||||
</if>
|
|
||||||
<if test="categoryCode != null and categoryCode != ''">
|
<if test="categoryCode != null and categoryCode != ''">
|
||||||
<!-- 🔧 BugFix: 支持两种匹配方式 -->
|
<!-- 🔧 BugFix: 支持两种匹配方式 -->
|
||||||
<!-- 1. 直接匹配:distribution_category_code = category_code(都是数字代码) -->
|
<!-- 1. 直接匹配:distribution_category_code = category_code(都是数字代码) -->
|
||||||
@@ -242,7 +239,7 @@
|
|||||||
NULL AS activity_type_dictText,
|
NULL AS activity_type_dictText,
|
||||||
-- 前端"包装单位"列:显示使用单位(permitted_unit_code)
|
-- 前端"包装单位"列:显示使用单位(permitted_unit_code)
|
||||||
T1.permitted_unit_code AS unit_code,
|
T1.permitted_unit_code AS unit_code,
|
||||||
'' AS min_unit_code,
|
T1.permitted_unit_code AS min_unit_code,
|
||||||
'' AS volume,
|
'' AS volume,
|
||||||
'' AS method_code,
|
'' AS method_code,
|
||||||
'' AS rate_code,
|
'' AS rate_code,
|
||||||
@@ -530,6 +527,9 @@
|
|||||||
LEFT JOIN cli_condition AS cc ON cc.id = T1.condition_id AND cc.delete_flag = '0'
|
LEFT JOIN cli_condition AS cc ON cc.id = T1.condition_id AND cc.delete_flag = '0'
|
||||||
LEFT JOIN cli_condition_definition AS ccd ON ccd.id = cc.definition_id
|
LEFT JOIN cli_condition_definition AS ccd ON ccd.id = cc.definition_id
|
||||||
WHERE T1.delete_flag = '0' AND T1.tcm_flag = 0
|
WHERE T1.delete_flag = '0' AND T1.tcm_flag = 0
|
||||||
|
<if test="generateSourceEnum != null">
|
||||||
|
AND T1.generate_source_enum = #{generateSourceEnum}
|
||||||
|
</if>
|
||||||
<if test="historyFlag == '0'.toString()">
|
<if test="historyFlag == '0'.toString()">
|
||||||
AND T1.encounter_id = #{encounterId}
|
AND T1.encounter_id = #{encounterId}
|
||||||
</if>
|
</if>
|
||||||
@@ -539,14 +539,15 @@
|
|||||||
AND T1.refund_medicine_id IS NULL
|
AND T1.refund_medicine_id IS NULL
|
||||||
ORDER BY T1.status_enum,T1.sort_number)
|
ORDER BY T1.status_enum,T1.sort_number)
|
||||||
UNION ALL
|
UNION ALL
|
||||||
-- 🔧 新增:查询门诊术中计费生成的耗材数据(这些数据存在于 adm_charge_item 和 wor_device_request)
|
-- 🔧 查询仅存在于 adm_charge_item 的"孤儿"耗材数据(DeviceRequest 缺失或 generate_source_enum 未设置)
|
||||||
|
-- 正常 DeviceRequest(generate_source_enum 已赋值)由下方 Part 3 统一负责,此处不做重复覆盖避免 UNION ALL 重复行
|
||||||
(SELECT 2 AS advice_type,
|
(SELECT 2 AS advice_type,
|
||||||
CI.service_id AS request_id,
|
CI.service_id AS request_id,
|
||||||
CI.service_id || '-ci-dev' AS unique_key,
|
CI.service_id || '-ci-dev' AS unique_key,
|
||||||
'' AS prescription_no,
|
'' AS prescription_no,
|
||||||
CI.enterer_id AS requester_id,
|
COALESCE(DR.requester_id, CI.enterer_id) AS requester_id,
|
||||||
CI.entered_date AS request_time,
|
CI.entered_date AS request_time,
|
||||||
CASE WHEN CI.enterer_id = #{practitionerId} THEN '1' ELSE '0' END AS biz_request_flag,
|
CASE WHEN COALESCE(DR.requester_id, CI.enterer_id) = #{practitionerId} THEN '1' ELSE '0' END AS biz_request_flag,
|
||||||
DR.content_json AS content_json,
|
DR.content_json AS content_json,
|
||||||
NULL AS skin_test_flag,
|
NULL AS skin_test_flag,
|
||||||
NULL AS inject_flag,
|
NULL AS inject_flag,
|
||||||
@@ -583,6 +584,9 @@
|
|||||||
LEFT JOIN adm_location AS AL ON AL.id = DR.perform_location AND AL.delete_flag = '0'
|
LEFT JOIN adm_location AS AL ON AL.id = DR.perform_location AND AL.delete_flag = '0'
|
||||||
WHERE CI.delete_flag = '0'
|
WHERE CI.delete_flag = '0'
|
||||||
AND CI.service_table = 'wor_device_request'
|
AND CI.service_table = 'wor_device_request'
|
||||||
|
<if test="generateSourceEnum != null">
|
||||||
|
AND DR.generate_source_enum IS NULL <!-- 仅匹配孤儿记录,normal DeviceRequest 由 Part 3 负责,避免 UNION ALL 重复 -->
|
||||||
|
</if>
|
||||||
<if test="historyFlag == '0'.toString()">
|
<if test="historyFlag == '0'.toString()">
|
||||||
AND CI.encounter_id = #{encounterId}
|
AND CI.encounter_id = #{encounterId}
|
||||||
</if>
|
</if>
|
||||||
@@ -698,6 +702,9 @@
|
|||||||
-- based_on_table='med_medication_request' → 输液/皮试执行记录,应排除
|
-- based_on_table='med_medication_request' → 输液/皮试执行记录,应排除
|
||||||
-- based_on_table='exam_apply'/'lab_apply' → 申请单原始医嘱,应保留
|
-- based_on_table='exam_apply'/'lab_apply' → 申请单原始医嘱,应保留
|
||||||
AND (T1.based_on_id IS NULL OR T1.based_on_table IS NULL OR T1.based_on_table NOT IN ('med_medication_request', 'med_medication_dispense'))
|
AND (T1.based_on_id IS NULL OR T1.based_on_table IS NULL OR T1.based_on_table NOT IN ('med_medication_request', 'med_medication_dispense'))
|
||||||
|
<if test="sourceBillNo != null and sourceBillNo != ''">
|
||||||
|
AND T1.prescription_no = #{sourceBillNo}
|
||||||
|
</if>
|
||||||
<if test="historyFlag == '0'.toString()">
|
<if test="historyFlag == '0'.toString()">
|
||||||
AND T1.encounter_id = #{encounterId}
|
AND T1.encounter_id = #{encounterId}
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -134,7 +134,11 @@
|
|||||||
T2.yb_no,
|
T2.yb_no,
|
||||||
T1.onset_date AS onsetDate,
|
T1.onset_date AS onsetDate,
|
||||||
T1.diagnosis_time AS diagnosisTime,
|
T1.diagnosis_time AS diagnosisTime,
|
||||||
T1.doctor AS diagnosisDoctor
|
T1.doctor AS diagnosisDoctor,
|
||||||
|
CASE WHEN EXISTS (
|
||||||
|
SELECT 1 FROM infectious_card T4
|
||||||
|
WHERE T4.diag_id = T2.id AND T4.delete_flag = '0' AND T4.status >= 1
|
||||||
|
) THEN 1 ELSE 0 END AS hasInfectiousReport
|
||||||
FROM adm_encounter_diagnosis AS T1
|
FROM adm_encounter_diagnosis AS T1
|
||||||
LEFT JOIN cli_condition AS T2 ON T2.ID = T1.condition_id
|
LEFT JOIN cli_condition AS T2 ON T2.ID = T1.condition_id
|
||||||
AND T2.delete_flag = '0' AND T2.tcm_flag = 0
|
AND T2.delete_flag = '0' AND T2.tcm_flag = 0
|
||||||
|
|||||||
@@ -231,7 +231,7 @@
|
|||||||
ae.priority_enum,
|
ae.priority_enum,
|
||||||
ae.organization_id,
|
ae.organization_id,
|
||||||
ae.start_time AS in_hos_time,
|
ae.start_time AS in_hos_time,
|
||||||
bed.start_time,
|
COALESCE(bed.start_time, ae.start_time) AS start_time,
|
||||||
bed.location_id AS bed_id,
|
bed.location_id AS bed_id,
|
||||||
bed.location_name AS bed_name,
|
bed.location_name AS bed_name,
|
||||||
house.location_id AS house_id,
|
house.location_id AS house_id,
|
||||||
@@ -264,7 +264,6 @@
|
|||||||
WHERE ael.status_enum = #{active}
|
WHERE ael.status_enum = #{active}
|
||||||
AND ael.delete_flag = '0'
|
AND ael.delete_flag = '0'
|
||||||
AND ael.form_enum = #{bed}
|
AND ael.form_enum = #{bed}
|
||||||
LIMIT 1
|
|
||||||
) AS bed ON bed.encounter_id = ae.id
|
) AS bed ON bed.encounter_id = ae.id
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT ael.encounter_id,
|
SELECT ael.encounter_id,
|
||||||
@@ -275,7 +274,6 @@
|
|||||||
WHERE ael.status_enum = #{active}
|
WHERE ael.status_enum = #{active}
|
||||||
AND ael.delete_flag = '0'
|
AND ael.delete_flag = '0'
|
||||||
AND ael.form_enum = #{house}
|
AND ael.form_enum = #{house}
|
||||||
LIMIT 1
|
|
||||||
) AS house ON house.encounter_id = ae.id
|
) AS house ON house.encounter_id = ae.id
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT ael.encounter_id,
|
SELECT ael.encounter_id,
|
||||||
@@ -286,7 +284,6 @@
|
|||||||
WHERE ael.status_enum = #{active}
|
WHERE ael.status_enum = #{active}
|
||||||
AND ael.delete_flag = '0'
|
AND ael.delete_flag = '0'
|
||||||
AND ael.form_enum = #{ward}
|
AND ael.form_enum = #{ward}
|
||||||
LIMIT 1
|
|
||||||
) AS ward ON ward.encounter_id = ae.id
|
) AS ward ON ward.encounter_id = ae.id
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT aep.encounter_id,
|
SELECT aep.encounter_id,
|
||||||
|
|||||||
@@ -155,7 +155,7 @@
|
|||||||
ii.performer_check_id,
|
ii.performer_check_id,
|
||||||
ii.category_code,
|
ii.category_code,
|
||||||
ii.dispense_status
|
ii.dispense_status
|
||||||
FROM (( SELECT T1.encounter_id,
|
FROM (( SELECT DISTINCT T1.encounter_id,
|
||||||
T1.tenant_id,
|
T1.tenant_id,
|
||||||
#{medMedicationRequest} AS advice_table,
|
#{medMedicationRequest} AS advice_table,
|
||||||
T1.id AS request_id,
|
T1.id AS request_id,
|
||||||
@@ -280,9 +280,13 @@
|
|||||||
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 LATERAL (
|
||||||
ON mmd.med_req_id = T1.id
|
SELECT status_enum
|
||||||
AND mmd.delete_flag = '0'
|
FROM med_medication_dispense
|
||||||
|
WHERE med_req_id = T1.id AND delete_flag = '0'
|
||||||
|
ORDER BY create_time DESC
|
||||||
|
LIMIT 1
|
||||||
|
) mmd ON true
|
||||||
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}
|
||||||
@@ -293,7 +297,7 @@
|
|||||||
T1.sort_number,
|
T1.sort_number,
|
||||||
T1.group_id )
|
T1.group_id )
|
||||||
UNION
|
UNION
|
||||||
( SELECT T1.encounter_id,
|
( SELECT DISTINCT T1.encounter_id,
|
||||||
T1.tenant_id,
|
T1.tenant_id,
|
||||||
#{worServiceRequest} AS advice_table,
|
#{worServiceRequest} AS advice_table,
|
||||||
T1.id AS request_id,
|
T1.id AS request_id,
|
||||||
|
|||||||
@@ -288,7 +288,7 @@
|
|||||||
AND T1.refund_device_id IS NULL
|
AND T1.refund_device_id IS NULL
|
||||||
ORDER BY T1.status_enum)
|
ORDER BY T1.status_enum)
|
||||||
UNION ALL
|
UNION ALL
|
||||||
(SELECT CASE WHEN T1.category_enum = 4 THEN 6 ELSE COALESCE(T1.category_enum, 3) END AS advice_type,
|
(SELECT CASE WHEN T1.category_enum IN (4, 24) THEN 6 ELSE 3 END AS advice_type,
|
||||||
T1.id AS request_id,
|
T1.id AS request_id,
|
||||||
T1.id || '-3' AS unique_key,
|
T1.id || '-3' AS unique_key,
|
||||||
T1.requester_id AS requester_id,
|
T1.requester_id AS requester_id,
|
||||||
|
|||||||
@@ -8,17 +8,34 @@
|
|||||||
SELECT drf.id AS request_form_id,
|
SELECT drf.id AS request_form_id,
|
||||||
drf.encounter_id,
|
drf.encounter_id,
|
||||||
drf.prescription_no,
|
drf.prescription_no,
|
||||||
drf.NAME,
|
COALESCE(
|
||||||
|
(SELECT STRING_AGG(DISTINCT wad.name, '、')
|
||||||
|
FROM wor_service_request wsr2
|
||||||
|
LEFT JOIN wor_activity_definition wad ON wad.id = wsr2.activity_id AND wad.delete_flag = '0'
|
||||||
|
WHERE wsr2.prescription_no = drf.prescription_no AND wsr2.delete_flag = '0'),
|
||||||
|
drf.name
|
||||||
|
) AS name,
|
||||||
drf.desc_json,
|
drf.desc_json,
|
||||||
drf.requester_id,
|
drf.requester_id,
|
||||||
drf.create_time,
|
drf.create_time,
|
||||||
drf.status,
|
ap.NAME AS patient_name,
|
||||||
ap.NAME AS patient_name
|
CASE
|
||||||
|
WHEN MIN(wsr.status_enum) = 1 THEN 0
|
||||||
|
WHEN MIN(wsr.status_enum) = 2 THEN 1
|
||||||
|
WHEN MIN(wsr.status_enum) = 3 AND MAX(CASE WHEN wsr.performer_check_id IS NOT NULL THEN 1 ELSE 0 END) = 1 THEN 2
|
||||||
|
WHEN MIN(wsr.status_enum) = 3 THEN 4
|
||||||
|
WHEN MIN(wsr.status_enum) = 4 THEN 3
|
||||||
|
WHEN MIN(wsr.status_enum) = 5 OR MIN(wsr.status_enum) = 6 OR MIN(wsr.status_enum) = 7 THEN 7
|
||||||
|
WHEN MIN(wsr.status_enum) = 8 THEN 6
|
||||||
|
ELSE NULL
|
||||||
|
END AS status
|
||||||
FROM doc_request_form AS drf
|
FROM doc_request_form AS drf
|
||||||
LEFT JOIN adm_encounter AS ae ON ae.ID = drf.encounter_id
|
LEFT JOIN adm_encounter AS ae ON ae.ID = drf.encounter_id
|
||||||
AND ae.delete_flag = '0'
|
AND ae.delete_flag = '0'
|
||||||
LEFT JOIN adm_patient AS ap ON ap.ID = ae.patient_id
|
LEFT JOIN adm_patient AS ap ON ap.ID = ae.patient_id
|
||||||
AND ap.delete_flag = '0'
|
AND ap.delete_flag = '0'
|
||||||
|
LEFT JOIN wor_service_request AS wsr ON wsr.prescription_no = drf.prescription_no
|
||||||
|
AND wsr.delete_flag = '0'
|
||||||
WHERE drf.delete_flag = '0'
|
WHERE drf.delete_flag = '0'
|
||||||
AND drf.encounter_id = #{encounterId}
|
AND drf.encounter_id = #{encounterId}
|
||||||
AND drf.type_code = #{typeCode}
|
AND drf.type_code = #{typeCode}
|
||||||
@@ -29,8 +46,32 @@
|
|||||||
AND drf.create_time <= (#{endDate}::date + INTERVAL '1 day' - INTERVAL '1 second')
|
AND drf.create_time <= (#{endDate}::date + INTERVAL '1 day' - INTERVAL '1 second')
|
||||||
</if>
|
</if>
|
||||||
<if test="status != null and status != ''">
|
<if test="status != null and status != ''">
|
||||||
AND drf.status = #{status}::integer
|
AND CASE
|
||||||
|
WHEN MIN(wsr.status_enum) = 1 THEN 0
|
||||||
|
WHEN MIN(wsr.status_enum) = 2 THEN 1
|
||||||
|
WHEN MIN(wsr.status_enum) = 3 AND MAX(CASE WHEN wsr.performer_check_id IS NOT NULL THEN 1 ELSE 0 END) = 1 THEN 2
|
||||||
|
WHEN MIN(wsr.status_enum) = 3 THEN 4
|
||||||
|
WHEN MIN(wsr.status_enum) = 4 THEN 3
|
||||||
|
WHEN MIN(wsr.status_enum) = 5 OR MIN(wsr.status_enum) = 6 OR MIN(wsr.status_enum) = 7 THEN 7
|
||||||
|
WHEN MIN(wsr.status_enum) = 8 THEN 6
|
||||||
|
ELSE NULL
|
||||||
|
END = #{status}::integer
|
||||||
</if>
|
</if>
|
||||||
|
<if test="keyword != null and keyword != ''">
|
||||||
|
AND (drf.prescription_no ILIKE '%' || #{keyword} || '%'
|
||||||
|
OR EXISTS (
|
||||||
|
SELECT 1 FROM wor_service_request wsr2
|
||||||
|
WHERE wsr2.prescription_no = drf.prescription_no
|
||||||
|
AND wsr2.delete_flag = '0'
|
||||||
|
AND wsr2.activity_id IN (
|
||||||
|
SELECT id FROM wor_activity_definition wad
|
||||||
|
WHERE wad.delete_flag = '0'
|
||||||
|
AND wad.name ILIKE '%' || #{keyword} || '%'
|
||||||
|
)
|
||||||
|
))
|
||||||
|
</if>
|
||||||
|
GROUP BY drf.id, drf.encounter_id, drf.prescription_no, drf.name, drf.desc_json,
|
||||||
|
drf.requester_id, drf.create_time, ap.name
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getRequestFormDetail" resultType="com.openhis.web.regdoctorstation.dto.RequestFormDetailQueryDto">
|
<select id="getRequestFormDetail" resultType="com.openhis.web.regdoctorstation.dto.RequestFormDetailQueryDto">
|
||||||
@@ -126,6 +167,9 @@
|
|||||||
<if test="requestFormDto.surgeryNo != null and requestFormDto.surgeryNo != ''">
|
<if test="requestFormDto.surgeryNo != null and requestFormDto.surgeryNo != ''">
|
||||||
AND drf.prescription_no LIKE CONCAT('%', #{requestFormDto.surgeryNo}, '%')
|
AND drf.prescription_no LIKE CONCAT('%', #{requestFormDto.surgeryNo}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="requestFormDto.typeCode != null and requestFormDto.typeCode != ''">
|
||||||
|
AND drf.type_code IN (#{requestFormDto.typeCode}, 'SURGERY')
|
||||||
|
</if>
|
||||||
<if test="requestFormDto.applyTimeStart != null">
|
<if test="requestFormDto.applyTimeStart != null">
|
||||||
AND drf.create_time >= #{requestFormDto.applyTimeStart}
|
AND drf.create_time >= #{requestFormDto.applyTimeStart}
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -27,7 +27,9 @@
|
|||||||
T9.payment_id,
|
T9.payment_id,
|
||||||
T9.picture_url,
|
T9.picture_url,
|
||||||
T9.birth_date,
|
T9.birth_date,
|
||||||
t9.english_name
|
t9.english_name,
|
||||||
|
t9.slot_id,
|
||||||
|
t9.pool_id
|
||||||
from (
|
from (
|
||||||
SELECT T1.tenant_id AS tenant_id,
|
SELECT T1.tenant_id AS tenant_id,
|
||||||
T1.id AS encounter_id,
|
T1.id AS encounter_id,
|
||||||
@@ -51,7 +53,9 @@
|
|||||||
T13.id AS payment_id,
|
T13.id AS payment_id,
|
||||||
ai.picture_url AS picture_url,
|
ai.picture_url AS picture_url,
|
||||||
T8.birth_date AS birth_date,
|
T8.birth_date AS birth_date,
|
||||||
tx.staff_english_name AS english_name
|
tx.staff_english_name AS english_name,
|
||||||
|
om_slot.slot_id AS slot_id,
|
||||||
|
om_slot.pool_id AS pool_id
|
||||||
FROM adm_encounter AS T1
|
FROM adm_encounter AS T1
|
||||||
LEFT JOIN adm_organization AS T2 ON T1.organization_id = T2.ID AND T2.delete_flag = '0'
|
LEFT JOIN adm_organization AS T2 ON T1.organization_id = T2.ID AND T2.delete_flag = '0'
|
||||||
LEFT JOIN adm_healthcare_service AS T3 ON T1.service_type_id = T3.ID AND T3.delete_flag = '0'
|
LEFT JOIN adm_healthcare_service AS T3 ON T1.service_type_id = T3.ID AND T3.delete_flag = '0'
|
||||||
@@ -91,6 +95,8 @@
|
|||||||
AND T13.status_enum = ${paymentStatus}
|
AND T13.status_enum = ${paymentStatus}
|
||||||
LEFT JOIN adm_invoice AS ai
|
LEFT JOIN adm_invoice AS ai
|
||||||
ON ai.reconciliation_id = T13.id AND ai.delete_flag = '0'
|
ON ai.reconciliation_id = T13.id AND ai.delete_flag = '0'
|
||||||
|
LEFT JOIN order_main AS om ON T1.order_id = om.id AND om.delete_flag = '0'
|
||||||
|
LEFT JOIN adm_schedule_slot AS om_slot ON om.slot_id = om_slot.id
|
||||||
WHERE T1.delete_flag = '0'
|
WHERE T1.delete_flag = '0'
|
||||||
AND T1.class_enum = #{classEnum}
|
AND T1.class_enum = #{classEnum}
|
||||||
AND T10.context_enum = #{register}
|
AND T10.context_enum = #{register}
|
||||||
|
|||||||
@@ -270,6 +270,10 @@ public enum AssignSeqEnum {
|
|||||||
* 诊疗处方号
|
* 诊疗处方号
|
||||||
*/
|
*/
|
||||||
ACTIVITY_PSYCHOTROPIC_NO("62", "诊疗处方号", "PAR"),
|
ACTIVITY_PSYCHOTROPIC_NO("62", "诊疗处方号", "PAR"),
|
||||||
|
/**
|
||||||
|
* 检查申请单号(住院)
|
||||||
|
*/
|
||||||
|
CHECK_APPLY_NO("72", "检查申请单号", "JCZ"),
|
||||||
/**
|
/**
|
||||||
* b 病历文书
|
* b 病历文书
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -49,6 +49,11 @@ public enum RequestStatus implements HisEnumInterface {
|
|||||||
*/
|
*/
|
||||||
ENDED(7, "ended", "不执行"),
|
ENDED(7, "ended", "不执行"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已出报告
|
||||||
|
*/
|
||||||
|
COMPLETED_REPORT(8, "completed_report", "已出报告"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 未知
|
* 未知
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -187,6 +187,15 @@ public class OpSchedule extends HisBaseEntity {
|
|||||||
/** 沟通信息 */
|
/** 沟通信息 */
|
||||||
private String communicationInfo;
|
private String communicationInfo;
|
||||||
|
|
||||||
|
/** 是否外请专家 1-是 0-否 */
|
||||||
|
private Integer isExternalExpert;
|
||||||
|
|
||||||
|
/** 外请专家姓名 */
|
||||||
|
private String externalExpertName;
|
||||||
|
|
||||||
|
/** 费用类别 */
|
||||||
|
private String feeType;
|
||||||
|
|
||||||
/** 备注信息 */
|
/** 备注信息 */
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ CREATE TABLE IF NOT EXISTS triage_queue_item (
|
|||||||
patient_name VARCHAR(255),
|
patient_name VARCHAR(255),
|
||||||
healthcare_name VARCHAR(255),
|
healthcare_name VARCHAR(255),
|
||||||
practitioner_name VARCHAR(255),
|
practitioner_name VARCHAR(255),
|
||||||
status VARCHAR(50) NOT NULL, -- WAITING/CALLING/SKIPPED/COMPLETED
|
status INTEGER NOT NULL DEFAULT 0, -- 分诊队列状态: 0=WAITING(等待), 10=CALLING(叫号中), 20=IN_CLINIC(诊中), 30=COMPLETED(已完成), 40=SKIPPED(已跳过)
|
||||||
queue_order INTEGER NOT NULL,
|
queue_order INTEGER NOT NULL,
|
||||||
create_time TIMESTAMP,
|
create_time TIMESTAMP,
|
||||||
update_time TIMESTAMP,
|
update_time TIMESTAMP,
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
-- Bug #400 修复:triage_queue_item.status 字段类型修正
|
||||||
|
-- 原 DDL 将 status 定义为 VARCHAR(50),但 Java 实体 TriageQueueItem.status 为 Integer 类型,
|
||||||
|
-- 应用层使用 TriageQueueStatus 枚举值(0/10/20/30/40)写入,类型不匹配导致 MyBatis-Plus
|
||||||
|
-- 无法正确映射 status 字段,完诊时 status 更新为 30 失败。
|
||||||
|
--
|
||||||
|
-- 注意:必须在后端实际连接的 schema 中执行(dev=hisdev, test=histest, prd=hisprd)
|
||||||
|
-- 执行前请先确认:SET search_path TO hisdev; (或对应的 schema)
|
||||||
|
|
||||||
|
-- 1. 先将已有的字符串值转换为对应的整数值
|
||||||
|
-- 如果之前写入的是枚举 code(如 'waiting'、'completed'),需要先转换
|
||||||
|
UPDATE triage_queue_item
|
||||||
|
SET status = CASE
|
||||||
|
WHEN status IN ('0', 'waiting', 'WAITING') THEN 0
|
||||||
|
WHEN status IN ('10', 'calling', 'CALLING') THEN 10
|
||||||
|
WHEN status IN ('20', 'in-clinic', 'IN_CLINIC', 'in-clinic') THEN 20
|
||||||
|
WHEN status IN ('30', 'completed', 'COMPLETED') THEN 30
|
||||||
|
WHEN status IN ('40', 'skipped', 'SKIPPED') THEN 40
|
||||||
|
WHEN status IN ('50', 'refunded', 'REFUNDED') THEN 50
|
||||||
|
WHEN status IN ('60', 'follow', 'FOLLOW') THEN 60
|
||||||
|
ELSE 0
|
||||||
|
END
|
||||||
|
WHERE status IS NOT NULL AND status !~ '^[0-9]+$';
|
||||||
|
|
||||||
|
-- 2. 修改字段类型为 INTEGER
|
||||||
|
ALTER TABLE triage_queue_item
|
||||||
|
ALTER COLUMN status TYPE INTEGER USING status::INTEGER;
|
||||||
|
|
||||||
|
-- 3. 设置默认值
|
||||||
|
ALTER TABLE triage_queue_item
|
||||||
|
ALTER COLUMN status SET DEFAULT 0;
|
||||||
@@ -163,7 +163,7 @@ export function updateCheckPart(data) {
|
|||||||
// 查询检查套餐列表
|
// 查询检查套餐列表
|
||||||
export function listCheckPackage(query) {
|
export function listCheckPackage(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/check-package/list',
|
url: '/system/package/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import useDictStore from '@/store/modules/dict';
|
||||||
|
|
||||||
// 日期格式化
|
// 日期格式化
|
||||||
export function parseTime(time, pattern) {
|
export function parseTime(time, pattern) {
|
||||||
if (arguments.length === 0 || !time) {
|
if (arguments.length === 0 || !time) {
|
||||||
@@ -275,30 +277,13 @@ export function blobValidate(data) {
|
|||||||
|
|
||||||
// 按照频次天数计算总数量
|
// 按照频次天数计算总数量
|
||||||
export function calculateQuantityByDays(frequency, days) {
|
export function calculateQuantityByDays(frequency, days) {
|
||||||
// const dict = useDict('rate_code').rate_code.value
|
const dicts = useDictStore().getDict('rate_code');
|
||||||
// const rate = dict.find(item => item.value === frequency).remark
|
if (!dicts) return;
|
||||||
// if(rate){
|
const dict = dicts.find(item => item.value === frequency);
|
||||||
// return Math.floor(Number(rate) * days)
|
if (!dict?.remark) return;
|
||||||
// } else {
|
const rate = Number(dict.remark);
|
||||||
// return undefined
|
if (isNaN(rate) || !rate) return;
|
||||||
// }
|
const quantity = rate * days;
|
||||||
const frequencyMap = {
|
|
||||||
ST: 1,
|
|
||||||
QD: 1, // 每日一次
|
|
||||||
BID: 2, // 每日两次
|
|
||||||
TID: 3, // 每日三次
|
|
||||||
QID: 4, // 每日四次
|
|
||||||
QN: 1, // 每晚一次
|
|
||||||
QOD: 1 / 2, // 每隔一日一次
|
|
||||||
QW: 1 / 7, // 每周一次
|
|
||||||
BIW: 2 / 7, // 每周两次
|
|
||||||
TIW: 3 / 7, // 每周三次
|
|
||||||
QOW: 1 / 14, // 隔周一次
|
|
||||||
};
|
|
||||||
if (!frequencyMap[frequency]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const quantity = frequencyMap[frequency] * days;
|
|
||||||
return quantity < 1 ? 1 : Math.ceil(quantity);
|
return quantity < 1 ? 1 : Math.ceil(quantity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -178,22 +178,25 @@ service.interceptors.request.use(config => {
|
|||||||
}
|
}
|
||||||
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
||||||
} else if (code === 500) {
|
} else if (code === 500) {
|
||||||
// 检查是否需要跳过错误提示
|
// 检查是否需要跳过错误提示(静默请求:返回响应让.then()处理)
|
||||||
if (!res.config?.skipErrorMsg) {
|
if (res.config?.skipErrorMsg) {
|
||||||
ElMessage({ message: msg, type: 'error' })
|
return Promise.resolve(res.data)
|
||||||
}
|
}
|
||||||
|
ElMessage({ message: msg, type: 'error' })
|
||||||
return Promise.reject(new Error(msg))
|
return Promise.reject(new Error(msg))
|
||||||
} else if (code === 601) {
|
} else if (code === 601) {
|
||||||
// 检查是否需要跳过错误提示
|
// 检查是否需要跳过错误提示(静默请求:返回响应让.then()处理)
|
||||||
if (!res.config?.skipErrorMsg) {
|
if (res.config?.skipErrorMsg) {
|
||||||
ElMessage({ message: msg, type: 'warning' })
|
return Promise.resolve(res.data)
|
||||||
}
|
}
|
||||||
|
ElMessage({ message: msg, type: 'warning' })
|
||||||
return Promise.reject(new Error(msg))
|
return Promise.reject(new Error(msg))
|
||||||
} else if (code !== 200) {
|
} else if (code !== 200) {
|
||||||
// 检查是否需要跳过错误提示
|
// 检查是否需要跳过错误提示(静默请求:返回响应让.then()处理)
|
||||||
if (!res.config?.skipErrorMsg) {
|
if (res.config?.skipErrorMsg) {
|
||||||
ElNotification.error({ title: msg })
|
return Promise.resolve(res.data)
|
||||||
}
|
}
|
||||||
|
ElNotification.error({ title: msg })
|
||||||
return Promise.reject('error')
|
return Promise.reject('error')
|
||||||
} else {
|
} else {
|
||||||
return Promise.resolve(res.data)
|
return Promise.resolve(res.data)
|
||||||
|
|||||||
@@ -226,8 +226,14 @@ function getList() {
|
|||||||
getDiagnosisTreatmentList(queryParams.value).then((res) => {
|
getDiagnosisTreatmentList(queryParams.value).then((res) => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
catagoryList.value = res.data.records.map(record => {
|
catagoryList.value = res.data.records.map(record => {
|
||||||
// 为每一行初始化 filteredOptions,确保显示框能正确显示项目名称
|
|
||||||
const filteredOptions = allImplementDepartmentList.value.slice(0, 100);
|
const filteredOptions = allImplementDepartmentList.value.slice(0, 100);
|
||||||
|
// 确保后端返回的项目名称选项存在于 filteredOptions 中,避免 el-select 因找不到选项而回显为 ID
|
||||||
|
if (record.activityDefinitionId && !filteredOptions.some(o => o.value === record.activityDefinitionId)) {
|
||||||
|
filteredOptions.push({
|
||||||
|
value: record.activityDefinitionId,
|
||||||
|
label: record.activityDefinitionId_dictText || record.activityDefinitionId
|
||||||
|
});
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
...record,
|
...record,
|
||||||
loading: false,
|
loading: false,
|
||||||
|
|||||||
@@ -372,7 +372,6 @@ import {
|
|||||||
} from './diagnosistreatment';
|
} from './diagnosistreatment';
|
||||||
import PopoverList from '@/components/OpenHis/popoverList/index.vue';
|
import PopoverList from '@/components/OpenHis/popoverList/index.vue';
|
||||||
import medicineList from './medicineList.vue';
|
import medicineList from './medicineList.vue';
|
||||||
import MedicineList from '../components/medicineList.vue';
|
|
||||||
import {getCurrentInstance, nextTick, watch} from 'vue';
|
import {getCurrentInstance, nextTick, watch} from 'vue';
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
@@ -467,16 +466,21 @@ function calculateTotalPrice() {
|
|||||||
try {
|
try {
|
||||||
let sum = 0;
|
let sum = 0;
|
||||||
treatmentItems.value.forEach((item) => {
|
treatmentItems.value.forEach((item) => {
|
||||||
if (item.adviceDefinitionId && item.retailPrice && item.childrenRequestNum) {
|
if (item.adviceDefinitionId && item.adviceDefinitionId !== '') {
|
||||||
const price = parseFloat(item.retailPrice) || 0;
|
const price = Number(item.retailPrice) || 0;
|
||||||
const count = parseInt(item.childrenRequestNum) || 0;
|
const count = Number(item.childrenRequestNum) || 0;
|
||||||
sum += price * count;
|
sum += price * count;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
totalPrice.value = sum.toFixed(2);
|
totalPrice.value = sum.toFixed(2);
|
||||||
// Bug #464: 零售价与诊疗子项合计总价实时同步
|
// Bug #464: 零售价与诊疗子项合计总价实时同步,直接赋值不使用nextTick避免多调用方竞争
|
||||||
if (treatmentItems.value.length > 0 && treatmentItems.value[0].adviceDefinitionId !== '') {
|
const hasValidItem = treatmentItems.value.some(
|
||||||
form.value.retailPrice = parseFloat(totalPrice.value);
|
(item) => item.adviceDefinitionId && item.adviceDefinitionId !== ''
|
||||||
|
);
|
||||||
|
if (hasValidItem) {
|
||||||
|
form.value.retailPrice = parseFloat(totalPrice.value) || 0;
|
||||||
|
} else {
|
||||||
|
form.value.retailPrice = undefined;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
totalPrice.value = '0.00';
|
totalPrice.value = '0.00';
|
||||||
@@ -486,7 +490,7 @@ function calculateTotalPrice() {
|
|||||||
|
|
||||||
// 添加表单项
|
// 添加表单项
|
||||||
function addItem() {
|
function addItem() {
|
||||||
treatmentItems.value.push({ adviceDefinitionId: '', childrenRequestNum: 1, retailPrice: 0 });
|
treatmentItems.value.push({ adviceDefinitionId: '', childrenRequestNum: 1, name: '', retailPrice: 0 });
|
||||||
// 使用nextTick确保DOM更新后再计算
|
// 使用nextTick确保DOM更新后再计算
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
calculateTotalPrice();
|
calculateTotalPrice();
|
||||||
@@ -560,15 +564,16 @@ function edit() {
|
|||||||
form.value.pricingFlag = 1;
|
form.value.pricingFlag = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理子项数据,确保包含retailPrice字段
|
// 处理子项数据,确保包含retailPrice和name字段
|
||||||
if (props.item.childrenJson) {
|
if (props.item.childrenJson) {
|
||||||
const parsedItems = JSON.parse(props.item.childrenJson);
|
const parsedItems = JSON.parse(props.item.childrenJson);
|
||||||
treatmentItems.value = parsedItems.map((item) => ({
|
treatmentItems.value = parsedItems.map((item) => ({
|
||||||
...item,
|
...item,
|
||||||
|
name: item.name || '',
|
||||||
retailPrice: item.retailPrice || 0,
|
retailPrice: item.retailPrice || 0,
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
treatmentItems.value = [{ adviceDefinitionId: '', childrenRequestNum: 1, retailPrice: 0 }];
|
treatmentItems.value = [{ adviceDefinitionId: '', childrenRequestNum: 1, name: '', retailPrice: 0 }];
|
||||||
}
|
}
|
||||||
form.value.permittedUnitCode = form.value.permittedUnitCode
|
form.value.permittedUnitCode = form.value.permittedUnitCode
|
||||||
? form.value.permittedUnitCode.toString()
|
? form.value.permittedUnitCode.toString()
|
||||||
@@ -613,7 +618,7 @@ function reset() {
|
|||||||
chrgitmLv: undefined, //医保等级
|
chrgitmLv: undefined, //医保等级
|
||||||
pricingFlag: 1, // 划价标记,默认允许划价
|
pricingFlag: 1, // 划价标记,默认允许划价
|
||||||
};
|
};
|
||||||
treatmentItems.value = [{ adviceDefinitionId: '', childrenRequestNum: 1, retailPrice: 0 }];
|
treatmentItems.value = [{ adviceDefinitionId: '', childrenRequestNum: 1, name: '', retailPrice: 0 }];
|
||||||
totalPrice.value = '0.00';
|
totalPrice.value = '0.00';
|
||||||
proxy.resetForm('diagnosisTreatmentRef');
|
proxy.resetForm('diagnosisTreatmentRef');
|
||||||
}
|
}
|
||||||
@@ -647,12 +652,15 @@ async function submitForm() {
|
|||||||
form.value.ybMatchFlag ? (form.value.ybMatchFlag = 1) : (form.value.ybMatchFlag = 0);
|
form.value.ybMatchFlag ? (form.value.ybMatchFlag = 1) : (form.value.ybMatchFlag = 0);
|
||||||
form.value.ruleId ? (form.value.ruleId = 1) : (form.value.ruleId = 0);
|
form.value.ruleId ? (form.value.ruleId = 1) : (form.value.ruleId = 0);
|
||||||
form.value.childrenJson =
|
form.value.childrenJson =
|
||||||
treatmentItems.value.length > 0 && treatmentItems.value[0].adviceDefinitionId != ''
|
treatmentItems.value.some((item) => item.adviceDefinitionId != '' && item.adviceDefinitionId)
|
||||||
? JSON.stringify(treatmentItems.value)
|
? JSON.stringify(treatmentItems.value)
|
||||||
: undefined;
|
: undefined;
|
||||||
// Bug #464 修复:零售价自动与诊疗子项合计总价同步
|
// Bug #464 修复:零售价自动与诊疗子项合计总价同步
|
||||||
// 当有子项时,零售价自动设置为子项合计总价
|
// 当有子项时,零售价自动设置为子项合计总价
|
||||||
if (treatmentItems.value.length > 0 && treatmentItems.value[0].adviceDefinitionId != '') {
|
const hasValidItem = treatmentItems.value.some(
|
||||||
|
(item) => item.adviceDefinitionId && item.adviceDefinitionId !== ''
|
||||||
|
);
|
||||||
|
if (hasValidItem) {
|
||||||
form.value.retailPrice = parseFloat(totalPrice.value) || 0;
|
form.value.retailPrice = parseFloat(totalPrice.value) || 0;
|
||||||
}
|
}
|
||||||
proxy.$refs['diagnosisTreatmentRef'].validate(async (valid) => {
|
proxy.$refs['diagnosisTreatmentRef'].validate(async (valid) => {
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ const emit = defineEmits(['selectRow']);
|
|||||||
const diagnosisTreatmentList = ref([]); // 原始数据列表
|
const diagnosisTreatmentList = ref([]); // 原始数据列表
|
||||||
const filteredList = ref([]); // 过滤后的数据列表
|
const filteredList = ref([]); // 过滤后的数据列表
|
||||||
const hasLoaded = ref(false); // 标记是否已加载数据
|
const hasLoaded = ref(false); // 标记是否已加载数据
|
||||||
|
const isLoading = ref(false); // 标记是否正在加载
|
||||||
|
|
||||||
// 获取诊疗项目列表
|
// 获取诊疗项目列表
|
||||||
function getList() {
|
function getList() {
|
||||||
@@ -53,7 +54,7 @@ function getList() {
|
|||||||
getDiagnosisTreatmentList({ statusEnum: 2, pageSize: 1000, pageNo: 1 })
|
getDiagnosisTreatmentList({ statusEnum: 2, pageSize: 1000, pageNo: 1 })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
diagnosisTreatmentList.value =
|
diagnosisTreatmentList.value =
|
||||||
res.data?.records?.filter((item) => item.childrenJson == null) || [];
|
res.data?.records?.filter((item) => item.childrenJson == null || item.childrenJson === '') || [];
|
||||||
filterList(); // 初始化过滤
|
filterList(); // 初始化过滤
|
||||||
hasLoaded.value = true; // 标记为已加载
|
hasLoaded.value = true; // 标记为已加载
|
||||||
})
|
})
|
||||||
@@ -62,6 +63,47 @@ function getList() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 服务端搜索(当用户输入搜索关键词时)
|
||||||
|
function searchList(searchKey) {
|
||||||
|
if (!searchKey || searchKey.trim() === '') return;
|
||||||
|
isLoading.value = true;
|
||||||
|
// 使用较大的pageSize确保搜索结果尽可能多
|
||||||
|
getDiagnosisTreatmentList({ statusEnum: 2, searchKey: searchKey.trim(), pageSize: 5000, pageNo: 1 })
|
||||||
|
.then((res) => {
|
||||||
|
diagnosisTreatmentList.value =
|
||||||
|
res.data?.records?.filter((item) => item.childrenJson == null || item.childrenJson === '') || [];
|
||||||
|
filterList();
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error('搜索诊疗项目数据失败:', err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
isLoading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取预加载数据(不带搜索关键词时使用)
|
||||||
|
function loadPreloadedData() {
|
||||||
|
if (props.preloadedData && props.preloadedData.length > 0) {
|
||||||
|
diagnosisTreatmentList.value = props.preloadedData;
|
||||||
|
filterList();
|
||||||
|
hasLoaded.value = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasLoaded.value) return;
|
||||||
|
getDiagnosisTreatmentList({ statusEnum: 2, pageSize: 1000, pageNo: 1 })
|
||||||
|
.then((res) => {
|
||||||
|
diagnosisTreatmentList.value =
|
||||||
|
res.data?.records?.filter((item) => item.childrenJson == null || item.childrenJson === '') || [];
|
||||||
|
filterList();
|
||||||
|
hasLoaded.value = true;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error('获取诊疗项目数据失败:', err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 监听shouldLoadData属性变化,仅在首次为true时加载数据
|
// 监听shouldLoadData属性变化,仅在首次为true时加载数据
|
||||||
watch(
|
watch(
|
||||||
() => props.shouldLoadData,
|
() => props.shouldLoadData,
|
||||||
@@ -86,11 +128,17 @@ watch(
|
|||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
// 监听搜索关键词变化,实时过滤数据
|
// 监听搜索关键词变化,有搜索词时走服务端搜索,否则走本地过滤
|
||||||
watch(
|
watch(
|
||||||
() => props.searchKey,
|
() => props.searchKey,
|
||||||
() => {
|
(newVal) => {
|
||||||
filterList();
|
if (newVal && newVal.trim() !== '') {
|
||||||
|
// 有搜索关键词,走服务端搜索
|
||||||
|
searchList(newVal);
|
||||||
|
} else {
|
||||||
|
// 搜索词为空,使用预加载数据
|
||||||
|
loadPreloadedData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -69,13 +69,14 @@ const throttledGetList = throttle(
|
|||||||
watch(
|
watch(
|
||||||
() => props.adviceQueryParams,
|
() => props.adviceQueryParams,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
// 只有在弹窗打开时才响应 adviceQueryParams 的变化,避免选择项目后弹窗关闭时触发不必要的请求
|
// 始终同步参数到 queryParams,避免弹窗打开时使用旧参数
|
||||||
if (!props.popoverVisible) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
queryParams.value.searchKey = newValue?.searchKey;
|
queryParams.value.searchKey = newValue?.searchKey;
|
||||||
queryParams.value.adviceType = newValue?.adviceType;
|
queryParams.value.adviceType = newValue?.adviceType;
|
||||||
queryParams.value.categoryCode = newValue?.categoryCode;
|
queryParams.value.categoryCode = newValue?.categoryCode;
|
||||||
|
// 只有在弹窗打开时才触发 API 请求
|
||||||
|
if (!props.popoverVisible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
throttledGetList();
|
throttledGetList();
|
||||||
},
|
},
|
||||||
{ deep: true }
|
{ deep: true }
|
||||||
@@ -121,15 +122,37 @@ function getList() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
queryParams.value.organizationId = props.patientInfo.orgId;
|
// 🔧 Bug #448 修复:显式构建请求参数,确保 adviceType 正确传递
|
||||||
console.log('[adviceBaseList] getList() 请求参数:', JSON.stringify(queryParams.value));
|
// 不直接使用 queryParams.value,避免 undefined 值被发送到后端导致过滤失效
|
||||||
|
const requestParams = {
|
||||||
|
pageSize: queryParams.value.pageSize,
|
||||||
|
pageNum: queryParams.value.pageNum,
|
||||||
|
organizationId: props.patientInfo.orgId,
|
||||||
|
};
|
||||||
|
|
||||||
getAdviceBaseInfo(queryParams.value).then((res) => {
|
// 只在 adviceType 有值时添加(0 是无效值,undefined/null 会导致后端查询所有类型)
|
||||||
|
if (queryParams.value.adviceType != null && queryParams.value.adviceType !== 0) {
|
||||||
|
requestParams.adviceType = queryParams.value.adviceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 只在 categoryCode 有值时添加
|
||||||
|
if (queryParams.value.categoryCode) {
|
||||||
|
requestParams.categoryCode = queryParams.value.categoryCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 只在 searchKey 有值时添加
|
||||||
|
if (queryParams.value.searchKey) {
|
||||||
|
requestParams.searchKey = queryParams.value.searchKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('[adviceBaseList] getList() 请求参数:', JSON.stringify(requestParams));
|
||||||
|
|
||||||
|
getAdviceBaseInfo(requestParams).then((res) => {
|
||||||
console.log('[adviceBaseList] getList() 响应数据:', {
|
console.log('[adviceBaseList] getList() 响应数据:', {
|
||||||
total: res.data?.total,
|
total: res.data?.total,
|
||||||
recordsCount: res.data?.records?.length || 0,
|
recordsCount: res.data?.records?.length || 0,
|
||||||
firstRecord: res.data?.records?.[0]?.adviceName || '无数据',
|
firstRecord: res.data?.records?.[0]?.adviceName || '无数据',
|
||||||
adviceType: queryParams.value.adviceType
|
adviceType: requestParams.adviceType
|
||||||
});
|
});
|
||||||
adviceBaseList.value = res.data.records || [];
|
adviceBaseList.value = res.data.records || [];
|
||||||
total.value = res.data.total || 0;
|
total.value = res.data.total || 0;
|
||||||
|
|||||||
@@ -58,10 +58,17 @@ export function singOut(data) {
|
|||||||
/**
|
/**
|
||||||
* 获取患者本次就诊处方
|
* 获取患者本次就诊处方
|
||||||
*/
|
*/
|
||||||
export function getPrescriptionList(encounterId) {
|
export function getPrescriptionList(encounterId, generateSourceEnum, sourceBillNo) {
|
||||||
// Add timestamp to bypass browser caching and ensure fresh data is loaded
|
let url = '/doctor-station/advice/request-base-info?encounterId=' + encounterId
|
||||||
|
if (generateSourceEnum != null) {
|
||||||
|
url += '&generateSourceEnum=' + generateSourceEnum
|
||||||
|
}
|
||||||
|
if (sourceBillNo != null) {
|
||||||
|
url += '&sourceBillNo=' + encodeURIComponent(sourceBillNo)
|
||||||
|
}
|
||||||
|
url += '&t=' + Date.now()
|
||||||
return request({
|
return request({
|
||||||
url: '/doctor-station/advice/request-base-info?encounterId=' + encounterId + '&t=' + Date.now(),
|
url: url,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -381,6 +381,14 @@ const props = defineProps({
|
|||||||
activeTab: {
|
activeTab: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
|
generateSourceEnum: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
sourceBillNo: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const isAdding = ref(false);
|
const isAdding = ref(false);
|
||||||
const isSaving = ref(false); // #437 防重复提交锁
|
const isSaving = ref(false); // #437 防重复提交锁
|
||||||
@@ -453,7 +461,7 @@ watch(
|
|||||||
console.log(prescriptionList.value,"prescriptionList.value")
|
console.log(prescriptionList.value,"prescriptionList.value")
|
||||||
if(newValue&&newValue.length>0){
|
if(newValue&&newValue.length>0){
|
||||||
let saveList = prescriptionList.value.filter((item) => {
|
let saveList = prescriptionList.value.filter((item) => {
|
||||||
return item.statusEnum == 1&&(Number(item.bizRequestFlag)==1||!item.bizRequestFlag)
|
return item.check && item.statusEnum == 1&&(Number(item.bizRequestFlag)==1||!item.bizRequestFlag)
|
||||||
})
|
})
|
||||||
console.log(saveList,"prescriptionList.value")
|
console.log(saveList,"prescriptionList.value")
|
||||||
if (saveList.length == 0) {
|
if (saveList.length == 0) {
|
||||||
@@ -468,7 +476,11 @@ watch(
|
|||||||
|
|
||||||
function getListInfo(addNewRow) {
|
function getListInfo(addNewRow) {
|
||||||
isAdding.value = false;
|
isAdding.value = false;
|
||||||
getPrescriptionList(props.patientInfo.encounterId).then((res) => {
|
getPrescriptionList(
|
||||||
|
props.patientInfo.encounterId,
|
||||||
|
props.generateSourceEnum ?? undefined,
|
||||||
|
props.sourceBillNo ?? undefined,
|
||||||
|
).then((res) => {
|
||||||
// 为每行数据添加 adviceTypeValue 字段,用于类型下拉框显示
|
// 为每行数据添加 adviceTypeValue 字段,用于类型下拉框显示
|
||||||
prescriptionList.value = (res.data || []).map(item => {
|
prescriptionList.value = (res.data || []).map(item => {
|
||||||
// 根据 adviceType 和 categoryCode 找到对应的 adviceTypeValue
|
// 根据 adviceType 和 categoryCode 找到对应的 adviceTypeValue
|
||||||
@@ -875,12 +887,20 @@ function handleDelete() {
|
|||||||
if (item.statusEnum != 1 || item.chargeStatus == 5) {
|
if (item.statusEnum != 1 || item.chargeStatus == 5) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
// 🔧 Bug #442: 非本人创建的医嘱不允许删除(与签发/签退逻辑保持一致)
|
||||||
|
if (Number(item.bizRequestFlag) !== 1 && item.bizRequestFlag) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// 🔧 Bug #442: 已保存的行必须有有效的 requestId,否则跳过(避免后端删除不存在的记录)
|
||||||
|
if (item.requestId == null || item.requestId === undefined || item.requestId === '') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
requestId: item.requestId,
|
requestId: item.requestId,
|
||||||
dbOpType: '3',
|
dbOpType: '3',
|
||||||
adviceType: item.adviceType,
|
adviceType: item.adviceType,
|
||||||
};
|
};
|
||||||
}).filter(item => item !== null); // 过滤掉已签发或已收费的项目
|
}).filter(item => item !== null); // 过滤掉已签发、已收费、非本人创建或无 requestId 的项目
|
||||||
|
|
||||||
if (deleteList.length == 0) {
|
if (deleteList.length == 0) {
|
||||||
proxy.$modal.msgWarning('只能删除待签发且未收费的项目');
|
proxy.$modal.msgWarning('只能删除待签发且未收费的项目');
|
||||||
@@ -995,7 +1015,7 @@ function handleSave() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let saveList = prescriptionList.value.filter((item) => {
|
let saveList = prescriptionList.value.filter((item) => {
|
||||||
return item.statusEnum == 1&&(Number(item.bizRequestFlag)==1||!item.bizRequestFlag)
|
return item.check && item.statusEnum == 1&&(Number(item.bizRequestFlag)==1||!item.bizRequestFlag)
|
||||||
});
|
});
|
||||||
// let saveList = prescriptionList.value
|
// let saveList = prescriptionList.value
|
||||||
// .filter((item) => {
|
// .filter((item) => {
|
||||||
@@ -1016,6 +1036,14 @@ function handleSave() {
|
|||||||
requestId: item.requestId,
|
requestId: item.requestId,
|
||||||
dbOpType: '1',
|
dbOpType: '1',
|
||||||
groupId: item.groupId,
|
groupId: item.groupId,
|
||||||
|
// 🔧 Bug #443: 补充顶层关键字段(这些不在 contentJson 中,需从 API 响应顶层提取)
|
||||||
|
encounterId: item.encounterId,
|
||||||
|
patientId: item.patientId,
|
||||||
|
locationId: item.positionId,
|
||||||
|
adviceType: item.adviceType,
|
||||||
|
adviceTableName: item.adviceTableName,
|
||||||
|
adviceDefinitionId: item.adviceDefinitionId,
|
||||||
|
chargeItemId: item.chargeItemId,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
savePrescriptionSign({
|
savePrescriptionSign({
|
||||||
@@ -1031,7 +1059,12 @@ function handleSave() {
|
|||||||
groupIndexList.value = []
|
groupIndexList.value = []
|
||||||
groupList.value = []
|
groupList.value = []
|
||||||
nextId.value = 1;
|
nextId.value = 1;
|
||||||
|
} else {
|
||||||
|
proxy.$modal.msgError(res?.msg || '签发失败,请重试');
|
||||||
}
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error('签发失败:', error);
|
||||||
|
proxy.$modal.msgError(error?.response?.data?.msg || error?.message || '签发失败,请重试');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1047,42 +1080,44 @@ function handleSaveSign(row, index) {
|
|||||||
proxy.$modal.msgWarning('诊疗项目必须选择执行科室');
|
proxy.$modal.msgWarning('诊疗项目必须选择执行科室');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
isSaving.value = true; // #437 立即加锁,消除 TOCTOU 竞态
|
||||||
proxy.$refs['formRef' + index].validate((valid) => {
|
proxy.$refs['formRef' + index].validate((valid) => {
|
||||||
if (valid) {
|
if (!valid) {
|
||||||
isSaving.value = true; // #437 加锁
|
isSaving.value = false; // 验证失败释放锁
|
||||||
row.isEdit = false;
|
return;
|
||||||
isAdding.value = false;
|
|
||||||
expandOrder.value = [];
|
|
||||||
row.patientId = props.patientInfo.patientId;
|
|
||||||
row.encounterId = props.patientInfo.encounterId;
|
|
||||||
row.accountId = props.patientInfo.accountId;
|
|
||||||
const cleanRow = JSON.parse(JSON.stringify(row));
|
|
||||||
cleanRow.contentJson = JSON.stringify(cleanRow);
|
|
||||||
cleanRow.dbOpType = cleanRow.requestId ? '2' : '1';
|
|
||||||
cleanRow.minUnitQuantity = cleanRow.quantity * cleanRow.partPercent;
|
|
||||||
cleanRow.categoryEnum = cleanRow.adviceType
|
|
||||||
// 如果是手术计费,设置生成来源和来源业务单据号
|
|
||||||
if (props.patientInfo.sourceBillNo) {
|
|
||||||
cleanRow.generateSourceEnum = 6; // 手术计费
|
|
||||||
cleanRow.sourceBillNo = props.patientInfo.sourceBillNo;
|
|
||||||
}
|
|
||||||
console.log('cleanRow', cleanRow)
|
|
||||||
savePrescription({ adviceSaveList: [cleanRow] }).then((res) => {
|
|
||||||
if (res.code === 200) {
|
|
||||||
proxy.$modal.msgSuccess('保存成功');
|
|
||||||
getListInfo(false);
|
|
||||||
nextId.value = 1;
|
|
||||||
// 🔧 Bug Fix #238: 如果诊疗项目缺少执行科室,标记为需要修复的脏数据
|
|
||||||
if (row.adviceType === 3 && !row.orgId) {
|
|
||||||
console.warn('Bug #238: 检测到诊疗项目保存时缺少执行科室,请手动编辑修正:', cleanRow);
|
|
||||||
proxy.$modal.msgWarning('诊疗项目执行科室信息不完整,请编辑后重新保存');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).finally(() => {
|
|
||||||
isSaving.value = false; // #437 释放锁
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
row.isEdit = false;
|
||||||
|
isAdding.value = false;
|
||||||
|
expandOrder.value = [];
|
||||||
|
row.patientId = props.patientInfo.patientId;
|
||||||
|
row.encounterId = props.patientInfo.encounterId;
|
||||||
|
row.accountId = props.patientInfo.accountId;
|
||||||
|
const cleanRow = JSON.parse(JSON.stringify(row));
|
||||||
|
cleanRow.contentJson = JSON.stringify(cleanRow);
|
||||||
|
cleanRow.dbOpType = cleanRow.requestId ? '2' : '1';
|
||||||
|
cleanRow.minUnitQuantity = cleanRow.quantity * cleanRow.partPercent;
|
||||||
|
cleanRow.categoryEnum = cleanRow.adviceType
|
||||||
|
// 如果是手术计费,设置生成来源和来源业务单据号
|
||||||
|
if (props.patientInfo.sourceBillNo) {
|
||||||
|
cleanRow.generateSourceEnum = 6; // 手术计费
|
||||||
|
cleanRow.sourceBillNo = props.patientInfo.sourceBillNo;
|
||||||
|
}
|
||||||
|
console.log('cleanRow', cleanRow)
|
||||||
|
savePrescription({ adviceSaveList: [cleanRow] }, '1').then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
proxy.$modal.msgSuccess('保存成功');
|
||||||
|
getListInfo(false);
|
||||||
|
nextId.value = 1;
|
||||||
|
// 🔧 Bug Fix #238: 如果诊疗项目缺少执行科室,标记为需要修复的脏数据
|
||||||
|
if (row.adviceType === 3 && !row.orgId) {
|
||||||
|
console.warn('Bug #238: 检测到诊疗项目保存时缺少执行科室,请手动编辑修正:', cleanRow);
|
||||||
|
proxy.$modal.msgWarning('诊疗项目执行科室信息不完整,请编辑后重新保存');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
isSaving.value = false; // #437 释放锁
|
||||||
|
});
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 签退
|
// 签退
|
||||||
|
|||||||
@@ -519,9 +519,10 @@
|
|||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<!-- 审核记录:查看/审核都展示,保证留痕可追溯 -->
|
<!-- 审核记录:查看/审核都展示,保证留痕可追溯 -->
|
||||||
|
<!-- 修复:查看模式始终显示区块;审核模式始终显示区块(header + 空状态 或 timeline) -->
|
||||||
<div
|
<div
|
||||||
class="audit-records-section"
|
class="audit-records-section"
|
||||||
v-if="drawerMode === 'view' || (drawerMode === 'audit' && auditRecords.length > 0)"
|
v-if="drawerMode === 'view' || drawerMode === 'audit'"
|
||||||
>
|
>
|
||||||
<h3 class="section-title">审核记录</h3>
|
<h3 class="section-title">审核记录</h3>
|
||||||
<el-timeline v-if="auditRecords.length > 0">
|
<el-timeline v-if="auditRecords.length > 0">
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ const queryParams = ref({
|
|||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
adviceTypes: '1,2,3',
|
adviceTypes: '1,2,3',
|
||||||
|
categoryCode: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
// 节流函数 - 与V1.3一致:300ms,首次立即响应
|
// 节流函数 - 与V1.3一致:300ms,首次立即响应
|
||||||
@@ -148,6 +149,7 @@ watch(
|
|||||||
} else {
|
} else {
|
||||||
queryParams.value.adviceTypes = '1,2,3';
|
queryParams.value.adviceTypes = '1,2,3';
|
||||||
}
|
}
|
||||||
|
queryParams.value.categoryCode = newValue.categoryCode || '';
|
||||||
throttledGetList();
|
throttledGetList();
|
||||||
},
|
},
|
||||||
{ deep: true }
|
{ deep: true }
|
||||||
@@ -176,6 +178,12 @@ function getList() {
|
|||||||
filteredData = filteredData.filter(item => types.includes(item.adviceType));
|
filteredData = filteredData.filter(item => types.includes(item.adviceType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据 categoryCode 过滤(如西药='2',中成药='1')
|
||||||
|
const categoryCode = queryParams.value.categoryCode;
|
||||||
|
if (categoryCode) {
|
||||||
|
filteredData = filteredData.filter(item => String(item.categoryCode) === String(categoryCode));
|
||||||
|
}
|
||||||
|
|
||||||
// 根据搜索关键词过滤
|
// 根据搜索关键词过滤
|
||||||
if (searchKey && searchKey.length >= 1) {
|
if (searchKey && searchKey.length >= 1) {
|
||||||
const lowerSearchKey = searchKey.toLowerCase();
|
const lowerSearchKey = searchKey.toLowerCase();
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ const finishCallPatient = async () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await completeEncounter(currentCallPatient.value.encounterId);
|
await completeEncounter({ encounterId: currentCallPatient.value.encounterId, firstEnum: currentCallPatient.value.firstEnum || 1 });
|
||||||
emit('finish');
|
emit('finish');
|
||||||
emit('update:dialogVisible', false);
|
emit('update:dialogVisible', false);
|
||||||
ElMessage.success('患者已完诊');
|
ElMessage.success('患者已完诊');
|
||||||
|
|||||||
@@ -349,11 +349,17 @@ async function getList() {
|
|||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
// 过滤掉中医诊断,只保留西医诊断
|
// 过滤掉中医诊断,只保留西医诊断
|
||||||
form.value.diagnosisList = res.data.filter(item => item.typeName !== '中医诊断');
|
form.value.diagnosisList = res.data.filter(item => item.typeName !== '中医诊断');
|
||||||
// 为旧数据添加默认分类
|
// 为旧数据添加默认分类和selectedDiseases
|
||||||
form.value.diagnosisList.forEach(item => {
|
form.value.diagnosisList.forEach(item => {
|
||||||
if (!item.classification) {
|
if (!item.classification) {
|
||||||
item.classification = '西医';
|
item.classification = '西医';
|
||||||
}
|
}
|
||||||
|
// 如果ybNo(诊断编码)符合传染病编码格式,添加到selectedDiseases
|
||||||
|
if (item.ybNo && /^(01|02|03)/.test(item.ybNo)) {
|
||||||
|
item.selectedDiseases = [item.ybNo];
|
||||||
|
} else {
|
||||||
|
item.selectedDiseases = item.selectedDiseases || [];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
emits('diagnosisSave', false);
|
emits('diagnosisSave', false);
|
||||||
}
|
}
|
||||||
@@ -685,23 +691,80 @@ async function handleFoodDiseasesCheck() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 传染病报告卡处理
|
* 传染病报告卡处理
|
||||||
* 通过诊断目录维护的'报卡类型'字段自动识别是否有需要填写的传染病报告卡
|
* 通过诊断名称自动识别并勾选传染病报告卡中的疾病
|
||||||
* 如果有则弹出诊断对应需登记的报告卡界面
|
* 修复 Bug #519:跳过已有已提交报卡的诊断
|
||||||
*/
|
*/
|
||||||
function handleInfectiousDiseaseReport() {
|
function handleInfectiousDiseaseReport() {
|
||||||
// 查找所有有报卡类型的诊断(reportTypeCode不为空)
|
// 疾病名称到报卡编码的映射(根据传染病报告卡弹窗中的疾病列表)
|
||||||
const diagnosesWithReportType = form.value.diagnosisList.filter(d => d.reportTypeCode);
|
const diseaseNameToCode = {
|
||||||
|
// 甲类
|
||||||
|
'鼠疫': '0101',
|
||||||
|
'霍乱': '0102',
|
||||||
|
// 乙类
|
||||||
|
'传染性非典型肺炎': '0201',
|
||||||
|
'艾滋病': '0202',
|
||||||
|
'病毒性肝炎': '0203',
|
||||||
|
'脊髓灰质炎': '0204',
|
||||||
|
'人感染高致病性禽流感': '0205',
|
||||||
|
'麻疹': '0206',
|
||||||
|
'流行性出血热': '0207',
|
||||||
|
'狂犬病': '0208',
|
||||||
|
'流行性乙型脑炎': '0209',
|
||||||
|
'登革热': '0210',
|
||||||
|
'炭疽': '0211',
|
||||||
|
'细菌性和阿米巴性痢疾': '0212',
|
||||||
|
'肺结核': '0213',
|
||||||
|
'伤寒和副伤寒': '0214',
|
||||||
|
'流行性脑脊髓膜炎': '0215',
|
||||||
|
'百日咳': '0216',
|
||||||
|
'白喉': '0217',
|
||||||
|
'新生儿破伤风': '0218',
|
||||||
|
'猩红热': '0219',
|
||||||
|
'布鲁氏菌病': '0220',
|
||||||
|
'淋病': '0221',
|
||||||
|
'梅毒': '0222',
|
||||||
|
'钩端螺旋体病': '0223',
|
||||||
|
'血吸虫病': '0224',
|
||||||
|
'疟疾': '0225',
|
||||||
|
'新型冠状病毒肺炎': '0226',
|
||||||
|
'甲型H1N1流感': '0227',
|
||||||
|
'人感染H7N9禽流感': '0228',
|
||||||
|
// 丙类
|
||||||
|
'流行性感冒': '0301',
|
||||||
|
'流行性腮腺炎': '0302',
|
||||||
|
'风疹': '0303',
|
||||||
|
'急性出血性结膜炎': '0304',
|
||||||
|
'麻风病': '0305',
|
||||||
|
'流行性和地方性斑疹伤寒': '0306',
|
||||||
|
'黑热病': '0307',
|
||||||
|
'包虫病': '0308',
|
||||||
|
'丝虫病': '0309',
|
||||||
|
'除霍乱/菌痢/伤寒副伤寒以外的感染性腹泻病': '0310',
|
||||||
|
'其它感染性腹泻病': '0310',
|
||||||
|
'手足口病': '0311',
|
||||||
|
};
|
||||||
|
|
||||||
if (diagnosesWithReportType.length === 0) {
|
// 获取所有诊断名称对应的报卡编码,但跳过已有已提交报卡的诊断
|
||||||
|
const allSelectedDiseases = form.value.diagnosisList
|
||||||
|
.filter(d => d.name && d.hasInfectiousReport !== 1)
|
||||||
|
.map(d => diseaseNameToCode[d.name] || null)
|
||||||
|
.filter(code => code);
|
||||||
|
|
||||||
|
if (allSelectedDiseases.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 优先使用主诊断,如果没有主诊断有报卡类型则使用第一个有报卡类型的诊断
|
// 优先使用主诊断(同样跳过已有报卡的)
|
||||||
const mainDiagnosisWithReport = diagnosesWithReportType.find(d => d.maindiseFlag === 1);
|
const mainDiagnosis = form.value.diagnosisList.find(d => d.maindiseFlag === 1 && d.hasInfectiousReport !== 1);
|
||||||
const targetDiagnosis = mainDiagnosisWithReport || diagnosesWithReportType[0];
|
const firstDiagnosis = form.value.diagnosisList.find(d => d.hasInfectiousReport !== 1) || form.value.diagnosisList[0];
|
||||||
|
|
||||||
|
const diagnosisToShow = {
|
||||||
|
...(mainDiagnosis || firstDiagnosis),
|
||||||
|
selectedDiseases: allSelectedDiseases
|
||||||
|
};
|
||||||
|
|
||||||
// 弹出传染病报告卡弹窗
|
// 弹出传染病报告卡弹窗
|
||||||
proxy.$refs.infectiousDiseaseReportRef?.show(targetDiagnosis);
|
proxy.$refs.infectiousDiseaseReportRef?.show(diagnosisToShow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -814,7 +877,8 @@ form.value.diagnosisList.push({
|
|||||||
classification: '西医', // 默认为西医
|
classification: '西医', // 默认为西医
|
||||||
onsetDate: getCurrentDate(),
|
onsetDate: getCurrentDate(),
|
||||||
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: getCurrentDate()
|
diagnosisTime: getCurrentDate(),
|
||||||
|
selectedDiseases: data.ybNo ? [data.ybNo] : [], // 用于传染病报告卡自动勾选
|
||||||
});
|
});
|
||||||
|
|
||||||
// 添加后按排序号排序
|
// 添加后按排序号排序
|
||||||
|
|||||||
@@ -16,15 +16,15 @@
|
|||||||
v-model="form.cardNo"
|
v-model="form.cardNo"
|
||||||
class="card-number-input"
|
class="card-number-input"
|
||||||
placeholder="单位自编,与网络直报一致"
|
placeholder="单位自编,与网络直报一致"
|
||||||
maxlength="12"
|
maxlength="20"
|
||||||
:disabled="readOnly"
|
:disabled="readOnly || dialogReadOnly"
|
||||||
/>
|
/>
|
||||||
</el-space>
|
</el-space>
|
||||||
</el-card>
|
</el-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<el-card class="report-form" shadow="never">
|
<el-card class="report-form" shadow="never">
|
||||||
<el-form ref="formRef" :model="form" :rules="rules" label-position="top" :disabled="readOnly">
|
<el-form ref="formRef" :model="form" :rules="rules" label-position="top" :disabled="readOnly || dialogReadOnly">
|
||||||
<!-- 患者姓名、家长姓名、身份证号 -->
|
<!-- 患者姓名、家长姓名、身份证号 -->
|
||||||
<el-row :gutter="16" class="form-row">
|
<el-row :gutter="16" class="form-row">
|
||||||
<el-col :span="8" class="form-item">
|
<el-col :span="8" class="form-item">
|
||||||
@@ -49,6 +49,40 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 性别、出生日期、或实足年龄 -->
|
||||||
|
<el-row :gutter="16" class="form-row">
|
||||||
|
<el-col :span="7" class="form-item">
|
||||||
|
<span class="form-label required">性别</span>
|
||||||
|
<el-radio-group v-model="form.sex" class="gender-radio-group">
|
||||||
|
<el-radio value="男">男</el-radio>
|
||||||
|
<el-radio value="女">女</el-radio>
|
||||||
|
<el-radio value="未知">未知</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="10" class="form-item">
|
||||||
|
<span class="form-label required">出生日期</span>
|
||||||
|
<div class="birth-input-group">
|
||||||
|
<el-input v-model="form.birthYear" class="birth-input year" placeholder="年" maxlength="4" />
|
||||||
|
<span class="birth-separator">年</span>
|
||||||
|
<el-input v-model="form.birthMonth" class="birth-input month" placeholder="月" maxlength="2" />
|
||||||
|
<span class="birth-separator">月</span>
|
||||||
|
<el-input v-model="form.birthDay" class="birth-input day" placeholder="日" maxlength="2" />
|
||||||
|
<span class="birth-separator">日</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="7" class="form-item">
|
||||||
|
<span class="form-label">或 实足年龄</span>
|
||||||
|
<div class="age-input-group">
|
||||||
|
<el-input v-model="form.age" class="age-input" placeholder="年龄" />
|
||||||
|
<el-select v-model="form.ageUnit" class="age-unit-select">
|
||||||
|
<el-option label="岁" value="岁" />
|
||||||
|
<el-option label="月" value="月" />
|
||||||
|
<el-option label="天" value="天" />
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
<!-- 联系电话、紧急联系人电话 -->
|
<!-- 联系电话、紧急联系人电话 -->
|
||||||
<el-row :gutter="16" class="form-row">
|
<el-row :gutter="16" class="form-row">
|
||||||
<el-col :span="12" class="form-item">
|
<el-col :span="12" class="form-item">
|
||||||
@@ -476,9 +510,9 @@
|
|||||||
<template #footer>
|
<template #footer>
|
||||||
<slot name="footer" :close="handleClose" :submit-loading="submitLoading">
|
<slot name="footer" :close="handleClose" :submit-loading="submitLoading">
|
||||||
<el-space :size="16" justify="center" class="dialog-footer-space" style="display: flex; justify-content: center; width: 100%;">
|
<el-space :size="16" justify="center" class="dialog-footer-space" style="display: flex; justify-content: center; width: 100%;">
|
||||||
<el-button v-if="!readOnly" type="primary" @click="handleSubmit" :loading="submitLoading" class="blue-button">保 存</el-button>
|
<el-button v-if="!(readOnly || dialogReadOnly)" type="primary" @click="handleSubmit" :loading="submitLoading" class="blue-button">保 存</el-button>
|
||||||
<el-button type="info" @click="handleClose">关 闭</el-button>
|
<el-button type="info" @click="handleClose">关 闭</el-button>
|
||||||
<el-button v-if="!readOnly" type="danger" @click="handleReset">重 置</el-button>
|
<el-button v-if="!(readOnly || dialogReadOnly)" type="danger" @click="handleReset">重 置</el-button>
|
||||||
</el-space>
|
</el-space>
|
||||||
</slot>
|
</slot>
|
||||||
</template>
|
</template>
|
||||||
@@ -510,6 +544,7 @@ const DISEASE_NAMES = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const dialogVisible = ref(false);
|
const dialogVisible = ref(false);
|
||||||
|
const dialogReadOnly = ref(false);
|
||||||
const formRef = ref(null);
|
const formRef = ref(null);
|
||||||
// 保存按钮加载状态,防止重复提交
|
// 保存按钮加载状态,防止重复提交
|
||||||
const submitLoading = ref(false);
|
const submitLoading = ref(false);
|
||||||
@@ -999,6 +1034,17 @@ function normalizeSex(value) {
|
|||||||
return '未知';
|
return '未知';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function normalizeSexFromPatientInfo(patientInfo) {
|
||||||
|
// 优先使用文本字段
|
||||||
|
if (patientInfo.genderEnum_enumText) return patientInfo.genderEnum_enumText;
|
||||||
|
if (patientInfo.genderName) return patientInfo.genderName;
|
||||||
|
if (patientInfo.sex) return normalizeSex(patientInfo.sex);
|
||||||
|
// 使用数字枚举字段
|
||||||
|
if (patientInfo.genderEnum === 1) return '男';
|
||||||
|
if (patientInfo.genderEnum === 2) return '女';
|
||||||
|
return '未知';
|
||||||
|
}
|
||||||
|
|
||||||
function normalizeAgeUnit(value) {
|
function normalizeAgeUnit(value) {
|
||||||
const ageUnitMap = {
|
const ageUnitMap = {
|
||||||
1: '岁',
|
1: '岁',
|
||||||
@@ -1037,8 +1083,9 @@ function resetAddressSelector() {
|
|||||||
* 以只读详情方式打开报卡弹窗,供报卡管理等页面复用医生站报卡样式。
|
* 以只读详情方式打开报卡弹窗,供报卡管理等页面复用医生站报卡样式。
|
||||||
* @param {Object} reportData - 报卡详情数据
|
* @param {Object} reportData - 报卡详情数据
|
||||||
*/
|
*/
|
||||||
function showReport(reportData = {}) {
|
function showReport(reportData = {}, readOnly = true) {
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
|
dialogReadOnly.value = readOnly;
|
||||||
|
|
||||||
resetAddressSelector();
|
resetAddressSelector();
|
||||||
initProvinceOptions();
|
initProvinceOptions();
|
||||||
@@ -1069,7 +1116,7 @@ function showReport(reportData = {}) {
|
|||||||
addressHouse: reportData.addressHouse || '',
|
addressHouse: reportData.addressHouse || '',
|
||||||
patientBelong: reportData.patientBelong || 1,
|
patientBelong: reportData.patientBelong || 1,
|
||||||
occupation: reportData.occupation || '',
|
occupation: reportData.occupation || '',
|
||||||
caseClass: reportData.caseClass != null ? String(reportData.caseClass) : '',
|
caseClass: reportData.diseaseType != null ? String(reportData.diseaseType) : '',
|
||||||
onsetDate: normalizeDate(reportData.onsetDate),
|
onsetDate: normalizeDate(reportData.onsetDate),
|
||||||
diagDate: normalizeDate(reportData.diagDate),
|
diagDate: normalizeDate(reportData.diagDate),
|
||||||
deathDate: normalizeDate(reportData.deathDate),
|
deathDate: normalizeDate(reportData.deathDate),
|
||||||
@@ -1078,13 +1125,13 @@ function showReport(reportData = {}) {
|
|||||||
selectedClassB: diseaseSelection.selectedClassB,
|
selectedClassB: diseaseSelection.selectedClassB,
|
||||||
selectedClassC: diseaseSelection.selectedClassC,
|
selectedClassC: diseaseSelection.selectedClassC,
|
||||||
otherDisease: reportData.otherDisease || (diseaseCode === 'OTHER' ? reportData.diseaseName || '' : ''),
|
otherDisease: reportData.otherDisease || (diseaseCode === 'OTHER' ? reportData.diseaseName || '' : ''),
|
||||||
diseaseType: reportData.diseaseType || '',
|
diseaseType: reportData.diseaseSubtype || '',
|
||||||
reportOrg: reportData.reportOrg || '',
|
reportOrg: reportData.reportOrg || '',
|
||||||
reportOrgPhone: reportData.reportOrgPhone || '',
|
reportOrgPhone: reportData.reportOrgPhone || '',
|
||||||
reportDoc: reportData.reportDoc || '',
|
reportDoc: reportData.reportDoc || '',
|
||||||
reportDate: normalizeDate(reportData.reportDate || reportData.createdAt),
|
reportDate: normalizeDate(reportData.reportDate || reportData.createdAt),
|
||||||
correctName: reportData.correctName || '',
|
correctName: reportData.revisedDiseaseName || '',
|
||||||
withdrawReason: reportData.withdrawReason || '',
|
withdrawReason: reportData.returnReason || '',
|
||||||
remark: reportData.remark || '',
|
remark: reportData.remark || '',
|
||||||
encounterId: reportData.encounterId || reportData.visitId || '',
|
encounterId: reportData.encounterId || reportData.visitId || '',
|
||||||
patientId: reportData.patientId || reportData.patId || '',
|
patientId: reportData.patientId || reportData.patId || '',
|
||||||
@@ -1205,6 +1252,7 @@ function calculateAge() {
|
|||||||
*/
|
*/
|
||||||
async function show(diagnosisData) {
|
async function show(diagnosisData) {
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
|
dialogReadOnly.value = false;
|
||||||
|
|
||||||
// 重置地址选择器状态
|
// 重置地址选择器状态
|
||||||
resetAddressSelector();
|
resetAddressSelector();
|
||||||
@@ -1238,13 +1286,15 @@ async function show(diagnosisData) {
|
|||||||
let cardNo = '';
|
let cardNo = '';
|
||||||
try {
|
try {
|
||||||
const res = await getNextCardNo(orgCode);
|
const res = await getNextCardNo(orgCode);
|
||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data && res.data.length >= 12) {
|
||||||
cardNo = res.data;
|
cardNo = res.data;
|
||||||
} else {
|
} else {
|
||||||
|
// API返回失败或不合规时,生成临时卡号避免保存时 cardNo 为空导致后端校验失败
|
||||||
cardNo = 'TEMP_' + Date.now();
|
cardNo = 'TEMP_' + Date.now();
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('获取卡片编号失败:', err);
|
console.error('获取卡片编号失败:', err);
|
||||||
|
// API调用异常时,生成临时卡号
|
||||||
cardNo = 'TEMP_' + Date.now();
|
cardNo = 'TEMP_' + Date.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1256,7 +1306,7 @@ async function show(diagnosisData) {
|
|||||||
patName: patientInfo.patientName || patientInfo.name || '', // 患者姓名
|
patName: patientInfo.patientName || patientInfo.name || '', // 患者姓名
|
||||||
parentName: '', // 家长姓名(14岁以下患者必填)
|
parentName: '', // 家长姓名(14岁以下患者必填)
|
||||||
idNo: patientInfo.idCard, // 身份证号
|
idNo: patientInfo.idCard, // 身份证号
|
||||||
sex: patientInfo.sex || patientInfo.genderName || '男', // 性别
|
sex: normalizeSexFromPatientInfo(patientInfo), // 性别
|
||||||
|
|
||||||
// 出生日期信息
|
// 出生日期信息
|
||||||
birthYear: birthInfo.year, // 出生年份
|
birthYear: birthInfo.year, // 出生年份
|
||||||
@@ -1316,7 +1366,11 @@ async function show(diagnosisData) {
|
|||||||
// 系统关联信息
|
// 系统关联信息
|
||||||
encounterId: patientInfo.encounterId || '', // 就诊ID
|
encounterId: patientInfo.encounterId || '', // 就诊ID
|
||||||
patientId: patientInfo.patientId || '', // 患者ID
|
patientId: patientInfo.patientId || '', // 患者ID
|
||||||
diagnosisId: diagnosisData?.conditionId || diagnosisData?.definitionId || '', // 诊断ID
|
diagnosisId: (diagnosisData?.conditionId != null && diagnosisData?.conditionId !== '')
|
||||||
|
? diagnosisData.conditionId
|
||||||
|
: (diagnosisData?.definitionId != null && diagnosisData?.definitionId !== '')
|
||||||
|
? diagnosisData.definitionId
|
||||||
|
: '', // 诊断ID
|
||||||
};
|
};
|
||||||
|
|
||||||
// 更新selectedDiseases数组
|
// 更新selectedDiseases数组
|
||||||
@@ -1357,6 +1411,9 @@ async function buildSubmitData() {
|
|||||||
} else if (formData.otherDisease) {
|
} else if (formData.otherDisease) {
|
||||||
// 其他传染病使用自定义编码
|
// 其他传染病使用自定义编码
|
||||||
diseaseCode = 'OTHER';
|
diseaseCode = 'OTHER';
|
||||||
|
} else if (formData.selectedDiseases && formData.selectedDiseases.length > 0) {
|
||||||
|
// 兜底:如果 ClassA/B/C 都为空但 selectedDiseases 有值,取第一个作为 diseaseCode
|
||||||
|
diseaseCode = formData.selectedDiseases[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 转换年龄单位:岁=1, 月=2, 天=3
|
// 转换年龄单位:岁=1, 月=2, 天=3
|
||||||
@@ -1371,7 +1428,7 @@ async function buildSubmitData() {
|
|||||||
const submitData = {
|
const submitData = {
|
||||||
cardNo: formData.cardNo,
|
cardNo: formData.cardNo,
|
||||||
visitId: props.patientInfo?.encounterId || formData.encounterId || null,
|
visitId: props.patientInfo?.encounterId || formData.encounterId || null,
|
||||||
diagId: formData.diagnosisId || null,
|
diagId: formData.diagnosisId ? Number(formData.diagnosisId) : null,
|
||||||
patId: formData.patientId || null,
|
patId: formData.patientId || null,
|
||||||
idType: 1, // 默认身份证
|
idType: 1, // 默认身份证
|
||||||
idNo: formData.idNo,
|
idNo: formData.idNo,
|
||||||
@@ -1424,9 +1481,9 @@ async function buildSubmitData() {
|
|||||||
function validateFormManually() {
|
function validateFormManually() {
|
||||||
const errors = [];
|
const errors = [];
|
||||||
|
|
||||||
// 卡片编号验证(可选,但如果填写了必须是12位)
|
// 卡片编号验证(至少12位,后端自动生成16位编号;临时卡号 TEMP_ 开头允许通过)
|
||||||
if (form.value.cardNo && form.value.cardNo.length !== 12) {
|
if (form.value.cardNo && !form.value.cardNo.startsWith('TEMP_') && form.value.cardNo.length < 12) {
|
||||||
errors.push('卡片编号必须为12位');
|
errors.push('卡片编号至少12位');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 身份证号验证
|
// 身份证号验证
|
||||||
@@ -1537,6 +1594,12 @@ async function handleSubmit() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查诊断ID是否有效(后端 @NotNull 校验要求)
|
||||||
|
if (!form.value.diagnosisId) {
|
||||||
|
proxy.$modal.msgError('诊断信息不完整,请重新选择诊断后重试');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 开始加载状态,防止重复提交
|
// 开始加载状态,防止重复提交
|
||||||
submitLoading.value = true;
|
submitLoading.value = true;
|
||||||
|
|
||||||
@@ -1760,6 +1823,33 @@ defineExpose({ show, showReport, close: handleClose });
|
|||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 输入框下划线样式(与 underline-select 保持一致) */
|
||||||
|
.underline-input :deep(.el-input__wrapper) {
|
||||||
|
border: none;
|
||||||
|
border-bottom: 1px solid #dcdfe6;
|
||||||
|
border-radius: 0;
|
||||||
|
box-shadow: none;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.underline-input :deep(.el-input__wrapper:hover) {
|
||||||
|
border-bottom-color: #c0c4cc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.underline-input :deep(.el-input__wrapper.is-focus) {
|
||||||
|
border-bottom-color: #409eff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.underline-input :deep(.el-input__inner) {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.underline-input :deep(.el-input__inner::placeholder) {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
/* 街道下拉框下划线样式 */
|
/* 街道下拉框下划线样式 */
|
||||||
.underline-select {
|
.underline-select {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -1947,4 +2037,53 @@ defineExpose({ show, showReport, close: handleClose });
|
|||||||
display: flex !important;
|
display: flex !important;
|
||||||
justify-content: center !important;
|
justify-content: center !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 性别单选按钮组 */
|
||||||
|
.gender-radio-group {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
padding-top: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 出生日期输入组 */
|
||||||
|
.birth-input-group {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.birth-input {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.birth-input.year {
|
||||||
|
width: 70px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.birth-input.month,
|
||||||
|
.birth-input.day {
|
||||||
|
width: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.birth-separator {
|
||||||
|
color: #606266;
|
||||||
|
font-size: 13px;
|
||||||
|
margin: 0 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 年龄输入组 */
|
||||||
|
.age-input-group {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.age-input {
|
||||||
|
width: 70px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.age-unit-select {
|
||||||
|
width: 65px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -56,6 +56,13 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="申请单号" prop="applyNo" min-width="160" align="center" header-align="center" />
|
<el-table-column label="申请单号" prop="applyNo" min-width="160" align="center" header-align="center" />
|
||||||
|
<el-table-column label="单据状态" prop="applyStatus" width="100" align="center" header-align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag :type="getStatusType(scope.row.applyStatus)" size="small">
|
||||||
|
{{ getStatusLabel(scope.row.applyStatus, scope.row) }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="检验项目" prop="itemName" min-width="170px" align="center" header-align="center">
|
<el-table-column label="检验项目" prop="itemName" min-width="170px" align="center" header-align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span>{{ scope.row.itemName }}</span>
|
<span>{{ scope.row.itemName }}</span>
|
||||||
@@ -1445,6 +1452,26 @@ const formatAmount = (amount) => {
|
|||||||
return num.toFixed(2)
|
return num.toFixed(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 单据状态标签文字
|
||||||
|
const getStatusLabel = (applyStatus, row) => {
|
||||||
|
// applyStatus: 0=待开立, 1=已开立(已签发)
|
||||||
|
// 结合收费/执行标记推导更丰富的状态
|
||||||
|
if (applyStatus === 1) {
|
||||||
|
// 已收费后根据执行标记判断
|
||||||
|
if (row.needExecute === true) {
|
||||||
|
return '已执行'
|
||||||
|
}
|
||||||
|
return '已开立'
|
||||||
|
}
|
||||||
|
return '待开立'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 单据状态标签颜色
|
||||||
|
const getStatusType = (applyStatus) => {
|
||||||
|
if (applyStatus === 1) return 'success'
|
||||||
|
return 'info'
|
||||||
|
}
|
||||||
|
|
||||||
// 格式化日期时间为字符串 YYYY-MM-DD HH:mm:ss
|
// 格式化日期时间为字符串 YYYY-MM-DD HH:mm:ss
|
||||||
const formatDateTime = (date) => {
|
const formatDateTime = (date) => {
|
||||||
if (!date) return ''
|
if (!date) return ''
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ const props = defineProps({
|
|||||||
});
|
});
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const encounterId = ref();
|
const encounterId = ref();
|
||||||
|
const firstEnum = ref(1); // 初复诊标识:1=初诊,2=复诊
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getPatientList();
|
getPatientList();
|
||||||
});
|
});
|
||||||
@@ -127,6 +128,7 @@ function getPatientList() {
|
|||||||
|
|
||||||
function clickRow(row) {
|
function clickRow(row) {
|
||||||
encounterId.value = row.encounterId;
|
encounterId.value = row.encounterId;
|
||||||
|
firstEnum.value = row.firstEnum ?? row.first_enum ?? 1;
|
||||||
emits('cellClick', row);
|
emits('cellClick', row);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +184,7 @@ function handleComplete() {
|
|||||||
}
|
}
|
||||||
proxy.$modal.confirm('是否完成该患者问诊?').then(() => {
|
proxy.$modal.confirm('是否完成该患者问诊?').then(() => {
|
||||||
proxy.$modal.loading();
|
proxy.$modal.loading();
|
||||||
completeEncounter(encounterId.value).then(() => {
|
completeEncounter({ encounterId: encounterId.value, firstEnum: firstEnum.value }).then(() => {
|
||||||
proxy.$modal.closeLoading();
|
proxy.$modal.closeLoading();
|
||||||
proxy.$modal.msgSuccess('完成问诊成功');
|
proxy.$modal.msgSuccess('完成问诊成功');
|
||||||
getPatientList();
|
getPatientList();
|
||||||
|
|||||||
@@ -589,36 +589,46 @@ function handleUseOrderGroup(row) {
|
|||||||
minUnitPrice: orderDetail.minUnitPrice,
|
minUnitPrice: orderDetail.minUnitPrice,
|
||||||
inventoryList: orderDetail.inventoryList || [],
|
inventoryList: orderDetail.inventoryList || [],
|
||||||
priceList: orderDetail.priceList || [],
|
priceList: orderDetail.priceList || [],
|
||||||
partPercent: orderDetail.partPercent || 1,
|
partPercent: orderDetail.partPercent ?? 1,
|
||||||
|
partAttributeEnum: orderDetail.partAttributeEnum,
|
||||||
|
unitConversionRatio: orderDetail.unitConversionRatio,
|
||||||
// 🔧 Bug #218 修复:positionId 可能存储在 item 本身,优先使用 item.positionId
|
// 🔧 Bug #218 修复:positionId 可能存储在 item 本身,优先使用 item.positionId
|
||||||
positionId: item.positionId || orderDetail.positionId,
|
positionId: item.positionId ?? orderDetail.positionId,
|
||||||
defaultLotNumber: orderDetail.defaultLotNumber,
|
defaultLotNumber: orderDetail.defaultLotNumber,
|
||||||
|
|
||||||
// 单位信息
|
// 单位信息
|
||||||
unitCode: item.unitCode || orderDetail.unitCode,
|
unitCode: item.unitCode ?? orderDetail.unitCode,
|
||||||
|
categoryCode: item.categoryCode ?? orderDetail.categoryCode,
|
||||||
unitCodeName: item.unitCodeName || orderDetail.unitCode_dictText,
|
unitCodeName: item.unitCodeName || orderDetail.unitCode_dictText,
|
||||||
minUnitCode: orderDetail.minUnitCode,
|
minUnitCode: orderDetail.minUnitCode,
|
||||||
doseUnitCode: orderDetail.doseUnitCode,
|
doseUnitCode: orderDetail.doseUnitCode,
|
||||||
|
|
||||||
// 合并后的完整对象(用于 setValue)
|
// 合并后的完整对象(用于 setValue)
|
||||||
|
// 先展开 orderDetail 获取所有药品基础字段(categoryCode、minUnitCode、doseUnitCode、
|
||||||
|
// partPercent、partAttributeEnum、unitConversionRatio、defaultLotNumber 等),
|
||||||
|
// 再用组套用户覆盖值覆盖,确保单次剂量/频次/用法/用药天数/总量等不被丢失
|
||||||
mergedDetail: {
|
mergedDetail: {
|
||||||
...orderDetail,
|
...orderDetail,
|
||||||
adviceName: orderDetail.adviceName || item.orderDefinitionName || '未知项目',
|
adviceName: orderDetail.adviceName || item.orderDefinitionName || '未知项目',
|
||||||
adviceType: orderDetail.adviceType,
|
adviceType: orderDetail.adviceType,
|
||||||
quantity: item.quantity,
|
quantity: item.quantity,
|
||||||
unitCode: item.unitCode || orderDetail.unitCode,
|
unitCode: item.unitCode ?? orderDetail.unitCode,
|
||||||
|
categoryCode: item.categoryCode ?? orderDetail.categoryCode,
|
||||||
unitCodeName: item.unitCodeName,
|
unitCodeName: item.unitCodeName,
|
||||||
dose: item.dose || orderDetail.dose,
|
dose: item.dose ?? orderDetail.dose,
|
||||||
rateCode: item.rateCode || orderDetail.rateCode,
|
rateCode: item.rateCode ?? orderDetail.rateCode,
|
||||||
methodCode: item.methodCode || orderDetail.methodCode,
|
methodCode: item.methodCode ?? orderDetail.methodCode,
|
||||||
dispensePerDuration: item.dispensePerDuration || orderDetail.dispensePerDuration,
|
dispensePerDuration: item.dispensePerDuration ?? orderDetail.dispensePerDuration,
|
||||||
doseQuantity: item.doseQuantity,
|
doseQuantity: item.doseQuantity ?? orderDetail.doseQuantity,
|
||||||
inventoryList: orderDetail.inventoryList || [],
|
// 🔧 Bug #218 / #403 修复:positionId 可能存储在 item 本身,优先使用 item.positionId
|
||||||
priceList: orderDetail.priceList || [],
|
positionId: item.positionId ?? orderDetail.positionId,
|
||||||
partPercent: orderDetail.partPercent || 1,
|
// 执行科室:优先使用组套明细中保存的 orgId
|
||||||
// 🔧 Bug #218 修复:positionId 可能存储在 item 本身,优先使用 item.positionId
|
orgId: item.orgId ?? orderDetail.orgId,
|
||||||
positionId: item.positionId || orderDetail.positionId,
|
orgName: item.orgName ?? orderDetail.orgName,
|
||||||
defaultLotNumber: orderDetail.defaultLotNumber,
|
// 组号(保留组套中的分组信息)
|
||||||
|
groupId: item.groupId,
|
||||||
|
groupOrder: item.groupOrder,
|
||||||
|
therapyEnum: item.therapyEnum ?? orderDetail.therapyEnum ?? '1',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -315,6 +315,7 @@
|
|||||||
data-prop="dispensePerDuration">
|
data-prop="dispensePerDuration">
|
||||||
<el-input-number v-model="scope.row.dispensePerDuration" style="width: 80px" :min="1"
|
<el-input-number v-model="scope.row.dispensePerDuration" style="width: 80px" :min="1"
|
||||||
controls-position="right" :controls="false" :ref="(el) => (inputRefs.dispensePerDuration = el)"
|
controls-position="right" :controls="false" :ref="(el) => (inputRefs.dispensePerDuration = el)"
|
||||||
|
@input="calculateTotalAmount(scope.row, scope.$index)"
|
||||||
@change="calculateTotalAmount(scope.row, scope.$index)"
|
@change="calculateTotalAmount(scope.row, scope.$index)"
|
||||||
@keyup.enter.prevent="
|
@keyup.enter.prevent="
|
||||||
handleEnter('dispensePerDuration', scope.row, scope.$index)
|
handleEnter('dispensePerDuration', scope.row, scope.$index)
|
||||||
@@ -874,7 +875,7 @@ import { ArrowDown, Search, Memo, Minus, Plus, Edit, Delete } from '@element-plu
|
|||||||
import printUtils, { getPrinterList, PRINT_TEMPLATE, savePrinterToCache, } from '@/utils/printUtils';
|
import printUtils, { getPrinterList, PRINT_TEMPLATE, savePrinterToCache, } from '@/utils/printUtils';
|
||||||
import Template from "@/views/inpatientDoctor/home/emr/components/template.vue";
|
import Template from "@/views/inpatientDoctor/home/emr/components/template.vue";
|
||||||
|
|
||||||
const emit = defineEmits(['selectDiagnosis']);
|
const emit = defineEmits(['selectDiagnosis', 'inspectionListRefresh']);
|
||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
const queryParams = ref({});
|
const queryParams = ref({});
|
||||||
const prescriptionList = ref([]);
|
const prescriptionList = ref([]);
|
||||||
@@ -1021,7 +1022,21 @@ const mapAdviceTypeLabel = (type, adviceTableName) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const found = adviceTypeList.value.find((item) => item.value === type);
|
const found = adviceTypeList.value.find((item) => item.value === type);
|
||||||
return found ? found.label : '';
|
if (found) {
|
||||||
|
return found.label;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 🔧 Bug #458 Fix: 诊疗/手术类型字典缺失时的兜底,避免保存后"医嘱类型"列显示为空
|
||||||
|
if (adviceTableName === 'wor_activity_definition' || adviceTableName === 'wor_service_request') {
|
||||||
|
if (type === 6) return '手术';
|
||||||
|
if (type === 4) return '手术';
|
||||||
|
if (type === 1) return '检验';
|
||||||
|
if (type === 2) return '检查';
|
||||||
|
if (type === 5) return '其他';
|
||||||
|
return '诊疗';
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
// 西药处方管理相关变量
|
// 西药处方管理相关变量
|
||||||
@@ -2069,6 +2084,21 @@ function getOrgList() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 诊疗医嘱关联检验申请时 contentJson 含 applyNo */
|
||||||
|
function getInspectionApplyNoFromAdviceRow(row) {
|
||||||
|
if (!row || row.adviceType !== 3) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const raw = row.contentJson;
|
||||||
|
const j = raw ? (typeof raw === 'string' ? JSON.parse(raw) : raw) : {};
|
||||||
|
const no = j && j.applyNo != null ? String(j.applyNo).trim() : '';
|
||||||
|
return no || null;
|
||||||
|
} catch (e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function handleDelete() {
|
function handleDelete() {
|
||||||
let selectRows = prescriptionRef.value.getSelectionRows();
|
let selectRows = prescriptionRef.value.getSelectionRows();
|
||||||
console.log('BugFix#219: handleDelete called, selectRows=', selectRows);
|
console.log('BugFix#219: handleDelete called, selectRows=', selectRows);
|
||||||
@@ -2248,12 +2278,31 @@ function handleDelete() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (deleteList.length > 0) {
|
if (deleteList.length > 0) {
|
||||||
savePrescription({ adviceSaveList: deleteList }).then((res) => {
|
const hasLabLinked = deleteList.some((d) => {
|
||||||
if (res.code == 200) {
|
const row = normalRows.find((r) => r.requestId === d.requestId);
|
||||||
proxy.$modal.msgSuccess('删除成功');
|
return row && getInspectionApplyNoFromAdviceRow(row);
|
||||||
getListInfo(false);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
const runApiDelete = () => {
|
||||||
|
savePrescription({ adviceSaveList: deleteList }).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
proxy.$modal.msgSuccess('删除成功');
|
||||||
|
getListInfo(false);
|
||||||
|
emit('inspectionListRefresh');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
if (hasLabLinked) {
|
||||||
|
proxy.$modal
|
||||||
|
.confirm(
|
||||||
|
'删除此医嘱将同时作废关联的检验申请单(检验页签中的同单申请及同单下相关医嘱)。是否继续?',
|
||||||
|
'删除确认',
|
||||||
|
{ type: 'warning' }
|
||||||
|
)
|
||||||
|
.then(runApiDelete)
|
||||||
|
.catch(() => {});
|
||||||
|
} else {
|
||||||
|
runApiDelete();
|
||||||
|
}
|
||||||
} else if (consultationRows.length == 0) {
|
} else if (consultationRows.length == 0) {
|
||||||
proxy.$modal.msgWarning('所选医嘱不可删除,请先撤回后再删除');
|
proxy.$modal.msgWarning('所选医嘱不可删除,请先撤回后再删除');
|
||||||
return;
|
return;
|
||||||
@@ -2499,7 +2548,9 @@ function handleSave(prescriptionId) {
|
|||||||
'contentJson', 'definitionDetailId', 'definitionId', 'diagnosisName',
|
'contentJson', 'definitionDetailId', 'definitionId', 'diagnosisName',
|
||||||
'dosageInstruction', 'effectiveOrgId', 'encounterDiagnosisId',
|
'dosageInstruction', 'effectiveOrgId', 'encounterDiagnosisId',
|
||||||
'encounterId', 'lotNumber', 'patientId', 'practitionerId',
|
'encounterId', 'lotNumber', 'patientId', 'practitionerId',
|
||||||
'prescriptionNo', 'skinTestFlag', 'unitPrice', 'volume', 'ybClassEnum'
|
'prescriptionNo', 'skinTestFlag', 'unitPrice', 'volume', 'ybClassEnum',
|
||||||
|
// 🔧 Bug Fix: 添加 therapyEnum 字段(医嘱类型:1=长期, 2=临时)
|
||||||
|
'therapyEnum'
|
||||||
];
|
];
|
||||||
let filteredContent = {};
|
let filteredContent = {};
|
||||||
standardFields.forEach(field => {
|
standardFields.forEach(field => {
|
||||||
@@ -3143,7 +3194,9 @@ function handleSaveBatch(prescriptionId) {
|
|||||||
// 🔧 Bug Fix: 添加 definitionId 和 definitionDetailId 字段
|
// 🔧 Bug Fix: 添加 definitionId 和 definitionDetailId 字段
|
||||||
'definitionId', 'definitionDetailId',
|
'definitionId', 'definitionDetailId',
|
||||||
// 🔧 Bug Fix: 添加 categoryEnum 字段(耗材必填)
|
// 🔧 Bug Fix: 添加 categoryEnum 字段(耗材必填)
|
||||||
'categoryEnum'
|
'categoryEnum',
|
||||||
|
// 🔧 Bug Fix: 添加 therapyEnum 字段(医嘱类型:1=长期, 2=临时)
|
||||||
|
'therapyEnum'
|
||||||
];
|
];
|
||||||
let filteredItem = {};
|
let filteredItem = {};
|
||||||
standardItemFields.forEach(field => {
|
standardItemFields.forEach(field => {
|
||||||
@@ -3308,9 +3361,13 @@ function syncGroupFields(row) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 同步执行科室
|
// 同步执行科室
|
||||||
|
// 🔧 Bug #455: 诊疗类医嘱(adviceType=3)不使用项目配置的执行科室,
|
||||||
|
// 避免配置ID不在机构树中导致显示原始ID,保持患者就诊科室即可
|
||||||
if (row.orgId || row.positionId) {
|
if (row.orgId || row.positionId) {
|
||||||
// 🔧 修复:优先使用项目所属科室(orgId),其次positionId
|
if (Number(row.adviceType) != 3) {
|
||||||
prescriptionList.value[rowIndex.value].orgId = row.orgId || row.positionId;
|
// 🔧 修复:优先使用项目所属科室(orgId),其次positionId
|
||||||
|
prescriptionList.value[rowIndex.value].orgId = row.orgId || row.positionId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 同步皮试标记
|
// 同步皮试标记
|
||||||
@@ -3342,7 +3399,7 @@ function syncGroupFields(row) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setValue(row) {
|
async function setValue(row) {
|
||||||
unitCodeList.value = [];
|
unitCodeList.value = [];
|
||||||
unitCodeList.value.push({ value: row.unitCode, label: row.unitCode_dictText, type: 'unit' });
|
unitCodeList.value.push({ value: row.unitCode, label: row.unitCode_dictText, type: 'unit' });
|
||||||
|
|
||||||
@@ -3394,8 +3451,16 @@ function setValue(row) {
|
|||||||
showPopover: false, // 确保查询框关闭
|
showPopover: false, // 确保查询框关闭
|
||||||
};
|
};
|
||||||
console.log('[BugFix] setValue - prescriptionList[rowIndex].adviceType_dictText:', prescriptionList.value[rowIndex.value].adviceType_dictText);
|
console.log('[BugFix] setValue - prescriptionList[rowIndex].adviceType_dictText:', prescriptionList.value[rowIndex.value].adviceType_dictText);
|
||||||
// 🔧 修复执行科室逻辑:优先使用项目维护的所属科室(row.orgId),其次使用positionId,最后回退到患者科室
|
// 🔧 Bug #455: 诊疗医嘱(adviceType=3)的执行科室默认使用患者就诊科室,
|
||||||
prescriptionList.value[rowIndex.value].orgId = row.orgId || row.positionId || props.patientInfo?.orgId;
|
// 不使用positionId(诊疗目录配置的执行科室),避免配置ID不在机构树中导致显示原始ID
|
||||||
|
if (Number(row.adviceType) == 3) {
|
||||||
|
// 覆盖 catalog 传来的 positionId/orgId,使用患者就诊科室
|
||||||
|
prescriptionList.value[rowIndex.value].orgId = props.patientInfo?.orgId;
|
||||||
|
prescriptionList.value[rowIndex.value].positionId = props.patientInfo?.orgId;
|
||||||
|
prescriptionList.value[rowIndex.value].positionName = findOrgNameById(props.patientInfo?.orgId) || props.patientInfo?.orgName || '';
|
||||||
|
} else {
|
||||||
|
prescriptionList.value[rowIndex.value].orgId = row.positionId || props.patientInfo?.orgId;
|
||||||
|
}
|
||||||
prescriptionList.value[rowIndex.value].dose = row.dose || row.doseQuantity;
|
prescriptionList.value[rowIndex.value].dose = row.dose || row.doseQuantity;
|
||||||
prescriptionList.value[rowIndex.value].quantity = row.quantity || 1;
|
prescriptionList.value[rowIndex.value].quantity = row.quantity || 1;
|
||||||
prescriptionList.value[rowIndex.value].unitCodeList = unitCodeList.value;
|
prescriptionList.value[rowIndex.value].unitCodeList = unitCodeList.value;
|
||||||
@@ -3514,7 +3579,7 @@ function setValue(row) {
|
|||||||
prescriptionList.value[rowIndex.value].positionId = finalLocationId;
|
prescriptionList.value[rowIndex.value].positionId = finalLocationId;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
getOrgList();
|
await getOrgList();
|
||||||
// 会诊类型(adviceType == 5)和诊疗类型(adviceType == 3)的处理
|
// 会诊类型(adviceType == 5)和诊疗类型(adviceType == 3)的处理
|
||||||
if (row.adviceType == 5) {
|
if (row.adviceType == 5) {
|
||||||
// 会诊类型:设置默认值
|
// 会诊类型:设置默认值
|
||||||
@@ -3526,13 +3591,10 @@ function setValue(row) {
|
|||||||
prescriptionList.value[rowIndex.value].categoryEnum = 31; // 会诊的category_enum设置为31
|
prescriptionList.value[rowIndex.value].categoryEnum = 31; // 会诊的category_enum设置为31
|
||||||
} else {
|
} else {
|
||||||
// 诊疗类型(adviceType == 3)
|
// 诊疗类型(adviceType == 3)
|
||||||
// 🔧 Bug Fix #238: 诊疗项目默认使用患者就诊科室
|
// 🔧 Bug #455: 诊疗项目执行科室强制使用患者就诊科室,
|
||||||
if (!prescriptionList.value[rowIndex.value].orgId) {
|
// 不使用目录配置的执行科室(可能是错误ID或占位符,导致显示原始ID)
|
||||||
prescriptionList.value[rowIndex.value].orgId = props.patientInfo.orgId;
|
prescriptionList.value[rowIndex.value].orgId = props.patientInfo.orgId;
|
||||||
}
|
prescriptionList.value[rowIndex.value].positionName = findOrgNameById(props.patientInfo.orgId) || props.patientInfo.orgName || '';
|
||||||
if (!prescriptionList.value[rowIndex.value].positionName) {
|
|
||||||
prescriptionList.value[rowIndex.value].positionName = findOrgNameById(prescriptionList.value[rowIndex.value].orgId) || props.patientInfo.orgName || '';
|
|
||||||
}
|
|
||||||
// 🔧 Bug #218 修复:使用组套中维护的quantity,如果没有则默认1
|
// 🔧 Bug #218 修复:使用组套中维护的quantity,如果没有则默认1
|
||||||
prescriptionList.value[rowIndex.value].quantity = row.quantity || 1;
|
prescriptionList.value[rowIndex.value].quantity = row.quantity || 1;
|
||||||
// 🔧 Bug #144 修复:安全访问 priceList,防止 orderDetailInfos 为空时出错
|
// 🔧 Bug #144 修复:安全访问 priceList,防止 orderDetailInfos 为空时出错
|
||||||
@@ -3627,7 +3689,10 @@ function handleSaveGroup(orderGroupList) {
|
|||||||
unitCode_dictText: item.unitCodeName || '',
|
unitCode_dictText: item.unitCodeName || '',
|
||||||
statusEnum: 1,
|
statusEnum: 1,
|
||||||
// 🔧 修复执行科室逻辑:优先使用 orgId(所属科室),其次 positionId
|
// 🔧 修复执行科室逻辑:优先使用 orgId(所属科室),其次 positionId
|
||||||
orgId: item.orderDetailInfos?.orgId || mergedDetail.orgId || item.positionId || item.orderDetailInfos?.positionId || mergedDetail.positionId,
|
// 🔧 Bug #455: 诊疗类(adviceType=3)使用患者就诊科室,不使用目录配置的ID
|
||||||
|
orgId: item.adviceType === 3
|
||||||
|
? props.patientInfo?.orgId
|
||||||
|
: (item.orderDetailInfos?.orgId || mergedDetail.orgId || item.positionId || item.orderDetailInfos?.positionId || mergedDetail.positionId),
|
||||||
dbOpType: prescriptionList.value[rowIndex.value].requestId ? '2' : '1',
|
dbOpType: prescriptionList.value[rowIndex.value].requestId ? '2' : '1',
|
||||||
conditionId: conditionId.value,
|
conditionId: conditionId.value,
|
||||||
conditionDefinitionId: conditionDefinitionId.value,
|
conditionDefinitionId: conditionDefinitionId.value,
|
||||||
|
|||||||
@@ -56,6 +56,8 @@
|
|||||||
<!-- 手术等级 -->
|
<!-- 手术等级 -->
|
||||||
<el-table-column label="手术等级" align="center" prop="surgeryLevel_dictText" width="100" />
|
<el-table-column label="手术等级" align="center" prop="surgeryLevel_dictText" width="100" />
|
||||||
|
|
||||||
|
<!-- 手术室确认时间 -->
|
||||||
|
|
||||||
<el-table-column label="手术室确认时间" align="center" prop="operatingRoomConfirmTime" width="180">
|
<el-table-column label="手术室确认时间" align="center" prop="operatingRoomConfirmTime" width="180">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ scope.row.operatingRoomConfirmTime ? parseTime(scope.row.operatingRoomConfirmTime, '{y}-{m}-{d} {h}:{i}:{s}') : '-' }}
|
{{ scope.row.operatingRoomConfirmTime ? parseTime(scope.row.operatingRoomConfirmTime, '{y}-{m}-{d} {h}:{i}:{s}') : '-' }}
|
||||||
@@ -509,6 +511,10 @@ const props = defineProps({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
|
const surgeryLoading = ref(false)
|
||||||
|
const anesthesiaLoading = ref(false)
|
||||||
|
let surgerySearchTimer = null
|
||||||
|
let anesthesiaSearchTimer = null
|
||||||
const surgeryList = ref([])
|
const surgeryList = ref([])
|
||||||
const open = ref(false)
|
const open = ref(false)
|
||||||
const viewOpen = ref(false)
|
const viewOpen = ref(false)
|
||||||
@@ -627,7 +633,12 @@ function getList() {
|
|||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
encounterId: props.patientInfo.encounterId
|
encounterId: props.patientInfo.encounterId
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
surgeryList.value = res.data.records || []
|
if (res.code === 200) {
|
||||||
|
surgeryList.value = res.data?.records || []
|
||||||
|
} else {
|
||||||
|
proxy.$modal.msgError(res.msg || '数据加载失败,请稍后重试')
|
||||||
|
surgeryList.value = []
|
||||||
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error('获取手术列表失败:', error)
|
console.error('获取手术列表失败:', error)
|
||||||
proxy.$modal.msgError('数据加载失败,请稍后重试')
|
proxy.$modal.msgError('数据加载失败,请稍后重试')
|
||||||
@@ -1127,12 +1138,12 @@ function submitForm() {
|
|||||||
// 新增手术
|
// 新增手术
|
||||||
addSurgery(form.value).then((res) => {
|
addSurgery(form.value).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
proxy.$modal.msgSuccess(res.msg || '新增成功')
|
proxy.$modal.msgSuccess('手术申请提交成功!')
|
||||||
// 保存麻醉方式
|
// 保存麻醉方式
|
||||||
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
|
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
|
||||||
open.value = false
|
open.value = false
|
||||||
getList()
|
getList() // 提交成功后直接刷新列表
|
||||||
emit('saved') // 🔧 触发保存事件,通知父组件刷新医嘱列表
|
emit('saved') // 通知父组件刷新医嘱列表
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError(res.msg || '新增手术失败,请检查表单信息')
|
proxy.$modal.msgError(res.msg || '新增手术失败,请检查表单信息')
|
||||||
}
|
}
|
||||||
@@ -1144,12 +1155,12 @@ function submitForm() {
|
|||||||
// 修改手术
|
// 修改手术
|
||||||
updateSurgery(form.value).then((res) => {
|
updateSurgery(form.value).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
proxy.$modal.msgSuccess(res.msg || '修改成功')
|
proxy.$modal.msgSuccess('手术申请修改成功!')
|
||||||
// 保存麻醉方式
|
// 保存麻醉方式
|
||||||
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
|
sessionStorage.setItem('anesthesiaType', form.value.anesthesiaTypeEnum)
|
||||||
open.value = false
|
open.value = false
|
||||||
getList()
|
getList() // 修改成功后直接刷新列表
|
||||||
emit('saved') // 🔧 触发保存事件,通知父组件刷新医嘱列表
|
emit('saved') // 通知父组件刷新医嘱列表
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError(res.msg || '更新手术失败,请检查表单信息')
|
proxy.$modal.msgError(res.msg || '更新手术失败,请检查表单信息')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,8 @@
|
|||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="医嘱" name="prescription">
|
<el-tab-pane label="医嘱" name="prescription">
|
||||||
<prescriptionlist :patientInfo="patientInfo" ref="prescriptionRef" :activeTab="activeTab"
|
<prescriptionlist :patientInfo="patientInfo" ref="prescriptionRef" :activeTab="activeTab"
|
||||||
:outpatientEmrSaved="outpatientEmrSaved" />
|
:outpatientEmrSaved="outpatientEmrSaved"
|
||||||
|
@inspectionListRefresh="refreshInspectionListFromAdvice" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="中医" name="tcm">
|
<el-tab-pane label="中医" name="tcm">
|
||||||
<tcmAdvice :patientInfo="patientInfo" ref="tcmRef" />
|
<tcmAdvice :patientInfo="patientInfo" ref="tcmRef" />
|
||||||
@@ -152,7 +153,7 @@
|
|||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="手术申请" name="surgery">
|
<el-tab-pane label="手术申请" name="surgery">
|
||||||
<surgeryApplication :patientInfo="patientInfo" :activeTab="activeTab" ref="surgeryRef"
|
<surgeryApplication :patientInfo="patientInfo" :activeTab="activeTab" ref="surgeryRef"
|
||||||
@saved="() => prescriptionRef?.getListInfo()" />
|
@saved="() => { prescriptionRef?.getListInfo(); surgeryRef?.getList() }" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="电子处方" name="eprescription">
|
<el-tab-pane label="电子处方" name="eprescription">
|
||||||
<eprescriptionlist :patientInfo="patientInfo" ref="eprescriptionRef" />
|
<eprescriptionlist :patientInfo="patientInfo" ref="eprescriptionRef" />
|
||||||
@@ -312,6 +313,9 @@ const patientDrawerRef = ref();
|
|||||||
const prescriptionRef = ref();
|
const prescriptionRef = ref();
|
||||||
const tcmRef = ref();
|
const tcmRef = ref();
|
||||||
const inspectionRef = ref();
|
const inspectionRef = ref();
|
||||||
|
function refreshInspectionListFromAdvice() {
|
||||||
|
inspectionRef.value?.getList?.();
|
||||||
|
}
|
||||||
const examinationRef = ref();
|
const examinationRef = ref();
|
||||||
const surgeryRef = ref();
|
const surgeryRef = ref();
|
||||||
const emrRef = ref();
|
const emrRef = ref();
|
||||||
|
|||||||
@@ -151,23 +151,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-dialog
|
<InfectiousDiseaseReportDialog
|
||||||
v-model="detailVisible"
|
ref="infectiousDiseaseReportRef"
|
||||||
:title="detailMode === 'view' ? '报卡详情 - 中华人民共和国传染病报告卡' : '编辑报卡 - 中华人民共和国传染病报告卡'"
|
:read-only="detailMode === 'view'"
|
||||||
width="1100px"
|
@success="detailVisible = false"
|
||||||
destroy-on-close
|
@close="detailVisible = false"
|
||||||
class="card-detail-dialog"
|
/>
|
||||||
>
|
|
||||||
<InfectiousReport
|
|
||||||
:mode=" detailMode"
|
|
||||||
:card-data="currentCard"
|
|
||||||
@submit-edit="handleSaveEdit"
|
|
||||||
style="max-height: 75vh; overflow-y: auto;"
|
|
||||||
/>
|
|
||||||
<template #footer>
|
|
||||||
<el-button @click="detailVisible = false">关闭</el-button>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -175,7 +164,7 @@
|
|||||||
import { ref, reactive, onMounted, onActivated, onBeforeUnmount, nextTick, computed } from 'vue';
|
import { ref, reactive, onMounted, onActivated, onBeforeUnmount, nextTick, computed } from 'vue';
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||||
import { DataAnalysis, Warning, CircleCheck, Check, RefreshRight } from '@element-plus/icons-vue';
|
import { DataAnalysis, Warning, CircleCheck, Check, RefreshRight } from '@element-plus/icons-vue';
|
||||||
import InfectiousReport from '../components/infectiousReport/index.vue';
|
import InfectiousDiseaseReportDialog from '../components/diagnosis/infectiousDiseaseReportDialog.vue';
|
||||||
import {
|
import {
|
||||||
getDoctorCardStatistics,
|
getDoctorCardStatistics,
|
||||||
getDoctorCardList,
|
getDoctorCardList,
|
||||||
@@ -185,7 +174,6 @@ import {
|
|||||||
batchDeleteCards,
|
batchDeleteCards,
|
||||||
exportCardToWord,
|
exportCardToWord,
|
||||||
getCardDetail,
|
getCardDetail,
|
||||||
updateDoctorCard,
|
|
||||||
} from './api';
|
} from './api';
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
@@ -211,7 +199,7 @@ const queryParams = reactive({
|
|||||||
|
|
||||||
const detailVisible = ref(false);
|
const detailVisible = ref(false);
|
||||||
const detailMode = ref('view');
|
const detailMode = ref('view');
|
||||||
const currentCard = ref({});
|
const infectiousDiseaseReportRef = ref(null);
|
||||||
|
|
||||||
// 计算表格高度:根据视口高度动态调整
|
// 计算表格高度:根据视口高度动态调整
|
||||||
const tableHeight = computed(() => {
|
const tableHeight = computed(() => {
|
||||||
@@ -327,9 +315,11 @@ async function handleView(row) {
|
|||||||
try {
|
try {
|
||||||
const res = await getCardDetail(row.cardNo);
|
const res = await getCardDetail(row.cardNo);
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
currentCard.value = res.data || {};
|
|
||||||
detailMode.value = 'view';
|
detailMode.value = 'view';
|
||||||
detailVisible.value = true;
|
detailVisible.value = true;
|
||||||
|
nextTick(() => {
|
||||||
|
infectiousDiseaseReportRef.value?.showReport(res.data || {});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
ElMessage.error('获取详情失败');
|
ElMessage.error('获取详情失败');
|
||||||
@@ -340,57 +330,17 @@ async function handleEdit(row) {
|
|||||||
try {
|
try {
|
||||||
const res = await getCardDetail(row.cardNo);
|
const res = await getCardDetail(row.cardNo);
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
currentCard.value = res.data || {};
|
|
||||||
detailMode.value = 'edit';
|
detailMode.value = 'edit';
|
||||||
detailVisible.value = true;
|
detailVisible.value = true;
|
||||||
|
nextTick(() => {
|
||||||
|
infectiousDiseaseReportRef.value?.showReport(res.data || {}, false);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
ElMessage.error('获取详情失败');
|
ElMessage.error('获取详情失败');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleSaveEdit(submitData) {
|
|
||||||
// submitData 来自 InfectiousReport 组件的 submit-edit 事件
|
|
||||||
try {
|
|
||||||
const updateData = {
|
|
||||||
cardNo: submitData.cardNo,
|
|
||||||
phone: submitData.phone,
|
|
||||||
contactPhone: submitData.contactPhone,
|
|
||||||
onsetDate: submitData.onsetDate,
|
|
||||||
diagDate: submitData.diagDate,
|
|
||||||
diseaseCode: submitData.diseaseCode,
|
|
||||||
diseaseType: submitData.diseaseType,
|
|
||||||
otherDisease: submitData.otherDisease,
|
|
||||||
caseClass: submitData.caseClass,
|
|
||||||
occupation: submitData.occupation,
|
|
||||||
patientBelong: submitData.patientBelong,
|
|
||||||
addressProv: submitData.addressProv,
|
|
||||||
addressCity: submitData.addressCity,
|
|
||||||
addressCounty: submitData.addressCounty,
|
|
||||||
addressTown: submitData.addressTown,
|
|
||||||
addressVillage: submitData.addressVillage,
|
|
||||||
addressHouse: submitData.addressHouse,
|
|
||||||
workplace: submitData.workplace,
|
|
||||||
parentName: submitData.parentName,
|
|
||||||
deathDate: submitData.deathDate,
|
|
||||||
correctName: submitData.correctName,
|
|
||||||
withdrawReason: submitData.withdrawReason,
|
|
||||||
remark: submitData.remark,
|
|
||||||
};
|
|
||||||
|
|
||||||
const res = await updateDoctorCard(updateData);
|
|
||||||
if (res.code === 200) {
|
|
||||||
ElMessage.success('保存成功');
|
|
||||||
detailVisible.value = false;
|
|
||||||
getList();
|
|
||||||
} else {
|
|
||||||
ElMessage.error(res.msg || '保存失败');
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
ElMessage.error('保存失败:' + (error.message || '网络错误'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleSubmit(row) {
|
async function handleSubmit(row) {
|
||||||
try {
|
try {
|
||||||
await ElMessageBox.confirm('确认提交该报卡?', '提示', {
|
await ElMessageBox.confirm('确认提交该报卡?', '提示', {
|
||||||
@@ -800,17 +750,4 @@ function handleResize() {
|
|||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 报卡详情弹窗 */
|
|
||||||
:deep(.card-detail-dialog .el-dialog__body) {
|
|
||||||
padding: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.card-detail-dialog .infectious-report-container) {
|
|
||||||
padding: 16px;
|
|
||||||
height: auto;
|
|
||||||
max-height: 70vh;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@@ -51,7 +51,7 @@ const currentSelectRow = ref<any>({});
|
|||||||
const queryParams = ref({
|
const queryParams = ref({
|
||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
adviceTypes: '1,2,3,6',
|
adviceTypes: [1, 2, 3, 6],
|
||||||
searchKey: '',
|
searchKey: '',
|
||||||
organizationId: '',
|
organizationId: '',
|
||||||
categoryCode: '',
|
categoryCode: '',
|
||||||
@@ -88,10 +88,10 @@ const tableColumns = computed<TableColumn[]>(() => [
|
|||||||
function refresh(adviceType: any, categoryCode: string, searchKey: string) {
|
function refresh(adviceType: any, categoryCode: string, searchKey: string) {
|
||||||
// 有搜索词时跨类型搜索,避免用户输入"级护理"但因当前adviceType为药品而搜不到诊疗类护理项目
|
// 有搜索词时跨类型搜索,避免用户输入"级护理"但因当前adviceType为药品而搜不到诊疗类护理项目
|
||||||
if (searchKey) {
|
if (searchKey) {
|
||||||
queryParams.value.adviceTypes = '1,2,3,6';
|
queryParams.value.adviceTypes = [1, 2, 3, 6];
|
||||||
} else {
|
} else {
|
||||||
queryParams.value.adviceTypes =
|
queryParams.value.adviceTypes =
|
||||||
adviceType !== undefined && adviceType !== '' ? String(adviceType) : '1,2,3,6';
|
adviceType !== undefined && adviceType !== '' ? [parseInt(adviceType)] : [1, 2, 3, 6];
|
||||||
}
|
}
|
||||||
queryParams.value.categoryCode = categoryCode || '';
|
queryParams.value.categoryCode = categoryCode || '';
|
||||||
queryParams.value.searchKey = searchKey || '';
|
queryParams.value.searchKey = searchKey || '';
|
||||||
@@ -131,7 +131,8 @@ function getList() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((err) => {
|
||||||
|
console.warn('医嘱基础信息加载失败:', err);
|
||||||
adviceBaseList.value = [];
|
adviceBaseList.value = [];
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
|||||||
@@ -44,6 +44,17 @@ export function getSurgery(queryParams) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询手术申请单(全局,不需要encounterId,用于门诊手术安排查找弹窗)
|
||||||
|
*/
|
||||||
|
export function getSurgeryPage(queryParams) {
|
||||||
|
return request({
|
||||||
|
url: '/reg-doctorstation/request-form/get-surgery-page',
|
||||||
|
method: 'get',
|
||||||
|
params: queryParams,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询护理医嘱信息
|
* 查询护理医嘱信息
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -49,6 +49,15 @@
|
|||||||
<el-option label="已作废" value="7" />
|
<el-option label="已作废" value="7" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="关键字">
|
||||||
|
<el-input
|
||||||
|
v-model="filterForm.keyword"
|
||||||
|
placeholder="申请单号 / 检查项目名称"
|
||||||
|
clearable
|
||||||
|
style="width: 220px"
|
||||||
|
@keyup.enter="handleSearch"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="handleSearch" :loading="loading">
|
<el-button type="primary" @click="handleSearch" :loading="loading">
|
||||||
<el-icon><Search /></el-icon>
|
<el-icon><Search /></el-icon>
|
||||||
@@ -77,18 +86,53 @@
|
|||||||
</template>
|
</template>
|
||||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||||
<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 label="申请单名称" width="140">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ buildApplicationName(scope.row) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<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">
|
||||||
<span>{{ parseStatus(scope.row.status) }}</span>
|
<el-tag :type="getStatusTagType(scope.row.status)" effect="plain" round>
|
||||||
|
{{ parseStatus(scope.row.status) }}
|
||||||
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" fixed="right">
|
<el-table-column label="操作" width="280" align="center" fixed="right">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
<!-- 详情 - 所有状态都显示 -->
|
||||||
<el-button link type="primary" @click="handleViewDetail(scope.row)">详情</el-button>
|
<el-button link type="primary" @click="handleViewDetail(scope.row)">详情</el-button>
|
||||||
|
<!-- 待签发:修改、删除 -->
|
||||||
|
<template v-if="scope.row.status === '0' || scope.row.status === 0">
|
||||||
|
<el-button link type="primary" @click="handleEdit(scope.row)">修改</el-button>
|
||||||
|
<el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
<!-- 已签发:撤回 -->
|
||||||
|
<template v-else-if="scope.row.status === '1' || scope.row.status === 1">
|
||||||
|
<el-button link type="warning" @click="handleRecall(scope.row)">撤回</el-button>
|
||||||
|
</template>
|
||||||
|
<!-- 已校对/待接收:打印 -->
|
||||||
|
<template v-else-if="scope.row.status === '2' || scope.row.status === 2 || scope.row.status === '3' || scope.row.status === 3">
|
||||||
|
<el-button link type="primary" @click="handlePrint(scope.row)">打印</el-button>
|
||||||
|
</template>
|
||||||
|
<!-- 已接收/已检查:看报告 -->
|
||||||
|
<template v-else-if="scope.row.status === '4' || scope.row.status === 4 || scope.row.status === '5' || scope.row.status === 5">
|
||||||
|
<el-button link type="success" @click="handleViewReport(scope.row)">看报告</el-button>
|
||||||
|
</template>
|
||||||
|
<!-- 已出报告:打印、看报告 -->
|
||||||
|
<template v-else-if="scope.row.status === '6' || scope.row.status === 6">
|
||||||
|
<el-button link type="primary" @click="handlePrint(scope.row)">打印</el-button>
|
||||||
|
<el-button link type="success" @click="handleViewReport(scope.row)">看报告</el-button>
|
||||||
|
</template>
|
||||||
|
<!-- 已作废:无额外按钮 -->
|
||||||
|
<template v-else-if="scope.row.status === '7' || scope.row.status === 7">
|
||||||
|
</template>
|
||||||
|
<!-- 其他/未知状态:仅详情 -->
|
||||||
|
<template v-else>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -118,7 +162,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="申请者">{{
|
||||||
@@ -137,7 +181,7 @@
|
|||||||
<el-descriptions title="申请单描述" :column="2">
|
<el-descriptions title="申请单描述" :column="2">
|
||||||
<template v-for="(value, key) in descJsonData" :key="key">
|
<template v-for="(value, key) in descJsonData" :key="key">
|
||||||
<el-descriptions-item v-if="isFieldMatched(key)" :label="getFieldLabel(key)">
|
<el-descriptions-item v-if="isFieldMatched(key)" :label="getFieldLabel(key)">
|
||||||
{{ value || '-' }}
|
{{ transformField(key, value) || '-' }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
</template>
|
</template>
|
||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
@@ -160,15 +204,102 @@
|
|||||||
<el-button @click="detailDialogVisible = false">关闭</el-button>
|
<el-button @click="detailDialogVisible = false">关闭</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 修改申请单弹窗 - 复用检查申请单组件 -->
|
||||||
|
<el-dialog
|
||||||
|
v-model="editDialogVisible"
|
||||||
|
title="修改检查申请"
|
||||||
|
width="1200px"
|
||||||
|
destroy-on-close
|
||||||
|
top="5vh"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
>
|
||||||
|
<MedicalExaminations
|
||||||
|
v-if="editDialogVisible"
|
||||||
|
ref="editFormRef"
|
||||||
|
:is-edit-mode="true"
|
||||||
|
:edit-data="editingRow"
|
||||||
|
:external-patient-info="patientInfo"
|
||||||
|
/>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="editDialogVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="handleEditSubmit">确认</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 查看报告弹窗 -->
|
||||||
|
<el-dialog
|
||||||
|
v-model="reportDialogVisible"
|
||||||
|
:title="'检查报告 - ' + (reportData?.prescriptionNo || '')"
|
||||||
|
width="900px"
|
||||||
|
destroy-on-close
|
||||||
|
top="5vh"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
>
|
||||||
|
<div v-loading="reportLoading" class="report-viewer">
|
||||||
|
<!-- 报告基本信息 -->
|
||||||
|
<div v-if="reportData" class="report-viewer-container">
|
||||||
|
<el-descriptions title="报告信息" :column="2" border size="small">
|
||||||
|
<el-descriptions-item label="患者姓名">{{ reportData.patientName || reportRow?.patientName || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="申请单号">{{ reportData.prescriptionNo || reportRow?.prescriptionNo || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="申请单名称">{{ reportData.name || reportRow?.name || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="报告时间">{{ reportData.reportTime || '-' }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="诊断意见" :span="2">{{ reportData.diagnosis || reportData.conclusion || '-' }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
|
||||||
|
<!-- 报告详细内容 -->
|
||||||
|
<div v-if="reportData.content" class="report-content-section">
|
||||||
|
<div class="section-title">报告内容</div>
|
||||||
|
<div class="report-content-text">{{ reportData.content }}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 影像预览 - PACS链接 -->
|
||||||
|
<div v-if="reportData.imageUrl || reportData.pacsUrl" class="report-image-section">
|
||||||
|
<div class="section-title">
|
||||||
|
影像预览
|
||||||
|
<el-button
|
||||||
|
v-if="reportData.imageUrl || reportData.pacsUrl"
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
plain
|
||||||
|
style="margin-left: 12px;"
|
||||||
|
@click="openPacsLink"
|
||||||
|
>
|
||||||
|
<el-icon><Link /></el-icon>
|
||||||
|
打开PACS影像
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<iframe
|
||||||
|
v-if="reportData.imageUrl"
|
||||||
|
:src="reportData.imageUrl"
|
||||||
|
class="report-iframe"
|
||||||
|
frameborder="0"
|
||||||
|
/>
|
||||||
|
<el-empty v-else-if="!reportData.imageUrl && reportData.pacsUrl" description="点击上方按钮打开PACS影像" :image-size="60" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 完全无数据时的提示 -->
|
||||||
|
<el-empty v-if="!reportData.content && !reportData.imageUrl && !reportData.pacsUrl" description="暂无详细报告数据" :image-size="60" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 未获取到报告 -->
|
||||||
|
<el-empty v-else description="暂未生成报告" :image-size="80" />
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="reportDialogVisible = false">关闭</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {computed, getCurrentInstance, ref, watch} from 'vue';
|
import {computed, getCurrentInstance, ref, watch, nextTick} from 'vue';
|
||||||
import {Refresh, Search} from '@element-plus/icons-vue';
|
import {Refresh, Search, Link} from '@element-plus/icons-vue';
|
||||||
import {patientInfo} from '../../store/patient.js';
|
import {patientInfo} from '../../store/patient.js';
|
||||||
import {getCheck} from './api';
|
import {getCheck, deleteRequestForm, withdrawRequestForm, getTestResult} from './api';
|
||||||
import {getOrgList} from '@/views/doctorstation/components/api.js';
|
import {getDepartmentList} from '@/api/public.js';
|
||||||
|
import {getApplicationList, saveCheckd} from '../order/applicationForm/api';
|
||||||
|
import MedicalExaminations from '../order/applicationForm/medicalExaminations.vue';
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
|
|
||||||
@@ -178,11 +309,38 @@ const detailDialogVisible = ref(false);
|
|||||||
const currentDetail = ref(null);
|
const currentDetail = ref(null);
|
||||||
const descJsonData = ref(null);
|
const descJsonData = ref(null);
|
||||||
const orgOptions = ref([]);
|
const orgOptions = ref([]);
|
||||||
|
const editForm = ref({
|
||||||
|
name: '',
|
||||||
|
targetDepartment: '',
|
||||||
|
symptom: '',
|
||||||
|
sign: '',
|
||||||
|
clinicalDiagnosis: '',
|
||||||
|
otherDiagnosis: '',
|
||||||
|
relatedResult: '',
|
||||||
|
attention: '',
|
||||||
|
examinationPurpose: '',
|
||||||
|
medicalHistorySummary: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
// 报告弹窗相关
|
||||||
|
const reportDialogVisible = ref(false);
|
||||||
|
const reportLoading = ref(false);
|
||||||
|
const reportData = ref(null);
|
||||||
|
const reportRow = ref(null);
|
||||||
|
|
||||||
|
// 获取近7天的日期范围作为默认值
|
||||||
|
const getDefaultDateRange = () => {
|
||||||
|
const now = new Date();
|
||||||
|
const endDate = now.toISOString().split('T')[0];
|
||||||
|
const startDate = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0];
|
||||||
|
return [startDate, endDate];
|
||||||
|
};
|
||||||
|
|
||||||
// 筛选表单数据
|
// 筛选表单数据
|
||||||
const filterForm = ref({
|
const filterForm = ref({
|
||||||
dateRange: [], // [startDate, endDate]
|
dateRange: getDefaultDateRange(), // 默认近一周
|
||||||
status: '', // 申请单状态
|
status: '', // 申请单状态
|
||||||
|
keyword: '', // 关键字搜索
|
||||||
});
|
});
|
||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
@@ -207,11 +365,18 @@ const fetchData = async () => {
|
|||||||
params.status = filterForm.value.status;
|
params.status = filterForm.value.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加关键字搜索
|
||||||
|
if (filterForm.value.keyword && filterForm.value.keyword.trim()) {
|
||||||
|
params.keyword = filterForm.value.keyword.trim();
|
||||||
|
}
|
||||||
|
|
||||||
const res = await getCheck(params);
|
const res = await getCheck(params);
|
||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data) {
|
||||||
const raw = res.data?.records || res.data;
|
const raw = res.data?.records || res.data;
|
||||||
const list = Array.isArray(raw) ? raw : [raw];
|
const list = Array.isArray(raw) ? raw : [raw];
|
||||||
|
console.log('API返回的原始数据:', JSON.stringify(list, null, 2));
|
||||||
tableData.value = list.filter(Boolean);
|
tableData.value = list.filter(Boolean);
|
||||||
|
console.log('tableData设置后的第一条:', tableData.value[0]);
|
||||||
} else {
|
} else {
|
||||||
tableData.value = [];
|
tableData.value = [];
|
||||||
}
|
}
|
||||||
@@ -243,8 +408,9 @@ const handleSearch = async () => {
|
|||||||
* 重置按钮处理
|
* 重置按钮处理
|
||||||
*/
|
*/
|
||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
filterForm.value.dateRange = [];
|
filterForm.value.dateRange = getDefaultDateRange();
|
||||||
filterForm.value.status = '';
|
filterForm.value.status = '';
|
||||||
|
filterForm.value.keyword = '';
|
||||||
fetchData();
|
fetchData();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -267,9 +433,51 @@ const parseStatus = (status) => {
|
|||||||
return statusMap[String(status)] || '-';
|
return statusMap[String(status)] || '-';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据申请单详情构建申请单名称
|
||||||
|
* 单一项目:显示项目名称
|
||||||
|
* 多个项目:显示首个项目名称+"等X项"
|
||||||
|
*/
|
||||||
|
const buildApplicationName = (row) => {
|
||||||
|
const details = row.requestFormDetailList;
|
||||||
|
if (!details || details.length === 0) {
|
||||||
|
return row.name || '-';
|
||||||
|
}
|
||||||
|
if (details.length === 1) {
|
||||||
|
return details[0].adviceName || row.name || '-';
|
||||||
|
}
|
||||||
|
const first = details[0];
|
||||||
|
return `${first.adviceName || ''}等${details.length}项`;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取状态标签类型 - 参考临床医嘱样式
|
||||||
|
* @param {string|number} status - 状态码
|
||||||
|
* @returns {string} el-tag type
|
||||||
|
*/
|
||||||
|
const getStatusTagType = (status) => {
|
||||||
|
const typeMap = {
|
||||||
|
'0': 'primary', // 待签发 - 蓝色
|
||||||
|
'1': 'success', // 已签发 - 绿色
|
||||||
|
'2': 'success', // 已校对 - 绿色
|
||||||
|
'3': 'primary', // 待接收 - 蓝色
|
||||||
|
'4': 'primary', // 已接收 - 蓝色
|
||||||
|
'5': 'success', // 已检查 - 绿色
|
||||||
|
'6': 'success', // 已出报告 - 绿色
|
||||||
|
'7': 'danger', // 已作废 - 红色
|
||||||
|
};
|
||||||
|
return typeMap[String(status)] || 'info';
|
||||||
|
};
|
||||||
|
|
||||||
const labelMap = {
|
const labelMap = {
|
||||||
categoryType: '项目类别',
|
categoryType: '项目类别',
|
||||||
targetDepartment: '发往科室',
|
targetDepartment: '发往科室',
|
||||||
|
urgencyLevel: '紧急程度',
|
||||||
|
allergyHistory: '过敏史',
|
||||||
|
examinationPurpose: '检查目的',
|
||||||
|
expectedExaminationTime: '期望检查时间',
|
||||||
|
medicalHistorySummary: '病史摘要',
|
||||||
|
allergyConfirmed: '过敏确认',
|
||||||
symptom: '症状',
|
symptom: '症状',
|
||||||
sign: '体征',
|
sign: '体征',
|
||||||
clinicalDiagnosis: '临床诊断',
|
clinicalDiagnosis: '临床诊断',
|
||||||
@@ -278,6 +486,17 @@ const labelMap = {
|
|||||||
attention: '注意事项',
|
attention: '注意事项',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Fields that need value transformation before display
|
||||||
|
const transformField = (key, value) => {
|
||||||
|
if (key === 'urgencyLevel') {
|
||||||
|
return value === 'emergency' ? '急诊' : '普通';
|
||||||
|
}
|
||||||
|
if (key === 'allergyConfirmed') {
|
||||||
|
return value === true || value === 'true' ? '已口头确认' : '未确认';
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
};
|
||||||
|
|
||||||
const isFieldMatched = (key) => {
|
const isFieldMatched = (key) => {
|
||||||
return key in labelMap;
|
return key in labelMap;
|
||||||
};
|
};
|
||||||
@@ -292,39 +511,68 @@ const hasMatchedFields = computed(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
/** 查询科室 */
|
/** 查询科室 */
|
||||||
const getLocationInfo = () => {
|
const getLocationInfo = async () => {
|
||||||
getOrgList().then((res) => {
|
try {
|
||||||
orgOptions.value = res.data.records;
|
const res = await getDepartmentList();
|
||||||
});
|
orgOptions.value = Array.isArray(res.data) ? res.data : [];
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('科室列表加载失败:', e.message);
|
||||||
|
orgOptions.value = [];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 递归查找树形科室节点
|
||||||
|
const findTreeItem = (list, id) => {
|
||||||
|
if (!list || list.length === 0) return null;
|
||||||
|
for (const item of list) {
|
||||||
|
if (item.id == id) return item;
|
||||||
|
if (item.children && item.children.length > 0) {
|
||||||
|
const found = findTreeItem(item.children, id);
|
||||||
|
if (found) return found;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const recursionFun = (targetDepartment) => {
|
const recursionFun = (targetDepartment) => {
|
||||||
|
if (!targetDepartment) return '';
|
||||||
let name = '';
|
let name = '';
|
||||||
for (let index = 0; index < orgOptions.value.length; index++) {
|
for (let index = 0; index < orgOptions.value.length; index++) {
|
||||||
const obj = orgOptions.value[index];
|
const obj = orgOptions.value[index];
|
||||||
if (obj.id == targetDepartment) {
|
if (obj.id == targetDepartment) {
|
||||||
name = obj.name;
|
name = obj.name;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
const subObjArray = obj['children'];
|
const subObjArray = obj['children'];
|
||||||
for (let index = 0; index < subObjArray.length; index++) {
|
if (subObjArray && subObjArray.length > 0) {
|
||||||
const item = subObjArray[index];
|
for (let i = 0; i < subObjArray.length; i++) {
|
||||||
if (item.id == targetDepartment) {
|
const item = subObjArray[i];
|
||||||
name = item.name;
|
if (item.id == targetDepartment) {
|
||||||
|
name = item.name;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (name) break;
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleViewDetail = (row) => {
|
const handleViewDetail = async (row) => {
|
||||||
console.log('targetDepartment========>', JSON.stringify(row));
|
// 确保科室数据已加载,以便将 ID 解析为名称
|
||||||
|
if (!orgOptions.value || orgOptions.value.length === 0) {
|
||||||
|
await getLocationInfo();
|
||||||
|
}
|
||||||
|
|
||||||
currentDetail.value = row;
|
currentDetail.value = row;
|
||||||
// 解析 descJson
|
// 解析 descJson
|
||||||
if (row.descJson) {
|
if (row.descJson) {
|
||||||
try {
|
try {
|
||||||
const obj = JSON.parse(row.descJson);
|
const obj = JSON.parse(row.descJson);
|
||||||
obj.targetDepartment = recursionFun(obj.targetDepartment);
|
// 将发往科室 ID 转换为名称
|
||||||
|
if (obj.targetDepartment) {
|
||||||
|
obj.targetDepartment = recursionFun(obj.targetDepartment);
|
||||||
|
}
|
||||||
descJsonData.value = obj;
|
descJsonData.value = obj;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('解析 descJson 失败:', e);
|
console.error('解析 descJson 失败:', e);
|
||||||
@@ -336,6 +584,395 @@ const handleViewDetail = (row) => {
|
|||||||
detailDialogVisible.value = true;
|
detailDialogVisible.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除申请单 - 仅待签发状态可用
|
||||||
|
*/
|
||||||
|
const handleDelete = async (row) => {
|
||||||
|
try {
|
||||||
|
await proxy.$modal?.confirm?.('确认删除该检查申请单?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
});
|
||||||
|
const res = await deleteRequestForm({ requestFormId: row.requestFormId });
|
||||||
|
if (res.code === 200) {
|
||||||
|
proxy.$modal?.msgSuccess?.('删除成功');
|
||||||
|
fetchData();
|
||||||
|
} else {
|
||||||
|
proxy.$modal?.msgError?.(res.msg || '删除失败');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// 用户取消操作,不做处理
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 撤回申请单 - 仅已签发状态可用
|
||||||
|
*/
|
||||||
|
const handleRecall = async (row) => {
|
||||||
|
try {
|
||||||
|
await proxy.$modal?.confirm?.('确认撤回该申请单?撤回后状态将变更为"待签发"。', '提示', {
|
||||||
|
confirmButtonText: '确定撤回',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
});
|
||||||
|
const res = await withdrawRequestForm({ requestFormId: row.requestFormId });
|
||||||
|
if (res.code === 200) {
|
||||||
|
proxy.$modal?.msgSuccess?.('撤回成功');
|
||||||
|
fetchData();
|
||||||
|
} else {
|
||||||
|
proxy.$modal?.msgError?.(res.msg || '撤回失败');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// 用户取消操作,不做处理
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打印申请单 - 已校对/待接收/已接收/已检查状态可用
|
||||||
|
* 打印内容与详情展示一致,并包含申请单条码
|
||||||
|
*/
|
||||||
|
const handlePrint = async (row) => {
|
||||||
|
try {
|
||||||
|
proxy.$modal?.msgInfo?.('正在生成打印预览...');
|
||||||
|
|
||||||
|
// 确保科室数据已加载,用于解析发往科室名称
|
||||||
|
if (!orgOptions.value || orgOptions.value.length === 0) {
|
||||||
|
await new Promise((resolve) => {
|
||||||
|
getDepartmentList().then((res) => {
|
||||||
|
orgOptions.value = res.data || [];
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析 descJson
|
||||||
|
let descData = {};
|
||||||
|
if (row.descJson) {
|
||||||
|
try {
|
||||||
|
const obj = JSON.parse(row.descJson);
|
||||||
|
// 将发往科室ID转换为名称
|
||||||
|
if (obj.targetDepartment) {
|
||||||
|
obj.targetDepartment = recursionFun(obj.targetDepartment);
|
||||||
|
}
|
||||||
|
descData = obj;
|
||||||
|
} catch (e) {
|
||||||
|
console.error('解析 descJson 失败:', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建诊疗项目表格行
|
||||||
|
let detailRowsHtml = '';
|
||||||
|
const detailList = row.requestFormDetailList || [];
|
||||||
|
if (detailList.length > 0) {
|
||||||
|
detailList.forEach((item, index) => {
|
||||||
|
detailRowsHtml += `
|
||||||
|
<tr>
|
||||||
|
<td style="text-align:center;padding:6px 8px;border:1px solid #ddd;">${index + 1}</td>
|
||||||
|
<td style="padding:6px 8px;border:1px solid #ddd;">${item.adviceName || '-'}</td>
|
||||||
|
<td style="text-align:center;padding:6px 8px;border:1px solid #ddd;">${item.quantity || '-'}</td>
|
||||||
|
<td style="padding:6px 8px;border:1px solid #ddd;">${item.unitCode_dictText || '-'}</td>
|
||||||
|
<td style="text-align:right;padding:6px 8px;border:1px solid #ddd;">${item.totalPrice != null ? '¥' + Number(item.totalPrice).toFixed(2) : '-'}</td>
|
||||||
|
</tr>`;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建 descJson 字段行(与详情弹窗展示的字段一致)
|
||||||
|
const fieldKeys = ['targetDepartment', 'symptom', 'sign', 'clinicalDiagnosis', 'otherDiagnosis', 'relatedResult', 'attention'];
|
||||||
|
let descFieldsHtml = '';
|
||||||
|
fieldKeys.forEach((key) => {
|
||||||
|
const label = labelMap[key] || key;
|
||||||
|
if (descData[key] != null && descData[key] !== '') {
|
||||||
|
descFieldsHtml += `
|
||||||
|
<div class="info-row">
|
||||||
|
<span class="label">${label}:</span>
|
||||||
|
<span class="value">${descData[key]}</span>
|
||||||
|
</div>`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 构建完整打印HTML
|
||||||
|
const printContent = `
|
||||||
|
<div class="print-wrapper">
|
||||||
|
<!-- 标题 -->
|
||||||
|
<div class="print-header">
|
||||||
|
<div class="print-title">检查申请单</div>
|
||||||
|
<div class="print-meta">打印时间:${new Date().toLocaleString()}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 基本信息 -->
|
||||||
|
<div class="print-section">
|
||||||
|
<div class="section-title">基本信息</div>
|
||||||
|
<div class="info-grid">
|
||||||
|
<div class="info-row"><span class="label">患者姓名:</span><span class="value">${row.patientName || '-'}</span></div>
|
||||||
|
<div class="info-row"><span class="label">申请单名称:</span><span class="value">${row.name || '-'}</span></div>
|
||||||
|
<div class="info-row"><span class="label">申请单状态:</span><span class="value">${parseStatus(row.status)}</span></div>
|
||||||
|
<div class="info-row"><span class="label">创建时间:</span><span class="value">${row.createTime || '-'}</span></div>
|
||||||
|
<div class="info-row"><span class="label">申请单号:</span><span class="value">${row.prescriptionNo || '-'}</span></div>
|
||||||
|
<div class="info-row"><span class="label">申请者:</span><span class="value">${row.requesterId_dictText || '-'}</span></div>
|
||||||
|
<div class="info-row"><span class="label">就诊ID:</span><span class="value">${row.encounterId || '-'}</span></div>
|
||||||
|
<div class="info-row"><span class="label">申请单ID:</span><span class="value">${row.requestFormId || '-'}</span></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
${descFieldsHtml ? `
|
||||||
|
<!-- 申请单描述 -->
|
||||||
|
<div class="print-section">
|
||||||
|
<div class="section-title">申请单描述</div>
|
||||||
|
${descFieldsHtml}
|
||||||
|
</div>` : ''}
|
||||||
|
|
||||||
|
${detailRowsHtml ? `
|
||||||
|
<!-- 诊疗项目 -->
|
||||||
|
<div class="print-section">
|
||||||
|
<div class="section-title">诊疗项目</div>
|
||||||
|
<table class="detail-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width:50px;padding:8px;border:1px solid #ddd;background:#f5f7fa;text-align:center;">序号</th>
|
||||||
|
<th style="padding:8px;border:1px solid #ddd;background:#f5f7fa;text-align:left;">医嘱名称</th>
|
||||||
|
<th style="width:60px;padding:8px;border:1px solid #ddd;background:#f5f7fa;text-align:center;">数量</th>
|
||||||
|
<th style="width:60px;padding:8px;border:1px solid #ddd;background:#f5f7fa;text-align:center;">单位</th>
|
||||||
|
<th style="width:80px;padding:8px;border:1px solid #ddd;background:#f5f7fa;text-align:right;">总价</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>${detailRowsHtml}</tbody>
|
||||||
|
</table>
|
||||||
|
</div>` : ''}
|
||||||
|
|
||||||
|
<!-- 条码区 -->
|
||||||
|
<div class="barcode-section">
|
||||||
|
<div class="barcode-container">
|
||||||
|
<div class="barcode-number">${row.prescriptionNo || ''}</div>
|
||||||
|
<div class="barcode-label">申请单号 / 扫码核验</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="print-footer">
|
||||||
|
<div class="footer-line">本申请单仅供院内使用,请勿外传</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
// 打开新窗口打印
|
||||||
|
const printWindow = window.open('', '_blank');
|
||||||
|
if (!printWindow) {
|
||||||
|
proxy.$modal?.msgError?.('无法打开打印窗口,请检查浏览器弹窗设置');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
printWindow.document.write(`
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>检查申请单 - 打印</title>
|
||||||
|
<style>
|
||||||
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||||
|
body {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #333;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
.print-wrapper {
|
||||||
|
max-width: 210mm;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
.print-header {
|
||||||
|
text-align: center;
|
||||||
|
padding-bottom: 12px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
border-bottom: 2px solid #333;
|
||||||
|
}
|
||||||
|
.print-title {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: bold;
|
||||||
|
letter-spacing: 4px;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
.print-meta {
|
||||||
|
font-size: 11px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
.print-section {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
.section-title {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding-bottom: 4px;
|
||||||
|
border-bottom: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
.info-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 6px 16px;
|
||||||
|
}
|
||||||
|
.info-row {
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.8;
|
||||||
|
}
|
||||||
|
.info-row .label {
|
||||||
|
font-weight: 600;
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
.info-row .value {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.detail-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin-top: 6px;
|
||||||
|
}
|
||||||
|
.detail-table th {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
.detail-table td {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
.barcode-section {
|
||||||
|
margin-top: 24px;
|
||||||
|
padding-top: 16px;
|
||||||
|
border-top: 1px dashed #ccc;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.barcode-container {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 12px 24px;
|
||||||
|
border: 2px solid #333;
|
||||||
|
border-radius: 6px;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
.barcode-number {
|
||||||
|
font-family: 'Libre Barcode 128', 'Libre Barcode 39', 'Code128', 'C', monospace;
|
||||||
|
font-size: 42px;
|
||||||
|
letter-spacing: 4px;
|
||||||
|
color: #000;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
.barcode-label {
|
||||||
|
font-size: 10px;
|
||||||
|
color: #888;
|
||||||
|
margin-top: 4px;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
}
|
||||||
|
.print-footer {
|
||||||
|
margin-top: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.footer-line {
|
||||||
|
font-size: 10px;
|
||||||
|
color: #aaa;
|
||||||
|
}
|
||||||
|
@media print {
|
||||||
|
body { padding: 0; }
|
||||||
|
.print-wrapper { max-width: none; }
|
||||||
|
.barcode-section { page-break-inside: avoid; }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
${printContent}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
`);
|
||||||
|
|
||||||
|
printWindow.document.close();
|
||||||
|
// 等待内容渲染后打印
|
||||||
|
printWindow.onload = function() {
|
||||||
|
setTimeout(() => {
|
||||||
|
printWindow.print();
|
||||||
|
proxy.$modal?.closeAll?.();
|
||||||
|
}, 300);
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
console.error('打印失败:', error);
|
||||||
|
proxy.$modal?.msgError?.('打印失败: ' + (error.message || '未知错误'));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看报告 - 仅已出报告状态可用
|
||||||
|
* 调用报告查询接口,弹窗展示结构化报告或影像预览(PACS链接)
|
||||||
|
*/
|
||||||
|
const handleViewReport = async (row) => {
|
||||||
|
reportRow.value = row;
|
||||||
|
reportDialogVisible.value = true;
|
||||||
|
reportLoading.value = true;
|
||||||
|
reportData.value = null;
|
||||||
|
try {
|
||||||
|
const res = await getTestResult({ prescriptionNo: row.prescriptionNo });
|
||||||
|
if (res.code === 200) {
|
||||||
|
if (res.data) {
|
||||||
|
// 支持两种返回格式:
|
||||||
|
// 1. res.data 为对象(结构化报告):含 patientName, prescriptionNo, reportTime, diagnosis/content, imageUrl/pacsUrl
|
||||||
|
// 2. res.data 为字符串(报告URL):映射到 imageUrl 以支持iframe预览
|
||||||
|
if (typeof res.data === 'string') {
|
||||||
|
reportData.value = {
|
||||||
|
prescriptionNo: row.prescriptionNo,
|
||||||
|
imageUrl: res.data,
|
||||||
|
};
|
||||||
|
} else if (typeof res.data === 'object') {
|
||||||
|
reportData.value = {
|
||||||
|
...res.data,
|
||||||
|
prescriptionNo: res.data.prescriptionNo || row.prescriptionNo,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reportData.value = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
reportData.value = null;
|
||||||
|
proxy.$modal?.msgWarning?.(res.msg || '暂未生成报告');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('获取报告失败:', e);
|
||||||
|
reportData.value = null;
|
||||||
|
proxy.$modal?.msgError?.('获取报告失败');
|
||||||
|
} finally {
|
||||||
|
reportLoading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打开PACS影像链接
|
||||||
|
*/
|
||||||
|
const openPacsLink = () => {
|
||||||
|
const url = reportData.value?.pacsUrl || reportData.value?.imageUrl;
|
||||||
|
if (url) {
|
||||||
|
window.open(url, '_blank');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// ========== 修改申请单相关 ==========
|
||||||
|
const editDialogVisible = ref(false);
|
||||||
|
const editFormRef = ref(null);
|
||||||
|
const editingRow = ref(null);
|
||||||
|
|
||||||
|
// 修改申请单 - 复用检查申请单弹窗
|
||||||
|
const handleEdit = (row) => {
|
||||||
|
editingRow.value = { ...row };
|
||||||
|
editDialogVisible.value = true;
|
||||||
|
// 弹窗打开后,手动调用getList确保数据加载
|
||||||
|
nextTick(() => {
|
||||||
|
editFormRef.value?.getList?.();
|
||||||
|
editFormRef.value?.getLocationInfo?.();
|
||||||
|
editFormRef.value?.getDiagnosisList?.();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 编辑弹窗确认提交
|
||||||
|
const handleEditSubmit = () => {
|
||||||
|
// 调用MedicalExaminations组件的submit方法
|
||||||
|
if (editFormRef.value?.submit) {
|
||||||
|
editFormRef.value.submit();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => patientInfo.value?.encounterId,
|
() => patientInfo.value?.encounterId,
|
||||||
(val) => {
|
(val) => {
|
||||||
@@ -344,8 +981,9 @@ watch(
|
|||||||
getLocationInfo();
|
getLocationInfo();
|
||||||
} else {
|
} else {
|
||||||
tableData.value = [];
|
tableData.value = [];
|
||||||
filterForm.value.dateRange = [];
|
filterForm.value.dateRange = getDefaultDateRange();
|
||||||
filterForm.value.status = '';
|
filterForm.value.status = '';
|
||||||
|
filterForm.value.keyword = '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
@@ -459,4 +1097,96 @@ defineExpose({
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 报告弹窗样式
|
||||||
|
.report-viewer {
|
||||||
|
min-height: 200px;
|
||||||
|
padding: 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-viewer-container {
|
||||||
|
.report-content-section {
|
||||||
|
margin-top: 16px;
|
||||||
|
padding: 12px;
|
||||||
|
background: #fafafa;
|
||||||
|
border-radius: 6px;
|
||||||
|
border: 1px solid #eee;
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
color: #303133;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-content-text {
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.8;
|
||||||
|
color: #606266;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-image-section {
|
||||||
|
margin-top: 16px;
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
color: #303133;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-iframe {
|
||||||
|
width: 100%;
|
||||||
|
height: 480px;
|
||||||
|
border: 1px solid #dcdfe6;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 状态标签样式 - 参考临床医嘱
|
||||||
|
:deep(.el-tag) {
|
||||||
|
border-radius: 2px;
|
||||||
|
padding: 0 8px;
|
||||||
|
height: 24px;
|
||||||
|
line-height: 22px;
|
||||||
|
font-size: 12px;
|
||||||
|
border-width: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-tag--info.is-plain) {
|
||||||
|
background: #f4f4f5;
|
||||||
|
border-color: #e9e9eb;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-tag--primary.is-plain) {
|
||||||
|
background: #ecf5ff;
|
||||||
|
border-color: #d9ecff;
|
||||||
|
color: #409eff;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-tag--success.is-plain) {
|
||||||
|
background: #f0f9eb;
|
||||||
|
border-color: #e1f3d8;
|
||||||
|
color: #67c23a;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-tag--warning.is-plain) {
|
||||||
|
background: #fdf6ec;
|
||||||
|
border-color: #faecd8;
|
||||||
|
color: #e6a23c;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-tag--danger.is-plain) {
|
||||||
|
background: #fef0f0;
|
||||||
|
border-color: #fde2e2;
|
||||||
|
color: #f56c6c;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -41,8 +41,6 @@
|
|||||||
<el-option label="全部" value="" />
|
<el-option label="全部" value="" />
|
||||||
<el-option label="待签发" value="0" />
|
<el-option label="待签发" value="0" />
|
||||||
<el-option label="已签发" value="1" />
|
<el-option label="已签发" value="1" />
|
||||||
<el-option label="已采集" value="2" />
|
|
||||||
<el-option label="已收样" value="3" />
|
|
||||||
<el-option label="报告已出" value="4" />
|
<el-option label="报告已出" value="4" />
|
||||||
<el-option label="已作废" value="5" />
|
<el-option label="已作废" value="5" />
|
||||||
</el-select>
|
</el-select>
|
||||||
@@ -84,7 +82,11 @@
|
|||||||
</template>
|
</template>
|
||||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||||
<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 label="申请单名称" width="140">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ buildApplicationName(scope.row) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<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 label="单据状态" width="100" align="center">
|
<el-table-column label="单据状态" width="100" align="center">
|
||||||
@@ -103,8 +105,15 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="requesterId_dictText" label="申请者" width="120" />
|
<el-table-column prop="requesterId_dictText" label="申请者" width="120" />
|
||||||
<el-table-column label="操作" align="center" fixed="right">
|
<el-table-column label="操作" align="center" fixed="right" width="160">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
<template v-if="scope.row.status == 0">
|
||||||
|
<el-button link type="primary" @click="handleEdit(scope.row)">修改</el-button>
|
||||||
|
<el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="scope.row.status == 1">
|
||||||
|
<el-button link type="warning" @click="handleWithdraw(scope.row)">撤回</el-button>
|
||||||
|
</template>
|
||||||
<el-button link type="primary" @click="handleViewDetail(scope.row)">详情</el-button>
|
<el-button link type="primary" @click="handleViewDetail(scope.row)">详情</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -132,7 +141,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="申请者">{{
|
||||||
@@ -174,6 +183,26 @@
|
|||||||
<el-button @click="detailDialogVisible = false">关闭</el-button>
|
<el-button @click="detailDialogVisible = false">关闭</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 编辑检验申请单弹窗 -->
|
||||||
|
<el-dialog
|
||||||
|
v-model="editDialogVisible"
|
||||||
|
title="编辑检验申请单"
|
||||||
|
width="1200px"
|
||||||
|
destroy-on-close
|
||||||
|
top="5vh"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
>
|
||||||
|
<LaboratoryTests
|
||||||
|
ref="editFormRef"
|
||||||
|
@submitOk="handleEditSubmitOk"
|
||||||
|
:editData="editRowData"
|
||||||
|
/>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="editDialogVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="submitEditForm">确认</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -181,14 +210,19 @@
|
|||||||
import {computed, getCurrentInstance, ref, watch} from 'vue';
|
import {computed, getCurrentInstance, ref, watch} from 'vue';
|
||||||
import {Refresh, Search} from '@element-plus/icons-vue';
|
import {Refresh, Search} from '@element-plus/icons-vue';
|
||||||
import {patientInfo} from '../../store/patient.js';
|
import {patientInfo} from '../../store/patient.js';
|
||||||
import {getInspection} from './api';
|
import {getInspection, deleteRequestForm, withdrawRequestForm} from './api';
|
||||||
import {getDepartmentList} from '@/api/public.js';
|
import {getDepartmentList} from '@/api/public.js';
|
||||||
|
import LaboratoryTests from '../order/applicationForm/laboratoryTests.vue';
|
||||||
|
import {saveInspection} from '../order/applicationForm/api.js';
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
|
|
||||||
const tableData = ref([]);
|
const tableData = ref([]);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const detailDialogVisible = ref(false);
|
const detailDialogVisible = ref(false);
|
||||||
|
const editDialogVisible = ref(false);
|
||||||
|
const editRowData = ref(null);
|
||||||
|
const editFormRef = ref(null);
|
||||||
const currentDetail = ref(null);
|
const currentDetail = ref(null);
|
||||||
const descJsonData = ref(null);
|
const descJsonData = ref(null);
|
||||||
const orgOptions = ref([]);
|
const orgOptions = ref([]);
|
||||||
@@ -280,6 +314,9 @@ const labelMap = {
|
|||||||
otherDiagnosis: '其他诊断',
|
otherDiagnosis: '其他诊断',
|
||||||
relatedResult: '相关结果',
|
relatedResult: '相关结果',
|
||||||
attention: '注意事项',
|
attention: '注意事项',
|
||||||
|
applicationType: '申请类型',
|
||||||
|
specimenName: '标本类型',
|
||||||
|
executeTime: '执行时间',
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -291,8 +328,6 @@ const parseBillStatus = (status) => {
|
|||||||
const statusMap = {
|
const statusMap = {
|
||||||
'0': '待签发',
|
'0': '待签发',
|
||||||
'1': '已签发',
|
'1': '已签发',
|
||||||
'2': '已采集',
|
|
||||||
'3': '已收样',
|
|
||||||
'4': '报告已出',
|
'4': '报告已出',
|
||||||
'5': '已作废',
|
'5': '已作废',
|
||||||
};
|
};
|
||||||
@@ -308,8 +343,8 @@ const parsePriorityCode = (descJson) => {
|
|||||||
if (!descJson) return '-';
|
if (!descJson) return '-';
|
||||||
try {
|
try {
|
||||||
const obj = JSON.parse(descJson);
|
const obj = JSON.parse(descJson);
|
||||||
// priorityCode: 0-普通, 1-急
|
// applicationType: 0-普通, 1-急诊
|
||||||
return obj.priorityCode === 1 ? '急' : '普通';
|
return obj.applicationType === 1 ? '急' : '普通';
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('解析 descJson 失败:', e);
|
console.error('解析 descJson 失败:', e);
|
||||||
return '-';
|
return '-';
|
||||||
@@ -333,6 +368,24 @@ const parseSpecimenType = (descJson) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据申请单详情构建申请单名称
|
||||||
|
* 单一项目:显示项目名称+数量
|
||||||
|
* 多个项目:显示首个项目名称+数量+"等X项"
|
||||||
|
*/
|
||||||
|
const buildApplicationName = (row) => {
|
||||||
|
const details = row.requestFormDetailList;
|
||||||
|
if (!details || details.length === 0) {
|
||||||
|
return row.name || '-';
|
||||||
|
}
|
||||||
|
if (details.length === 1) {
|
||||||
|
const item = details[0];
|
||||||
|
return `${item.adviceName}${item.quantity || ''}`;
|
||||||
|
}
|
||||||
|
const first = details[0];
|
||||||
|
return `${first.adviceName}${first.quantity || ''}等${details.length}项`;
|
||||||
|
};
|
||||||
|
|
||||||
const isFieldMatched = (key) => {
|
const isFieldMatched = (key) => {
|
||||||
return key in labelMap;
|
return key in labelMap;
|
||||||
};
|
};
|
||||||
@@ -353,11 +406,13 @@ const getLocationInfo = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const recursionFun = (targetDepartment) => {
|
const recursionFun = (targetDepartment) => {
|
||||||
|
if (!targetDepartment) return '';
|
||||||
let name = '';
|
let name = '';
|
||||||
for (let index = 0; index < orgOptions.value.length; index++) {
|
for (let index = 0; index < orgOptions.value.length; index++) {
|
||||||
const obj = orgOptions.value[index];
|
const obj = orgOptions.value[index];
|
||||||
if (obj.id == targetDepartment) {
|
if (obj.id == targetDepartment) {
|
||||||
name = obj.name;
|
name = obj.name;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
const subObjArray = obj['children'];
|
const subObjArray = obj['children'];
|
||||||
if (subObjArray && subObjArray.length > 0) {
|
if (subObjArray && subObjArray.length > 0) {
|
||||||
@@ -365,9 +420,11 @@ const recursionFun = (targetDepartment) => {
|
|||||||
const item = subObjArray[i];
|
const item = subObjArray[i];
|
||||||
if (item.id == targetDepartment) {
|
if (item.id == targetDepartment) {
|
||||||
name = item.name;
|
name = item.name;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (name) break;
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
};
|
};
|
||||||
@@ -384,8 +441,10 @@ const handleViewDetail = async (row) => {
|
|||||||
try {
|
try {
|
||||||
const obj = JSON.parse(row.descJson);
|
const obj = JSON.parse(row.descJson);
|
||||||
obj.targetDepartment = recursionFun(obj.targetDepartment);
|
obj.targetDepartment = recursionFun(obj.targetDepartment);
|
||||||
|
// 转换申请类型编码为可读文本
|
||||||
|
if (obj.applicationType === 0) obj.applicationType = '普通';
|
||||||
|
else if (obj.applicationType === 1) obj.applicationType = '急诊';
|
||||||
descJsonData.value = obj;
|
descJsonData.value = obj;
|
||||||
// descJsonData.value = JSON.parse(row.descJson);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('解析 descJson 失败:', e);
|
console.error('解析 descJson 失败:', e);
|
||||||
descJsonData.value = null;
|
descJsonData.value = null;
|
||||||
@@ -396,6 +455,83 @@ const handleViewDetail = async (row) => {
|
|||||||
detailDialogVisible.value = true;
|
detailDialogVisible.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改检验申请单(待签发状态)
|
||||||
|
*/
|
||||||
|
const handleEdit = async (row) => {
|
||||||
|
// 确保科室数据已加载
|
||||||
|
if (!orgOptions.value || orgOptions.value.length === 0) {
|
||||||
|
await getLocationInfo();
|
||||||
|
}
|
||||||
|
editRowData.value = row;
|
||||||
|
editDialogVisible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑弹窗提交成功回调
|
||||||
|
*/
|
||||||
|
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?.(`确定要删除申请单 "${row.prescriptionNo}" 吗?此操作不可恢复。`);
|
||||||
|
} 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 (e) {
|
||||||
|
proxy.$modal?.msgError?.(e.message || '删除异常');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 撤回检验申请单(已签发状态撤回至待签发)
|
||||||
|
*/
|
||||||
|
const handleWithdraw = async (row) => {
|
||||||
|
try {
|
||||||
|
await proxy.$modal?.confirm?.(`确定要撤回申请单 "${row.prescriptionNo}" 吗?撤回后将恢复为待签发状态。`);
|
||||||
|
} 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 (e) {
|
||||||
|
proxy.$modal?.msgError?.(e.message || '撤回异常');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => patientInfo.value?.encounterId,
|
() => patientInfo.value?.encounterId,
|
||||||
async (val) => {
|
async (val) => {
|
||||||
|
|||||||
@@ -568,6 +568,11 @@ function handleMaindise(value, index) {
|
|||||||
* 保存诊断
|
* 保存诊断
|
||||||
*/
|
*/
|
||||||
function handleSaveDiagnosis() {
|
function handleSaveDiagnosis() {
|
||||||
|
// 防止重复点击保存
|
||||||
|
if (isSaving.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
@@ -600,7 +605,7 @@ function handleSaveDiagnosis() {
|
|||||||
|
|
||||||
// 步骤2:重新分配连续的序号(从1开始)
|
// 步骤2:重新分配连续的序号(从1开始)
|
||||||
sortedList.forEach((item, index) => {
|
sortedList.forEach((item, index) => {
|
||||||
item.diagSrtNo = index + 1; // 这里是关键!把“诊断排序”改成新顺序
|
item.diagSrtNo = index + 1; // 这里是关键!把”诊断排序”改成新顺序
|
||||||
});
|
});
|
||||||
|
|
||||||
// 步骤3:提交排序后的数据
|
// 步骤3:提交排序后的数据
|
||||||
@@ -610,12 +615,12 @@ function handleSaveDiagnosis() {
|
|||||||
diagnosisChildList: sortedList,
|
diagnosisChildList: sortedList,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
// 步骤4:更新本地数据,使用全新对象防止响应式问题
|
|
||||||
form.value.diagnosisList = sortedList.map(item => ({ ...item }));
|
|
||||||
|
|
||||||
emits('diagnosisSave', false);
|
emits('diagnosisSave', false);
|
||||||
proxy.$modal.msgSuccess('诊断已保存');
|
proxy.$modal.msgSuccess('诊断已保存');
|
||||||
|
|
||||||
|
// 保存成功后从服务器重新加载数据,确保前后端数据一致
|
||||||
|
getList();
|
||||||
|
|
||||||
// 食源性疾病逻辑
|
// 食源性疾病逻辑
|
||||||
isFoodDiseasesNew({ encounterId: props.patientInfo.encounterId }).then((res2) => {
|
isFoodDiseasesNew({ encounterId: props.patientInfo.encounterId }).then((res2) => {
|
||||||
if (res2.code === 20 && res2.data) {
|
if (res2.code === 20 && res2.data) {
|
||||||
|
|||||||
@@ -112,6 +112,8 @@ const showApplicationFormDialog = (name) => {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
applicationFormName.value = components.value[name];
|
applicationFormName.value = components.value[name];
|
||||||
applicationFormDialogVisible.value = true;
|
applicationFormDialogVisible.value = true;
|
||||||
|
// 列表(项目列表)
|
||||||
|
applicationFormNameRef?.value.getList?.();
|
||||||
// 科室列表
|
// 科室列表
|
||||||
applicationFormNameRef?.value.getLocationInfo();
|
applicationFormNameRef?.value.getLocationInfo();
|
||||||
// 诊断目录列表
|
// 诊断目录列表
|
||||||
@@ -121,6 +123,8 @@ const showApplicationFormDialog = (name) => {
|
|||||||
applicationFormName.value = components.value[name];
|
applicationFormName.value = components.value[name];
|
||||||
applicationFormDialogVisible.value = true;
|
applicationFormDialogVisible.value = true;
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
|
// 列表(项目列表)
|
||||||
|
applicationFormNameRef?.value.getList?.();
|
||||||
// 科室列表
|
// 科室列表
|
||||||
applicationFormNameRef?.value.getLocationInfo();
|
applicationFormNameRef?.value.getLocationInfo();
|
||||||
// 诊断目录列表
|
// 诊断目录列表
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ const submit = () => {
|
|||||||
requestFormId: '', // 申请单ID
|
requestFormId: '', // 申请单ID
|
||||||
name: '输血申请单',
|
name: '输血申请单',
|
||||||
descJson: JSON.stringify(form),
|
descJson: JSON.stringify(form),
|
||||||
categoryEnum: '3', // 1 检验 2 检查 3 输血 4 手术
|
categoryEnum: '23', // 21 检验 22 检查 23 输血 24 手术(避开 adviceType 1-6 碰撞)
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
proxy.$message.success(res.msg);
|
proxy.$message.success(res.msg);
|
||||||
|
|||||||
@@ -6,9 +6,26 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="LaboratoryTests-container">
|
<div class="LaboratoryTests-container">
|
||||||
<div v-loading="loading" class="transfer-wrapper">
|
<div v-loading="loading" class="transfer-wrapper">
|
||||||
|
<!-- 远程搜索框 -->
|
||||||
|
<div class="search-bar">
|
||||||
|
<el-input
|
||||||
|
v-model="searchKey"
|
||||||
|
placeholder="输入项目代码/名称搜索"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleSearch"
|
||||||
|
@clear="handleSearch"
|
||||||
|
style="width: 300px; margin-bottom: 10px"
|
||||||
|
>
|
||||||
|
<template #append>
|
||||||
|
<el-button @click="handleSearch">搜索</el-button>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
<span v-if="!searchKey" class="total-count">共 {{ totalCount }} 项</span>
|
||||||
|
<span v-else class="total-count">搜索到 {{ filteredCount }} 项 / 共 {{ totalCount }} 项</span>
|
||||||
|
</div>
|
||||||
<el-transfer
|
<el-transfer
|
||||||
v-model="transferValue"
|
v-model="transferValue"
|
||||||
:data="applicationList"
|
:data="transferData"
|
||||||
filter-placeholder="项目代码/名称"
|
filter-placeholder="项目代码/名称"
|
||||||
filterable
|
filterable
|
||||||
:titles="['未选择', '已选择']"
|
:titles="['未选择', '已选择']"
|
||||||
@@ -72,16 +89,55 @@
|
|||||||
<el-input v-model="form.attention" autocomplete="off" type="textarea" />
|
<el-input v-model="form.attention" autocomplete="off" type="textarea" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<!-- 申请类型 -->
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="申请类型" prop="applicationType" style="width: 100%">
|
||||||
|
<el-radio-group v-model="form.applicationType">
|
||||||
|
<el-radio :value="0">普通</el-radio>
|
||||||
|
<el-radio :value="1">急诊</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<!-- 标本类型 -->
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="标本类型" prop="specimenName" style="width: 100%">
|
||||||
|
<el-select v-model="form.specimenName" placeholder="请选择标本类型" style="width: 100%">
|
||||||
|
<el-option label="血液" value="血液" />
|
||||||
|
<el-option label="尿液" value="尿液" />
|
||||||
|
<el-option label="粪便" value="粪便" />
|
||||||
|
<el-option label="痰液" value="痰液" />
|
||||||
|
<el-option label="咽拭子" value="咽拭子" />
|
||||||
|
<el-option label="脑脊液" value="脑脊液" />
|
||||||
|
<el-option label="胸腹水" value="胸腹水" />
|
||||||
|
<el-option label="关节液" value="关节液" />
|
||||||
|
<el-option label="分泌物" value="分泌物" />
|
||||||
|
<el-option label="其他" value="其他" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<!-- 执行时间 -->
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="执行时间" prop="executeTime" style="width: 100%">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="form.executeTime"
|
||||||
|
type="datetime"
|
||||||
|
placeholder="选择执行时间"
|
||||||
|
format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup name="LaboratoryTests">
|
<script setup name="LaboratoryTests">
|
||||||
import {getCurrentInstance, onBeforeMount, onMounted, reactive, watch} from 'vue';
|
import {getCurrentInstance, onMounted, reactive, ref, watch, computed} from 'vue';
|
||||||
import {patientInfo} from '../../../store/patient.js';
|
import {patientInfo} from '../../../store/patient.js';
|
||||||
import {getApplicationList, saveInspection} from './api';
|
import {getApplicationList, saveInspection} from './api';
|
||||||
import {getDepartmentList} from '@/api/public.js';
|
import {getOrgList} from '@/views/doctorstation/components/api.js';
|
||||||
import {getEncounterDiagnosis} from '../../api.js';
|
import {getEncounterDiagnosis} from '../../api.js';
|
||||||
import {ElMessage} from 'element-plus';
|
import {ElMessage} from 'element-plus';
|
||||||
|
|
||||||
@@ -99,48 +155,92 @@ const findTreeItem = (list, id) => {
|
|||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
const emits = defineEmits(['submitOk']);
|
const emits = defineEmits(['submitOk']);
|
||||||
const props = defineProps({});
|
const props = defineProps({
|
||||||
|
editData: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const isEditMode = computed(() => !!props.editData?.requestFormId);
|
||||||
const state = reactive({});
|
const state = reactive({});
|
||||||
const applicationListAll = ref();
|
const applicationListAll = ref([]);
|
||||||
const applicationList = ref();
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const orgOptions = ref([]); // 科室选项
|
const orgOptions = ref([]);
|
||||||
const getList = () => {
|
const searchKey = ref('');
|
||||||
|
const totalCount = ref(0);
|
||||||
|
|
||||||
|
// 将已加载的全部数据转为 transfer 组件所需的格式
|
||||||
|
const buildTransferData = (records) => {
|
||||||
|
return records.map((item) => {
|
||||||
|
const priceInfo = item.priceList?.[0] || {};
|
||||||
|
const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
|
||||||
|
const unit = item.unitCode_dictText || item.unitCode || '';
|
||||||
|
return {
|
||||||
|
adviceDefinitionId: item.adviceDefinitionId,
|
||||||
|
orgId: item.orgId,
|
||||||
|
label: item.adviceName + ' (¥' + price + '/' + unit + ')',
|
||||||
|
key: item.adviceDefinitionId,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 加载全部数据(不分页,一次性拉取)
|
||||||
|
const loadAllData = async () => {
|
||||||
if (!patientInfo.value?.inHospitalOrgId) {
|
if (!patientInfo.value?.inHospitalOrgId) {
|
||||||
applicationList.value = [];
|
applicationListAll.value = [];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
getApplicationList({
|
try {
|
||||||
pageSize: 9999,
|
// 使用大 pageSize 一次性拉取所有启用状态的检验类诊疗项目
|
||||||
pageNum: 1,
|
const res = await getApplicationList({
|
||||||
categoryCode: '22',
|
pageSize: 9999,
|
||||||
organizationId: patientInfo.value.inHospitalOrgId,
|
pageNo: 1,
|
||||||
adviceTypes: [3], //1 药品 2耗材 3诊疗
|
categoryCode: '22',
|
||||||
})
|
organizationId: patientInfo.value.inHospitalOrgId,
|
||||||
.then((res) => {
|
adviceTypes: [3], // 1 药品 2 耗材 3 诊疗
|
||||||
if (res.code === 200) {
|
|
||||||
applicationListAll.value = res.data.records;
|
|
||||||
applicationList.value = res.data.records.map((item) => {
|
|
||||||
const priceInfo = item.priceList?.[0] || {};
|
|
||||||
const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
|
|
||||||
const unit = item.unitCode_dictText || item.unitCode || '';
|
|
||||||
return {
|
|
||||||
adviceDefinitionId: item.adviceDefinitionId,
|
|
||||||
orgId: item.orgId,
|
|
||||||
label: item.adviceName + ' (¥' + price + '/' + unit + ')',
|
|
||||||
key: item.adviceDefinitionId,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
console.log('applicationList========>', JSON.stringify(res.data.records));
|
|
||||||
} else {
|
|
||||||
proxy.$message.error(res.message);
|
|
||||||
applicationList.value = [];
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
loading.value = false;
|
|
||||||
});
|
});
|
||||||
|
if (res.code !== 200) {
|
||||||
|
proxy.$message.error(res.message);
|
||||||
|
applicationListAll.value = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
applicationListAll.value = res.data?.records || [];
|
||||||
|
totalCount.value = res.data?.total || 0;
|
||||||
|
} catch (e) {
|
||||||
|
proxy.$message.error('获取检验项目列表失败');
|
||||||
|
applicationListAll.value = [];
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 根据搜索关键词过滤数据
|
||||||
|
const filterData = (key) => {
|
||||||
|
if (!key || key.trim() === '') {
|
||||||
|
return applicationListAll.value;
|
||||||
|
}
|
||||||
|
const lowerKey = key.toLowerCase().trim();
|
||||||
|
return applicationListAll.value.filter((item) => {
|
||||||
|
return (
|
||||||
|
item.adviceName?.toLowerCase().includes(lowerKey) ||
|
||||||
|
item.pyStr?.toLowerCase().includes(lowerKey) ||
|
||||||
|
item.adviceBusNo?.toLowerCase().includes(lowerKey)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// transfer 组件实际显示的数据(受搜索词影响)
|
||||||
|
const transferData = computed(() => buildTransferData(filterData(searchKey.value)));
|
||||||
|
// 当前显示的条数
|
||||||
|
const filteredCount = computed(() => filterData(searchKey.value).length);
|
||||||
|
|
||||||
|
const getList = async () => {
|
||||||
|
await loadAllData();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSearch = () => {
|
||||||
|
// 搜索时保持已选中的项目不受影响
|
||||||
};
|
};
|
||||||
const transferValue = ref([]);
|
const transferValue = ref([]);
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
@@ -152,11 +252,13 @@ const form = reactive({
|
|||||||
otherDiagnosis: '', // 其他诊断
|
otherDiagnosis: '', // 其他诊断
|
||||||
relatedResult: '', // 相关结果
|
relatedResult: '', // 相关结果
|
||||||
attention: '', // 注意事项
|
attention: '', // 注意事项
|
||||||
|
applicationType: 0, // 申请类型 0-普通 1-急诊
|
||||||
|
specimenName: '血液', // 标本类型
|
||||||
|
executeTime: null, // 执行时间
|
||||||
primaryDiagnosisList: [], //主诊断目录
|
primaryDiagnosisList: [], //主诊断目录
|
||||||
otherDiagnosisList: [], //其他断目录
|
otherDiagnosisList: [], //其他断目录
|
||||||
});
|
});
|
||||||
const rules = reactive({});
|
const rules = reactive({});
|
||||||
onBeforeMount(() => {});
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
@@ -169,12 +271,22 @@ const projectWithDepartment = (selectProjectIds, type) => {
|
|||||||
let isRelease = true;
|
let isRelease = true;
|
||||||
// 选中项目的数组
|
// 选中项目的数组
|
||||||
const arr = [];
|
const arr = [];
|
||||||
// 根据选中的项目id查找对应的项目
|
// 根据选中的项目id查找对应的项目(从全部原始数据中查找)
|
||||||
selectProjectIds.forEach((element) => {
|
selectProjectIds.forEach((element) => {
|
||||||
const searchData = applicationList.value.find((item) => {
|
const searchData = applicationListAll.value.find((item) => {
|
||||||
return element == item.adviceDefinitionId;
|
return element == item.adviceDefinitionId;
|
||||||
});
|
});
|
||||||
arr.push(searchData);
|
if (searchData) {
|
||||||
|
const priceInfo = searchData.priceList?.[0] || {};
|
||||||
|
const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00';
|
||||||
|
const unit = searchData.unitCode_dictText || searchData.unitCode || '';
|
||||||
|
arr.push({
|
||||||
|
adviceDefinitionId: searchData.adviceDefinitionId,
|
||||||
|
orgId: searchData.orgId,
|
||||||
|
label: searchData.adviceName + ' (¥' + price + '/' + unit + ')',
|
||||||
|
key: searchData.adviceDefinitionId,
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
// 保存用户手动选择的发往科室(提交时需要保留)
|
// 保存用户手动选择的发往科室(提交时需要保留)
|
||||||
const manualDept = type === 2 ? form.targetDepartment : '';
|
const manualDept = type === 2 ? form.targetDepartment : '';
|
||||||
@@ -200,16 +312,23 @@ const projectWithDepartment = (selectProjectIds, type) => {
|
|||||||
if (type === 2 && manualDept) {
|
if (type === 2 && manualDept) {
|
||||||
form.targetDepartment = manualDept;
|
form.targetDepartment = manualDept;
|
||||||
isRelease = true;
|
isRelease = true;
|
||||||
} else {
|
} else if (type === 2 && !manualDept) {
|
||||||
|
// 提交时用户未手动选择科室,才提示错误
|
||||||
isRelease = false;
|
isRelease = false;
|
||||||
ElMessage({
|
ElMessage({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: '未找到项目执行的科室',
|
message: '未找到项目执行的科室',
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
// type=1(选择项目变化)时,不弹窗,仅清空科室让用户自行选择
|
||||||
|
isRelease = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type == 1) {
|
if (findItem && isRelease) {
|
||||||
if (isRelease) {
|
// 提交时若用户已选「发往科室」,不得用项目默认执行科室覆盖
|
||||||
|
if (type === 2 && manualDept) {
|
||||||
|
form.targetDepartment = manualDept;
|
||||||
|
} else {
|
||||||
form.targetDepartment = findItem.id;
|
form.targetDepartment = findItem.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,6 +342,44 @@ watch(
|
|||||||
projectWithDepartment(newValue, 1);
|
projectWithDepartment(newValue, 1);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 编辑模式下,回显已有数据
|
||||||
|
watch(
|
||||||
|
() => props.editData,
|
||||||
|
(newData) => {
|
||||||
|
if (!newData || !newData.requestFormId) return;
|
||||||
|
|
||||||
|
// 解析 descJson 回填表单
|
||||||
|
if (newData.descJson) {
|
||||||
|
try {
|
||||||
|
const obj = JSON.parse(newData.descJson);
|
||||||
|
Object.keys(form).forEach((key) => {
|
||||||
|
if (obj[key] !== undefined) {
|
||||||
|
form[key] = obj[key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.error('解析 descJson 失败:', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 回填已选项目
|
||||||
|
if (newData.requestFormDetailList && newData.requestFormDetailList.length > 0) {
|
||||||
|
// 从全部数据中匹配已选项目
|
||||||
|
const selectedIds = [];
|
||||||
|
newData.requestFormDetailList.forEach((detail) => {
|
||||||
|
const matched = applicationListAll.value.find(
|
||||||
|
(item) => item.adviceName === detail.adviceName
|
||||||
|
);
|
||||||
|
if (matched) {
|
||||||
|
selectedIds.push(matched.adviceDefinitionId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
transferValue.value = selectedIds;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
if (transferValue.value.length == 0) {
|
if (transferValue.value.length == 0) {
|
||||||
return proxy.$message.error('请选择申请单');
|
return proxy.$message.error('请选择申请单');
|
||||||
@@ -240,7 +397,7 @@ const submit = () => {
|
|||||||
unitCode: item.priceList[0].unitCode /** 请求单位编码 */,
|
unitCode: item.priceList[0].unitCode /** 请求单位编码 */,
|
||||||
unitPrice: item.priceList[0].price /** 单价 */,
|
unitPrice: item.priceList[0].price /** 单价 */,
|
||||||
totalPrice: item.priceList[0].price /** 总价 */,
|
totalPrice: item.priceList[0].price /** 总价 */,
|
||||||
positionId: item.positionId || form.targetDepartment, //执行科室id,未配置时使用用户手动选择的科室
|
positionId: form.targetDepartment || item.positionId, // 用户指定发往科室优先于项目默认执行科室
|
||||||
ybClassEnum: item.ybClassEnum, //类别医保编码
|
ybClassEnum: item.ybClassEnum, //类别医保编码
|
||||||
conditionId: item.conditionId, //诊断ID
|
conditionId: item.conditionId, //诊断ID
|
||||||
encounterDiagnosisId: item.encounterDiagnosisId, //就诊诊断id
|
encounterDiagnosisId: item.encounterDiagnosisId, //就诊诊断id
|
||||||
@@ -255,15 +412,15 @@ const submit = () => {
|
|||||||
patientId: patientInfo.value.patientId, //患者ID
|
patientId: patientInfo.value.patientId, //患者ID
|
||||||
encounterId: patientInfo.value.encounterId, // 就诊ID
|
encounterId: patientInfo.value.encounterId, // 就诊ID
|
||||||
organizationId: patientInfo.value.inHospitalOrgId, // 医疗机构ID
|
organizationId: patientInfo.value.inHospitalOrgId, // 医疗机构ID
|
||||||
requestFormId: '', // 申请单ID
|
requestFormId: isEditMode.value ? props.editData.requestFormId : '', // 申请单ID(编辑模式传入,新增为空)
|
||||||
name: '检验申请单',
|
name: '检验申请单',
|
||||||
descJson: JSON.stringify(form),
|
descJson: JSON.stringify(form),
|
||||||
categoryEnum: '1', // 1 检验 2 检查 3 输血 4 手术
|
categoryEnum: '21', // 21 检验 22 检查 23 输血 24 手术(避开 adviceType 1-6 碰撞)
|
||||||
};
|
};
|
||||||
saveInspection(params).then((res) => {
|
saveInspection(params).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
proxy.$message.success(res.msg);
|
proxy.$message.success(isEditMode.value ? '修改成功' : res.msg);
|
||||||
applicationList.value = [];
|
transferValue.value = [];
|
||||||
emits('submitOk');
|
emits('submitOk');
|
||||||
} else {
|
} else {
|
||||||
proxy.$message.error(res.message);
|
proxy.$message.error(res.message);
|
||||||
@@ -272,8 +429,8 @@ const submit = () => {
|
|||||||
};
|
};
|
||||||
/** 查询科室 */
|
/** 查询科室 */
|
||||||
const getLocationInfo = () => {
|
const getLocationInfo = () => {
|
||||||
getDepartmentList().then((res) => {
|
getOrgList().then((res) => {
|
||||||
orgOptions.value = res.data || [];
|
orgOptions.value = res.data.records;
|
||||||
console.log('科室========>', JSON.stringify(orgOptions.value));
|
console.log('科室========>', JSON.stringify(orgOptions.value));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -310,7 +467,7 @@ function getDiagnosisList() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
defineExpose({ state, submit, getLocationInfo, getDiagnosisList });
|
defineExpose({ state, submit, getLocationInfo, getDiagnosisList, getList });
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.LaboratoryTests-container {
|
.LaboratoryTests-container {
|
||||||
@@ -320,6 +477,19 @@ defineExpose({ state, submit, getLocationInfo, getDiagnosisList });
|
|||||||
.transfer-wrapper {
|
.transfer-wrapper {
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: 300px;
|
min-height: 300px;
|
||||||
|
|
||||||
|
.search-bar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
|
||||||
|
.total-count {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #909399;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-transfer {
|
.el-transfer {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@
|
|||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<div class="surgery-container">
|
<div class="surgery-container">
|
||||||
<div class="transfer-wrapper">
|
<div v-loading="loading" class="transfer-wrapper" style="min-height: 300px;">
|
||||||
<el-transfer
|
<el-transfer
|
||||||
v-model="transferValue"
|
v-model="transferValue"
|
||||||
:data="applicationList"
|
:data="applicationList"
|
||||||
@@ -86,6 +86,9 @@ import {getApplicationList, saveSurgery} from './api';
|
|||||||
import {ElMessage} from 'element-plus';
|
import {ElMessage} from 'element-plus';
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
|
// 模块级缓存:避免每次打开弹窗都重新请求手术项目列表
|
||||||
|
let surgeryRecordsCache = null; // 原始 API 记录
|
||||||
|
let surgeryMappedCache = null; // 映射后的 el-transfer 数据
|
||||||
// 递归查找树形科室节点
|
// 递归查找树形科室节点
|
||||||
const findTreeItem = (list, id) => {
|
const findTreeItem = (list, id) => {
|
||||||
if (!list || list.length === 0) return null;
|
if (!list || list.length === 0) return null;
|
||||||
@@ -101,14 +104,22 @@ const findTreeItem = (list, id) => {
|
|||||||
const emits = defineEmits(['submitOk']);
|
const emits = defineEmits(['submitOk']);
|
||||||
const props = defineProps({});
|
const props = defineProps({});
|
||||||
const state = reactive({});
|
const state = reactive({});
|
||||||
const applicationListAll = ref([]);
|
const applicationListAll = ref();
|
||||||
const applicationList = ref([]);
|
const applicationList = ref();
|
||||||
const orgOptions = ref([]); // 科室选项
|
const orgOptions = ref([]); // 科室选项
|
||||||
|
const loading = ref(false); // 加载状态
|
||||||
const getList = () => {
|
const getList = () => {
|
||||||
if (!patientInfo.value?.inHospitalOrgId) {
|
if (!patientInfo.value?.inHospitalOrgId) {
|
||||||
applicationList.value = [];
|
applicationList.value = [];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 命中缓存时直接使用,避免重复请求导致加载缓慢
|
||||||
|
if (surgeryMappedCache && surgeryMappedCache.length > 0) {
|
||||||
|
applicationList.value = surgeryMappedCache;
|
||||||
|
applicationListAll.value = surgeryRecordsCache;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loading.value = true;
|
||||||
getApplicationList({
|
getApplicationList({
|
||||||
pageSize: 500,
|
pageSize: 500,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
@@ -130,6 +141,9 @@ const getList = () => {
|
|||||||
key: item.adviceDefinitionId,
|
key: item.adviceDefinitionId,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
// 写入模块缓存,后续打开弹窗直接复用
|
||||||
|
surgeryRecordsCache = res.data.records;
|
||||||
|
surgeryMappedCache = applicationList.value;
|
||||||
} else {
|
} else {
|
||||||
console.warn('获取手术项目列表失败:', res.message);
|
console.warn('获取手术项目列表失败:', res.message);
|
||||||
applicationList.value = [];
|
applicationList.value = [];
|
||||||
@@ -138,6 +152,9 @@ const getList = () => {
|
|||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.warn('手术项目列表加载失败(可能无权限):', e?.message || e);
|
console.warn('手术项目列表加载失败(可能无权限):', e?.message || e);
|
||||||
applicationList.value = [];
|
applicationList.value = [];
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading.value = false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const transferValue = ref([]);
|
const transferValue = ref([]);
|
||||||
@@ -250,7 +267,7 @@ const submit = () => {
|
|||||||
requestFormId: '', // 申请单ID
|
requestFormId: '', // 申请单ID
|
||||||
name: '手术申请单',
|
name: '手术申请单',
|
||||||
descJson: JSON.stringify(form),
|
descJson: JSON.stringify(form),
|
||||||
categoryEnum: '4', // 1 检验 2 检查 3 输血 4 手术
|
categoryEnum: '24', // 21 检验 22 检查 23 输血 24 手术(避开 adviceType 1-6 碰撞)
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
proxy.$message.success(res.msg);
|
proxy.$message.success(res.msg);
|
||||||
@@ -301,7 +318,7 @@ function getDiagnosisList() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
defineExpose({ state, submit, getLocationInfo, getDiagnosisList });
|
defineExpose({ state, submit, getLocationInfo, getDiagnosisList, getList });
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.surgery-container {
|
.surgery-container {
|
||||||
|
|||||||
@@ -380,7 +380,7 @@ const form = ref({
|
|||||||
prescriptionList: prescriptionList.value,
|
prescriptionList: prescriptionList.value,
|
||||||
});
|
});
|
||||||
const adviceQueryParams = ref({
|
const adviceQueryParams = ref({
|
||||||
adviceType: 1,
|
adviceType: '',
|
||||||
categoryCode: '', // 初始为空,等待加载配置后动态设置
|
categoryCode: '', // 初始为空,等待加载配置后动态设置
|
||||||
searchKey: '',
|
searchKey: '',
|
||||||
});
|
});
|
||||||
@@ -533,6 +533,7 @@ const statusOption = [
|
|||||||
let loadingInstance = undefined;
|
let loadingInstance = undefined;
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
document.addEventListener('keydown', escKeyListener);
|
document.addEventListener('keydown', escKeyListener);
|
||||||
|
getList();
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
@@ -573,7 +574,6 @@ function handleTotalAmount() {
|
|||||||
}
|
}
|
||||||
}, new Decimal(0));
|
}, new Decimal(0));
|
||||||
}
|
}
|
||||||
getList();
|
|
||||||
function getList() {
|
function getList() {
|
||||||
getDiagnosisDefinitionList(queryParams.value).then((res) => {
|
getDiagnosisDefinitionList(queryParams.value).then((res) => {
|
||||||
// prescriptionList.value = res.data.records;
|
// prescriptionList.value = res.data.records;
|
||||||
@@ -585,6 +585,11 @@ function refresh() {
|
|||||||
}
|
}
|
||||||
// 获取列表信息
|
// 获取列表信息
|
||||||
function getListInfo(addNewRow) {
|
function getListInfo(addNewRow) {
|
||||||
|
// 守护:未选择患者时不发起 API 请求,避免页面加载时循环报错
|
||||||
|
if (!patientInfo.value || !patientInfo.value.encounterId) {
|
||||||
|
console.warn('⚠️ getListInfo 跳过:未选择患者');
|
||||||
|
return;
|
||||||
|
}
|
||||||
loadingInstance = ElLoading.service({ fullscreen: true });
|
loadingInstance = ElLoading.service({ fullscreen: true });
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
loadingInstance.close();
|
loadingInstance.close();
|
||||||
@@ -686,7 +691,7 @@ function loadConfiguredCategories() {
|
|||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
// 创建新对象触发响应式更新
|
// 创建新对象触发响应式更新
|
||||||
adviceQueryParams.value = {
|
adviceQueryParams.value = {
|
||||||
adviceType: 1,
|
adviceType: '',
|
||||||
categoryCode: defaultCategoryCode,
|
categoryCode: defaultCategoryCode,
|
||||||
searchKey: '',
|
searchKey: '',
|
||||||
};
|
};
|
||||||
@@ -710,9 +715,17 @@ function loadConfiguredCategories() {
|
|||||||
// 数据过滤
|
// 数据过滤
|
||||||
const filterPrescriptionList = computed(() => {
|
const filterPrescriptionList = computed(() => {
|
||||||
const pList = prescriptionList.value.filter((item) => {
|
const pList = prescriptionList.value.filter((item) => {
|
||||||
|
// 修复 Bug #488:orderClassCode 可能是复合值 '1-2',需提取 adviceType 部分进行比较
|
||||||
|
let matchAdviceType = true;
|
||||||
|
if (orderClassCode.value) {
|
||||||
|
const filterAdviceType = String(orderClassCode.value).includes('-')
|
||||||
|
? parseInt(String(orderClassCode.value).split('-')[0])
|
||||||
|
: orderClassCode.value;
|
||||||
|
matchAdviceType = filterAdviceType == item.adviceType;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
(!therapyEnum.value || therapyEnum.value == item.therapyEnum) &&
|
(!therapyEnum.value || therapyEnum.value == item.therapyEnum) &&
|
||||||
(!orderClassCode.value || orderClassCode.value == item.adviceType) &&
|
matchAdviceType &&
|
||||||
(!orderStatus.value || (orderStatus.value == item.statusEnum && item.requestId))
|
(!orderStatus.value || (orderStatus.value == item.statusEnum && item.requestId))
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -740,12 +753,28 @@ function getRowDisabled(row) {
|
|||||||
/**
|
/**
|
||||||
* 将行的 adviceType + categoryCode 映射为 el-select 的选中值
|
* 将行的 adviceType + categoryCode 映射为 el-select 的选中值
|
||||||
* 药品子分类使用复合值如 '1-2'(adviceType-categoryCode),诊疗/手术/全部使用原始值
|
* 药品子分类使用复合值如 '1-2'(adviceType-categoryCode),诊疗/手术/全部使用原始值
|
||||||
|
* 修复 Bug #488:当行的 adviceType 在当前配置中找不到匹配选项时,返回最接近的可用值,避免回显为纯数字
|
||||||
*/
|
*/
|
||||||
function getRowSelectValue(row) {
|
function getRowSelectValue(row) {
|
||||||
if (row.adviceType == 1 && row.categoryCode) {
|
if (row.adviceType == 1 && row.categoryCode) {
|
||||||
return '1-' + row.categoryCode;
|
const compositeValue = '1-' + row.categoryCode;
|
||||||
|
// 检查复合值是否在选项列表中
|
||||||
|
if (adviceTypeList.value.some(item => item.value === compositeValue)) {
|
||||||
|
return compositeValue;
|
||||||
|
}
|
||||||
|
// 配置的 categoryCode 已变更,回退到第一个药品选项
|
||||||
|
const firstPharmacy = adviceTypeList.value.find(item => String(item.value).startsWith('1-'));
|
||||||
|
if (firstPharmacy) {
|
||||||
|
return firstPharmacy.value;
|
||||||
|
}
|
||||||
|
return row.adviceType;
|
||||||
}
|
}
|
||||||
return row.adviceType;
|
// 诊疗/手术等非药品类型,检查其值是否在选项列表中
|
||||||
|
if (adviceTypeList.value.some(item => item.value === row.adviceType)) {
|
||||||
|
return row.adviceType;
|
||||||
|
}
|
||||||
|
// 不在选项中的值(如已废弃的 adviceType),返回 undefined 让 el-select 显示为空
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增医嘱
|
// 新增医嘱
|
||||||
@@ -802,8 +831,8 @@ function clickRowDb(row, column, event) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
row.showPopover = false;
|
row.showPopover = false;
|
||||||
// “待签发(已保存 requestId存在)”不允许再编辑;仅“待保存(无requestId)”允许编辑
|
// 仅”待签发(statusEnum==1)”允许编辑;”已签发(statusEnum==2)”及之后状态不允许编辑
|
||||||
if (row.statusEnum == 1 && !row.requestId) {
|
if (row.statusEnum == 1) {
|
||||||
// 确保治疗类型为字符串,方便与单选框 label 对齐,默认为长期医嘱('1')
|
// 确保治疗类型为字符串,方便与单选框 label 对齐,默认为长期医嘱('1')
|
||||||
row.therapyEnum = String(row.therapyEnum ?? '1');
|
row.therapyEnum = String(row.therapyEnum ?? '1');
|
||||||
row.isEdit = true;
|
row.isEdit = true;
|
||||||
@@ -923,7 +952,9 @@ function handleChange(value) {
|
|||||||
// 修复Bug #486:当行没有显式选择医嘱类型时(row?.adviceType为undefined),
|
// 修复Bug #486:当行没有显式选择医嘱类型时(row?.adviceType为undefined),
|
||||||
// 不传categoryCode,让搜索在全药库中进行;只有行已选择类型时才用对应categoryCode过滤
|
// 不传categoryCode,让搜索在全药库中进行;只有行已选择类型时才用对应categoryCode过滤
|
||||||
const categoryCode = row?.adviceType !== undefined ? (selectedItem ? selectedItem.categoryCode : '') : '';
|
const categoryCode = row?.adviceType !== undefined ? (selectedItem ? selectedItem.categoryCode : '') : '';
|
||||||
tableRef.refresh(adviceType, categoryCode, value);
|
// 修复Bug #453:当adviceType为空字符串或NaN时,不传具体类型,让refresh函数根据searchKey决定搜索范围
|
||||||
|
const effectiveAdviceType = (adviceType && !isNaN(Number(adviceType))) ? adviceType : '';
|
||||||
|
tableRef.refresh(effectiveAdviceType, categoryCode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1182,19 +1213,27 @@ function handleSave() {
|
|||||||
});
|
});
|
||||||
// 此处签发处方和单行保存处方传参相同,后台已经将传参存为JSON字符串,此处直接转换为JSON即可
|
// 此处签发处方和单行保存处方传参相同,后台已经将传参存为JSON字符串,此处直接转换为JSON即可
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
let list = saveList.map((item) => {
|
let list = [];
|
||||||
const parsedContent = JSON.parse(item.contentJson);
|
try {
|
||||||
return {
|
list = saveList.map((item) => {
|
||||||
...parsedContent,
|
const parsedContent = item.contentJson ? JSON.parse(item.contentJson) || {} : {};
|
||||||
adviceType: item.adviceType,
|
return {
|
||||||
requestId: item.requestId,
|
...parsedContent,
|
||||||
dbOpType: '1',
|
adviceType: item.adviceType,
|
||||||
groupId: item.groupId,
|
requestId: item.requestId,
|
||||||
uniqueKey: undefined,
|
dbOpType: '1',
|
||||||
// 确保 therapyEnum 被正确传递
|
groupId: item.groupId,
|
||||||
therapyEnum: parsedContent.therapyEnum || item.therapyEnum || '1',
|
uniqueKey: undefined,
|
||||||
};
|
// 确保 therapyEnum 被正确传递
|
||||||
});
|
therapyEnum: parsedContent?.therapyEnum || item.therapyEnum || '1',
|
||||||
|
};
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
loading.value = false;
|
||||||
|
isSaving.value = false;
|
||||||
|
proxy.$modal.msgError('医嘱内容解析失败,请检查待签发医嘱');
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 保存签发按钮
|
// 保存签发按钮
|
||||||
isSaving.value = true;
|
isSaving.value = true;
|
||||||
console.log('签发处方参数:', {
|
console.log('签发处方参数:', {
|
||||||
@@ -1209,9 +1248,16 @@ function handleSave() {
|
|||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
proxy.$modal.msgSuccess('签发成功');
|
proxy.$modal.msgSuccess('签发成功');
|
||||||
isSaving.value = false;
|
isSaving.value = false;
|
||||||
|
// 乐观更新:立即将已签发医嘱的状态设为"已签发",确保列表实时刷新
|
||||||
|
saveList.forEach((item) => {
|
||||||
|
const row = prescriptionList.value.find((r) => r.requestId && r.requestId === item.requestId);
|
||||||
|
if (row) {
|
||||||
|
row.statusEnum = 2;
|
||||||
|
}
|
||||||
|
});
|
||||||
getListInfo(false);
|
getListInfo(false);
|
||||||
bindMethod.value = {};
|
bindMethod.value = {};
|
||||||
nextId.value == 1;
|
nextId.value = 1;
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError(res.message);
|
proxy.$modal.msgError(res.message);
|
||||||
isSaving.value = false;
|
isSaving.value = false;
|
||||||
@@ -1312,11 +1358,12 @@ function handleCancelEdit(row, index) {
|
|||||||
|
|
||||||
function handleSaveSign(row, index) {
|
function handleSaveSign(row, index) {
|
||||||
if (row.adviceType != 2) {
|
if (row.adviceType != 2) {
|
||||||
|
// 修复 Bug #488:严格校验 itemNo,确保非空且为有效字符串才发起请求
|
||||||
let itemNo = row.adviceType == 1 ? row.methodCode : row.adviceDefinitionId;
|
let itemNo = row.adviceType == 1 ? row.methodCode : row.adviceDefinitionId;
|
||||||
if (!itemNo) {
|
if (!itemNo || String(itemNo).trim() === '') {
|
||||||
console.warn('绑定设备检查跳过:itemNo为空(adviceType=' + row.adviceType + ', adviceName=' + row.adviceName + ')');
|
console.warn('绑定设备检查跳过:itemNo为空(adviceType=' + row.adviceType + ', adviceName=' + row.adviceName + ')');
|
||||||
} else {
|
} else {
|
||||||
getBindDevice({ typeCode: row.adviceType, itemNo: itemNo }).then((res) => {
|
getBindDevice({ typeCode: row.adviceType, itemNo: String(itemNo) }).then((res) => {
|
||||||
if (res.data.length == 0) {
|
if (res.data.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1377,13 +1424,21 @@ function handleSaveSign(row, index) {
|
|||||||
savePrescription({ regAdviceSaveList: [row] }).then((res) => {
|
savePrescription({ regAdviceSaveList: [row] }).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
proxy.$modal.msgSuccess('保存成功');
|
proxy.$modal.msgSuccess('保存成功');
|
||||||
nextId.value == 1;
|
nextId.value = 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (prescriptionList.value[0].adviceName) {
|
// 新增行:调用保存接口将数据持久化到后端
|
||||||
handleAddPrescription();
|
row.dbOpType = '1';
|
||||||
}
|
savePrescription({ regAdviceSaveList: [row] }).then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
proxy.$modal.msgSuccess('保存成功');
|
||||||
|
nextId.value = 1;
|
||||||
|
// 保存成功后刷新列表,确保后端返回的数据带 requestId
|
||||||
|
getListInfo(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 不需要再添加空行,保存成功后由 getListInfo 处理
|
||||||
}
|
}
|
||||||
adviceQueryParams.value.adviceType = undefined;
|
adviceQueryParams.value.adviceType = undefined;
|
||||||
}
|
}
|
||||||
@@ -1424,32 +1479,40 @@ function handleSaveBatch() {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
proxy.$modal.msgSuccess('保存成功');
|
proxy.$modal.msgSuccess('保存成功');
|
||||||
// 修复【#405】:保存成功后重置所有待保存行的 isEdit 为 false,锁定医嘱不再编辑
|
// 修复 Bug #405:保存成功后锁定所有待保存行,避免医嘱条目仍处于可编辑状态
|
||||||
|
// saveList 中的 item 与 prescriptionList 是同一对象引用,直接修改即可
|
||||||
saveList.forEach(item => {
|
saveList.forEach(item => {
|
||||||
const row = prescriptionList.value.find(r => r.uniqueKey === item.uniqueKey);
|
item.isEdit = false;
|
||||||
if (row) row.isEdit = false;
|
|
||||||
});
|
});
|
||||||
|
// 兜底:锁定所有 statusEnum == 1 的行,确保没有遗漏
|
||||||
|
prescriptionList.value.forEach(row => {
|
||||||
|
if (row.statusEnum == 1) {
|
||||||
|
row.isEdit = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
expandOrder.value = [];
|
||||||
getListInfo(false);
|
getListInfo(false);
|
||||||
nextId.value == 1;
|
nextId.value = 1;
|
||||||
isSaving.value = false;
|
isSaving.value = false;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
isSaving.value = false;
|
isSaving.value = false;
|
||||||
|
proxy.$modal.msgError(error?.msg || '保存失败,请重试');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setValue(row) {
|
function setValue(row) {
|
||||||
// 构造单位列表
|
// 构造单位列表,确保 value 始终为 String 类型,避免 el-select 值类型不匹配
|
||||||
unitCodeList.value = [
|
unitCodeList.value = [
|
||||||
{ value: row.unitCode, label: row.unitCode_dictText, type: 'unit' },
|
{ value: String(row.unitCode ?? ''), label: row.unitCode_dictText, type: 'unit' },
|
||||||
{
|
{
|
||||||
value: row.doseUnitCode,
|
value: String(row.doseUnitCode ?? ''),
|
||||||
label: row.doseUnitCode_dictText,
|
label: row.doseUnitCode_dictText,
|
||||||
type: 'dose',
|
type: 'dose',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: row.minUnitCode,
|
value: String(row.minUnitCode ?? ''),
|
||||||
label: row.minUnitCode_dictText,
|
label: row.minUnitCode_dictText,
|
||||||
type: 'minUnit',
|
type: 'minUnit',
|
||||||
},
|
},
|
||||||
@@ -1514,9 +1577,9 @@ function setValue(row) {
|
|||||||
orgName: row.adviceType != 3 ? undefined : (findOrgName(row.orgId || row.positionId || patientInfo.value?.inHospitalOrgId) || row.orgName || patientInfo.value?.inHospitalOrgName || ''),
|
orgName: row.adviceType != 3 ? undefined : (findOrgName(row.orgId || row.positionId || patientInfo.value?.inHospitalOrgId) || row.orgName || patientInfo.value?.inHospitalOrgName || ''),
|
||||||
// dose: undefined, Removed to preserve dose value from group package
|
// dose: undefined, Removed to preserve dose value from group package
|
||||||
unitCodeList: unitCodeList.value,
|
unitCodeList: unitCodeList.value,
|
||||||
doseUnitCode: row.doseUnitCode,
|
doseUnitCode: String(row.doseUnitCode ?? ''),
|
||||||
minUnitCode: row.minUnitCode,
|
minUnitCode: String(row.minUnitCode ?? ''),
|
||||||
unitCode: row.partAttributeEnum == 1 ? row.minUnitCode : row.unitCode,
|
unitCode: row.partAttributeEnum == 1 ? String(row.minUnitCode ?? '') : String(row.unitCode ?? ''),
|
||||||
categoryEnum: row.categoryCode,
|
categoryEnum: row.categoryCode,
|
||||||
definitionId: row.chargeItemDefinitionId,
|
definitionId: row.chargeItemDefinitionId,
|
||||||
executeNum: 1,
|
executeNum: 1,
|
||||||
@@ -1532,6 +1595,10 @@ function setValue(row) {
|
|||||||
? new Decimal(selectedStock.price).div(row.partPercent).toFixed(6)
|
? new Decimal(selectedStock.price).div(row.partPercent).toFixed(6)
|
||||||
: prevRow.minUnitPrice,
|
: prevRow.minUnitPrice,
|
||||||
positionName: selectedStock?.locationName,
|
positionName: selectedStock?.locationName,
|
||||||
|
// 🔧 Bug #523 修复:初始化 totalPrice 为 0,避免总金额列显示为横杠
|
||||||
|
totalPrice: row.quantity
|
||||||
|
? new Decimal(row.quantity).mul(selectedStock?.price ?? 0).toFixed(6)
|
||||||
|
: '0',
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
@@ -1563,17 +1630,21 @@ function handleSaveGroup(orderGroupList) {
|
|||||||
// 🔥 新版组件已经预处理了数据,优先使用 mergedDetail
|
// 🔥 新版组件已经预处理了数据,优先使用 mergedDetail
|
||||||
const mergedDetail = item.mergedDetail || {
|
const mergedDetail = item.mergedDetail || {
|
||||||
...(item.orderDetailInfos || {}),
|
...(item.orderDetailInfos || {}),
|
||||||
adviceName: item.orderDetailInfos?.adviceName || item.orderDefinitionName || '未知项目',
|
adviceName: item.orderDefinitionName || item.orderDetailInfos?.adviceName || '未知项目',
|
||||||
adviceType: item.orderDetailInfos?.adviceType,
|
adviceType: item.orderDetailInfos?.adviceType,
|
||||||
adviceDefinitionId: item.orderDefinitionId || item.orderDetailInfos?.adviceDefinitionId,
|
adviceDefinitionId: item.orderDefinitionId || item.orderDetailInfos?.adviceDefinitionId,
|
||||||
quantity: item.quantity,
|
quantity: item.quantity,
|
||||||
unitCode: item.unitCode || item.orderDetailInfos?.unitCode,
|
unitCode: item.unitCode || item.orderDetailInfos?.unitCode,
|
||||||
unitCodeName: item.unitCodeName,
|
unitCodeName: item.unitCodeName,
|
||||||
dose: item.dose || item.orderDetailInfos?.dose,
|
// 🔧 Bug #403 修复:dose/doseQuantity/dispensePerDuration 需用 null 检查,
|
||||||
|
// 避免组套中值为 null 时回退到医嘱库的 orderDetailInfos
|
||||||
|
dose: item.dose !== undefined && item.dose !== null ? item.dose : item.orderDetailInfos?.dose,
|
||||||
rateCode: item.rateCode || item.orderDetailInfos?.rateCode,
|
rateCode: item.rateCode || item.orderDetailInfos?.rateCode,
|
||||||
methodCode: item.methodCode || item.orderDetailInfos?.methodCode,
|
methodCode: item.methodCode || item.orderDetailInfos?.methodCode,
|
||||||
dispensePerDuration: item.dispensePerDuration || item.orderDetailInfos?.dispensePerDuration,
|
dispensePerDuration: item.dispensePerDuration !== undefined && item.dispensePerDuration !== null
|
||||||
doseQuantity: item.doseQuantity,
|
? item.dispensePerDuration : item.orderDetailInfos?.dispensePerDuration,
|
||||||
|
doseQuantity: item.doseQuantity !== undefined && item.doseQuantity !== null
|
||||||
|
? item.doseQuantity : item.orderDetailInfos?.doseQuantity,
|
||||||
inventoryList: item.orderDetailInfos?.inventoryList || [],
|
inventoryList: item.orderDetailInfos?.inventoryList || [],
|
||||||
priceList: item.orderDetailInfos?.priceList || [],
|
priceList: item.orderDetailInfos?.priceList || [],
|
||||||
partPercent: item.orderDetailInfos?.partPercent || 1,
|
partPercent: item.orderDetailInfos?.partPercent || 1,
|
||||||
@@ -1592,20 +1663,15 @@ function handleSaveGroup(orderGroupList) {
|
|||||||
setValue(mergedDetail);
|
setValue(mergedDetail);
|
||||||
|
|
||||||
// 创建新的处方项目
|
// 创建新的处方项目
|
||||||
|
// 🔧 Bug #403 修复:关键字段使用 null-safe 回退到 mergedDetail(已由 setValue 填充完整数据)
|
||||||
|
// 先取 setValue 填充的行数据作为基础
|
||||||
|
const baseRow = prescriptionList.value[rowIndex.value];
|
||||||
const newRow = {
|
const newRow = {
|
||||||
...prescriptionList.value[rowIndex.value],
|
...baseRow,
|
||||||
patientId: patientInfo.value.patientId,
|
patientId: patientInfo.value.patientId,
|
||||||
encounterId: patientInfo.value.encounterId,
|
encounterId: patientInfo.value.encounterId,
|
||||||
accountId: accountId.value,
|
accountId: accountId.value,
|
||||||
quantity: item.quantity,
|
|
||||||
methodCode: item.methodCode,
|
|
||||||
rateCode: item.rateCode,
|
|
||||||
dispensePerDuration: item.dispensePerDuration,
|
|
||||||
dose: item.dose,
|
|
||||||
doseQuantity: item.doseQuantity,
|
|
||||||
executeNum: 1,
|
executeNum: 1,
|
||||||
unitCode: item.unitCode,
|
|
||||||
unitCode_dictText: item.unitCodeName || '',
|
|
||||||
statusEnum: 1,
|
statusEnum: 1,
|
||||||
orgId: resolveOrgId(item.orderDetailInfos?.orgId || mergedDetail.orgId || patientInfo.value?.inHospitalOrgId) || '',
|
orgId: resolveOrgId(item.orderDetailInfos?.orgId || mergedDetail.orgId || patientInfo.value?.inHospitalOrgId) || '',
|
||||||
// 🔧 修复:同时保存 orgName,确保树匹配不到时仍有中文名称可显示
|
// 🔧 修复:同时保存 orgName,确保树匹配不到时仍有中文名称可显示
|
||||||
@@ -1614,19 +1680,33 @@ function handleSaveGroup(orderGroupList) {
|
|||||||
conditionId: conditionId.value,
|
conditionId: conditionId.value,
|
||||||
conditionDefinitionId: conditionDefinitionId.value,
|
conditionDefinitionId: conditionDefinitionId.value,
|
||||||
encounterDiagnosisId: encounterDiagnosisId.value,
|
encounterDiagnosisId: encounterDiagnosisId.value,
|
||||||
therapyEnum: prescriptionList.value[rowIndex.value]?.therapyEnum || '1',
|
therapyEnum: baseRow?.therapyEnum || '1',
|
||||||
};
|
};
|
||||||
|
// 覆盖关键字段:优先使用 item 的值,其次 mergedDetail(已由 setValue 填充),最后 baseRow
|
||||||
|
newRow.quantity = item.quantity ?? mergedDetail.quantity ?? baseRow.quantity;
|
||||||
|
newRow.methodCode = item.methodCode ?? mergedDetail.methodCode ?? baseRow.methodCode;
|
||||||
|
newRow.rateCode = item.rateCode ?? mergedDetail.rateCode ?? baseRow.rateCode;
|
||||||
|
newRow.dispensePerDuration = item.dispensePerDuration ?? mergedDetail.dispensePerDuration ?? baseRow.dispensePerDuration;
|
||||||
|
newRow.dose = item.dose ?? mergedDetail.dose ?? baseRow.dose;
|
||||||
|
newRow.doseQuantity = item.doseQuantity ?? mergedDetail.doseQuantity ?? baseRow.doseQuantity;
|
||||||
|
newRow.unitCode = item.unitCode ?? mergedDetail.unitCode ?? baseRow.unitCode;
|
||||||
|
newRow.unitCode_dictText = item.unitCodeName || mergedDetail.unitCodeName || baseRow.unitCode_dictText || '';
|
||||||
|
|
||||||
// 计算价格和总量
|
// 计算价格和总量
|
||||||
const unitInfo = unitCodeList.value.find((k) => k.value == item.unitCode);
|
// 🔧 Bug #403 修复:使用 newRow.unitCode(已由 setValue 填充)而非 item.unitCode
|
||||||
|
// 使用 ?? 替代 || 计算 partPercent,确保值为 0 时不会被错误替换
|
||||||
|
const finalUnitCode = newRow.unitCode;
|
||||||
|
const unitInfo = unitCodeList.value.find((k) => k.value == finalUnitCode);
|
||||||
|
const finalQuantity = newRow.quantity;
|
||||||
|
const partPercent = item.orderDetailInfos?.partPercent ?? mergedDetail.partPercent ?? baseRow.partPercent ?? 1;
|
||||||
if (unitInfo && unitInfo.type == 'minUnit') {
|
if (unitInfo && unitInfo.type == 'minUnit') {
|
||||||
newRow.price = newRow.minUnitPrice;
|
newRow.price = newRow.minUnitPrice;
|
||||||
newRow.totalPrice = (item.quantity * newRow.minUnitPrice).toFixed(6);
|
newRow.totalPrice = ((finalQuantity || 0) * newRow.minUnitPrice).toFixed(6);
|
||||||
newRow.minUnitQuantity = item.quantity;
|
newRow.minUnitQuantity = finalQuantity || 0;
|
||||||
} else {
|
} else {
|
||||||
newRow.price = newRow.unitPrice;
|
newRow.price = newRow.unitPrice;
|
||||||
newRow.totalPrice = (item.quantity * newRow.unitPrice).toFixed(6);
|
newRow.totalPrice = ((finalQuantity || 0) * newRow.unitPrice).toFixed(6);
|
||||||
newRow.minUnitQuantity = item.quantity * (item.orderDetailInfos?.partPercent || mergedDetail.partPercent || 1);
|
newRow.minUnitQuantity = (finalQuantity || 0) * partPercent;
|
||||||
}
|
}
|
||||||
|
|
||||||
newRow.contentJson = JSON.stringify(newRow);
|
newRow.contentJson = JSON.stringify(newRow);
|
||||||
|
|||||||
@@ -19,11 +19,9 @@
|
|||||||
<el-tab-pane label="检验申请" name="test">
|
<el-tab-pane label="检验申请" name="test">
|
||||||
<TestApplication ref="testApplicationRef" :show-status-column="true" />
|
<TestApplication ref="testApplicationRef" :show-status-column="true" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
```vue
|
|
||||||
<el-tab-pane label="检查申请" name="examine">
|
<el-tab-pane label="检查申请" name="examine">
|
||||||
<ExamineApplication ref="examineApplicationRef" />
|
<ExamineApplication ref="examineApplicationRef" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
```
|
|
||||||
<el-tab-pane label="汇总发药申请" name="summaryDrug">
|
<el-tab-pane label="汇总发药申请" name="summaryDrug">
|
||||||
<SummaryDrugApplication ref="summaryDrugApplicationRef" />
|
<SummaryDrugApplication ref="summaryDrugApplicationRef" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@@ -49,6 +47,7 @@
|
|||||||
import {computed, onBeforeMount, onMounted, provide, reactive, ref, watch,} from 'vue';
|
import {computed, onBeforeMount, onMounted, provide, reactive, ref, watch,} from 'vue';
|
||||||
|
|
||||||
import Emr from './emr/index.vue';
|
import Emr from './emr/index.vue';
|
||||||
|
import SummaryDrugApplication from './components/applicationShow/summaryDrugApplication.vue';
|
||||||
import inPatientBarDoctorFold from '@/components/patientBar/inPatientBarDoctorFold.vue';
|
import inPatientBarDoctorFold from '@/components/patientBar/inPatientBarDoctorFold.vue';
|
||||||
import PatientList from '@/components/PatientList/patient-list.vue';
|
import PatientList from '@/components/PatientList/patient-list.vue';
|
||||||
import {localPatientInfo, updateLocalPatientInfo} from './store/localPatient';
|
import {localPatientInfo, updateLocalPatientInfo} from './store/localPatient';
|
||||||
@@ -84,6 +83,7 @@ const currentPatientInfo = ref({});
|
|||||||
const testApplicationRef = ref();
|
const testApplicationRef = ref();
|
||||||
const examineApplicationRef = ref();
|
const examineApplicationRef = ref();
|
||||||
const surgeryApplicationRef = ref();
|
const surgeryApplicationRef = ref();
|
||||||
|
const summaryDrugApplicationRef = ref();
|
||||||
const bloodTtransfusionAapplicationRef = ref();
|
const bloodTtransfusionAapplicationRef = ref();
|
||||||
|
|
||||||
// 患者列表相关逻辑
|
// 患者列表相关逻辑
|
||||||
|
|||||||
@@ -251,7 +251,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<!-- 划价组套选择对话框 -->
|
<!-- 划价组套选择对话框 -->
|
||||||
<el-dialog v-model="groupSetDialogVisible" title="划价组套选择" width="600px" :close-on-click-modal="false" append-to-body>
|
<el-dialog v-model="groupSetDialogVisible" title="划价组套选择" width="600px" :close-on-click-modal="false" append-to-body :z-index="3000">
|
||||||
<div style="margin-bottom: 15px; display: flex; align-items: center; gap: 10px">
|
<div style="margin-bottom: 15px; display: flex; align-items: center; gap: 10px">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="groupSetSearchText"
|
v-model="groupSetSearchText"
|
||||||
@@ -296,6 +296,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
<el-empty v-if="!groupSetLoading && groupSetList.length === 0" description="暂无划价组套数据" :image-size="80" />
|
||||||
<div style="margin-top: 15px; text-align: right">
|
<div style="margin-top: 15px; text-align: right">
|
||||||
<el-button @click="groupSetDialogVisible = false">取消</el-button>
|
<el-button @click="groupSetDialogVisible = false">取消</el-button>
|
||||||
<el-button type="primary" @click="applyGroupSet" :disabled="!selectedGroupSet">应用</el-button>
|
<el-button type="primary" @click="applyGroupSet" :disabled="!selectedGroupSet">应用</el-button>
|
||||||
@@ -481,19 +482,68 @@ watch(
|
|||||||
(visible) => {
|
(visible) => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
executeTime.value = formatDateStr(new Date(), 'YYYY-MM-DD HH:mm:ss');
|
executeTime.value = formatDateStr(new Date(), 'YYYY-MM-DD HH:mm:ss');
|
||||||
|
// 弹窗打开时重新加载科室和位置选项,确保数据最新
|
||||||
|
loadDepartmentOptions();
|
||||||
|
getDiseaseInitLoc(16);
|
||||||
} else {
|
} else {
|
||||||
resetData();
|
resetData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// 加载科室选项
|
// 监听科室选项加载完成,为已添加的诊疗项目设置默认执行科室
|
||||||
|
watch(
|
||||||
|
() => departmentOptions.value,
|
||||||
|
(depts) => {
|
||||||
|
if (!depts || depts.length === 0) return;
|
||||||
|
feeItemsList.value.forEach(item => {
|
||||||
|
if (item.adviceType === 3 && !item.positionId) {
|
||||||
|
const patientOrgId = props.patientInfo.organizationId;
|
||||||
|
const matched = depts.find(d => String(d.id) === String(patientOrgId));
|
||||||
|
item.positionId = matched ? String(matched.id) : String(depts[0].id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// 监听位置选项加载完成,为已添加的耗材项目设置默认位置
|
||||||
|
watch(
|
||||||
|
() => locationOptions.value,
|
||||||
|
(locs) => {
|
||||||
|
if (!locs || locs.length === 0) return;
|
||||||
|
feeItemsList.value.forEach(item => {
|
||||||
|
if (item.adviceType === 2 && !item.positionId) {
|
||||||
|
item.positionId = String(locs[0].value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// 加载科室选项(支持树形/扁平两种数据结构)
|
||||||
function loadDepartmentOptions() {
|
function loadDepartmentOptions() {
|
||||||
getOrgList()
|
getOrgList()
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.data && res.data.records && res.data.records.length > 0) {
|
if (res.data) {
|
||||||
departmentOptions.value = res.data.records[0].children || [];
|
// 尝试从树形结构中取:records[0].children
|
||||||
|
if (res.data.records && res.data.records.length > 0) {
|
||||||
|
if (res.data.records[0].children && res.data.records[0].children.length > 0) {
|
||||||
|
departmentOptions.value = res.data.records[0].children;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 如果 records[0] 有 id 和 name(非树根节点),直接用所有 records
|
||||||
|
if (res.data.records[0].id) {
|
||||||
|
departmentOptions.value = res.data.records;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 兜底:如果 records 不存在或为空,尝试直接使用 data 本身
|
||||||
|
if (Array.isArray(res.data)) {
|
||||||
|
departmentOptions.value = res.data;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// 所有方式都失败,置空
|
||||||
|
departmentOptions.value = [];
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
console.warn('科室列表加载失败(可能无权限)');
|
console.warn('科室列表加载失败(可能无权限)');
|
||||||
@@ -527,23 +577,27 @@ function getDiseaseInitLoc() {
|
|||||||
locationOptions.value = [];
|
locationOptions.value = [];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 下拉框模糊搜索过滤
|
// 下拉框模糊搜索过滤(自定义filter-method,配合element-plus filterable使用)
|
||||||
function filterOptions(val, row, optionsKey) {
|
function filterOptions(val, row, optionsKey) {
|
||||||
const key = row.adviceDefinitionId + '_' + optionsKey;
|
const key = row.adviceDefinitionId + '_' + optionsKey;
|
||||||
filterKeywords.value[key] = val;
|
if (!val || val.trim() === '') {
|
||||||
|
delete filterKeywords.value[key];
|
||||||
|
} else {
|
||||||
|
filterKeywords.value[key] = val.toLowerCase();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function getFilteredOptions(row, optionsKey) {
|
function getFilteredOptions(row, optionsKey) {
|
||||||
const key = row.adviceDefinitionId + '_' + optionsKey;
|
const key = row.adviceDefinitionId + '_' + optionsKey;
|
||||||
const keyword = filterKeywords.value[key];
|
const keyword = filterKeywords.value[key];
|
||||||
const options = optionsKey === 'departmentOptions' ? departmentOptions.value : locationOptions.value;
|
const options = optionsKey === 'departmentOptions' ? departmentOptions.value : locationOptions.value;
|
||||||
if (!keyword || keyword.trim() === '') {
|
if (!keyword) {
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
const lower = keyword.toLowerCase();
|
|
||||||
return options.filter(item => {
|
return options.filter(item => {
|
||||||
const name = (item.name || item.label || '').toLowerCase();
|
const name = (item.name || item.label || '').toLowerCase();
|
||||||
const id = String(item.id || item.value || '').toLowerCase();
|
const id = String(item.id || item.value || '').toLowerCase();
|
||||||
return name.includes(lower) || id.includes(lower);
|
const py = (item.pyStr || '').toLowerCase();
|
||||||
|
return name.includes(keyword) || id.includes(keyword) || py.includes(keyword);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 获取组套类型文本
|
// 获取组套类型文本
|
||||||
@@ -552,19 +606,26 @@ function getItemType_Text(type) {
|
|||||||
return map[type] || '其他';
|
return map[type] || '其他';
|
||||||
}
|
}
|
||||||
function getUnitCodeOptions(row) {
|
function getUnitCodeOptions(row) {
|
||||||
const unitCodes = [
|
const unitCodes = [];
|
||||||
{ code: row.unitCode, codeText: row.unitCode_dictText },
|
// 大单位:优先用 code,code 缺失时用字典文本兜底
|
||||||
{ code: row.minUnitCode, codeText: row.minUnitCode_dictText },
|
if (row.unitCode != null && String(row.unitCode) !== '') {
|
||||||
];
|
unitCodes.push({ code: String(row.unitCode), codeText: row.unitCode_dictText });
|
||||||
// 使用 Set 来跟踪已经存在的 code
|
} else if (row.unitCode_dictText) {
|
||||||
|
unitCodes.push({ code: row.unitCode_dictText, codeText: row.unitCode_dictText });
|
||||||
|
}
|
||||||
|
// 小单位:同上
|
||||||
|
if (row.minUnitCode != null && String(row.minUnitCode) !== '') {
|
||||||
|
unitCodes.push({ code: String(row.minUnitCode), codeText: row.minUnitCode_dictText });
|
||||||
|
} else if (row.minUnitCode_dictText) {
|
||||||
|
unitCodes.push({ code: row.minUnitCode_dictText, codeText: row.minUnitCode_dictText });
|
||||||
|
}
|
||||||
|
// 去重
|
||||||
const seenCodes = new Set();
|
const seenCodes = new Set();
|
||||||
const uniqueUnitCodes = unitCodes.filter((item) => {
|
const uniqueUnitCodes = unitCodes.filter((item) => {
|
||||||
// 如果 Set 中没有这个 code,就保留它,并把它加入 Set
|
|
||||||
if (!seenCodes.has(item.code)) {
|
if (!seenCodes.has(item.code)) {
|
||||||
seenCodes.add(item.code);
|
seenCodes.add(item.code);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// 如果已经存在,就过滤掉
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
return uniqueUnitCodes;
|
return uniqueUnitCodes;
|
||||||
@@ -575,11 +636,11 @@ function unitCodeChange(row) {
|
|||||||
// 获取价格
|
// 获取价格
|
||||||
const price = row.priceList?.[0]?.price || 0;
|
const price = row.priceList?.[0]?.price || 0;
|
||||||
|
|
||||||
// 根据选择的单位调整单价
|
// 根据选择的单位调整单价(统一用字符串比较)
|
||||||
if (row.selectUnitCode === row.unitCode) {
|
if (String(row.selectUnitCode) === String(row.unitCode)) {
|
||||||
// 如果选择的是大单位 (如 "盒")
|
// 如果选择的是大单位 (如 "盒")
|
||||||
row.unitPrice = price.toFixed(6); // 单价就是原价
|
row.unitPrice = price.toFixed(6); // 单价就是原价
|
||||||
} else if (row.selectUnitCode === row.minUnitCode) {
|
} else if (String(row.selectUnitCode) === String(row.minUnitCode)) {
|
||||||
// 如果选择的是小单位 (如 "个")
|
// 如果选择的是小单位 (如 "个")
|
||||||
row.unitPrice = (price / (row.partPercent || 1)).toFixed(6); // 单价 = 原价 / 拆零比
|
row.unitPrice = (price / (row.partPercent || 1)).toFixed(6); // 单价 = 原价 / 拆零比
|
||||||
}
|
}
|
||||||
@@ -627,14 +688,36 @@ function selectChange(row) {
|
|||||||
defaultUnitCode = String(row.minUnitCode);
|
defaultUnitCode = String(row.minUnitCode);
|
||||||
} else if (row.unitCode) {
|
} else if (row.unitCode) {
|
||||||
defaultUnitCode = String(row.unitCode);
|
defaultUnitCode = String(row.unitCode);
|
||||||
|
} else if (row.minUnitCode_dictText) {
|
||||||
|
// 兜底:如果 minUnitCode 为空但字典文本存在,使用文本作为选项值
|
||||||
|
defaultUnitCode = row.minUnitCode_dictText;
|
||||||
|
} else if (row.unitCode_dictText) {
|
||||||
|
defaultUnitCode = row.unitCode_dictText;
|
||||||
|
}
|
||||||
|
// 如果默认单位不在 uniqueUnitCodes 中,添加兜底选项
|
||||||
|
if (defaultUnitCode && !uniqueUnitCodes.some(u => u.code === defaultUnitCode)) {
|
||||||
|
uniqueUnitCodes.push({ code: defaultUnitCode, codeText: defaultUnitCode });
|
||||||
}
|
}
|
||||||
// 设置默认执行科室/位置(统一转为字符串,避免 el-select 类型不匹配)
|
// 设置默认执行科室/位置(统一转为字符串,避免 el-select 类型不匹配)
|
||||||
let defaultPositionId = undefined;
|
let defaultPositionId = undefined;
|
||||||
if (row.adviceType === 3 && departmentOptions.value.length > 0) {
|
if (row.adviceType === 3 && departmentOptions.value.length > 0) {
|
||||||
// 诊疗:优先使用患者所在科室,否则取第一个科室
|
// 诊疗:
|
||||||
const patientOrgId = props.patientInfo.organizationId;
|
// 1. 优先使用诊疗目录项目的"所属科室"(row.orgId)
|
||||||
const matched = departmentOptions.value.find(d => String(d.id) === String(patientOrgId));
|
// 2. 其次使用患者当前病房科室(patientInfo.organizationId)
|
||||||
defaultPositionId = matched ? String(matched.id) : String(departmentOptions.value[0].id);
|
// 3. 最后取第一个科室
|
||||||
|
const orgIdPriority = [row.orgId, props.patientInfo.organizationId];
|
||||||
|
for (const id of orgIdPriority) {
|
||||||
|
if (id) {
|
||||||
|
const matched = departmentOptions.value.find(d => String(d.id) === String(id));
|
||||||
|
if (matched) {
|
||||||
|
defaultPositionId = String(matched.id);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!defaultPositionId) {
|
||||||
|
defaultPositionId = String(departmentOptions.value[0].id);
|
||||||
|
}
|
||||||
} else if (row.adviceType === 2 && locationOptions.value.length > 0) {
|
} else if (row.adviceType === 2 && locationOptions.value.length > 0) {
|
||||||
// 耗材:默认取第一个药房/耗材房
|
// 耗材:默认取第一个药房/耗材房
|
||||||
defaultPositionId = String(locationOptions.value[0].value);
|
defaultPositionId = String(locationOptions.value[0].value);
|
||||||
@@ -763,6 +846,7 @@ function resetData() {
|
|||||||
|
|
||||||
// 划价组套相关功能
|
// 划价组套相关功能
|
||||||
function openGroupSetDialog() {
|
function openGroupSetDialog() {
|
||||||
|
console.log('openGroupSetDialog called');
|
||||||
groupSetDialogVisible.value = true;
|
groupSetDialogVisible.value = true;
|
||||||
groupSetSearchText.value = '';
|
groupSetSearchText.value = '';
|
||||||
selectedGroupSet.value = null;
|
selectedGroupSet.value = null;
|
||||||
@@ -771,19 +855,37 @@ function openGroupSetDialog() {
|
|||||||
|
|
||||||
function loadGroupSets() {
|
function loadGroupSets() {
|
||||||
groupSetLoading.value = true;
|
groupSetLoading.value = true;
|
||||||
getOrderGroup({ organizationId: orgId.value })
|
const params = { organizationId: orgId.value };
|
||||||
|
// 传递搜索关键字,后端 /group-package-for-order 虽不直接支持 searchKey,
|
||||||
|
// 但保持参数传递以便后续扩展
|
||||||
|
if (groupSetSearchText.value && groupSetSearchText.value.trim()) {
|
||||||
|
params.searchKey = groupSetSearchText.value.trim();
|
||||||
|
}
|
||||||
|
getOrderGroup(params)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res?.data || {};
|
const data = res?.data || {};
|
||||||
|
let rawList = [];
|
||||||
if (groupSetRange.value === 1) {
|
if (groupSetRange.value === 1) {
|
||||||
groupSetList.value = data.personalList || [];
|
rawList = data.personalList || [];
|
||||||
} else if (groupSetRange.value === 2) {
|
} else if (groupSetRange.value === 2) {
|
||||||
groupSetList.value = data.organizationList || [];
|
rawList = data.organizationList || [];
|
||||||
} else {
|
} else {
|
||||||
groupSetList.value = data.hospitalList || [];
|
rawList = data.hospitalList || [];
|
||||||
|
}
|
||||||
|
// 客户端过滤:根据搜索关键字过滤组套名称
|
||||||
|
const keyword = groupSetSearchText.value?.trim()?.toLowerCase();
|
||||||
|
if (keyword) {
|
||||||
|
groupSetList.value = rawList.filter(item => {
|
||||||
|
const name = (item.name || item.Name || '').toLowerCase();
|
||||||
|
return name.includes(keyword);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
groupSetList.value = rawList;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((err) => {
|
||||||
console.warn('组套列表加载失败(可能无权限)');
|
console.warn('组套列表加载失败(可能无权限):', err);
|
||||||
|
ElMessage.warning('组套列表加载失败,当前暂无可用组套');
|
||||||
groupSetList.value = [];
|
groupSetList.value = [];
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ export function getOrgList() {
|
|||||||
return request({
|
return request({
|
||||||
url: '/base-data-manage/organization/organization',
|
url: '/base-data-manage/organization/organization',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
params: { pageSize: 100, pageNum: 1 },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -463,20 +463,45 @@ function watchPatientSelection() {
|
|||||||
}, 300);
|
}, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 查询科室 */
|
/** 查询科室(支持树形/扁平多种响应结构) */
|
||||||
const getLocationInfo = () => {
|
const getLocationInfo = () => {
|
||||||
getOrgList().then((res) => {
|
getOrgList().then((res) => {
|
||||||
orgOptions.value = res.data?.records[0]?.children;
|
if (!res.data) {
|
||||||
|
orgOptions.value = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 尝试从树形结构取:records[0].children
|
||||||
|
if (res.data.records && res.data.records.length > 0) {
|
||||||
|
if (res.data.records[0].children && res.data.records[0].children.length > 0) {
|
||||||
|
orgOptions.value = res.data.records[0].children;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 如果 records[0] 有 id 和 name(非树根节点),直接用所有 records
|
||||||
|
if (res.data.records[0].id) {
|
||||||
|
orgOptions.value = res.data.records;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 兜底:如果 data 本身是数组
|
||||||
|
if (Array.isArray(res.data)) {
|
||||||
|
orgOptions.value = res.data;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
orgOptions.value = [];
|
||||||
|
}).catch(() => {
|
||||||
|
console.warn('科室列表加载失败(可能无权限)');
|
||||||
|
orgOptions.value = [];
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
getLocationInfo();
|
getLocationInfo();
|
||||||
|
|
||||||
// 映射
|
// 映射(查找失败时返回 '-' 而非显示内码)
|
||||||
const selectOrg = (itemid) => {
|
const selectOrg = (itemid) => {
|
||||||
|
if (!itemid) return '-';
|
||||||
const item = orgOptions.value.find((item) => {
|
const item = orgOptions.value.find((item) => {
|
||||||
return item.id == itemid;
|
return item.id == itemid;
|
||||||
});
|
});
|
||||||
return item?.name;
|
return item?.name || '-';
|
||||||
};
|
};
|
||||||
// 重置
|
// 重置
|
||||||
const onReset = () => {
|
const onReset = () => {
|
||||||
|
|||||||
@@ -174,7 +174,6 @@ const activeNames = ref([]);
|
|||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const prescriptionList = ref([]);
|
const prescriptionList = ref([]);
|
||||||
const deadline = ref(formatDateStr(new Date(), 'YYYY-MM-DD') + ' 23:59:59');
|
const deadline = ref(formatDateStr(new Date(), 'YYYY-MM-DD') + ' 23:59:59');
|
||||||
const therapyEnum = ref(undefined);
|
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const chooseAll = ref(false);
|
const chooseAll = ref(false);
|
||||||
@@ -190,6 +189,10 @@ const props = defineProps({
|
|||||||
deadline: {
|
deadline: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
|
therapyEnum: {
|
||||||
|
type: Number,
|
||||||
|
default: undefined,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
function handleGetPrescription() {
|
function handleGetPrescription() {
|
||||||
@@ -200,7 +203,7 @@ function handleGetPrescription() {
|
|||||||
encounterIds: encounterIds,
|
encounterIds: encounterIds,
|
||||||
pageSize: 10000,
|
pageSize: 10000,
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
therapyEnum: therapyEnum.value,
|
therapyEnum: props.therapyEnum,
|
||||||
exeStatus: props.exeStatus,
|
exeStatus: props.exeStatus,
|
||||||
requestStatus: props.requestStatus,
|
requestStatus: props.requestStatus,
|
||||||
})
|
})
|
||||||
@@ -299,6 +302,29 @@ function getSelectRows() {
|
|||||||
});
|
});
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTableRef(index) {
|
||||||
|
return proxy.$refs['tableRef' + index]?.[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectAllRows() {
|
||||||
|
prescriptionList.value.forEach((item, index) => {
|
||||||
|
const tableRef = getTableRef(index);
|
||||||
|
if (!tableRef) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
item.forEach((row) => {
|
||||||
|
tableRef.toggleRowSelection(row, true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearSelection() {
|
||||||
|
prescriptionList.value.forEach((item, index) => {
|
||||||
|
getTableRef(index)?.clearSelection();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function handleRateChange(value, item, row) {
|
function handleRateChange(value, item, row) {
|
||||||
// 拼接当前选中时间
|
// 拼接当前选中时间
|
||||||
if (value) {
|
if (value) {
|
||||||
@@ -316,6 +342,8 @@ function handleRateChange(value, item, row) {
|
|||||||
defineExpose({
|
defineExpose({
|
||||||
handleGetPrescription,
|
handleGetPrescription,
|
||||||
handleMedicineSummary,
|
handleMedicineSummary,
|
||||||
|
selectAllRows,
|
||||||
|
clearSelection,
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -66,13 +66,21 @@ const props = defineProps({
|
|||||||
type: Number,
|
type: Number,
|
||||||
default: 1,
|
default: 1,
|
||||||
},
|
},
|
||||||
|
therapyEnum: {
|
||||||
|
type: Number,
|
||||||
|
default: undefined,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
handleGetPrescription();
|
handleGetPrescription();
|
||||||
function handleGetPrescription() {
|
function handleGetPrescription() {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
let encounterIds = patientInfoList.value.map((i) => i.encounterId).join(',');
|
let encounterIds = patientInfoList.value.map((i) => i.encounterId).join(',');
|
||||||
getMedicineSummary({}).then((res) => {
|
const params = {};
|
||||||
|
if (props.therapyEnum !== undefined) {
|
||||||
|
params.therapyEnum = props.therapyEnum;
|
||||||
|
}
|
||||||
|
getMedicineSummary(params).then((res) => {
|
||||||
medicineSummaryFormList.value = res.data.records;
|
medicineSummaryFormList.value = res.data.records;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
:clearable="false"
|
:clearable="false"
|
||||||
@change="handleGetPrescription"
|
@change="handleGetPrescription"
|
||||||
/>
|
/>
|
||||||
<el-radio-group v-model="therapyEnum" class="ml20" @change="handleRadioChange">
|
<el-radio-group v-model="therapyEnum" class="ml20" @change="handleTherapyChange">
|
||||||
<el-radio :value="undefined">全部</el-radio>
|
<el-radio :value="undefined">全部</el-radio>
|
||||||
<el-radio :value="1">长期</el-radio>
|
<el-radio :value="1">长期</el-radio>
|
||||||
<el-radio :value="2">临时</el-radio>
|
<el-radio :value="2">临时</el-radio>
|
||||||
@@ -69,7 +69,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span class="descriptions-item-label">全选:</span>
|
<span class="descriptions-item-label">全选:</span>
|
||||||
<el-switch v-model="chooseAll" @change="handelSwicthChange" />
|
<el-switch
|
||||||
|
v-model="chooseAll"
|
||||||
|
:disabled="isDetails != '1'"
|
||||||
|
@change="handelSwicthChange"
|
||||||
|
/>
|
||||||
<el-button class="ml20 mr20" type="primary" @click="handleExecute"> 汇总领药 </el-button>
|
<el-button class="ml20 mr20" type="primary" @click="handleExecute"> 汇总领药 </el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -79,8 +83,9 @@
|
|||||||
:exeStatus="exeStatus"
|
:exeStatus="exeStatus"
|
||||||
:requestStatus="requestStatus"
|
:requestStatus="requestStatus"
|
||||||
:deadline="deadline"
|
:deadline="deadline"
|
||||||
|
:therapyEnum="therapyEnum"
|
||||||
/>
|
/>
|
||||||
<SummaryMedicineList v-else />
|
<SummaryMedicineList v-else ref="summaryMedicineRefs" :therapyEnum="therapyEnum" />
|
||||||
<!-- <el-tabs v-model="activeName" class="demo-tabs centered-tabs" @tab-change="handleClick">
|
<!-- <el-tabs v-model="activeName" class="demo-tabs centered-tabs" @tab-change="handleClick">
|
||||||
<el-tab-pane
|
<el-tab-pane
|
||||||
v-for="tab in prescriptionTabs"
|
v-for="tab in prescriptionTabs"
|
||||||
@@ -120,9 +125,11 @@ const requestStatus = ref(RequestStatus.COMPLETED);
|
|||||||
const chooseAll = ref(false);
|
const chooseAll = ref(false);
|
||||||
const drugType = ref('1');
|
const drugType = ref('1');
|
||||||
const isDetails = ref('1');
|
const isDetails = ref('1');
|
||||||
|
const therapyEnum = ref(undefined);
|
||||||
|
|
||||||
// 存储子组件引用的对象
|
// 存储子组件引用的对象
|
||||||
const prescriptionRefs = ref();
|
const prescriptionRefs = ref();
|
||||||
|
const summaryMedicineRefs = ref();
|
||||||
|
|
||||||
const navigationButtons = inpatientNurseNavs;
|
const navigationButtons = inpatientNurseNavs;
|
||||||
|
|
||||||
@@ -158,23 +165,38 @@ function handleClick(tabName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleGetPrescription() {
|
function handleGetPrescription() {
|
||||||
prescriptionRefs.value.handleGetPrescription();
|
chooseAll.value = false;
|
||||||
|
if (isDetails.value == '1') {
|
||||||
|
prescriptionRefs.value?.handleGetPrescription();
|
||||||
|
} else {
|
||||||
|
summaryMedicineRefs.value?.handleGetPrescription();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handelSwicthChange() {
|
function handelSwicthChange(value) {
|
||||||
if (chooseAll.value) {
|
if (!prescriptionRefs.value) {
|
||||||
proxy.$refs['prescriptionRefs'].selectAllRows();
|
chooseAll.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (value) {
|
||||||
|
prescriptionRefs.value.selectAllRows();
|
||||||
} else {
|
} else {
|
||||||
proxy.$refs['prescriptionRefs'].clearSelection();
|
prescriptionRefs.value.clearSelection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleRadioChange(value) {
|
function handleRadioChange(value) {
|
||||||
|
chooseAll.value = false;
|
||||||
if (value == '1') {
|
if (value == '1') {
|
||||||
handleGetPrescription();
|
handleGetPrescription();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleTherapyChange() {
|
||||||
|
chooseAll.value = false;
|
||||||
|
handleGetPrescription();
|
||||||
|
}
|
||||||
|
|
||||||
function handleExecute() {
|
function handleExecute() {
|
||||||
proxy.$refs['prescriptionRefs'].handleMedicineSummary();
|
proxy.$refs['prescriptionRefs'].handleMedicineSummary();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -453,8 +453,14 @@ const loadPatientInfo = () => {
|
|||||||
interventionForm.value.startTime = dayjs(res.data.startTime).format(
|
interventionForm.value.startTime = dayjs(res.data.startTime).format(
|
||||||
'YYYY-MM-DD HH:mm:ss'
|
'YYYY-MM-DD HH:mm:ss'
|
||||||
);
|
);
|
||||||
|
} else if (res.data.inHosTime) {
|
||||||
|
interventionForm.value.startTime = dayjs(res.data.inHosTime).format(
|
||||||
|
'YYYY-MM-DD HH:mm:ss'
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
interventionForm.value.startTime = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss');
|
// 已有患者(entranceType == 1)不自动填充当前时间,避免覆盖历史数据
|
||||||
|
// 新入科患者由后端默认返回当前时间,或由用户手动选择
|
||||||
|
interventionForm.value.startTime = '';
|
||||||
}
|
}
|
||||||
interventionForm.value.height = res.data.height;
|
interventionForm.value.height = res.data.height;
|
||||||
interventionForm.value.weight = res.data.weight;
|
interventionForm.value.weight = res.data.weight;
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ function normalizeDayTimeHm(part) {
|
|||||||
return `${h}:${m}`;
|
return `${h}:${m}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleGetPrescription() {
|
function handleGetPrescription(skipAutoSelectAll = false) {
|
||||||
if (patientInfoList.value.length > 0) {
|
if (patientInfoList.value.length > 0) {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
let encounterIds = patientInfoList.value.map((i) => i.encounterId).join(',');
|
let encounterIds = patientInfoList.value.map((i) => i.encounterId).join(',');
|
||||||
@@ -430,10 +430,12 @@ function handleGetPrescription() {
|
|||||||
|
|
||||||
// 将分组结果转换为数组形式
|
// 将分组结果转换为数组形式
|
||||||
prescriptionList.value = Object.values(groupedPrescriptions);
|
prescriptionList.value = Object.values(groupedPrescriptions);
|
||||||
// 默认选中全部行
|
// 默认选中全部行(执行后刷新时不自动全选,保持用户操作状态)
|
||||||
nextTick(() => {
|
if (!skipAutoSelectAll) {
|
||||||
defaultSelectAllRows();
|
nextTick(() => {
|
||||||
});
|
defaultSelectAllRows();
|
||||||
|
});
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('医嘱执行-获取处方列表数据处理失败:', error);
|
console.error('医嘱执行-获取处方列表数据处理失败:', error);
|
||||||
prescriptionList.value = [];
|
prescriptionList.value = [];
|
||||||
@@ -457,10 +459,15 @@ function handleGetPrescription() {
|
|||||||
// 执行
|
// 执行
|
||||||
function handleExecute() {
|
function handleExecute() {
|
||||||
let list = getSelectRows();
|
let list = getSelectRows();
|
||||||
|
if (list.length === 0) {
|
||||||
|
proxy.$modal.msgWarning('请选择需要执行的医嘱');
|
||||||
|
return;
|
||||||
|
}
|
||||||
let encounterIds = patientInfoList.value.map((i) => i.encounterId).join(',');
|
let encounterIds = patientInfoList.value.map((i) => i.encounterId).join(',');
|
||||||
list = list.map((item) => {
|
list = list.map((item) => {
|
||||||
return {
|
return {
|
||||||
requestId: item.requestId,
|
requestId: item.requestId,
|
||||||
|
encounterId: item.encounterId,
|
||||||
accountId: item.accountId,
|
accountId: item.accountId,
|
||||||
adviceTable: item.adviceTable,
|
adviceTable: item.adviceTable,
|
||||||
executeTimes: item.executeTimes,
|
executeTimes: item.executeTimes,
|
||||||
@@ -469,22 +476,35 @@ function handleExecute() {
|
|||||||
console.log(list, 'list');
|
console.log(list, 'list');
|
||||||
adviceExecute({ exeDate: exeDate.value, adviceExecuteDetailList: list }).then((res) => {
|
adviceExecute({ exeDate: exeDate.value, adviceExecuteDetailList: list }).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
handleGetPrescription();
|
// 仅当选中医嘱中包含诊疗类医嘱(可能绑定耗材)时,才调用耗材批号匹配
|
||||||
// 仅当选中医嘱中包含药品/耗材类医嘱时,才调用耗材批号匹配
|
// adviceTable 取值为 med_medication_request(药品)或 wor_service_request(诊疗/耗材)
|
||||||
const hasMedOrDevice = list.some(
|
const hasServiceRequest = list.some((item) =>
|
||||||
(item) =>
|
String(item.adviceTable || '') === 'wor_service_request',
|
||||||
item.adviceTable === 'med_medication_request' ||
|
|
||||||
String(item.adviceTable || '').includes('device'),
|
|
||||||
);
|
);
|
||||||
if (hasMedOrDevice) {
|
if (hasServiceRequest) {
|
||||||
lotNumberMatch({ encounterIdList: encounterIds }, { skipErrorMsg: true }).catch((error) => {
|
// 仅传入选中医嘱对应的 encounterId,避免其他患者的耗材记录干扰
|
||||||
console.warn('lotNumberMatch failed after adviceExecute:', error);
|
const selectedEncounterIds = [...new Set(list.map((item) => item.encounterId).filter(Boolean))];
|
||||||
});
|
if (selectedEncounterIds.length > 0) {
|
||||||
|
lotNumberMatch({ encounterIdList: selectedEncounterIds }, { skipErrorMsg: true })
|
||||||
|
.then((matchRes) => {
|
||||||
|
if (matchRes && matchRes.code !== 200) {
|
||||||
|
console.warn('lotNumberMatch returned error:', matchRes.msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.warn('lotNumberMatch failed after adviceExecute:', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// 刷新列表(不自动全选,保持用户操作前的选择状态)
|
||||||
|
handleGetPrescription(true);
|
||||||
proxy.$modal.msgSuccess(res.msg || '医嘱执行成功');
|
proxy.$modal.msgSuccess(res.msg || '医嘱执行成功');
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError(res.msg || '医嘱执行失败');
|
proxy.$modal.msgError(res.msg || '医嘱执行失败');
|
||||||
}
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error('医嘱执行接口调用失败:', error);
|
||||||
|
proxy.$modal.msgError('医嘱执行失败,请稍后重试');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,7 +524,7 @@ function handleNoExecute() {
|
|||||||
adviceNoExecute({ adviceExecuteDetailList: list }).then((res) => {
|
adviceNoExecute({ adviceExecuteDetailList: list }).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
proxy.$modal.msgSuccess(res.msg || '操作成功');
|
proxy.$modal.msgSuccess(res.msg || '操作成功');
|
||||||
handleGetPrescription();
|
handleGetPrescription(true);
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError(res.msg || '操作失败');
|
proxy.$modal.msgError(res.msg || '操作失败');
|
||||||
}
|
}
|
||||||
@@ -543,7 +563,7 @@ function handleCancel() {
|
|||||||
adviceCancel({ adviceExecuteDetailList: producerIds }).then((res) => {
|
adviceCancel({ adviceExecuteDetailList: producerIds }).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
proxy.$modal.msgSuccess(res.msg || '取消执行成功');
|
proxy.$modal.msgSuccess(res.msg || '取消执行成功');
|
||||||
handleGetPrescription();
|
handleGetPrescription(true);
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError(res.msg || '取消执行失败');
|
proxy.$modal.msgError(res.msg || '取消执行失败');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,9 @@
|
|||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<el-radio-group v-model="type" class="ml20" @change="handleRadioChange">
|
<el-radio-group v-model="type" class="ml20" @change="handleRadioChange">
|
||||||
<el-radio :label="1">全部</el-radio>
|
<el-radio :label="null">全部</el-radio>
|
||||||
<el-radio :label="2">长期</el-radio>
|
<el-radio :label="1">长期</el-radio>
|
||||||
<el-radio :label="3">临时</el-radio>
|
<el-radio :label="2">临时</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
<el-button class="ml20" type="primary" plain @click="handleGetPrescription">
|
<el-button class="ml20" type="primary" plain @click="handleGetPrescription">
|
||||||
查询
|
查询
|
||||||
@@ -159,7 +159,7 @@ import {formatDateStr} from '@/utils/index';
|
|||||||
const activeNames = ref([]);
|
const activeNames = ref([]);
|
||||||
const prescriptionList = ref([]);
|
const prescriptionList = ref([]);
|
||||||
const deadline = ref(formatDateStr(new Date(), 'YYYY-MM-DD') + ' 23:59:59');
|
const deadline = ref(formatDateStr(new Date(), 'YYYY-MM-DD') + ' 23:59:59');
|
||||||
const type = ref(1);
|
const type = ref(null);
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const chooseAll = ref(false);
|
const chooseAll = ref(false);
|
||||||
@@ -181,7 +181,7 @@ function handleGetPrescription() {
|
|||||||
getPrescriptionList({
|
getPrescriptionList({
|
||||||
encounterIds: encounterIds,
|
encounterIds: encounterIds,
|
||||||
requestStatus: props.requestStatus,
|
requestStatus: props.requestStatus,
|
||||||
...(type.value !== undefined ? { therapyEnum: type.value } : {}),
|
...(type.value != null ? { therapyEnum: type.value } : {}),
|
||||||
pageSize: 10000,
|
pageSize: 10000,
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
|
|||||||
@@ -1057,8 +1057,8 @@ function confirmCharge() {
|
|||||||
params.recordingDate = formData.value.recordingDate || moment(new Date()).format('YYYY-MM-DD');
|
params.recordingDate = formData.value.recordingDate || moment(new Date()).format('YYYY-MM-DD');
|
||||||
|
|
||||||
addVitalSigns(params).then(res => {
|
addVitalSigns(params).then(res => {
|
||||||
console.log('保存成功:', res);
|
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
|
proxy.msgSuccess('保存成功');
|
||||||
// 保存成功后刷新列表
|
// 保存成功后刷新列表
|
||||||
getPatientList();
|
getPatientList();
|
||||||
// 清空表单
|
// 清空表单
|
||||||
@@ -1087,8 +1087,6 @@ function confirmCharge() {
|
|||||||
urineVolume: '',
|
urineVolume: '',
|
||||||
stoolVolume: '',
|
stoolVolume: '',
|
||||||
};
|
};
|
||||||
// 保存成功后关闭弹窗
|
|
||||||
closeDialog();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,11 @@ const props = defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
/** 表头所选出库仓库:传入后药品列表只含该仓有库存的行,避免选到别仓批号导致 inventory-item-info 一直为 0 */
|
||||||
|
orgLocationId: {
|
||||||
|
type: [String, Number],
|
||||||
|
default: undefined,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
const emit = defineEmits(['selectRow']);
|
const emit = defineEmits(['selectRow']);
|
||||||
const queryParams = ref({
|
const queryParams = ref({
|
||||||
@@ -89,11 +93,14 @@ watch(
|
|||||||
queryParams.value.searchKey = newValue.searchKey;
|
queryParams.value.searchKey = newValue.searchKey;
|
||||||
queryParams.value.itemType = newValue.itemType;
|
queryParams.value.itemType = newValue.itemType;
|
||||||
queryParams.value.purchaseFlag = 0;
|
queryParams.value.purchaseFlag = 0;
|
||||||
// queryParams.value.sourceLocationId = newValue.sourceLocationId;
|
if (newValue.orgLocationId != null && newValue.orgLocationId !== '') {
|
||||||
// queryParams.value.purposeLocationId = newValue.purposeLocationId;
|
queryParams.value.orgLocationId = newValue.orgLocationId;
|
||||||
|
} else {
|
||||||
|
delete queryParams.value.orgLocationId;
|
||||||
|
}
|
||||||
throttledGetList();
|
throttledGetList();
|
||||||
},
|
},
|
||||||
{ immdiate: true, deep: true }
|
{ immediate: true, deep: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
getList();
|
getList();
|
||||||
|
|||||||
@@ -133,6 +133,7 @@
|
|||||||
filterable
|
filterable
|
||||||
style="width: 200px"
|
style="width: 200px"
|
||||||
:disabled="data.isEdit"
|
:disabled="data.isEdit"
|
||||||
|
@change="onHeaderWarehouseChange"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in purposeTypeListOptions"
|
v-for="item in purposeTypeListOptions"
|
||||||
@@ -222,6 +223,7 @@
|
|||||||
@selectRow="(row) => selectRow(row, scope.$index)"
|
@selectRow="(row) => selectRow(row, scope.$index)"
|
||||||
:searchKey="medicineSearchKey"
|
:searchKey="medicineSearchKey"
|
||||||
:itemType="itemType"
|
:itemType="itemType"
|
||||||
|
:orgLocationId="receiptHeaderForm.headerLocationId"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</PopoverList>
|
</PopoverList>
|
||||||
@@ -483,6 +485,46 @@ import {useStore} from '@/store/store';
|
|||||||
import useTagsViewStore from '@/store/modules/tagsView';
|
import useTagsViewStore from '@/store/modules/tagsView';
|
||||||
import TraceNoDialog from '@/components/OpenHis/TraceNoDialog/index.vue'
|
import TraceNoDialog from '@/components/OpenHis/TraceNoDialog/index.vue'
|
||||||
|
|
||||||
|
/** 领用保存 IssueDto:后端 Jackson 只认 yyyy-MM-dd HH:mm:ss;库存接口可能回传 2025/4/2 00:00:00 等 */
|
||||||
|
function toIssueDateTimeStr(val) {
|
||||||
|
if (val == null || val === '') return undefined;
|
||||||
|
if (typeof val === 'string') {
|
||||||
|
const s = val.trim();
|
||||||
|
if (/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(s)) return s;
|
||||||
|
if (/^\d{4}-\d{2}-\d{2}$/.test(s)) return `${s} 00:00:00`;
|
||||||
|
}
|
||||||
|
const d = val instanceof Date ? val : new Date(val);
|
||||||
|
if (Number.isNaN(d.getTime())) return undefined;
|
||||||
|
return formatDate(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 总库存 totalQuantity 为最小单位;领用数量按当前计量单位折算成最小单位后再比较 */
|
||||||
|
function getRequisitionQtyInMinUnit(r) {
|
||||||
|
const q = Number(r.itemQuantity ?? 0);
|
||||||
|
if (!Number.isFinite(q) || q < 0) return NaN;
|
||||||
|
const minCode = r.unitList?.minUnitCode;
|
||||||
|
if (!minCode || r.unitCode === minCode) return q;
|
||||||
|
const part = Number(r.partPercent ?? 1);
|
||||||
|
return q * part;
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateRequisitionQtyVsStock(r, lineNo) {
|
||||||
|
const cap = Number(r.totalQuantity ?? 0);
|
||||||
|
const reqMin = getRequisitionQtyInMinUnit(r);
|
||||||
|
if (!Number.isFinite(reqMin)) {
|
||||||
|
return `第${lineNo}行:领用数量请输入有效数字`;
|
||||||
|
}
|
||||||
|
if (cap > 0 && reqMin > cap + 1e-9) {
|
||||||
|
const name = r.name || `第${lineNo}行`;
|
||||||
|
return `${name}:领用数量(折合最小单位)不能超过当前仓库可领库存 ${cap},请修改后再保存。`;
|
||||||
|
}
|
||||||
|
if (cap <= 0 && reqMin > 0) {
|
||||||
|
const name = r.name || `第${lineNo}行`;
|
||||||
|
return `${name}:当前仓库可领库存为 0,不能填写正数领用数量。`;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const tagsViewStore = useTagsViewStore();
|
const tagsViewStore = useTagsViewStore();
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
|
|
||||||
@@ -492,6 +534,7 @@ const userStore = useUserStore();
|
|||||||
const openTraceNoDialog = ref(false)
|
const openTraceNoDialog = ref(false)
|
||||||
const rowData = ref({})
|
const rowData = ref({})
|
||||||
const ypName = ref('')
|
const ypName = ref('')
|
||||||
|
const currentIndex = ref(-1)
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { warehous_type, category_code, service_type_code, specialty_code, purchase_type } =
|
const { warehous_type, category_code, service_type_code, specialty_code, purchase_type } =
|
||||||
@@ -568,6 +611,8 @@ const data = reactive({
|
|||||||
medicationType: [{ required: true, message: '请选择药品类型', trigger: 'change' }],
|
medicationType: [{ required: true, message: '请选择药品类型', trigger: 'change' }],
|
||||||
locationId: [{ required: true, message: '请选择领用部门', trigger: 'change' }],
|
locationId: [{ required: true, message: '请选择领用部门', trigger: 'change' }],
|
||||||
practitionerId: [{ required: true, message: '请选择部门经手人', trigger: 'change' }],
|
practitionerId: [{ required: true, message: '请选择部门经手人', trigger: 'change' }],
|
||||||
|
// 领用出库按「表头仓库」查 /app-common/inventory-item-info,未选仓库会查不到库存并误报「仓库数量为0」
|
||||||
|
headerLocationId: [{ required: true, message: '请先选择仓库(按仓库查询可领用库存)', trigger: 'change' }],
|
||||||
},
|
},
|
||||||
tableRules: {
|
tableRules: {
|
||||||
name: [{ required: true, message: '项目不能为空', trigger: 'change' }],
|
name: [{ required: true, message: '项目不能为空', trigger: 'change' }],
|
||||||
@@ -988,10 +1033,9 @@ function selectRow(rowValue, index) {
|
|||||||
form.purchaseinventoryList[index].unitList = rowValue.unitList[0];
|
form.purchaseinventoryList[index].unitList = rowValue.unitList[0];
|
||||||
form.purchaseinventoryList[index].lotNumber = rowValue.lotNumber;
|
form.purchaseinventoryList[index].lotNumber = rowValue.lotNumber;
|
||||||
form.purchaseinventoryList[index].ybNo = rowValue.ybNo;
|
form.purchaseinventoryList[index].ybNo = rowValue.ybNo;
|
||||||
// #439 fix: 不清空sourceLocationId,保留handleAddRow设置的仓库ID
|
// 出库仓库:优先表头当前所选仓库(避免先选药后选仓时行上一直为空)
|
||||||
if (!form.purchaseinventoryList[index].sourceLocationId) {
|
form.purchaseinventoryList[index].sourceLocationId =
|
||||||
form.purchaseinventoryList[index].sourceLocationId = receiptHeaderForm.headerLocationId || '';
|
receiptHeaderForm.headerLocationId || form.purchaseinventoryList[index].sourceLocationId || '';
|
||||||
}
|
|
||||||
getPharmacyCabinetList().then((res) => {
|
getPharmacyCabinetList().then((res) => {
|
||||||
purposeTypeListOptions.value = res.data;
|
purposeTypeListOptions.value = res.data;
|
||||||
handleLocationClick(1, rowValue, index)
|
handleLocationClick(1, rowValue, index)
|
||||||
@@ -1004,78 +1048,125 @@ function selectRow(rowValue, index) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 选择仓库
|
/** 多条库存记录时取可领数量最大的一条(避免仅取 res.data[0] 恰好为 0) */
|
||||||
function handleLocationClick(item, row, index) {
|
function pickBestOrgQuantityRow(list) {
|
||||||
getCount({
|
if (!Array.isArray(list) || list.length === 0) return null;
|
||||||
itemId: form.purchaseinventoryList[index].itemId,
|
return list.reduce((best, cur) => {
|
||||||
orgLocationId: form.purchaseinventoryList[index].sourceLocationId,
|
const cq = Number(cur?.orgQuantity ?? 0);
|
||||||
// objLocationId:purposeLocationId,
|
const bq = Number(best?.orgQuantity ?? 0);
|
||||||
lotNumber: form.purchaseinventoryList[index].lotNumber,
|
return cq > bq ? cur : best;
|
||||||
}).then((res) => {
|
});
|
||||||
if (res.data && res.data.length > 0) {
|
}
|
||||||
form.purchaseinventoryList[index].itemTable = res.data[0].itemTable || '';
|
|
||||||
form.purchaseinventoryList[index].totalQuantity = res.data[0].orgQuantity || 0;
|
|
||||||
|
|
||||||
if (res.data[0].price) {
|
/** 表头「仓库」变化:同步每行 sourceLocationId 并重新拉库存(修复先选药品后选仓库行上仍无仓库 ID) */
|
||||||
form.purchaseinventoryList[index].price = res.data[0].price.toFixed(4);
|
function onHeaderWarehouseChange() {
|
||||||
} else {
|
const hid = receiptHeaderForm.headerLocationId;
|
||||||
form.purchaseinventoryList[index].price = 0;
|
form.purchaseinventoryList.forEach((r) => {
|
||||||
}
|
r.sourceLocationId = hid || '';
|
||||||
// 获取供应商id
|
});
|
||||||
form.purchaseinventoryList[index].supplierId = res.data[0].supplierId || '';
|
form.purchaseinventoryList.forEach((r, idx) => {
|
||||||
// 生产日期
|
if (hid && r.itemId) {
|
||||||
form.purchaseinventoryList[index].startTime = res.data[0].productionDate;
|
handleLocationClick(1, {}, idx);
|
||||||
// 有效期
|
}
|
||||||
form.purchaseinventoryList[index].endTime = res.data[0].expirationDate;
|
});
|
||||||
form.purchaseinventoryList[index].unitCode =
|
}
|
||||||
form.purchaseinventoryList[index].unitList.minUnitCode;
|
|
||||||
form.purchaseinventoryList[index].unitCode_dictText =
|
// 选择仓库 / 选药品后拉取该仓库存
|
||||||
form.purchaseinventoryList[index].unitList.minUnitCode_dictText;
|
function handleLocationClick(item, row, index) {
|
||||||
// 单价 大单位单价
|
const r = form.purchaseinventoryList[index];
|
||||||
console.log(
|
let orgLocationId = r.sourceLocationId || receiptHeaderForm.headerLocationId || '';
|
||||||
form.purchaseinventoryList[index].unitCode ==
|
if (!orgLocationId) {
|
||||||
form.purchaseinventoryList[index].unitList.minUnitCode,
|
proxy.$message.warning('请先在表头选择「仓库」。库存按仓库维度查询,未选仓库无法匹配您看到的总库存。');
|
||||||
1212121
|
r.totalQuantity = 0;
|
||||||
);
|
r.price = 0;
|
||||||
if (
|
return;
|
||||||
form.purchaseinventoryList[index].unitCode ==
|
}
|
||||||
form.purchaseinventoryList[index].unitList.minUnitCode
|
if (!r.sourceLocationId) {
|
||||||
) {
|
r.sourceLocationId = orgLocationId;
|
||||||
form.purchaseinventoryList[index].price =
|
}
|
||||||
res.data[0].price / form.purchaseinventoryList[index].partPercent || '';
|
|
||||||
form.purchaseinventoryList[index].price =
|
const lotTrimmed =
|
||||||
form.purchaseinventoryList[index].price.toFixed(4);
|
r.lotNumber != null && String(r.lotNumber).trim() !== '' ? String(r.lotNumber).trim() : null;
|
||||||
// parseFloat(form.purchaseinventoryList[index].price.toFixed(4))
|
|
||||||
} else {
|
const runGet = (withLot) => {
|
||||||
console.log(
|
const params = { itemId: r.itemId, orgLocationId };
|
||||||
form.purchaseinventoryList[index].price > 1,
|
if (withLot && lotTrimmed) {
|
||||||
1212,
|
params.lotNumber = lotTrimmed;
|
||||||
form.purchaseinventoryList[index].price
|
}
|
||||||
);
|
return getCount(params);
|
||||||
if (form.purchaseinventoryList[index].price > 1) {
|
};
|
||||||
form.purchaseinventoryList[index].price =
|
|
||||||
form.purchaseinventoryList[index].price.toFixed(4);
|
const applyFromDto = (d, syncLotFromPick) => {
|
||||||
|
if (syncLotFromPick && d.lotNumber != null && d.lotNumber !== '') {
|
||||||
|
r.lotNumber = d.lotNumber;
|
||||||
|
}
|
||||||
|
r.itemTable = d.itemTable || '';
|
||||||
|
r.totalQuantity = d.orgQuantity || 0;
|
||||||
|
if (d.price) {
|
||||||
|
r.price = d.price.toFixed(4);
|
||||||
|
} else {
|
||||||
|
r.price = 0;
|
||||||
|
}
|
||||||
|
r.supplierId = d.supplierId || '';
|
||||||
|
r.startTime = toIssueDateTimeStr(d.productionDate) || '';
|
||||||
|
r.endTime = toIssueDateTimeStr(d.expirationDate) || '';
|
||||||
|
r.unitCode = r.unitList.minUnitCode;
|
||||||
|
r.unitCode_dictText = r.unitList.minUnitCode_dictText;
|
||||||
|
if (r.unitCode == r.unitList.minUnitCode) {
|
||||||
|
r.price = d.price / r.partPercent || '';
|
||||||
|
r.price = r.price.toFixed(4);
|
||||||
|
} else if (r.price > 1) {
|
||||||
|
r.price = r.price.toFixed(4);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const persistStore = () => {
|
||||||
|
store.setCurrentDataLYCK({
|
||||||
|
purchaseinventoryList: form.purchaseinventoryList,
|
||||||
|
receiptHeaderForm: receiptHeaderForm,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
runGet(true)
|
||||||
|
.then((res) => {
|
||||||
|
const list = res.data || [];
|
||||||
|
const d = pickBestOrgQuantityRow(list);
|
||||||
|
const strictOk = d && Number(d.orgQuantity ?? 0) > 0;
|
||||||
|
if (strictOk) {
|
||||||
|
applyFromDto(d, false);
|
||||||
|
if (Number(r.totalQuantity) <= 0) {
|
||||||
|
proxy.$message.warning('仓库数量为0,无法调用!');
|
||||||
}
|
}
|
||||||
}
|
persistStore();
|
||||||
if (form.purchaseinventoryList[index].totalQuantity == 0) {
|
|
||||||
proxy.$message.warning('仓库数量为0,无法调用!');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
if (lotTrimmed) {
|
||||||
form.purchaseinventoryList[index].totalQuantity = 0;
|
return runGet(false).then((res2) => {
|
||||||
form.purchaseinventoryList[index].price = 0;
|
const list2 = res2.data || [];
|
||||||
// if(form.purchaseinventoryList[index].totalQuantity==0){
|
const d2 = pickBestOrgQuantityRow(list2);
|
||||||
|
if (d2 && Number(d2.orgQuantity ?? 0) > 0) {
|
||||||
|
applyFromDto(d2, true);
|
||||||
|
proxy.$message.info(
|
||||||
|
'所选批号在本仓库无对应库存或批号不一致,已按仓库实物回显批号与可领数量,请核对。'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
r.totalQuantity = 0;
|
||||||
|
r.price = 0;
|
||||||
|
proxy.$message.warning('仓库数量为0,无法调用!');
|
||||||
|
}
|
||||||
|
persistStore();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
r.totalQuantity = 0;
|
||||||
|
r.price = 0;
|
||||||
proxy.$message.warning('仓库数量为0,无法调用!');
|
proxy.$message.warning('仓库数量为0,无法调用!');
|
||||||
// }
|
persistStore();
|
||||||
}
|
})
|
||||||
}).catch(() => {
|
.catch(() => {
|
||||||
form.purchaseinventoryList[index].totalQuantity = 0;
|
r.totalQuantity = 0;
|
||||||
form.purchaseinventoryList[index].price = 0;
|
r.price = 0;
|
||||||
});
|
persistStore();
|
||||||
store.setCurrentDataLYCK({
|
});
|
||||||
purchaseinventoryList: form.purchaseinventoryList,
|
|
||||||
receiptHeaderForm: receiptHeaderForm,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
// 切换仓库类型获取药房/药库列表
|
// 切换仓库类型获取药房/药库列表
|
||||||
// function handleChangeLocationType(value) {
|
// function handleChangeLocationType(value) {
|
||||||
@@ -1232,20 +1323,19 @@ function getMaxCounts(row, index, counts) {
|
|||||||
}
|
}
|
||||||
// 计算总价
|
// 计算总价
|
||||||
function handleTotalPrice(index) {
|
function handleTotalPrice(index) {
|
||||||
form.purchaseinventoryList[index].olditemQuantity =
|
const r = form.purchaseinventoryList[index];
|
||||||
form.purchaseinventoryList[index].itemQuantity * row.partPercent;
|
r.olditemQuantity = r.itemQuantity * (r.partPercent ?? 1);
|
||||||
form.purchaseinventoryList[index].itemMaxQuantity =
|
r.itemMaxQuantity = r.itemQuantity;
|
||||||
form.purchaseinventoryList[index].itemQuantity;
|
let purchaseItem = r;
|
||||||
let purchaseItem = form.purchaseinventoryList[index];
|
|
||||||
if (purchaseItem.price > 0 && purchaseItem.itemQuantity > 0) {
|
if (purchaseItem.price > 0 && purchaseItem.itemQuantity > 0) {
|
||||||
form.purchaseinventoryList[index].totalPrice = purchaseItem.price * purchaseItem.itemQuantity;
|
r.totalPrice = purchaseItem.price * purchaseItem.itemQuantity;
|
||||||
form.purchaseinventoryList[index].totalPrice =
|
r.totalPrice = r.totalPrice.toFixed(4);
|
||||||
form.purchaseinventoryList[index].totalPrice.toFixed(4);
|
|
||||||
// parseFloat(form.purchaseinventoryList[index].totalPrice.toFixed(4))
|
|
||||||
}
|
}
|
||||||
if (form.purchaseinventoryList[index].itemQuantity == 0) {
|
if (r.itemQuantity == 0) {
|
||||||
form.purchaseinventoryList[index].totalPrice = 0;
|
r.totalPrice = 0;
|
||||||
}
|
}
|
||||||
|
const qtyErr = validateRequisitionQtyVsStock(r, index + 1);
|
||||||
|
r.error = !!qtyErr;
|
||||||
store.setCurrentDataLYCK({
|
store.setCurrentDataLYCK({
|
||||||
purchaseinventoryList: form.purchaseinventoryList,
|
purchaseinventoryList: form.purchaseinventoryList,
|
||||||
receiptHeaderForm: receiptHeaderForm,
|
receiptHeaderForm: receiptHeaderForm,
|
||||||
@@ -1254,6 +1344,15 @@ function handleTotalPrice(index) {
|
|||||||
// 保存
|
// 保存
|
||||||
function handleSave(row, index) {
|
function handleSave(row, index) {
|
||||||
rowList.value = [];
|
rowList.value = [];
|
||||||
|
for (let i = 0; i < form.purchaseinventoryList.length; i++) {
|
||||||
|
const line = form.purchaseinventoryList[i];
|
||||||
|
if (!line) continue;
|
||||||
|
const err = validateRequisitionQtyVsStock(line, i + 1);
|
||||||
|
if (err) {
|
||||||
|
proxy.$message.warning(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
form.purchaseinventoryList.map((row, index) => {
|
form.purchaseinventoryList.map((row, index) => {
|
||||||
if (row) {
|
if (row) {
|
||||||
// 触发校验
|
// 触发校验
|
||||||
@@ -1301,7 +1400,13 @@ function handleSave(row, index) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function addTransferProducts(rowList) {
|
function addTransferProducts(rowList) {
|
||||||
addTransferProduct(JSON.parse(JSON.stringify(rowList))).then((res) => {
|
const payload = (Array.isArray(rowList) ? rowList : []).map((item) => ({
|
||||||
|
...item,
|
||||||
|
startTime: toIssueDateTimeStr(item.startTime),
|
||||||
|
endTime: toIssueDateTimeStr(item.endTime),
|
||||||
|
occurrenceTime: toIssueDateTimeStr(item.occurrenceTime) ?? item.occurrenceTime,
|
||||||
|
}));
|
||||||
|
addTransferProduct(JSON.parse(JSON.stringify(payload))).then((res) => {
|
||||||
// 当前行没有id视为首次新增
|
// 当前行没有id视为首次新增
|
||||||
// if (!row.id) {
|
// if (!row.id) {
|
||||||
// data.isAdding = false; // 允许新增下一行
|
// data.isAdding = false; // 允许新增下一行
|
||||||
@@ -1370,7 +1475,7 @@ function handleScan(row,index){
|
|||||||
rowData.value = row
|
rowData.value = row
|
||||||
rowData.value.itemType = receiptHeaderForm.medicationType
|
rowData.value.itemType = receiptHeaderForm.medicationType
|
||||||
ypName.value = row.name
|
ypName.value = row.name
|
||||||
openTraceNoDialog .value = true;
|
openTraceNoDialog.value = true;
|
||||||
currentIndex.value = index
|
currentIndex.value = index
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1593,6 +1698,17 @@ const exportRequiredParams = ref({
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
busNo: route.query.supplyBusNo
|
busNo: route.query.supplyBusNo
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 追溯码对话框提交处理
|
||||||
|
function submit(traceNoData) {
|
||||||
|
if (currentIndex.value >= 0 && form.purchaseinventoryList[currentIndex.value]) {
|
||||||
|
form.purchaseinventoryList[currentIndex.value].traceNo = traceNoData.traceNo;
|
||||||
|
form.purchaseinventoryList[currentIndex.value].ybNo = traceNoData.ybNo;
|
||||||
|
proxy.$message.success('追溯码保存成功');
|
||||||
|
}
|
||||||
|
openTraceNoDialog.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
function handleExport() {
|
function handleExport() {
|
||||||
proxy.downloadGet(
|
proxy.downloadGet(
|
||||||
'/issue-manage/requisition/excel-out',
|
'/issue-manage/requisition/excel-out',
|
||||||
|
|||||||
@@ -744,11 +744,7 @@ function handleSubmitApproval() {
|
|||||||
} else {
|
} else {
|
||||||
submitApproval(receiptHeaderForm.busNo).then((response) => {
|
submitApproval(receiptHeaderForm.busNo).then((response) => {
|
||||||
proxy.$modal.msgSuccess('提交审批成功');
|
proxy.$modal.msgSuccess('提交审批成功');
|
||||||
// proxy.$tab.closePage(route).then(({ visitedViews }) => { // 关闭当前页
|
|
||||||
// toLastView(visitedViews, route)
|
|
||||||
// })
|
|
||||||
tagsViewStore.delView(router.currentRoute.value);
|
tagsViewStore.delView(router.currentRoute.value);
|
||||||
// 跳转到调拨管理页面
|
|
||||||
router.replace({ path: 'transferManagentList' });
|
router.replace({ path: 'transferManagentList' });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -871,7 +867,6 @@ function handleUnitCodeChange(row, index, value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleItemQuantityChange(row, value) {
|
function handleItemQuantityChange(row, value) {
|
||||||
debugger;
|
|
||||||
let quantityTemp = ''; // 转换成小单位的临时变量 做校验
|
let quantityTemp = ''; // 转换成小单位的临时变量 做校验
|
||||||
// 大单位情况
|
// 大单位情况
|
||||||
if (row.unitCodeMap[row.unitCode] == 'unit') {
|
if (row.unitCodeMap[row.unitCode] == 'unit') {
|
||||||
@@ -882,12 +877,6 @@ function handleItemQuantityChange(row, value) {
|
|||||||
row.itemQuantity = value;
|
row.itemQuantity = value;
|
||||||
quantityTemp = value;
|
quantityTemp = value;
|
||||||
}
|
}
|
||||||
if (row.totalSourceQuantity < quantityTemp) {
|
|
||||||
proxy.$modal.msgWarning('调拨数量不可超出源库存数量');
|
|
||||||
row.itemQuantity = 0;
|
|
||||||
row.itemQuantityDisplay = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
row.totalPrice = ((row.price * quantityTemp) / row.partPercent).toFixed(2);
|
row.totalPrice = ((row.price * quantityTemp) / row.partPercent).toFixed(2);
|
||||||
// 更新总数据中对应的记录
|
// 更新总数据中对应的记录
|
||||||
const totalIndex = totalIncentoryInfoList.value.findIndex((item) => item.id === row.id);
|
const totalIndex = totalIncentoryInfoList.value.findIndex((item) => item.id === row.id);
|
||||||
@@ -918,11 +907,12 @@ function remakeBlur(row, index) {
|
|||||||
editBatchTransfer(index);
|
editBatchTransfer(index);
|
||||||
}
|
}
|
||||||
function handleSave() {
|
function handleSave() {
|
||||||
const invalidRow = totalIncentoryInfoList.value.find(
|
// 校验单价
|
||||||
|
const invalidPriceRow = totalIncentoryInfoList.value.find(
|
||||||
(row) => !row.price || row.price <= 0
|
(row) => !row.price || row.price <= 0
|
||||||
);
|
);
|
||||||
if (invalidRow) {
|
if (invalidPriceRow) {
|
||||||
proxy.$message.warning('调拨单价不能为空或为0,请检查!');
|
proxy.$modal.msgError('调拨单价不能为空或为0,请检查!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
addTransferProductBatch(totalIncentoryInfoList.value).then((res) => {
|
addTransferProductBatch(totalIncentoryInfoList.value).then((res) => {
|
||||||
|
|||||||
@@ -970,12 +970,6 @@ function handleItemQuantityChange(row, value) {
|
|||||||
row.itemQuantity = value;
|
row.itemQuantity = value;
|
||||||
quantityTemp = value;
|
quantityTemp = value;
|
||||||
}
|
}
|
||||||
if (row.totalSourceQuantity < quantityTemp) {
|
|
||||||
proxy.$modal.msgWarning('调拨数量不可超出源库存数量');
|
|
||||||
row.itemQuantity = 0;
|
|
||||||
row.itemQuantityDisplay = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
row.totalPrice = ((row.price * quantityTemp) / row.partPercent).toFixed(2);
|
row.totalPrice = ((row.price * quantityTemp) / row.partPercent).toFixed(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1022,11 +1016,7 @@ function handleSubmitApproval() {
|
|||||||
} else {
|
} else {
|
||||||
submitApproval(receiptHeaderForm.busNo).then((response) => {
|
submitApproval(receiptHeaderForm.busNo).then((response) => {
|
||||||
proxy.$modal.msgSuccess('提交审批成功');
|
proxy.$modal.msgSuccess('提交审批成功');
|
||||||
// proxy.$tab.closePage(route).then(({ visitedViews }) => { // 关闭当前页
|
|
||||||
// toLastView(visitedViews, route)
|
|
||||||
// })
|
|
||||||
tagsViewStore.delView(router.currentRoute.value);
|
tagsViewStore.delView(router.currentRoute.value);
|
||||||
// 跳转到调拨管理页面
|
|
||||||
router.replace({ path: 'transferManagentList' });
|
router.replace({ path: 'transferManagentList' });
|
||||||
store.clearCurrentDataDB();
|
store.clearCurrentDataDB();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="surgeryList" row-key="id" :row-class-name="getRowClassName">
|
<el-table v-loading="loading" :data="surgeryList" row-key="id" :row-class-name="getRowClassName" highlight-current-row @current-change="handleCurrentChange">
|
||||||
<!-- 申请日期:datetime - 2025-09-19 14:15:00 - 不可操作 -->
|
<!-- 申请日期:datetime - 2025-09-19 14:15:00 - 不可操作 -->
|
||||||
<el-table-column label="申请日期" align="center" prop="createTime" width="160">
|
<el-table-column label="申请日期" align="center" prop="createTime" width="160">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
@@ -1405,6 +1405,12 @@ function getRowClassName({ row }) {
|
|||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 当前选中行(高亮)
|
||||||
|
const currentRow = ref(null)
|
||||||
|
function handleCurrentChange(row) {
|
||||||
|
currentRow.value = row
|
||||||
|
}
|
||||||
|
|
||||||
// 时间格式化函数
|
// 时间格式化函数
|
||||||
function parseTime(time, pattern) {
|
function parseTime(time, pattern) {
|
||||||
if (!time) return ''
|
if (!time) return ''
|
||||||
|
|||||||
@@ -803,7 +803,7 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 手术计费弹窗 -->
|
<!-- 手术计费弹窗 -->
|
||||||
<el-dialog :title="chargeDialogTitle" v-model="showChargeDialog" width="1400px" @close="closeChargeDialog" append-to-body>
|
<el-dialog :title="chargeDialogTitle" v-model="showChargeDialog" width="1400px" @close="closeChargeDialog" append-to-body destroy-on-close>
|
||||||
<div style="display: flex; justify-content: space-between; height: 80vh">
|
<div style="display: flex; justify-content: space-between; height: 80vh">
|
||||||
<div style="width: 100%; border: 1px solid #eee; position: relative">
|
<div style="width: 100%; border: 1px solid #eee; position: relative">
|
||||||
<div style="padding: 10px; border: 1px solid #eee; height: 50px; border-left: 0">
|
<div style="padding: 10px; border: 1px solid #eee; height: 50px; border-left: 0">
|
||||||
@@ -829,7 +829,9 @@
|
|||||||
</el-descriptions>
|
</el-descriptions>
|
||||||
</div>
|
</div>
|
||||||
<div style="padding: 10px">
|
<div style="padding: 10px">
|
||||||
<prescriptionlist :patientInfo="chargePatientInfo" ref="prescriptionRef" />
|
<prescriptionlist :patientInfo="chargePatientInfo" ref="prescriptionRef"
|
||||||
|
:generateSourceEnum="1"
|
||||||
|
:sourceBillNo="chargePatientInfo.sourceBillNo" />
|
||||||
<div class="overlay" v-if="disabled"></div>
|
<div class="overlay" v-if="disabled"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -872,16 +874,59 @@ import { Loading } from '@element-plus/icons-vue' // 🔧 新增:导入 Loadin
|
|||||||
import { getPrescriptionList } from '@/views/clinicmanagement/bargain/component/api'
|
import { getPrescriptionList } from '@/views/clinicmanagement/bargain/component/api'
|
||||||
|
|
||||||
// API 导入
|
// API 导入
|
||||||
import { getSurgerySchedulePage, addSurgerySchedule, updateSurgerySchedule, deleteSurgerySchedule, getSurgeryScheduleDetail } from '@/api/surgicalschedule'
|
import {
|
||||||
import { listUser } from '@/api/system/user'
|
getSurgerySchedulePage,
|
||||||
import { deptTreeSelect } from '@/api/system/user'
|
addSurgerySchedule,
|
||||||
import { listOperatingRoom } from '@/api/operatingroom'
|
updateSurgerySchedule,
|
||||||
import { getSurgery} from '@/views/inpatientDoctor/home/components/applicationShow/api.js'
|
deleteSurgerySchedule,
|
||||||
import { getTenantPage } from '@/api/system/tenant'
|
getSurgeryScheduleDetail
|
||||||
|
} from '@/api/surgicalschedule'
|
||||||
|
import { getSurgeryPage} from '@/views/inpatientDoctor/home/components/applicationShow/api.js'
|
||||||
import { getContract } from '@/views/inpatientDoctor/home/components/api.js'
|
import { getContract } from '@/views/inpatientDoctor/home/components/api.js'
|
||||||
|
import request from '@/utils/request'
|
||||||
import SurgeryCharge from '../charge/surgerycharge/index.vue'
|
import SurgeryCharge from '../charge/surgerycharge/index.vue'
|
||||||
import TemporaryMedical from './temporaryMedical.vue'
|
import TemporaryMedical from './temporaryMedical.vue'
|
||||||
|
|
||||||
|
// 静默获取字典列表(跳过拦截器错误提示,手术室护士等角色可能无此权限)
|
||||||
|
function getTenantPageSilent(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/tenant/page',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
skipErrorMsg: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 静默获取科室树(跳过拦截器错误提示)
|
||||||
|
function deptTreeSelectSilent(params = {}) {
|
||||||
|
return request({
|
||||||
|
url: '/base-data-manage/organization/organization',
|
||||||
|
method: 'get',
|
||||||
|
params: { typeEnum: 2, ...params },
|
||||||
|
skipErrorMsg: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 静默获取用户列表(跳过拦截器错误提示)
|
||||||
|
function listUserSilent(query) {
|
||||||
|
return request({
|
||||||
|
url: '/base-data-manage/practitioner/user-practitioner-page',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
skipErrorMsg: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 静默获取手术室列表(跳过拦截器错误提示)
|
||||||
|
function listOperatingRoomSilent(query) {
|
||||||
|
return request({
|
||||||
|
url: '/base-data-manage/operating-room/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
skipErrorMsg: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
@@ -921,7 +966,7 @@ const form = reactive({
|
|||||||
allergyRemark: undefined,
|
allergyRemark: undefined,
|
||||||
surgeryNature: undefined,
|
surgeryNature: undefined,
|
||||||
surgerySite: undefined,
|
surgerySite: undefined,
|
||||||
incisionLevel: undefined,
|
incisionType: undefined,
|
||||||
surgeryLevel: undefined,
|
surgeryLevel: undefined,
|
||||||
|
|
||||||
admissionTime: undefined,
|
admissionTime: undefined,
|
||||||
@@ -1110,7 +1155,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
// 加载卫生机构列表
|
// 加载卫生机构列表
|
||||||
function loadOrgList() {
|
function loadOrgList() {
|
||||||
getTenantPage({ pageNo: 1, pageSize: 1000 })
|
getTenantPageSilent({ pageNo: 1, pageSize: 1000 })
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
const records = res.data?.records || res.data || []
|
const records = res.data?.records || res.data || []
|
||||||
@@ -1130,72 +1175,80 @@ function loadOrgList() {
|
|||||||
|
|
||||||
// 加载科室列表
|
// 加载科室列表
|
||||||
function loadDeptList() {
|
function loadDeptList() {
|
||||||
deptTreeSelect()
|
deptTreeSelectSilent()
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
const tree = res.data?.records || res.data || []
|
const tree = res.data?.records || res.data || []
|
||||||
deptList.value = flattenOrgTree(tree)
|
deptList.value = flattenOrgTree(tree)
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError('获取科室列表失败')
|
// 权限不足时静默降级,不弹窗阻断(Bug #441)
|
||||||
|
console.warn('科室列表加载失败(可能无权限):', res.message || res.code)
|
||||||
deptList.value = []
|
deptList.value = []
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
proxy.$modal.msgError('获取科室列表失败')
|
// 网络错误或权限拒绝:静默降级
|
||||||
|
console.warn('科室列表加载失败:', error?.message || error)
|
||||||
deptList.value = []
|
deptList.value = []
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载医生列表
|
// 加载医生列表
|
||||||
function loadDoctorList() {
|
function loadDoctorList() {
|
||||||
listUser({ pageNo: 1, pageSize: 1000 })
|
listUserSilent({ pageNo: 1, pageSize: 1000 })
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
const records = res.data?.records || []
|
const records = res.data?.records || []
|
||||||
doctorList.value = records.map(mapPractitionerToOption).filter(it => it.code && it.name)
|
doctorList.value = records.map(mapPractitionerToOption).filter(it => it.code && it.name)
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError('获取医生列表失败')
|
// 权限不足时静默降级,不弹窗阻断(Bug #441)
|
||||||
|
console.warn('医生列表加载失败(可能无权限):', res.message || res.code)
|
||||||
doctorList.value = []
|
doctorList.value = []
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
proxy.$modal.msgError('获取医生列表失败')
|
// 网络错误或权限拒绝:静默降级
|
||||||
|
console.warn('医生列表加载失败:', error?.message || error)
|
||||||
doctorList.value = []
|
doctorList.value = []
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载护士列表
|
// 加载护士列表
|
||||||
function loadNurseList() {
|
function loadNurseList() {
|
||||||
listUser({ pageNo: 1, pageSize: 1000 })
|
listUserSilent({ pageNo: 1, pageSize: 1000 })
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
const records = res.data?.records || []
|
const records = res.data?.records || []
|
||||||
nurseList.value = records.map(mapPractitionerToOption).filter(it => it.code && it.name)
|
nurseList.value = records.map(mapPractitionerToOption).filter(it => it.code && it.name)
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError('获取护士列表失败')
|
// 权限不足时静默降级,不弹窗阻断(Bug #441)
|
||||||
|
console.warn('护士列表加载失败(可能无权限):', res.message || res.code)
|
||||||
nurseList.value = []
|
nurseList.value = []
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
proxy.$modal.msgError('获取护士列表失败')
|
// 网络错误或权限拒绝:静默降级
|
||||||
|
console.warn('护士列表加载失败:', error?.message || error)
|
||||||
nurseList.value = []
|
nurseList.value = []
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载手术室列表
|
// 加载手术室列表
|
||||||
function loadOperatingRoomList() {
|
function loadOperatingRoomList() {
|
||||||
listOperatingRoom({ pageNo: 1, pageSize: 1000, statusEnum: 1 })
|
listOperatingRoomSilent({ pageNo: 1, pageSize: 1000, statusEnum: 1 })
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
const records = res.data?.records || []
|
const records = res.data?.records || []
|
||||||
operatingRoomList.value = records.map(mapOperatingRoomToOption).filter(it => it.roomCode)
|
operatingRoomList.value = records.map(mapOperatingRoomToOption).filter(it => it.roomCode)
|
||||||
} else {
|
} else {
|
||||||
proxy.$modal.msgError('获取手术室列表失败')
|
// 权限不足时静默降级,不弹窗阻断(Bug #441)
|
||||||
|
console.warn('手术室列表加载失败(可能无权限):', res.message || res.code)
|
||||||
operatingRoomList.value = []
|
operatingRoomList.value = []
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
proxy.$modal.msgError('获取手术室列表失败')
|
// 网络错误或权限拒绝:静默降级
|
||||||
|
console.warn('手术室列表加载失败:', error?.message || error)
|
||||||
operatingRoomList.value = []
|
operatingRoomList.value = []
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1380,8 +1433,8 @@ async function handleChargeCharge(row) {
|
|||||||
orgId: userStore.organizationId || userStore.orgId || userStore.tenantId || 1,
|
orgId: userStore.organizationId || userStore.orgId || userStore.tenantId || 1,
|
||||||
// 添加账户ID
|
// 添加账户ID
|
||||||
accountId: accountId,
|
accountId: accountId,
|
||||||
// 添加手术申请单号用于追溯
|
// 添加手术单号用于关联对应的手术医嘱
|
||||||
sourceBillNo: row.applyId,
|
sourceBillNo: row.operCode,
|
||||||
//添加计费标志手术计费
|
//添加计费标志手术计费
|
||||||
generateSourceEnum: 6
|
generateSourceEnum: 6
|
||||||
}
|
}
|
||||||
@@ -1403,7 +1456,15 @@ async function handleChargeCharge(row) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 关闭计费弹窗
|
// 关闭计费弹窗
|
||||||
function closeChargeDialog() {
|
async function closeChargeDialog() {
|
||||||
|
// 先关闭 prescriptionlist 内所有已打开的项目字典 popover
|
||||||
|
if (prescriptionRef.value && prescriptionRef.value.closeAllPopovers) {
|
||||||
|
prescriptionRef.value.closeAllPopovers()
|
||||||
|
}
|
||||||
|
// 等待 Vue 完成 popover 可见性更新的 DOM 操作,
|
||||||
|
// 因为 el-popover 通过 teleport 渲染在 body 上,需要在 dialog 卸载前完成清理
|
||||||
|
await nextTick()
|
||||||
|
// 清空数据,避免下次打开时使用缓存
|
||||||
showChargeDialog.value = false
|
showChargeDialog.value = false
|
||||||
chargePatientInfo.value = {}
|
chargePatientInfo.value = {}
|
||||||
chargeSurgeryInfo.value = {}
|
chargeSurgeryInfo.value = {}
|
||||||
@@ -1435,7 +1496,8 @@ function handleMedicalAdvice(row) {
|
|||||||
role: userStore.roles[0],
|
role: userStore.roles[0],
|
||||||
effectiveOrgId : row.effectiveOrgId,
|
effectiveOrgId : row.effectiveOrgId,
|
||||||
orgId: userStore.orgId,
|
orgId: userStore.orgId,
|
||||||
positionId: userStore.orgId
|
positionId: userStore.orgId,
|
||||||
|
applyId: row.applyId // 手术申请单ID,用于过滤关联医嘱
|
||||||
}
|
}
|
||||||
|
|
||||||
// 🔧 关键修复:如果已有提交的医嘱数据,并且是同一个患者的就诊,则使用保存的数据
|
// 🔧 关键修复:如果已有提交的医嘱数据,并且是同一个患者的就诊,则使用保存的数据
|
||||||
@@ -1466,7 +1528,11 @@ function handleMedicalAdvice(row) {
|
|||||||
// 先清空旧数据
|
// 先清空旧数据
|
||||||
temporaryBillingMedicines.value = []
|
temporaryBillingMedicines.value = []
|
||||||
temporaryAdvices.value = []
|
temporaryAdvices.value = []
|
||||||
temporarySigned.value = false // 🔧 重置签名状态
|
// 🔧 修复 Bug #446: 如果是同一 encounter 且已有提交的医嘱(有 requestId),保留签名状态
|
||||||
|
const hasSubmittedAdvices = temporaryAdvices.value.length > 0 &&
|
||||||
|
temporaryAdvices.value[0]?.originalMedicine?.encounterId === row.visitId &&
|
||||||
|
temporaryAdvices.value.some(a => a.originalMedicine?.requestId);
|
||||||
|
temporarySigned.value = hasSubmittedAdvices; // 修复:根据已有数据状态设置,而非盲目重置
|
||||||
temporaryMedicalLoading.value = true // 🔧 新增:开始加载
|
temporaryMedicalLoading.value = true // 🔧 新增:开始加载
|
||||||
|
|
||||||
// 调用计费接口获取数据
|
// 调用计费接口获取数据
|
||||||
@@ -1481,9 +1547,13 @@ function handleMedicalAdvice(row) {
|
|||||||
const filteredItems = res.data.filter(item => {
|
const filteredItems = res.data.filter(item => {
|
||||||
// 匹配 encounterId
|
// 匹配 encounterId
|
||||||
if (item.encounterId !== row.visitId) return false;
|
if (item.encounterId !== row.visitId) return false;
|
||||||
|
// 只保留药品类型(adviceType=1),过滤掉耗材(2)和诊疗项目(3)
|
||||||
|
if (item.adviceType !== 1) return false;
|
||||||
// 过滤掉名称为空的项目
|
// 过滤掉名称为空的项目
|
||||||
const medicineName = item.adviceName || item.advice_name;
|
const medicineName = item.adviceName || item.advice_name;
|
||||||
if (!medicineName || medicineName.trim() === '') return false;
|
if (!medicineName || medicineName.trim() === '') return false;
|
||||||
|
// 🔧 修复 Bug #445: 过滤掉已生成医嘱的项目(已有 requestId 的不应出现在"待生成"列表)
|
||||||
|
if (item.requestId) return false;
|
||||||
// 根据药品请求ID去重,避免重复显示
|
// 根据药品请求ID去重,避免重复显示
|
||||||
const itemId = item.requestId || item.id;
|
const itemId = item.requestId || item.id;
|
||||||
if (itemId && seenIds.has(itemId)) return false;
|
if (itemId && seenIds.has(itemId)) return false;
|
||||||
@@ -1671,15 +1741,27 @@ function handleTemporaryMedicalSubmit(data) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 同步更新计费药品列表:移除已生成医嘱的项目,避免数据重复显示
|
// 🔧 修复 Bug #445: 使用稳定的字段组合匹配已提交项目,而不是依赖可能为空的 requestId/chargeItemId
|
||||||
const submittedIds = new Set(
|
// 构建已提交项目的匹配键集合(药品名称 + 规格 + 数量)
|
||||||
(data.temporaryAdvices || []).map(a => a.originalMedicine?.requestId || a.originalMedicine?.chargeItemId).filter(Boolean)
|
const submittedKeys = new Set(
|
||||||
|
(data.temporaryAdvices || [])
|
||||||
|
.map(a => {
|
||||||
|
const om = a.originalMedicine || {}
|
||||||
|
const name = om.medicineName || om.adviceName || om.advice_name || a.adviceName || ''
|
||||||
|
const spec = om.specification || om.volume || ''
|
||||||
|
const qty = om.quantity || 0
|
||||||
|
return `${name}|||${spec}|||${qty}`
|
||||||
|
})
|
||||||
|
.filter(k => k !== '|||0') // 过滤掉空项
|
||||||
)
|
)
|
||||||
if (submittedIds.size > 0) {
|
|
||||||
temporaryBillingMedicines.value = (data.billingMedicines || []).filter(
|
if (submittedKeys.size > 0) {
|
||||||
m => !submittedIds.has(m.requestId || m.chargeItemId)
|
temporaryBillingMedicines.value = (temporaryBillingMedicines.value || []).filter(m => {
|
||||||
)
|
const key = `${m.medicineName || ''}|||${m.specification || ''}|||${m.quantity || 0}`
|
||||||
|
return !submittedKeys.has(key)
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
|
// 如果没有任何匹配键,清空待生成列表(所有项目都已提交)
|
||||||
temporaryBillingMedicines.value = []
|
temporaryBillingMedicines.value = []
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1733,19 +1815,25 @@ function handleQuoteBilling() {
|
|||||||
// 重新拉取计费药品数据
|
// 重新拉取计费药品数据
|
||||||
if (temporaryPatientInfo.value.visitId) {
|
if (temporaryPatientInfo.value.visitId) {
|
||||||
temporaryMedicalLoading.value = true // 🔧 新增:开始加载
|
temporaryMedicalLoading.value = true // 🔧 新增:开始加载
|
||||||
getPrescriptionList(temporaryPatientInfo.value.visitId).then((res) => {
|
getPrescriptionList(temporaryPatientInfo.value.visitId, 6, temporaryPatientInfo.value.operCode).then((res) => {
|
||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data) {
|
||||||
// 🔧 修复:先清空旧数据,避免数据累积
|
// 🔧 修复:先清空旧数据,避免数据累积
|
||||||
temporaryBillingMedicines.value = []
|
temporaryBillingMedicines.value = []
|
||||||
temporaryAdvices.value = []
|
temporaryAdvices.value = []
|
||||||
|
|
||||||
// 🔧 修复:显示所有药品请求数据,不管有没有计费项目
|
// 🔧 修复 Bug #445: 只保留药品类型(adviceType=1),过滤掉耗材(2)和诊疗项目(3)
|
||||||
|
// 同时过滤掉已有 requestId 的项目(已生成医嘱的不需要再次显示在"待生成"列表中)
|
||||||
const filteredItems = res.data.filter(item => {
|
const filteredItems = res.data.filter(item => {
|
||||||
// 匹配 encounterId
|
// 匹配 encounterId
|
||||||
if (item.encounterId !== temporaryPatientInfo.value.visitId) return false;
|
if (item.encounterId !== temporaryPatientInfo.value.visitId) return false;
|
||||||
|
// 只保留药品类型(adviceType=1),过滤掉耗材(2)和诊疗项目(3)
|
||||||
|
if (item.adviceType !== 1) return false;
|
||||||
// 过滤掉名称为空的项目
|
// 过滤掉名称为空的项目
|
||||||
const medicineName = item.adviceName || item.advice_name;
|
const medicineName = item.adviceName || item.advice_name;
|
||||||
return medicineName && medicineName.trim() !== '';
|
if (!medicineName || medicineName.trim() === '') return false;
|
||||||
|
// 🔧 修复 Bug #445: 过滤掉已生成医嘱的项目(已有 requestId)
|
||||||
|
if (item.requestId) return false;
|
||||||
|
return true;
|
||||||
})
|
})
|
||||||
// 🔧 修复:限制返回数量,最多显示前100条,避免数据过多导致页面卡死
|
// 🔧 修复:限制返回数量,最多显示前100条,避免数据过多导致页面卡死
|
||||||
const maxItems = 100
|
const maxItems = 100
|
||||||
@@ -1910,6 +1998,7 @@ function resetForm() {
|
|||||||
allergyRemark: undefined,
|
allergyRemark: undefined,
|
||||||
surgeryNature: undefined,
|
surgeryNature: undefined,
|
||||||
surgerySite: undefined,
|
surgerySite: undefined,
|
||||||
|
incisionType: undefined,
|
||||||
admissionTime: undefined,
|
admissionTime: undefined,
|
||||||
entryTime: undefined,
|
entryTime: undefined,
|
||||||
roomCode: undefined,
|
roomCode: undefined,
|
||||||
@@ -1961,7 +2050,12 @@ function resetForm() {
|
|||||||
function submitForm() {
|
function submitForm() {
|
||||||
proxy.$refs['surgeryRef'].validate((valid) => {
|
proxy.$refs['surgeryRef'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const submitData = { ...form, orgId: userStore.orgId }
|
const submitData = {
|
||||||
|
...form,
|
||||||
|
orgId: userStore.orgId,
|
||||||
|
incisionLevel: form.incisionType
|
||||||
|
}
|
||||||
|
delete submitData.incisionType
|
||||||
if (!form.scheduleId) {
|
if (!form.scheduleId) {
|
||||||
// 新增手术安排
|
// 新增手术安排
|
||||||
addSurgerySchedule(submitData).then((res) => {
|
addSurgerySchedule(submitData).then((res) => {
|
||||||
@@ -2007,7 +2101,7 @@ function handleFindApply() {
|
|||||||
getSurgicalScheduleList()
|
getSurgicalScheduleList()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取手术申请列表(用于“查找”弹窗)
|
// 获取手术申请列表(用于”查找”弹窗)
|
||||||
function getSurgicalScheduleList() {
|
function getSurgicalScheduleList() {
|
||||||
applyLoading.value = true
|
applyLoading.value = true
|
||||||
const params = { ...applyQueryParams }
|
const params = { ...applyQueryParams }
|
||||||
@@ -2016,8 +2110,7 @@ function getSurgicalScheduleList() {
|
|||||||
params.applyTimeEnd = params.applyTimeRange[1]
|
params.applyTimeEnd = params.applyTimeRange[1]
|
||||||
delete params.applyTimeRange
|
delete params.applyTimeRange
|
||||||
}
|
}
|
||||||
getSurgery(params).then((res) => {
|
getSurgeryPage(params).then((res) => {
|
||||||
// Check if data is nested under data.data or directly under data
|
|
||||||
const responseData = res.data.data || res.data
|
const responseData = res.data.data || res.data
|
||||||
applyList.value = responseData.records || []
|
applyList.value = responseData.records || []
|
||||||
applyTotal.value = responseData.total || 0
|
applyTotal.value = responseData.total || 0
|
||||||
|
|||||||
@@ -147,9 +147,10 @@
|
|||||||
<el-button class="cancel-btn" @click="handleCancel">取消</el-button>
|
<el-button class="cancel-btn" @click="handleCancel">取消</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
class="sign-btn"
|
class="sign-btn"
|
||||||
|
:disabled="allItemsSubmitted"
|
||||||
@click="handleSignAndSubmit"
|
@click="handleSignAndSubmit"
|
||||||
>
|
>
|
||||||
{{ isSigned ? '提交医嘱' : '一键签名并生成医嘱' }}
|
{{ allItemsSubmitted ? '已签发' : (isSigned ? '提交医嘱' : '一键签名并生成医嘱') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -310,8 +311,21 @@ const getMethodCodeDict = computed(() => {
|
|||||||
return dict
|
return dict
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 🔧 修复 Bug #446: 检查计费药品是否已全部提交(有 requestId),用于区分"首次签名"和"已提交重开"
|
||||||
|
const allItemsSubmitted = computed(() => {
|
||||||
|
const meds = props.billingMedicines || []
|
||||||
|
return meds.length > 0 && meds.every(m => m.requestId)
|
||||||
|
})
|
||||||
|
|
||||||
// 响应式数据 - isSigned 从父组件传入的 prop 初始化
|
// 响应式数据 - isSigned 从父组件传入的 prop 初始化
|
||||||
const isSigned = ref(props.isSignedProp)
|
const isSigned = ref(props.isSignedProp)
|
||||||
|
|
||||||
|
// 🔧 修复 Bug #446: 同步父组件 isSignedProp 的变化到本地 isSigned
|
||||||
|
// ref(props.isSignedProp) 只在初始化时读取一次,父组件后续更新不会自动同步
|
||||||
|
watch(() => props.isSignedProp, (newVal) => {
|
||||||
|
isSigned.value = newVal
|
||||||
|
})
|
||||||
|
|
||||||
const signatureTime = ref('')
|
const signatureTime = ref('')
|
||||||
const showSignDialog = ref(false)
|
const showSignDialog = ref(false)
|
||||||
const signPassword = ref('')
|
const signPassword = ref('')
|
||||||
|
|||||||
5
sql/bug_434_add_incision_level_to_op_schedule.sql
Normal file
5
sql/bug_434_add_incision_level_to_op_schedule.sql
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
-- Bug #434 修复:为 op_schedule 表添加 incision_level 字段
|
||||||
|
-- 手术安排表需要存储切口类型,以便在编辑弹窗中正确回显和保存
|
||||||
|
ALTER TABLE op_schedule ADD COLUMN IF NOT EXISTS incision_level INT2;
|
||||||
|
|
||||||
|
COMMENT ON COLUMN op_schedule.incision_level IS '手术切口等级 1-I级切口 2-II级切口 3-III级切口 4-IV级切口';
|
||||||
18
sql/bug_462_add_specimen_code_dict.sql
Normal file
18
sql/bug_462_add_specimen_code_dict.sql
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
-- Bug #462: 诊疗目录编辑弹窗中"所需标本"下拉框数据加载失败
|
||||||
|
-- 根因: sys_dict_type 表中缺少 specimen_code 字典类型,sys_dict_data 表中缺少对应数据
|
||||||
|
-- 修复: 插入字典类型及7条标本数据
|
||||||
|
|
||||||
|
-- 插入字典类型
|
||||||
|
INSERT INTO sys_dict_type (dict_name, dict_type, status, create_by, create_time, remark)
|
||||||
|
VALUES ('标本类型', 'specimen_code', '0', 'admin', NOW(), '诊疗项目所需标本类型字典');
|
||||||
|
|
||||||
|
-- 插入标本数据
|
||||||
|
INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, status, create_by, create_time, remark)
|
||||||
|
VALUES
|
||||||
|
(1, '血液', '1', 'specimen_code', '0', 'admin', NOW(), '血液标本'),
|
||||||
|
(2, '尿液', '2', 'specimen_code', '0', 'admin', NOW(), '尿液标本'),
|
||||||
|
(3, '粪便', '3', 'specimen_code', '0', 'admin', NOW(), '粪便标本'),
|
||||||
|
(4, '呼吸道', '4', 'specimen_code', '0', 'admin', NOW(), '呼吸道标本'),
|
||||||
|
(5, '无菌体液', '5', 'specimen_code', '0', 'admin', NOW(), '无菌体液标本'),
|
||||||
|
(6, '生殖道', '6', 'specimen_code', '0', 'admin', NOW(), '生殖道标本'),
|
||||||
|
(7, '其他', '7', 'specimen_code', '0', 'admin', NOW(), '其他标本');
|
||||||
Reference in New Issue
Block a user