Quellcode durchsuchen

修改患者身份证业务

wjj vor 4 Tagen
Ursprung
Commit
6498cb0ae7

+ 19 - 1
fs-service/src/main/java/com/fs/his/service/impl/FsInquiryOrderServiceImpl.java

@@ -642,7 +642,18 @@ public class FsInquiryOrderServiceImpl implements IFsInquiryOrderService
         }
         else if(param.getInquiryType().equals(2)){
             //快速
-
+            FsDoctor doctor = null;
+            //获取销售绑定的医生信息
+            if (param.getCompanyUserId() != null) {
+                CompanyUser companyUser = companyUserService.selectCompanyUserById(param.getCompanyUserId());
+                if (companyUser != null && companyUser.getDoctorId() != null) {
+                    doctor = doctorMapper.selectFsDoctorByDoctorId(companyUser.getDoctorId());
+                    if (doctor != null) {
+                        order.setDoctorId(doctor.getDoctorId());
+                        order.setDepartmentId(doctor.getDeptId());
+                    }
+                }
+            }
             List<FsPriceDTO> price = configDTO.getPrices().stream().filter(x -> x.getType().equals(param.getOrderType())).collect(Collectors.toList());
             if(price!=null&&price.size()==1){
                 order.setMoney(price.get(0).getPrice());
@@ -661,6 +672,9 @@ public class FsInquiryOrderServiceImpl implements IFsInquiryOrderService
                 report.setPatientJson(JSONUtil.toJsonStr(dto));
                 report.setReportSn(reportSn);
                 report.setStatus(1);
+                if (doctor != null) {
+                    report.setDoctorId(doctor.getDoctorId());
+                }
                 order.setIsAudit(1);
             }
             else{
@@ -675,9 +689,13 @@ public class FsInquiryOrderServiceImpl implements IFsInquiryOrderService
                 report.setPatientJson(JSONUtil.toJsonStr(dto));
                 report.setReportSn(reportSn);
                 report.setStatus(0);
+                if (doctor != null) {
+                    report.setDoctorId(doctor.getDoctorId());
+                }
                 order.setIsAudit(0);
             }
 
+
         }
         else if(param.getInquiryType().equals(3)){
             //开药

+ 7 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsPackageOrderServiceImpl.java

@@ -480,8 +480,15 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
         }else {
             return R.error("请提交患者信息");
         }
+        logger.info("用户{}创建套餐订单,套餐id{},患者id{}",param.getUserId(),param.getPackageId(),param.getPatientId());
 
         FsPackage fsPackage=fsPackageMapper.selectFsPackageByPackageId(param.getPackageId());
+        logger.info("是否是中药或者西药{},{}",fsPackage.getProductType(),fsPackage.getProductType() == 1 || fsPackage.getProductType() == 2);
+        if (fsPackage.getProductType() == 1 || fsPackage.getProductType() == 2) {
+            if (StringUtils.isEmpty(patient.getIdCard())) {
+                return R.error("请完善患者身份证信息");
+            }
+        }
         if(fsPackage.getStatus().equals(0)){
             return R.error("套餐名已下架");
         }

+ 59 - 49
fs-user-app/src/main/java/com/fs/app/controller/PatientController.java

@@ -7,6 +7,7 @@ import com.fs.app.param.FsPatientAddEditParam;
 import com.fs.common.annotation.RepeatSubmit;
 import com.fs.common.core.domain.R;
 import com.fs.common.exception.CustomException;
+import com.fs.common.utils.StringUtils;
 import com.fs.his.domain.FsPatient;
 import com.fs.his.enums.FsUserIntegralLogTypeEnum;
 import com.fs.his.param.FsUserAddIntegralTemplateParam;
@@ -77,51 +78,56 @@ public class PatientController extends  AppBaseController {
     @ApiOperation("添加病人")
     @PostMapping("/addPatient")
     public R addPatient(@Valid @RequestBody FsPatientAddEditParam param, HttpServletRequest request){
-
-        String idCardNumber = param.getIdCard(); // 替换为要验证的身份证号码
-        if (idCardNumber == null || idCardNumber.length() != 18) {
-            return R.error("身份证号码不合法");
-        }
-        String regex = "\\d{17}[0-9Xx]";
-        if (!Pattern.matches(regex, idCardNumber)) {
-            return   R.error("身份证号码不合法");
-        }
-        if (param.getPatientName().length()<2||param.getPatientName().length()>30||!param.getPatientName().matches("^[\u4e00-\u9fa5]+$")) {
-            return   R.error("就诊人名称不合法");
-        }
-        try {
-            String birthDateString = idCardNumber.substring(6, 14);
-            LocalDate birthDate = LocalDate.parse(birthDateString, DateTimeFormatter.ofPattern("yyyyMMdd"));
-            LocalDate currentDate = LocalDate.now();
-            int age = currentDate.getYear() - birthDate.getYear();
-            if (currentDate.getMonthValue() < birthDate.getMonthValue()
-                    || (currentDate.getMonthValue() == birthDate.getMonthValue()
-                    && currentDate.getDayOfMonth() < birthDate.getDayOfMonth())) {
-                age--;
+        String idCardNumber = null;
+        if(StringUtils.isNotEmpty(param.getIdCard()) ) {
+            idCardNumber = param.getIdCard(); // 替换为要验证的身份证号码
+            if (idCardNumber == null || idCardNumber.length() != 18) {
+                return R.error("身份证号码不合法");
             }
-            if (age < 18) {
-                return R.error("年龄必须大于18岁");
+            String regex = "\\d{17}[0-9Xx]";
+            if (!Pattern.matches(regex, idCardNumber)) {
+                return   R.error("身份证号码不合法");
             }
-            if (age > 200) {
-                return   R.error("年龄超过200岁");
-
-            }
-            Date birthday = param.getBirthday();
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
-            String formattedBirthday = sdf.format(birthday);
-            LocalDate da = LocalDate.parse(formattedBirthday, DateTimeFormatter.ofPattern("yyyyMMdd"));
-            LocalDate currentDate2 = LocalDate.now();
-            int age2 = currentDate2.getYear() - da.getYear();
-            if (currentDate2.getMonthValue() < da.getMonthValue()
-                    || (currentDate2.getMonthValue() == da.getMonthValue()
-                    && currentDate2.getDayOfMonth() < da.getDayOfMonth())) {
-                age2--;
-            }
-            if (age2 < 18) {
-                return   R.error("年龄必须大于18岁");
+            if (param.getPatientName().length()<2||param.getPatientName().length()>30||!param.getPatientName().matches("^[\u4e00-\u9fa5]+$")) {
+                return   R.error("就诊人名称不合法");
             }
-            if (age2 > 200) {
-                return   R.error("年龄超过200岁");
+        }
+
+        try {
+            if (idCardNumber != null) {
+                String birthDateString = idCardNumber.substring(6, 14);
+                LocalDate birthDate = LocalDate.parse(birthDateString, DateTimeFormatter.ofPattern("yyyyMMdd"));
+                LocalDate currentDate = LocalDate.now();
+                int age = currentDate.getYear() - birthDate.getYear();
+                if (currentDate.getMonthValue() < birthDate.getMonthValue()
+                        || (currentDate.getMonthValue() == birthDate.getMonthValue()
+                        && currentDate.getDayOfMonth() < birthDate.getDayOfMonth())) {
+                    age--;
+                }
+                if (age < 18) {
+                    return R.error("年龄必须大于18岁");
+                }
+                if (age > 200) {
+                    return   R.error("年龄超过200岁");
+
+                }
+                Date birthday = param.getBirthday();
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+                String formattedBirthday = sdf.format(birthday);
+                LocalDate da = LocalDate.parse(formattedBirthday, DateTimeFormatter.ofPattern("yyyyMMdd"));
+                LocalDate currentDate2 = LocalDate.now();
+                int age2 = currentDate2.getYear() - da.getYear();
+                if (currentDate2.getMonthValue() < da.getMonthValue()
+                        || (currentDate2.getMonthValue() == da.getMonthValue()
+                        && currentDate2.getDayOfMonth() < da.getDayOfMonth())) {
+                    age2--;
+                }
+                if (age2 < 18) {
+                    return   R.error("年龄必须大于18岁");
+                }
+                if (age2 > 200) {
+                    return   R.error("年龄超过200岁");
+                }
             }
         }catch (Exception e){
             return   R.error("身份证校验错误");
@@ -148,14 +154,18 @@ public class PatientController extends  AppBaseController {
     @ApiOperation("编辑病人")
     @PostMapping("/editPatient")
     public R editPatient(@Valid @RequestBody FsPatientAddEditParam param, HttpServletRequest request){
-        String idCardNumber = param.getIdCard(); // 替换为要验证的身份证号码
-        if (idCardNumber == null || idCardNumber.length() != 18) {
-            throw new CustomException("身份证号码不合法");
-        }
-        String regex = "\\d{17}[0-9Xx]";
-        if (!Pattern.matches(regex, idCardNumber)) {
-            throw new CustomException("身份证号码不合法");
+
+        if (StringUtils.isNotEmpty(param.getIdCard())) {
+            String idCardNumber = param.getIdCard(); // 替换为要验证的身份证号码
+            if (idCardNumber == null || idCardNumber.length() != 18) {
+                throw new CustomException("身份证号码不合法");
+            }
+            String regex = "\\d{17}[0-9Xx]";
+            if (!Pattern.matches(regex, idCardNumber)) {
+                throw new CustomException("身份证号码不合法");
+            }
         }
+
         if (param.getPatientName().length()<2||param.getPatientName().length()>30||!param.getPatientName().matches("^[\u4e00-\u9fa5]+$")) {
             return   R.error("就诊人名称不合法");
         }

+ 1 - 1
fs-user-app/src/main/java/com/fs/app/param/FsPatientAddEditParam.java

@@ -23,7 +23,7 @@ public class FsPatientAddEditParam implements Serializable {
     private String patientName;
 
     /** 身份证号 */
-    @NotBlank(message = "身份证号不能为空")
+    //@NotBlank(message = "身份证号不能为空")
     private String idCard;
 
     /** 出生年月 */