Commit f84d3505e271a03a7d768ca1b2e3204604b7882c

Authored by cfl
1 parent a6a87a91fc
Exists in dev

测试过程中bug修改

Showing 6 changed files with 68 additions and 15 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/config/GlobalExceptionHandler.java View file @ f84d350
... ... @@ -2,7 +2,7 @@
2 2  
3 3 import com.lyms.talkonlineweb.result.BaseResponse;
4 4 import lombok.extern.log4j.Log4j2;
5   -import org.springframework.http.HttpRequest;
  5 +import org.springframework.dao.DataIntegrityViolationException;
6 6 import org.springframework.http.HttpStatus;
7 7 import org.springframework.validation.BindingResult;
8 8 import org.springframework.validation.FieldError;
9 9  
... ... @@ -52,11 +52,24 @@
52 52 public BaseResponse exceptionHandler(Exception e){
53 53 BaseResponse baseResponse=new BaseResponse();
54 54 baseResponse.setErrorcode(1);
55   - baseResponse.setErrormsg("服务器内部错误:"+e.getMessage());
  55 + baseResponse.setErrormsg("服务器内部错误,请联系管理员!");
56 56 log.error(e.getMessage());
57 57 e.printStackTrace();
58 58 return baseResponse;
59 59 }
  60 +
  61 +
  62 + @ExceptionHandler(value = DataIntegrityViolationException.class)
  63 + @ResponseBody
  64 + public BaseResponse dataIntegrityViolationExceptionHandler(Exception e){
  65 + BaseResponse baseResponse=new BaseResponse();
  66 + baseResponse.setErrorcode(1);
  67 + baseResponse.setErrormsg("服务器内部错误,参数长度错误");
  68 + log.error(e.getMessage());
  69 + return baseResponse;
  70 + }
  71 +
  72 +
60 73  
61 74  
62 75 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java View file @ f84d350
... ... @@ -341,28 +341,34 @@
341 341 @PostMapping("loginPatient")
342 342 public BaseResponse loginPatient(@RequestBody LymsPatient patient) {
343 343 BaseResponse baseResponse = new BaseResponse();
  344 + baseResponse.setErrorcode(1);
344 345  
345 346 //公众号跳转小程序登录状态。loginType==1不需要加密处理,这里是反相判断
346 347 if(!((Integer)1).equals(patient.getLoginType())){
347 348 //密码加密
348 349 patient.setPpasswd(DigestUtils.md5DigestAsHex(patient.getPpasswd().getBytes()));
349 350 }
350   - List<LymsPatient> dLst = lymsPatientService.list(Wrappers.query(patient));
351   - baseResponse.setErrorcode(1);
352   - LymsPatient patient2=null;
353 351  
  352 + List<LymsPatient> dLst = new ArrayList<>();
  353 + //身份证号登录,直接查询
  354 + if(patient.getIdno().length() > 11){
  355 + dLst = lymsPatientService.list(Wrappers.query(patient));
  356 + }
  357 + LymsPatient patient2=null;
354 358 //是否有病例
355 359 int pcaseSize=0;
356   - LymsPcase pcase=new LymsPcase();
357   - pcase.setMobile(patient.getIdno());
358   - List<LymsPcase> cLst =lymsPcaseService.list(Wrappers.query(pcase));
359   - pcaseSize=cLst.size();
360   - if(dLst.size() < 1 ){//手机号登录
361   - if(pcaseSize>0){
  360 + //手机号登录
  361 + if(patient.getIdno().length() == 11 && dLst.size() < 1 ){
  362 + LymsPcase pcase=new LymsPcase();
  363 + pcase.setMobile(patient.getIdno());
  364 + List<LymsPcase> cLst =lymsPcaseService.list(Wrappers.query(pcase));
  365 + pcaseSize = cLst.size();
  366 +
  367 + if(pcaseSize > 0){
362 368 Map<String,Object> param=new HashMap<>();
363 369 param.put("id",cLst.get(0).getPid());
364 370 param.put("ppasswd",patient.getPpasswd());
365   - dLst=lymsPatientService.listByMap(param);
  371 + dLst = lymsPatientService.listByMap(param);
366 372 }else {//没有病例
367 373 //小程序自主注册用手机号登录验证
368 374 Map<String,Object> paramQuery=new HashMap<>();
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/XljcTraceController.java View file @ f84d350
... ... @@ -78,6 +78,9 @@
78 78 for(XljcTraceRecord record : traceRecords.getRecords()){
79 79 record.setSexText(BeanUtils.tranferSexToText(record.getSex()));
80 80 record.setNextExamineStatusText(TraceStatusEnum.getName(record.getNextExamineStatus()));
  81 + if(record.getTraceWay() != null){
  82 + record.setTraceWayText(TraceWayEnum.getName(record.getTraceWay()));
  83 + }
81 84 }
82 85 return BaseResponse.ok(traceRecords);
83 86 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/XljcTraceRecord.java View file @ f84d350
... ... @@ -38,6 +38,8 @@
38 38  
39 39 private String tracePerson;
40 40  
  41 + private Integer traceWay;
  42 +
41 43 private String traceWayText;
42 44  
43 45  
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsXljcRecordServiceImpl.java View file @ f84d350
... ... @@ -13,12 +13,15 @@
13 13 import com.lyms.talkonlineweb.request.XljcPatientRequest;
14 14 import com.lyms.talkonlineweb.result.*;
15 15 import com.lyms.talkonlineweb.service.*;
  16 +import com.lyms.talkonlineweb.util.Constant;
16 17 import com.lyms.talkonlineweb.util.DateUtil;
  18 +import com.lyms.talkonlineweb.util.StringUtil;
17 19 import lombok.extern.log4j.Log4j2;
18 20 import org.springframework.beans.BeanUtils;
19 21 import org.springframework.beans.factory.annotation.Autowired;
20 22 import org.springframework.stereotype.Service;
21 23 import org.springframework.transaction.annotation.Transactional;
  24 +import org.springframework.util.DigestUtils;
22 25  
23 26 import javax.annotation.Resource;
24 27 import java.util.*;
25 28  
... ... @@ -58,7 +61,10 @@
58 61 @Autowired
59 62 private LymsIllnessService lymsIllnessService;//疾病
60 63  
  64 + @Autowired
  65 + private LymsTcardService lymsTcardService;
61 66  
  67 +
62 68 @Override
63 69 @Transactional
64 70 public boolean saveRecord(XljcExamineRequest xljcExamineRequest, LymsUser curUser) {
65 71  
66 72  
67 73  
68 74  
69 75  
... ... @@ -239,22 +245,33 @@
239 245 Date currentDate = new Date();
240 246 LymsPatient patientQuery = new LymsPatient();
241 247 patientQuery.setIdno(archive.getIdno());
242   - LymsPatient patient = lymsPatientService.getOne(Wrappers.query(patientQuery));
243 248  
  249 + //心理检测患者,默认6张问诊卡
  250 + int cardCount = 6;
  251 + LymsPatient patient = lymsPatientService.getOne(Wrappers.query(patientQuery));
244 252 if(patient == null){
245 253 patient = new LymsPatient();
246 254 patient.setPname(archive.getPname());
247 255 patient.setIdno(archive.getIdno());
  256 + patient.setPpasswd(DigestUtils.md5DigestAsHex(Constant.COMMON_PASSWD.getBytes()));
248 257 patient.setBirth(archive.getBirth());
249 258 patient.setSex(archive.getSex());
250   - patient.setCcnt(0);
  259 + patient.setCcnt(6);
  260 + //档案上的手机号
  261 + if(StringUtil.isNotEmpty(archive.getTel()) && archive.getTel().length() == 11){
  262 + patient.setEnrolmentPhone(archive.getTel());
  263 + }
251 264 patient.setNation(String.valueOf(archive.getNation()));
252 265 patient.setJobType(archive.getJobType());
253 266 patient.setResideAddres(archive.getResideAddres());
254 267 patient.setCreatedby(currentUser.getUid());
255 268 patient.setCreatedtime(currentDate);
256   - lymsPatientService.save(patient);
  269 + }else{
  270 + patient.setCcnt(patient.getCcnt()==null?cardCount:(patient.getCcnt()+cardCount));
  271 + patient.setUpdatedby(String.valueOf(currentUser.getUid()));
  272 + patient.setUpdatedtime(currentDate);
257 273 }
  274 + lymsPatientService.saveOrUpdate(patient);
258 275  
259 276 //病例中机构等信息取record表数据,不取档案表数据
260 277 LymsDoctor examineDoctor = lymsDoctorService.getById(lymsXljcRecord.getExamineDoctor());
... ... @@ -281,6 +298,16 @@
281 298 ness.setCreatedtime(currentDate);
282 299 boolean save = lymsIllnessService.save(ness);
283 300 //是否增加问诊卡
  301 + for(int i = 0; i < cardCount ;i++){
  302 + LymsTcard tcard = new LymsTcard();
  303 + tcard.setCnt(1);
  304 + tcard.setPcid(pcase.getPcid());
  305 + tcard.setPid(patient.getId());
  306 + tcard.setFid(2);
  307 + tcard.setCreatedby(currentUser.getCreatedby());
  308 + tcard.setCreatedtime(currentDate);
  309 + lymsTcardService.save(tcard);
  310 + }
284 311  
285 312 //更新record为上传状态
286 313 lymsXljcRecord.setUploadStatus(1);
talkonlineweb/src/main/resources/mapper/LymsXljcRecordTraceMapper.xml View file @ f84d350
... ... @@ -35,6 +35,8 @@
35 35 a.birth,
36 36 trace.next_examine_date as nextExamineDate,
37 37 trace.next_examine_status as nextExamineStatus,
  38 + trace.trace_way as traceWay,
  39 + trace.trace_person as tracePerson,
38 40 trace.trace_time as traceDate,
39 41 DATEDIFF((case when next_examine_status = 0 then now() else trace_time end),
40 42 next_examine_date) as overDays,