|
@@ -21,6 +21,7 @@ import com.fs.his.utils.IdCardUtil;
|
|
|
import com.fs.system.service.ISysConfigService;
|
|
import com.fs.system.service.ISysConfigService;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.checkerframework.checker.units.qual.A;
|
|
import org.checkerframework.checker.units.qual.A;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -82,116 +83,36 @@ public class PatientController extends AppBaseController {
|
|
|
}
|
|
}
|
|
|
return R.ok().put("data",data);
|
|
return R.ok().put("data",data);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 添加病人
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @return 添加结果
|
|
|
|
|
+ */
|
|
|
@Login
|
|
@Login
|
|
|
@RepeatSubmit
|
|
@RepeatSubmit
|
|
|
@ApiOperation("添加病人")
|
|
@ApiOperation("添加病人")
|
|
|
@PostMapping("/addPatient")
|
|
@PostMapping("/addPatient")
|
|
|
public R addPatient(@Valid @RequestBody FsPatientAddEditParam param, HttpServletRequest request){
|
|
public R addPatient(@Valid @RequestBody FsPatientAddEditParam param, HttpServletRequest request){
|
|
|
- String json = configService.selectConfigByKey("his.store");
|
|
|
|
|
- StoreConfig storeConfig = JSONUtil.toBean(json, StoreConfig.class);
|
|
|
|
|
- Integer isIdVerification = storeConfig.getIsIdVerification();
|
|
|
|
|
-
|
|
|
|
|
- String idCardNumber = param.getIdCard(); // 替换为要验证的身份证号码
|
|
|
|
|
- String mobile = param.getMobile();
|
|
|
|
|
- if (idCardNumber == null || idCardNumber.trim().isEmpty()) {
|
|
|
|
|
- return R.error("身份证号码不合法");
|
|
|
|
|
- }
|
|
|
|
|
- if (idCardNumber.length() != 18) {
|
|
|
|
|
-// //大陆身份证是18位
|
|
|
|
|
-// if (isIdVerification != 1) {
|
|
|
|
|
-// return R.error("身份证号码不合法");
|
|
|
|
|
-// } else {
|
|
|
|
|
-// //非大陆身份校验需要手机号 手机号只支持大陆的办理的手机号
|
|
|
|
|
-// if (StringUtils.isBlank(mobile)){
|
|
|
|
|
-// R.error("手机号不能为空");
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
- //暂时仅支持大陆身份证
|
|
|
|
|
- return R.error("身份证号码不合法");
|
|
|
|
|
- } else {
|
|
|
|
|
- String regex = "\\d{17}[0-9Xx]";
|
|
|
|
|
- if (!Pattern.matches(regex, idCardNumber)) {
|
|
|
|
|
- return R.error("身份证号码不合法");
|
|
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(param.getIdCard())) {
|
|
|
|
|
+ String idCardNumber = param.getIdCard(); // 替换为要验证的身份证号码
|
|
|
|
|
+ IdCardVerificationResponse idCardVerificationResponse = TxOcrClient.IdCardVerification(param.getPatientName(), idCardNumber);
|
|
|
|
|
+ if(0 != idCardVerificationResponse.getResult()){
|
|
|
|
|
+ throw new CustomException(idCardVerificationResponse.getDescription());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- if (param.getPatientName().length()<2||param.getPatientName().length()>30||!param.getPatientName().matches("^[\u4e00-\u9fa5]+$")) {
|
|
|
|
|
- return R.error("就诊人名称不合法");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- IdCardVerificationResponse idCardVerificationResponse = TxOcrClient.IdCardVerification(param.getPatientName(), idCardNumber);
|
|
|
|
|
- if(0 != idCardVerificationResponse.getResult()){
|
|
|
|
|
- throw new CustomException(idCardVerificationResponse.getDescription());
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- 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("身份证校验错误");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- //三方校验
|
|
|
|
|
- if (isIdVerification!=null&&isIdVerification == 1){
|
|
|
|
|
- boolean match = true;
|
|
|
|
|
- if (idCardNumber.length() != 18) {
|
|
|
|
|
- match = IdCardUtil.isMatchByMobile(storeConfig,param.getPatientName(), mobile);
|
|
|
|
|
- } else {
|
|
|
|
|
- match = IdCardUtil.isMatchById(storeConfig,param.getPatientName(), param.getIdCard());
|
|
|
|
|
- }
|
|
|
|
|
- if (!match){
|
|
|
|
|
- return R.error("身份证校验错误");
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
FsPatient patient=new FsPatient();
|
|
FsPatient patient=new FsPatient();
|
|
|
BeanUtil.copyProperties(param, patient);
|
|
BeanUtil.copyProperties(param, patient);
|
|
|
patient.setUserId(Long.parseLong(getUserId()));
|
|
patient.setUserId(Long.parseLong(getUserId()));
|
|
|
patient.setIsDel(0);
|
|
patient.setIsDel(0);
|
|
|
patient.setStatus(1);
|
|
patient.setStatus(1);
|
|
|
patientService.insertFsPatient(patient);
|
|
patientService.insertFsPatient(patient);
|
|
|
-
|
|
|
|
|
// 填写就诊人信息
|
|
// 填写就诊人信息
|
|
|
FsUserAddIntegralTemplateParam integralTemplateParam = new FsUserAddIntegralTemplateParam();
|
|
FsUserAddIntegralTemplateParam integralTemplateParam = new FsUserAddIntegralTemplateParam();
|
|
|
integralTemplateParam.setUserId(Long.parseLong(getUserId()));
|
|
integralTemplateParam.setUserId(Long.parseLong(getUserId()));
|
|
|
integralTemplateParam.setLogType(FsUserIntegralLogTypeEnum.TYPE_11.getValue());
|
|
integralTemplateParam.setLogType(FsUserIntegralLogTypeEnum.TYPE_11.getValue());
|
|
|
integralTemplateParam.setBusinessId(patient.getPatientId().toString());
|
|
integralTemplateParam.setBusinessId(patient.getPatientId().toString());
|
|
|
userIntegralLogsService.addIntegralTemplate(integralTemplateParam);
|
|
userIntegralLogsService.addIntegralTemplate(integralTemplateParam);
|
|
|
-
|
|
|
|
|
return R.ok("操作成功");
|
|
return R.ok("操作成功");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -199,83 +120,13 @@ public class PatientController extends AppBaseController {
|
|
|
@ApiOperation("编辑病人")
|
|
@ApiOperation("编辑病人")
|
|
|
@PostMapping("/editPatient")
|
|
@PostMapping("/editPatient")
|
|
|
public R editPatient(@Valid @RequestBody FsPatientAddEditParam param, HttpServletRequest request){
|
|
public R editPatient(@Valid @RequestBody FsPatientAddEditParam param, HttpServletRequest request){
|
|
|
- String json = configService.selectConfigByKey("his.store");
|
|
|
|
|
- StoreConfig storeConfig = JSONUtil.toBean(json, StoreConfig.class);
|
|
|
|
|
- Integer isIdVerification = storeConfig.getIsIdVerification();
|
|
|
|
|
- String mobile = param.getMobile();
|
|
|
|
|
-
|
|
|
|
|
- String idCardNumber = param.getIdCard(); // 替换为要验证的身份证号码
|
|
|
|
|
- if (idCardNumber == null || idCardNumber.trim().isEmpty()) {
|
|
|
|
|
- return R.error("身份证号码不合法");
|
|
|
|
|
- }
|
|
|
|
|
- if (idCardNumber.length() != 18) {
|
|
|
|
|
-// //大陆身份证是18位
|
|
|
|
|
-// if (isIdVerification != 1) {
|
|
|
|
|
-// return R.error("身份证号码不合法");
|
|
|
|
|
-// } else {
|
|
|
|
|
-// //非大陆身份校验需要手机号 手机号只支持大陆的办理的手机号
|
|
|
|
|
-// if (StringUtils.isBlank(mobile)){
|
|
|
|
|
-// R.error("手机号不能为空");
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
- //暂时仅支持大陆身份证
|
|
|
|
|
- return R.error("身份证号码不合法");
|
|
|
|
|
- } else {
|
|
|
|
|
- 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("就诊人名称不合法");
|
|
|
|
|
- }
|
|
|
|
|
-// 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) {
|
|
|
|
|
-// throw new CustomException("年龄必须大于18岁");
|
|
|
|
|
-// }
|
|
|
|
|
-// if (age > 200) {
|
|
|
|
|
-// throw new CustomException("年龄超过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) {
|
|
|
|
|
-// throw new CustomException("年龄必须大于18岁");
|
|
|
|
|
-// }
|
|
|
|
|
-// if (age2 > 200) {
|
|
|
|
|
-// throw new CustomException("年龄超过200岁");
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
- //三方校验
|
|
|
|
|
- if (isIdVerification!=null&&isIdVerification == 1){
|
|
|
|
|
- boolean match = true;
|
|
|
|
|
- if (idCardNumber.length() != 18) {
|
|
|
|
|
- match = IdCardUtil.isMatchByMobile(storeConfig,param.getPatientName(), mobile);
|
|
|
|
|
- } else {
|
|
|
|
|
- match = IdCardUtil.isMatchById(storeConfig,param.getPatientName(), param.getIdCard());
|
|
|
|
|
- }
|
|
|
|
|
- if (!match){
|
|
|
|
|
- return R.error("身份证校验错误");
|
|
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(param.getIdCard())) {
|
|
|
|
|
+ String idCardNumber = param.getIdCard(); // 替换为要验证的身份证号码
|
|
|
|
|
+ IdCardVerificationResponse idCardVerificationResponse = TxOcrClient.IdCardVerification(param.getPatientName(), idCardNumber);
|
|
|
|
|
+ if(0 != idCardVerificationResponse.getResult()){
|
|
|
|
|
+ throw new CustomException(idCardVerificationResponse.getDescription());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
FsPatient patient=new FsPatient();
|
|
FsPatient patient=new FsPatient();
|
|
|
BeanUtil.copyProperties(param, patient);
|
|
BeanUtil.copyProperties(param, patient);
|
|
|
patientService.updateFsPatient(patient);
|
|
patientService.updateFsPatient(patient);
|