diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/config/GlobalExceptionHandler.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/config/GlobalExceptionHandler.java index 5ab88d9..5753d93 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/config/GlobalExceptionHandler.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/config/GlobalExceptionHandler.java @@ -2,7 +2,7 @@ package com.lyms.talkonlineweb.config; import com.lyms.talkonlineweb.result.BaseResponse; import lombok.extern.log4j.Log4j2; -import org.springframework.http.HttpRequest; +import org.springframework.dao.DataIntegrityViolationException; import org.springframework.http.HttpStatus; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; @@ -52,11 +52,24 @@ public class GlobalExceptionHandler { public BaseResponse exceptionHandler(Exception e){ BaseResponse baseResponse=new BaseResponse(); baseResponse.setErrorcode(1); - baseResponse.setErrormsg("服务器内部错误:"+e.getMessage()); + baseResponse.setErrormsg("服务器内部错误,请联系管理员!"); log.error(e.getMessage()); e.printStackTrace(); return baseResponse; } + @ExceptionHandler(value = DataIntegrityViolationException.class) + @ResponseBody + public BaseResponse dataIntegrityViolationExceptionHandler(Exception e){ + BaseResponse baseResponse=new BaseResponse(); + baseResponse.setErrorcode(1); + baseResponse.setErrormsg("服务器内部错误,参数长度错误"); + log.error(e.getMessage()); + return baseResponse; + } + + + + } diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java index 9441662..c76c6c4 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java @@ -341,28 +341,34 @@ public class PatientController { @PostMapping("loginPatient") public BaseResponse loginPatient(@RequestBody LymsPatient patient) { BaseResponse baseResponse = new BaseResponse(); + baseResponse.setErrorcode(1); //公众号跳转小程序登录状态。loginType==1不需要加密处理,这里是反相判断 if(!((Integer)1).equals(patient.getLoginType())){ //密码加密 patient.setPpasswd(DigestUtils.md5DigestAsHex(patient.getPpasswd().getBytes())); } - List dLst = lymsPatientService.list(Wrappers.query(patient)); - baseResponse.setErrorcode(1); - LymsPatient patient2=null; + List dLst = new ArrayList<>(); + //身份证号登录,直接查询 + if(patient.getIdno().length() > 11){ + dLst = lymsPatientService.list(Wrappers.query(patient)); + } + LymsPatient patient2=null; //是否有病例 int pcaseSize=0; - LymsPcase pcase=new LymsPcase(); - pcase.setMobile(patient.getIdno()); - List cLst =lymsPcaseService.list(Wrappers.query(pcase)); - pcaseSize=cLst.size(); - if(dLst.size() < 1 ){//手机号登录 - if(pcaseSize>0){ + //手机号登录 + if(patient.getIdno().length() == 11 && dLst.size() < 1 ){ + LymsPcase pcase=new LymsPcase(); + pcase.setMobile(patient.getIdno()); + List cLst =lymsPcaseService.list(Wrappers.query(pcase)); + pcaseSize = cLst.size(); + + if(pcaseSize > 0){ Map param=new HashMap<>(); param.put("id",cLst.get(0).getPid()); param.put("ppasswd",patient.getPpasswd()); - dLst=lymsPatientService.listByMap(param); + dLst = lymsPatientService.listByMap(param); }else {//没有病例 //小程序自主注册用手机号登录验证 Map paramQuery=new HashMap<>(); diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/XljcTraceController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/XljcTraceController.java index 7e45e4c..7de1a8e 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/XljcTraceController.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/XljcTraceController.java @@ -78,6 +78,9 @@ public class XljcTraceController { for(XljcTraceRecord record : traceRecords.getRecords()){ record.setSexText(BeanUtils.tranferSexToText(record.getSex())); record.setNextExamineStatusText(TraceStatusEnum.getName(record.getNextExamineStatus())); + if(record.getTraceWay() != null){ + record.setTraceWayText(TraceWayEnum.getName(record.getTraceWay())); + } } return BaseResponse.ok(traceRecords); } diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/XljcTraceRecord.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/XljcTraceRecord.java index 6537f50..d99e2a1 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/XljcTraceRecord.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/XljcTraceRecord.java @@ -38,6 +38,8 @@ public class XljcTraceRecord extends XljcArchiveResult{ private String tracePerson; + private Integer traceWay; + private String traceWayText; diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsXljcRecordServiceImpl.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsXljcRecordServiceImpl.java index ca8f2df..c92dd9a 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsXljcRecordServiceImpl.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsXljcRecordServiceImpl.java @@ -13,12 +13,15 @@ import com.lyms.talkonlineweb.request.XljcExamineRequest; import com.lyms.talkonlineweb.request.XljcPatientRequest; import com.lyms.talkonlineweb.result.*; import com.lyms.talkonlineweb.service.*; +import com.lyms.talkonlineweb.util.Constant; import com.lyms.talkonlineweb.util.DateUtil; +import com.lyms.talkonlineweb.util.StringUtil; import lombok.extern.log4j.Log4j2; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.DigestUtils; import javax.annotation.Resource; import java.util.*; @@ -58,6 +61,9 @@ public class LymsXljcRecordServiceImpl extends ServiceImpl