diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/CommonResult.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/CommonResult.java index 77ea4fe..06b9da6 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/CommonResult.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/CommonResult.java @@ -77,6 +77,14 @@ public class CommonResult implements Serializable { return result; } + public static CommonResult success(T data,String msg) { + CommonResult result = new CommonResult<>(); + result.code = GlobalErrorCodeConstants.SUCCESS.getCode(); + result.data = data; + result.msg = msg; + return result; + } + public static CommonResult success(String msg) { CommonResult result = new CommonResult<>(); result.code = GlobalErrorCodeConstants.SUCCESS.getCode(); diff --git a/yudao-module-inspect/yudao-module-inspect-biz/src/main/java/cn/iocoder/yudao/module/inspect/controller/admin/inspectpatient/InspectPatientController.java b/yudao-module-inspect/yudao-module-inspect-biz/src/main/java/cn/iocoder/yudao/module/inspect/controller/admin/inspectpatient/InspectPatientController.java index 3916034..9f8bbdc 100644 --- a/yudao-module-inspect/yudao-module-inspect-biz/src/main/java/cn/iocoder/yudao/module/inspect/controller/admin/inspectpatient/InspectPatientController.java +++ b/yudao-module-inspect/yudao-module-inspect-biz/src/main/java/cn/iocoder/yudao/module/inspect/controller/admin/inspectpatient/InspectPatientController.java @@ -307,6 +307,11 @@ public class InspectPatientController { @Operation(summary = "根据表单创建患者信息和项目信息") public CommonResult insertPatinetInfo(@Valid @RequestBody InspectPatientSaveReqVO inspectPatientSaveReqVO) { + //验证身份证 + if( patientService.validateIdCardExists(inspectPatientSaveReqVO.getCardId())) + { + return success(false,"身份证号已存在"); + } //检查项目 // List dataList2 = new ArrayList<>(); diff --git a/yudao-module-inspect/yudao-module-inspect-biz/src/main/java/cn/iocoder/yudao/module/inspect/service/inspectpatient/InspectPatientService.java b/yudao-module-inspect/yudao-module-inspect-biz/src/main/java/cn/iocoder/yudao/module/inspect/service/inspectpatient/InspectPatientService.java index 61f1c57..c2a9bcc 100644 --- a/yudao-module-inspect/yudao-module-inspect-biz/src/main/java/cn/iocoder/yudao/module/inspect/service/inspectpatient/InspectPatientService.java +++ b/yudao-module-inspect/yudao-module-inspect-biz/src/main/java/cn/iocoder/yudao/module/inspect/service/inspectpatient/InspectPatientService.java @@ -81,6 +81,9 @@ public interface InspectPatientService { //根据条码获取患者信息 InspectPatientDO getPatientOfMedicalSn(String medicalSn); + //验证身份证号是否存在 + boolean validateIdCardExists(String idCard); + //根据身份证、姓名、体检编码获取患者信息 List getPatientBySearchKey(String searchKey); diff --git a/yudao-module-inspect/yudao-module-inspect-biz/src/main/java/cn/iocoder/yudao/module/inspect/service/inspectpatient/InspectPatientServiceImpl.java b/yudao-module-inspect/yudao-module-inspect-biz/src/main/java/cn/iocoder/yudao/module/inspect/service/inspectpatient/InspectPatientServiceImpl.java index a539ce5..d1a7cc9 100644 --- a/yudao-module-inspect/yudao-module-inspect-biz/src/main/java/cn/iocoder/yudao/module/inspect/service/inspectpatient/InspectPatientServiceImpl.java +++ b/yudao-module-inspect/yudao-module-inspect-biz/src/main/java/cn/iocoder/yudao/module/inspect/service/inspectpatient/InspectPatientServiceImpl.java @@ -158,6 +158,13 @@ public class InspectPatientServiceImpl implements InspectPatientService { lambdaQuery.eq(InspectPatientDO::getMedicalSn, medicalSn); return patientMapper.selectOne(lambdaQuery); } + + @Override + public boolean validateIdCardExists(String idCard) { + LambdaQueryWrapper lambdaQuery = new LambdaQueryWrapper<>(); + lambdaQuery.eq(InspectPatientDO::getCardId, idCard); + return patientMapper.selectCount(lambdaQuery) > 0; + } @Override public List getPatientBySearchKey(String searchKey) { LambdaQueryWrapper lambdaQuery = new LambdaQueryWrapper<>();