维护换卡处理的查询

This commit is contained in:
2025-11-12 09:38:47 +08:00
parent 618fb1e340
commit fe8fb3d321
13 changed files with 1271 additions and 4 deletions

View File

@@ -0,0 +1,53 @@
package com.openhis.web.charge.patientcardrenewal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.core.common.core.domain.R;
import lombok.extern.slf4j.Slf4j;
/**
* 患者换卡控制器
*
* @author system
* @date 2024-01-01
*/
@RestController
@RequestMapping("/charge/patientCardRenewal")
@Slf4j
public class PatientCardRenewalController {
@Autowired
private PatientCardRenewalService patientCardRenewalService;
/**
* 执行患者换卡操作
*
* @param request 换卡请求参数
* @return 换卡结果
*/
@PostMapping("/renewCard")
public R<?> renewCard(@RequestBody RenewalRequest request) {
try {
log.info("患者换卡请求: 旧卡号={}, 新卡号={}, 患者ID={}",
request.getOldCardNo(), request.getNewCardNo(), request.getPatientId());
// 执行换卡操作
boolean success = patientCardRenewalService.renewCard(request);
if (success) {
log.info("患者换卡成功: 旧卡号={} -> 新卡号={}",
request.getOldCardNo(), request.getNewCardNo());
return R.ok("换卡成功");
} else {
return R.fail("换卡失败");
}
} catch (Exception e) {
log.error("患者换卡异常: ", e);
return R.fail("换卡操作异常: " + e.getMessage());
}
}
}

View File

@@ -0,0 +1,18 @@
package com.openhis.web.charge.patientcardrenewal;
/**
* 患者换卡服务接口
*
* @author system
* @date 2024-01-01
*/
public interface PatientCardRenewalService {
/**
* 执行患者换卡操作
*
* @param request 换卡请求参数
* @return 是否换卡成功
*/
boolean renewCard(RenewalRequest request);
}

View File

@@ -0,0 +1,43 @@
package com.openhis.web.charge.patientcardrenewal;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
/**
* 患者换卡服务实现类
*
* @author system
* @date 2024-01-01
*/
@Service
@Slf4j
public class PatientCardRenewalServiceImpl implements PatientCardRenewalService {
@Override
public boolean renewCard(RenewalRequest request) {
// TODO: 这里应该实现真实的换卡业务逻辑
// 1. 验证参数合法性
// 2. 检查新卡号是否已被使用
// 3. 更新患者主表中的卡号信息
// 4. 记录换卡日志
// 5. 处理相关业务系统的卡号更新
// 目前返回模拟结果
log.info("模拟执行患者换卡操作: 旧卡号={}, 新卡号={}, 原因={}",
request.getOldCardNo(), request.getNewCardNo(), request.getReason());
// 简单验证:确保旧卡号和新卡号不为空且不相同
if (request.getOldCardNo() == null || request.getNewCardNo() == null ||
request.getOldCardNo().isEmpty() || request.getNewCardNo().isEmpty()) {
throw new IllegalArgumentException("卡号不能为空");
}
if (request.getOldCardNo().equals(request.getNewCardNo())) {
throw new IllegalArgumentException("新卡号不能与旧卡号相同");
}
// 模拟成功结果
return true;
}
}

View File

@@ -0,0 +1,38 @@
package com.openhis.web.charge.patientcardrenewal;
import lombok.Data;
/**
* 换卡请求参数类
*
* @author system
* @date 2024-01-01
*/
@Data
public class RenewalRequest {
/**
* 旧门诊号码
*/
private String oldCardNo;
/**
* 新门诊号码
*/
private String newCardNo;
/**
* 患者ID
*/
private String patientId;
/**
* 换卡原因
*/
private String reason;
/**
* 备注信息
*/
private String remark;
}

View File

@@ -91,9 +91,9 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra
*/
@Override
public Page<PatientMetadata> getPatientMetadataBySearchKey(String searchKey, Integer pageNo, Integer pageSize) {
// 构建查询条件
// 构建查询条件添加phone字段支持手机号搜索
QueryWrapper<Patient> queryWrapper = HisQueryUtils.buildQueryWrapper(null, searchKey,
new HashSet<>(Arrays.asList("id_card", "name", "py_str", "wb_str")), null);
new HashSet<>(Arrays.asList("id_card", "name", "py_str", "wb_str", "phone")), null);
// 设置排序
queryWrapper.orderByDesc("update_time");
// 通过证件号匹配 patient

View File

@@ -128,10 +128,11 @@ public class PatientInformationServiceImpl implements IPatientInformationService
public IPage<PatientInformationDto> getPatientInfo(PatientInfoSearchParam patientInfoSearchParam, String searchKey,
Integer pageNo, Integer pageSize, HttpServletRequest request) {
// 构建查询条件
// 构建查询条件 - 添加phone字段到搜索条件中
QueryWrapper<PatientInformationDto> queryWrapper = HisQueryUtils.buildQueryWrapper(
patientInfoSearchParam, searchKey, new HashSet<>(Arrays.asList(CommonConstants.FieldName.Name,
CommonConstants.FieldName.BusNo, CommonConstants.FieldName.PyStr, CommonConstants.FieldName.WbStr)),
CommonConstants.FieldName.BusNo, CommonConstants.FieldName.PyStr, CommonConstants.FieldName.WbStr,
CommonConstants.FieldName.Phone)), // 添加phone字段支持手机号搜索
request);
IPage<PatientInformationDto> patientInformationPage =

View File

@@ -142,6 +142,11 @@ public class CommonConstants {
*/
public interface FieldName {
/**
* 手机号
*/
String Phone = "phone";
/**
* 单据号
*/