103 增加医生个人报卡管理界面(需求)
This commit is contained in:
@@ -12,6 +12,8 @@ import com.core.common.utils.SecurityUtils;
|
||||
import com.core.common.core.domain.model.LoginUser;
|
||||
import com.openhis.infectious.domain.InfectiousAudit;
|
||||
import com.openhis.infectious.domain.InfectiousCard;
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
import com.openhis.administration.service.IPractitionerService;
|
||||
import com.openhis.web.cardmanagement.appservice.ICardManageAppService;
|
||||
import com.openhis.web.cardmanagement.dto.*;
|
||||
import com.openhis.web.cardmanagement.mapper.InfectiousAuditMapper;
|
||||
@@ -52,6 +54,7 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
|
||||
private final InfectiousCardMapper infectiousCardMapper;
|
||||
private final InfectiousAuditMapper infectiousAuditMapper;
|
||||
private final IPractitionerService iPractitionerService;
|
||||
|
||||
@Override
|
||||
public CardStatisticsDto getStatistics() {
|
||||
@@ -74,7 +77,7 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
}
|
||||
|
||||
// 状态
|
||||
if (StringUtils.hasText(queryParams.getStatus())) {
|
||||
if (queryParams.getStatus() != null) {
|
||||
wrapper.eq(InfectiousCard::getStatus, queryParams.getStatus());
|
||||
}
|
||||
|
||||
@@ -127,7 +130,7 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
if (card == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<InfectiousAudit> records = infectiousAuditMapper.selectByCardId(card.getId());
|
||||
List<InfectiousAudit> records = infectiousAuditMapper.selectByCardId(card.getCardNo());
|
||||
return records.stream().map(this::convertAuditToDto).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -145,16 +148,16 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
for (String cardNo : batchAuditDto.getCardNos()) {
|
||||
InfectiousCard card = infectiousCardMapper.selectByCardNo(cardNo);
|
||||
if (card == null) continue;
|
||||
if ("2".equals(card.getStatus()) || "3".equals(card.getStatus())) continue;
|
||||
if (Integer.valueOf(2).equals(card.getStatus()) || Integer.valueOf(3).equals(card.getStatus())) continue;
|
||||
|
||||
// 更新状态为已审核
|
||||
String oldStatus = card.getStatus();
|
||||
card.setStatus("2");
|
||||
Integer oldStatus = card.getStatus();
|
||||
card.setStatus(2);
|
||||
card.setUpdateTime(new Date());
|
||||
infectiousCardMapper.updateById(card);
|
||||
|
||||
// 创建审核记录
|
||||
createAuditRecord(card.getId(), oldStatus, "2", "1", batchAuditDto.getAuditOpinion(),
|
||||
createAuditRecord(card.getCardNo(), oldStatus, 2, 1, batchAuditDto.getAuditOpinion(),
|
||||
null, auditorId, auditorName, true, batchAuditDto.getCardNos().size());
|
||||
successCount++;
|
||||
}
|
||||
@@ -176,17 +179,17 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
for (String cardNo : batchReturnDto.getCardNos()) {
|
||||
InfectiousCard card = infectiousCardMapper.selectByCardNo(cardNo);
|
||||
if (card == null) continue;
|
||||
if ("2".equals(card.getStatus()) || "3".equals(card.getStatus())) continue;
|
||||
if (Integer.valueOf(2).equals(card.getStatus()) || Integer.valueOf(3).equals(card.getStatus())) continue;
|
||||
|
||||
// 更新状态为退回 (审核失败)
|
||||
String oldStatus = card.getStatus();
|
||||
card.setStatus("5");
|
||||
Integer oldStatus = card.getStatus();
|
||||
card.setStatus(5);
|
||||
card.setReturnReason(batchReturnDto.getReturnReason());
|
||||
card.setUpdateTime(new Date());
|
||||
infectiousCardMapper.updateById(card);
|
||||
|
||||
// 创建审核记录
|
||||
createAuditRecord(card.getId(), oldStatus, "5", "3", null,
|
||||
createAuditRecord(card.getCardNo(), oldStatus, 5, 3, null,
|
||||
batchReturnDto.getReturnReason(), auditorId, auditorName, true, batchReturnDto.getCardNos().size());
|
||||
successCount++;
|
||||
}
|
||||
@@ -206,13 +209,13 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
String auditorName = SecurityUtils.getUsername();
|
||||
|
||||
// 更新状态
|
||||
String oldStatus = card.getStatus();
|
||||
card.setStatus("2");
|
||||
Integer oldStatus = card.getStatus();
|
||||
card.setStatus(2);
|
||||
card.setUpdateTime(new Date());
|
||||
infectiousCardMapper.updateById(card);
|
||||
|
||||
// 创建审核记录
|
||||
createAuditRecord(card.getId(), oldStatus, "2", "2", auditDto.getAuditOpinion(),
|
||||
createAuditRecord(card.getCardNo(), oldStatus, 2, 2, auditDto.getAuditOpinion(),
|
||||
null, auditorId, auditorName, false, 1);
|
||||
|
||||
return R.ok("审核通过");
|
||||
@@ -230,14 +233,14 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
String auditorName = SecurityUtils.getUsername();
|
||||
|
||||
// 更新状态
|
||||
String oldStatus = card.getStatus();
|
||||
card.setStatus("5");
|
||||
Integer oldStatus = card.getStatus();
|
||||
card.setStatus(5);
|
||||
card.setReturnReason(returnDto.getReturnReason());
|
||||
card.setUpdateTime(new Date());
|
||||
infectiousCardMapper.updateById(card);
|
||||
|
||||
// 创建审核记录
|
||||
createAuditRecord(card.getId(), oldStatus, "5", "4", null,
|
||||
createAuditRecord(card.getCardNo(), oldStatus, 5, 4, null,
|
||||
returnDto.getReturnReason(), auditorId, auditorName, false, 1);
|
||||
|
||||
return R.ok("已退回");
|
||||
@@ -251,7 +254,7 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
if (queryParams.getRegistrationSource() != null) {
|
||||
wrapper.eq(InfectiousCard::getRegistrationSource, queryParams.getRegistrationSource());
|
||||
}
|
||||
if (StringUtils.hasText(queryParams.getStatus())) {
|
||||
if (queryParams.getStatus() != null) {
|
||||
wrapper.eq(InfectiousCard::getStatus, queryParams.getStatus());
|
||||
}
|
||||
if (StringUtils.hasText(queryParams.getPatientName())) {
|
||||
@@ -292,7 +295,7 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
row.createCell(1).setCellValue(card.getPatName());
|
||||
row.createCell(2).setCellValue("1".equals(card.getSex()) ? "男" : "2".equals(card.getSex()) ? "女" : "未知");
|
||||
row.createCell(3).setCellValue(card.getAge() != null ? card.getAge() + "岁" : "");
|
||||
row.createCell(4).setCellValue(card.getDiseaseName());
|
||||
row.createCell(4).setCellValue(card.getDiseaseCode());
|
||||
row.createCell(5).setCellValue(card.getDeptName());
|
||||
row.createCell(6).setCellValue(card.getCreateTime() != null ? dateFormat.format(card.getCreateTime()) : "");
|
||||
row.createCell(7).setCellValue(getStatusText(card.getStatus()));
|
||||
@@ -316,7 +319,19 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
|
||||
@Override
|
||||
public DoctorCardStatisticsDto getDoctorCardStatistics() {
|
||||
Long doctorId = SecurityUtils.getUserId();
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
|
||||
// 通过 sys_user 表的 user_id 查询医生表 (adm_practitioner) 获取医生 ID
|
||||
Practitioner practitioner = iPractitionerService.getPractitionerByUserId(userId);
|
||||
if (practitioner == null) {
|
||||
DoctorCardStatisticsDto dto = new DoctorCardStatisticsDto();
|
||||
dto.setTotalCount(0);
|
||||
dto.setPendingFailedCount(0);
|
||||
dto.setReportedCount(0);
|
||||
return dto;
|
||||
}
|
||||
|
||||
Long doctorId = practitioner.getId();
|
||||
|
||||
DoctorCardStatisticsDto dto = new DoctorCardStatisticsDto();
|
||||
Integer totalCount = infectiousCardMapper.countByDoctorId(doctorId);
|
||||
@@ -331,7 +346,18 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
|
||||
@Override
|
||||
public R<?> getDoctorCardPage(DoctorCardQueryDto queryParams) {
|
||||
Long doctorId = SecurityUtils.getUserId();
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
|
||||
// 通过 sys_user 表的 user_id 查询医生表 (adm_practitioner) 获取医生 ID
|
||||
Practitioner practitioner = iPractitionerService.getPractitionerByUserId(userId);
|
||||
if (practitioner == null) {
|
||||
Map<String, Object> emptyResult = new HashMap<>();
|
||||
emptyResult.put("list", new ArrayList<>());
|
||||
emptyResult.put("total", 0L);
|
||||
return R.ok(emptyResult);
|
||||
}
|
||||
|
||||
Long doctorId = practitioner.getId();
|
||||
|
||||
Page<InfectiousCard> page = new Page<>(queryParams.getPageNo(), queryParams.getPageSize());
|
||||
LambdaQueryWrapper<InfectiousCard> wrapper = new LambdaQueryWrapper<>();
|
||||
@@ -340,7 +366,7 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
wrapper.eq(InfectiousCard::getDoctorId, doctorId);
|
||||
|
||||
// 状态筛选
|
||||
if (StringUtils.hasText(queryParams.getStatus())) {
|
||||
if (queryParams.getStatus() != null) {
|
||||
wrapper.eq(InfectiousCard::getStatus, queryParams.getStatus());
|
||||
}
|
||||
|
||||
@@ -354,13 +380,24 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
wrapper.le(InfectiousCard::getCreateTime, endDateTime);
|
||||
}
|
||||
|
||||
// 关键词搜索(患者姓名或报卡名称)
|
||||
// 关键词搜索(患者姓名、疾病编码、报卡名称)
|
||||
if (StringUtils.hasText(queryParams.getKeyword())) {
|
||||
wrapper.and(w -> w
|
||||
.like(InfectiousCard::getPatName, queryParams.getKeyword())
|
||||
.or()
|
||||
.like(InfectiousCard::getDiseaseName, queryParams.getKeyword())
|
||||
);
|
||||
String kw = queryParams.getKeyword();
|
||||
// 将关键词匹配报卡名称,找出对应的 cardNameCode 列表
|
||||
List<Integer> matchedCodes = getMatchedCardNameCodes(kw);
|
||||
// cardNameCode为null的记录默认也属于"中华人民共和国传染病报告卡",匹配到code=1时需包含Null记录
|
||||
boolean includeNull = matchedCodes.contains(1);
|
||||
wrapper.and(w -> {
|
||||
w.like(InfectiousCard::getPatName, kw)
|
||||
.or()
|
||||
.like(InfectiousCard::getDiseaseCode, kw);
|
||||
if (!matchedCodes.isEmpty()) {
|
||||
w.or().in(InfectiousCard::getCardNameCode, matchedCodes);
|
||||
}
|
||||
if (includeNull) {
|
||||
w.or().isNull(InfectiousCard::getCardNameCode);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 按创建时间倒序
|
||||
@@ -388,17 +425,19 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
}
|
||||
|
||||
// 验证权限:只能提交自己的报卡
|
||||
if (!card.getDoctorId().equals(SecurityUtils.getUserId())) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
Practitioner practitioner = iPractitionerService.getPractitionerByUserId(userId);
|
||||
if (practitioner == null || !practitioner.getId().equals(card.getDoctorId())) {
|
||||
return R.fail("无权操作此报卡");
|
||||
}
|
||||
|
||||
// 验证状态:只有暂存状态可以提交
|
||||
if (!"0".equals(card.getStatus())) {
|
||||
// 狋证状态:只有暂存状态可以提交
|
||||
if (!Integer.valueOf(0).equals(card.getStatus())) {
|
||||
return R.fail("只能提交暂存状态的报卡");
|
||||
}
|
||||
|
||||
|
||||
// 更新状态为已提交
|
||||
card.setStatus("1");
|
||||
card.setStatus(1);
|
||||
card.setUpdateTime(new Date());
|
||||
infectiousCardMapper.updateById(card);
|
||||
|
||||
@@ -414,17 +453,19 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
}
|
||||
|
||||
// 验证权限:只能撤回自己的报卡
|
||||
if (!card.getDoctorId().equals(SecurityUtils.getUserId())) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
Practitioner practitioner = iPractitionerService.getPractitionerByUserId(userId);
|
||||
if (practitioner == null || !practitioner.getId().equals(card.getDoctorId())) {
|
||||
return R.fail("无权操作此报卡");
|
||||
}
|
||||
|
||||
// 验证状态:只有已提交状态可以撤回
|
||||
if (!"1".equals(card.getStatus())) {
|
||||
// 狋证状态:只有已提交状态可以撤回
|
||||
if (!Integer.valueOf(1).equals(card.getStatus())) {
|
||||
return R.fail("只能撤回已提交状态的报卡");
|
||||
}
|
||||
|
||||
|
||||
// 更新状态为暂存
|
||||
card.setStatus("0");
|
||||
card.setStatus(0);
|
||||
card.setUpdateTime(new Date());
|
||||
infectiousCardMapper.updateById(card);
|
||||
|
||||
@@ -440,17 +481,19 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
}
|
||||
|
||||
// 验证权限:只能删除自己的报卡
|
||||
if (!card.getDoctorId().equals(SecurityUtils.getUserId())) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
Practitioner practitioner = iPractitionerService.getPractitionerByUserId(userId);
|
||||
if (practitioner == null || !practitioner.getId().equals(card.getDoctorId())) {
|
||||
return R.fail("无权操作此报卡");
|
||||
}
|
||||
|
||||
// 验证状态:只有暂存状态可以删除
|
||||
if (!"0".equals(card.getStatus())) {
|
||||
// 狋证状态:只有暂存状态可以删除
|
||||
if (!Integer.valueOf(0).equals(card.getStatus())) {
|
||||
return R.fail("只能删除暂存状态的报卡");
|
||||
}
|
||||
|
||||
|
||||
// 更新状态为作废
|
||||
card.setStatus("6");
|
||||
card.setStatus(6);
|
||||
card.setUpdateTime(new Date());
|
||||
infectiousCardMapper.updateById(card);
|
||||
|
||||
@@ -464,7 +507,12 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
return R.fail("请选择要提交的报卡");
|
||||
}
|
||||
|
||||
Long doctorId = SecurityUtils.getUserId();
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
Practitioner practitioner = iPractitionerService.getPractitionerByUserId(userId);
|
||||
if (practitioner == null) {
|
||||
return R.fail("当前用户未关联医生信息");
|
||||
}
|
||||
Long doctorId = practitioner.getId();
|
||||
int successCount = 0;
|
||||
|
||||
for (String cardNo : cardNos) {
|
||||
@@ -472,13 +520,13 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
if (card == null) continue;
|
||||
|
||||
// 验证权限:只能提交自己的报卡
|
||||
if (!card.getDoctorId().equals(doctorId)) continue;
|
||||
|
||||
// 验证状态:只有暂存状态可以提交
|
||||
if (!"0".equals(card.getStatus())) continue;
|
||||
if (!doctorId.equals(card.getDoctorId())) continue;
|
||||
|
||||
// 狋证状态:只有暂存状态可以提交
|
||||
if (!Integer.valueOf(0).equals(card.getStatus())) continue;
|
||||
|
||||
// 更新状态为已提交
|
||||
card.setStatus("1");
|
||||
card.setStatus(1);
|
||||
card.setUpdateTime(new Date());
|
||||
infectiousCardMapper.updateById(card);
|
||||
successCount++;
|
||||
@@ -498,7 +546,12 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
return R.fail("请选择要删除的报卡");
|
||||
}
|
||||
|
||||
Long doctorId = SecurityUtils.getUserId();
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
Practitioner practitioner = iPractitionerService.getPractitionerByUserId(userId);
|
||||
if (practitioner == null) {
|
||||
return R.fail("当前用户未关联医生信息");
|
||||
}
|
||||
Long doctorId = practitioner.getId();
|
||||
int successCount = 0;
|
||||
|
||||
for (String cardNo : cardNos) {
|
||||
@@ -506,13 +559,13 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
if (card == null) continue;
|
||||
|
||||
// 验证权限:只能删除自己的报卡
|
||||
if (!card.getDoctorId().equals(doctorId)) continue;
|
||||
|
||||
// 验证状态:只有暂存状态可以删除
|
||||
if (!"0".equals(card.getStatus())) continue;
|
||||
if (!doctorId.equals(card.getDoctorId())) continue;
|
||||
|
||||
// 狋证状态:只有暂存状态可以删除
|
||||
if (!Integer.valueOf(0).equals(card.getStatus())) continue;
|
||||
|
||||
// 更新状态为作废
|
||||
card.setStatus("6");
|
||||
card.setStatus(6);
|
||||
card.setUpdateTime(new Date());
|
||||
infectiousCardMapper.updateById(card);
|
||||
successCount++;
|
||||
@@ -530,6 +583,13 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
// 获取当前登录用户信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Long currentUserId = loginUser.getUserId();
|
||||
|
||||
// 通过 sys_user 表的 user_id 查询医生表 (adm_practitioner) 获取医生 ID
|
||||
Practitioner practitioner = iPractitionerService.getPractitionerByUserId(currentUserId);
|
||||
if (practitioner == null) {
|
||||
return R.fail("当前用户未关联医生信息");
|
||||
}
|
||||
Long doctorId = practitioner.getId();
|
||||
|
||||
// 查询报卡
|
||||
InfectiousCard card = infectiousCardMapper.selectByCardNo(updateDto.getCardNo());
|
||||
@@ -538,12 +598,12 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
}
|
||||
|
||||
// 验证是否当前医生的报卡 - 根据 doctorId 字段验证
|
||||
if (!currentUserId.equals(card.getDoctorId())) {
|
||||
if (!doctorId.equals(card.getDoctorId())) {
|
||||
return R.fail("只能修改自己的报卡");
|
||||
}
|
||||
|
||||
// 验证状态是否允许修改(只能修改暂存状态的报卡)
|
||||
if (!"0".equals(card.getStatus())) {
|
||||
// 狋证状态是否允许修改(只能修改暂存状态的报卡)
|
||||
if (!Integer.valueOf(0).equals(card.getStatus())) {
|
||||
return R.fail("只能修改暂存状态的报卡");
|
||||
}
|
||||
|
||||
@@ -559,15 +619,6 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
card.setUpdateTime(new Date());
|
||||
card.setUpdateBy(loginUser.getUsername()); // 使用username作为更新者
|
||||
|
||||
card.setUpdateTime(new Date());
|
||||
card.setUpdateBy(loginUser.getUsername()); // 使用 username 作为更新者
|
||||
|
||||
card.setUpdateTime(new Date());
|
||||
card.setUpdateBy(loginUser.getUsername()); // 使用 username 作为更新者
|
||||
|
||||
card.setUpdateTime(new Date());
|
||||
card.setUpdateBy(loginUser.getUsername()); // 使用 username 作为更新者
|
||||
|
||||
int rows = infectiousCardMapper.updateById(card);
|
||||
if (rows > 0) {
|
||||
return R.ok("更新成功");
|
||||
@@ -583,12 +634,14 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
}
|
||||
|
||||
// 验证权限:只能导出自己的报卡
|
||||
if (!card.getDoctorId().equals(SecurityUtils.getUserId())) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
Practitioner practitioner = iPractitionerService.getPractitionerByUserId(userId);
|
||||
if (practitioner == null || !practitioner.getId().equals(card.getDoctorId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 验证状态:只有已上报状态可以导出
|
||||
if (!"3".equals(card.getStatus())) {
|
||||
// 狋证状态:只有已上报状态可以导出
|
||||
if (!Integer.valueOf(3).equals(card.getStatus())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -612,6 +665,8 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
private DoctorCardListDto convertToDoctorCardListDto(InfectiousCard card) {
|
||||
DoctorCardListDto dto = new DoctorCardListDto();
|
||||
BeanUtils.copyProperties(card, dto);
|
||||
// 由于数据库中没有 disease_name 字段,使用 disease_code 作为疾病名称展示
|
||||
dto.setDiseaseName(card.getDiseaseCode());
|
||||
dto.setCardName(getCardName(card.getCardNameCode()));
|
||||
dto.setSubmitTime(card.getCreateTime() != null ?
|
||||
new SimpleDateFormat("yyyy-MM-dd HH:mm").format(card.getCreateTime()) : null);
|
||||
@@ -632,13 +687,35 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据关键词匹配报卡名称,返回匹配的 cardNameCode 列表
|
||||
*/
|
||||
private List<Integer> getMatchedCardNameCodes(String keyword) {
|
||||
// 报卡名称映射表 code -> name
|
||||
java.util.Map<Integer, String> cardNameMap = new java.util.LinkedHashMap<>();
|
||||
cardNameMap.put(1, "中华人民共和国传染病报告卡");
|
||||
cardNameMap.put(2, "甲类传染病报告卡");
|
||||
cardNameMap.put(3, "乙类传染病报告卡");
|
||||
cardNameMap.put(4, "丙类传染病报告卡");
|
||||
|
||||
List<Integer> matchedCodes = new ArrayList<>();
|
||||
for (java.util.Map.Entry<Integer, String> entry : cardNameMap.entrySet()) {
|
||||
if (entry.getValue().contains(keyword)) {
|
||||
matchedCodes.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
// cardNameCode 为 null 的数据默认也是「中华人民共和国传染病报告卡」
|
||||
// 如果关键词匹配 code=1,则同时要包含 null 的记录
|
||||
return matchedCodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换审核记录为 DTO
|
||||
*/
|
||||
private AuditRecordDto convertAuditToDto(InfectiousAudit audit) {
|
||||
AuditRecordDto dto = new AuditRecordDto();
|
||||
BeanUtils.copyProperties(audit, dto);
|
||||
dto.setCardId(audit.getCardId() != null ? audit.getCardId().toString() : null);
|
||||
dto.setCardId(audit.getCardId());
|
||||
return dto;
|
||||
}
|
||||
|
||||
@@ -648,6 +725,8 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
private InfectiousCardDto convertToDto(InfectiousCard card) {
|
||||
InfectiousCardDto dto = new InfectiousCardDto();
|
||||
BeanUtils.copyProperties(card, dto);
|
||||
// 由于数据库中没有 disease_name 字段,使用 disease_code 作为疾病名称展示
|
||||
dto.setDiseaseName(card.getDiseaseCode());
|
||||
dto.setStatusText(getStatusText(card.getStatus()));
|
||||
return dto;
|
||||
}
|
||||
@@ -655,15 +734,15 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
/**
|
||||
* 创建审核记录
|
||||
*/
|
||||
private void createAuditRecord(Long cardId, String statusFrom, String statusTo, String auditType,
|
||||
private void createAuditRecord(String cardId, Integer statusFrom, Integer statusTo, Integer auditType,
|
||||
String auditOpinion, String returnReason, String auditorId, String auditorName,
|
||||
Boolean isBatch, Integer batchSize) {
|
||||
InfectiousAudit audit = new InfectiousAudit();
|
||||
audit.setCardId(cardId);
|
||||
audit.setAuditSeq(infectiousAuditMapper.getNextAuditSeq(cardId));
|
||||
audit.setAuditType(auditType);
|
||||
audit.setAuditStatusFrom(statusFrom);
|
||||
audit.setAuditStatusTo(statusTo);
|
||||
audit.setAuditType(String.valueOf(auditType));
|
||||
audit.setAuditStatusFrom(statusFrom != null ? String.valueOf(statusFrom) : null);
|
||||
audit.setAuditStatusTo(statusTo != null ? String.valueOf(statusTo) : null);
|
||||
audit.setAuditTime(LocalDateTime.now());
|
||||
audit.setAuditorId(auditorId);
|
||||
audit.setAuditorName(auditorName);
|
||||
@@ -677,15 +756,16 @@ public class CardManageAppServiceImpl implements ICardManageAppService {
|
||||
/**
|
||||
* 获取状态文本
|
||||
*/
|
||||
private String getStatusText(String status) {
|
||||
private String getStatusText(Integer status) {
|
||||
if (status == null) return "未知";
|
||||
switch (status) {
|
||||
case "0": return "暂存";
|
||||
case "1": return "已提交";
|
||||
case "2": return "审核通过";
|
||||
case "3": return "已上报";
|
||||
case "4": return "失败";
|
||||
case "5": return "审核失败";
|
||||
case "6": return "作废";
|
||||
case 0: return "暂存";
|
||||
case 1: return "已提交";
|
||||
case 2: return "审核通过";
|
||||
case 3: return "已上报";
|
||||
case 4: return "失败";
|
||||
case 5: return "审核失败";
|
||||
case 6: return "作废";
|
||||
default: return "未知";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ public class CardQueryDto {
|
||||
/** 患者姓名 */
|
||||
private String patientName;
|
||||
|
||||
/** 审核状态 */
|
||||
private String status;
|
||||
/** 审核状态(0暂存/1已提交/2已审核/3已上报/4失败/5退回/6作废) */
|
||||
private Integer status;
|
||||
|
||||
/** 科室ID */
|
||||
private Long deptId;
|
||||
|
||||
@@ -7,6 +7,9 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 医生个人报卡列表DTO
|
||||
*
|
||||
@@ -41,6 +44,51 @@ public class DoctorCardListDto {
|
||||
/** 提交时间 */
|
||||
private String submitTime;
|
||||
|
||||
/** 状态 */
|
||||
private String status;
|
||||
/** 状态(0暂存/1已提交/2已审核/3已上报/4失败/5退回/6作废) */
|
||||
private Integer status;
|
||||
|
||||
/** 疾病名称 */
|
||||
private String diseaseName;
|
||||
|
||||
/** 发病日期 */
|
||||
private LocalDate onsetDate;
|
||||
|
||||
/** 诊断日期 */
|
||||
private LocalDateTime diagDate;
|
||||
|
||||
/** 报告单位 */
|
||||
private String reportOrg;
|
||||
|
||||
/** 报告医生 */
|
||||
private String reportDoc;
|
||||
|
||||
/** 传染病类别 */
|
||||
private String diseaseType;
|
||||
|
||||
/** 性别 (1男/2女/0未知) */
|
||||
private String sex;
|
||||
|
||||
/** 年龄 */
|
||||
private Integer age;
|
||||
|
||||
/** 年龄单位 (1岁/2月/3天) */
|
||||
private String ageUnit;
|
||||
|
||||
/** 现住址省 */
|
||||
private String addressProv;
|
||||
|
||||
/** 现住址市 */
|
||||
private String addressCity;
|
||||
|
||||
/** 现住址县 */
|
||||
private String addressCounty;
|
||||
|
||||
/** 现住址街道 */
|
||||
private String addressTown;
|
||||
|
||||
/** 现住址村/居委 */
|
||||
private String addressVillage;
|
||||
|
||||
/** 现住址门牌号 */
|
||||
private String addressHouse;
|
||||
}
|
||||
@@ -26,8 +26,8 @@ public class DoctorCardQueryDto {
|
||||
/** 结束日期 */
|
||||
private String endDate;
|
||||
|
||||
/** 状态(0暂存/1已提交/2已审核/3已上报/4失败/5退回) */
|
||||
private String status;
|
||||
/** 状态(0暂存/1已提交/2已审核/3已上报/4失败/5退回/6作废) */
|
||||
private Integer status;
|
||||
|
||||
/** 患者姓名或报卡名称 */
|
||||
private String keyword;
|
||||
|
||||
@@ -1,18 +1,44 @@
|
||||
package com.openhis.web.cardmanagement.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class DoctorCardUpdateDto {
|
||||
@NotBlank(message = "卡片编号不能为空")
|
||||
private String cardNo;
|
||||
|
||||
private String phone;
|
||||
private String contactPhone; // 紧急联系人电话
|
||||
|
||||
private LocalDate onsetDate;
|
||||
private LocalDateTime diagDate;
|
||||
private String diseaseType; // 修改为diseaseType,对应InfectiousCard中的diseaseType字段
|
||||
private String addressProv;
|
||||
private String addressCity;
|
||||
private String addressCounty;
|
||||
private String addressHouse;
|
||||
|
||||
private String diseaseType; // 病例分类(对应InfectiousCard中的diseaseType字段)
|
||||
private String diseaseCode; // 疾病编码
|
||||
|
||||
@NotNull(message = "病例类别不能为空")
|
||||
private Integer caseClass; // 病例类别(1疑似病例/2临床诊断病例/3实验室确诊病例/4病原携带者/5阳性检测结果)
|
||||
|
||||
private String occupation; // 职业
|
||||
|
||||
@NotNull(message = "病人属于不能为空")
|
||||
private Integer patientBelong; // 病人属于(1本县区/2本市其他县区/3本省其他地市/4外省/5港澳台/6外籍)
|
||||
|
||||
private String addressProv; // 现住址省
|
||||
private String addressCity; // 现住址市
|
||||
private String addressCounty; // 现住址县
|
||||
private String addressTown; // 现住址街道
|
||||
private String addressVillage; // 现住址村/居委
|
||||
private String addressHouse; // 现住址门牌号
|
||||
|
||||
private String parentName; // 家长姓名
|
||||
private String workplace; // 工作单位
|
||||
private String correctName; // 订正病名
|
||||
private LocalDate deathDate; // 死亡日期
|
||||
private String withdrawReason; // 退卡原因
|
||||
private String otherDisease; // 其他传染病名称
|
||||
}
|
||||
@@ -65,8 +65,8 @@ public class InfectiousCardDto {
|
||||
/** 现住址门牌号 */
|
||||
private String addressHouse;
|
||||
|
||||
/** 病人属于 */
|
||||
private String patientbelong;
|
||||
/** 病人属于(1本县区/2本市其他县区/3本省其他地市/4外省/5港澳台/6外籍) */
|
||||
private Integer patientBelong;
|
||||
|
||||
/** 职业 */
|
||||
private String occupation;
|
||||
@@ -110,8 +110,8 @@ public class InfectiousCardDto {
|
||||
/** 填卡日期 */
|
||||
private LocalDate reportDate;
|
||||
|
||||
/** 状态 */
|
||||
private String status;
|
||||
/** 状态(0暂存/1已提交/2已审核/3已上报/4失败/5退回/6作废) */
|
||||
private Integer status;
|
||||
|
||||
/** 状态文本 */
|
||||
private String statusText;
|
||||
|
||||
@@ -18,14 +18,14 @@ import java.util.List;
|
||||
public interface InfectiousAuditMapper extends BaseMapper<InfectiousAudit> {
|
||||
|
||||
/**
|
||||
* 根据报卡ID查询审核记录
|
||||
* 根据报卡编号查询审核记录
|
||||
*/
|
||||
@Select("SELECT * FROM infectious_audit WHERE card_id = #{cardId} ORDER BY audit_time DESC")
|
||||
List<InfectiousAudit> selectByCardId(@Param("cardId") Long cardId);
|
||||
List<InfectiousAudit> selectByCardId(@Param("cardId") String cardId);
|
||||
|
||||
/**
|
||||
* 获取下一个审核序号
|
||||
*/
|
||||
@Select("SELECT COALESCE(MAX(audit_seq), 0) + 1 FROM infectious_audit WHERE card_id = #{cardId}")
|
||||
Integer getNextAuditSeq(@Param("cardId") Long cardId);
|
||||
Integer getNextAuditSeq(@Param("cardId") String cardId);
|
||||
}
|
||||
|
||||
@@ -21,25 +21,25 @@ public interface InfectiousCardMapper extends BaseMapper<InfectiousCard> {
|
||||
/**
|
||||
* 统计今日待审核数量
|
||||
*/
|
||||
@Select("SELECT COUNT(*) FROM infectious_card WHERE DATE(create_time) = CURRENT_DATE AND status = '1'")
|
||||
@Select("SELECT COUNT(*) FROM infectious_card WHERE DATE(create_time) = CURRENT_DATE AND status = 1")
|
||||
Integer countTodayPending();
|
||||
|
||||
/**
|
||||
* 统计本月审核失败数量
|
||||
*/
|
||||
@Select("SELECT COUNT(*) FROM infectious_card WHERE DATE_TRUNC('month', create_time) = DATE_TRUNC('month', CURRENT_DATE) AND status = '5'")
|
||||
@Select("SELECT COUNT(*) FROM infectious_card WHERE DATE_TRUNC('month', create_time) = DATE_TRUNC('month', CURRENT_DATE) AND status = 5")
|
||||
Integer countMonthFailed();
|
||||
|
||||
/**
|
||||
* 统计本月审核成功数量
|
||||
*/
|
||||
@Select("SELECT COUNT(*) FROM infectious_card WHERE DATE_TRUNC('month', create_time) = DATE_TRUNC('month', CURRENT_DATE) AND status = '2'")
|
||||
@Select("SELECT COUNT(*) FROM infectious_card WHERE DATE_TRUNC('month', create_time) = DATE_TRUNC('month', CURRENT_DATE) AND status = 2")
|
||||
Integer countMonthSuccess();
|
||||
|
||||
/**
|
||||
* 统计本月已上报数量
|
||||
*/
|
||||
@Select("SELECT COUNT(*) FROM infectious_card WHERE DATE_TRUNC('month', create_time) = DATE_TRUNC('month', CURRENT_DATE) AND status = '3'")
|
||||
@Select("SELECT COUNT(*) FROM infectious_card WHERE DATE_TRUNC('month', create_time) = DATE_TRUNC('month', CURRENT_DATE) AND status = 3")
|
||||
Integer countMonthReported();
|
||||
|
||||
/**
|
||||
@@ -55,14 +55,14 @@ public interface InfectiousCardMapper extends BaseMapper<InfectiousCard> {
|
||||
Integer countByDoctorId(@Param("doctorId") Long doctorId);
|
||||
|
||||
/**
|
||||
* 统计医生待处理失败数(状态为0暂存或4失败)
|
||||
* 统计医生待提交数(状态为0暂存待提交)
|
||||
*/
|
||||
@Select("SELECT COUNT(*) FROM infectious_card WHERE doctor_id = #{doctorId} AND status IN ('0', '4')")
|
||||
@Select("SELECT COUNT(*) FROM infectious_card WHERE doctor_id = #{doctorId} AND status = 0")
|
||||
Integer countPendingFailedByDoctorId(@Param("doctorId") Long doctorId);
|
||||
|
||||
/**
|
||||
* 统计医生已成功上报数(状态为3已上报)
|
||||
*/
|
||||
@Select("SELECT COUNT(*) FROM infectious_card WHERE doctor_id = #{doctorId} AND status = '3'")
|
||||
@Select("SELECT COUNT(*) FROM infectious_card WHERE doctor_id = #{doctorId} AND status = 3")
|
||||
Integer countReportedByDoctorId(@Param("doctorId") Long doctorId);
|
||||
}
|
||||
|
||||
@@ -127,14 +127,11 @@ public class InfectiousCardDto {
|
||||
/** 审核意见 */
|
||||
private String auditOpinion;
|
||||
|
||||
/** 退回原因 */
|
||||
/** 退卡原因 */
|
||||
private String returnReason;
|
||||
|
||||
/** 订正病名 */
|
||||
private String correctName;
|
||||
|
||||
/** 退卡原因 */
|
||||
private String withdrawReason;
|
||||
private String revisedDiseaseName;
|
||||
|
||||
/** 其他传染病 */
|
||||
private String otherDisease;
|
||||
|
||||
Reference in New Issue
Block a user