Commit 603ae45c13568f98516e6fc9a932360dfee59803

Authored by shiyang
1 parent 9df23f719a
Exists in master and in 1 other branch dev

HIS上传逻辑增加数据同步事务

Showing 2 changed files with 16 additions and 9 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/LymsHisInfoController.java View file @ 603ae45
... ... @@ -66,18 +66,12 @@
66 66 @PostMapping("upHisInfo")
67 67 public BaseResponse upHisInfo( @RequestBody @Validated LymsHisInfo lymsHisInfo){
68 68 BaseResponse baseResponse=new BaseResponse();
  69 + baseResponse.setErrorcode(0);
  70 + baseResponse.setErrormsg("患者上传成功");
69 71 String result = lymsHisInfoService.upHisInfo(lymsHisInfo);
70 72 if(StringUtil.isNotEmpty(result)){
71 73 baseResponse.setErrorcode(1);
72 74 baseResponse.setErrormsg(result);
73   - }else {
74   - lymsHisInfo.setUpType(1);
75   - lymsHisInfo.setUpTime(new Date());
76   - final boolean b = lymsHisInfoService.updateById(lymsHisInfo);
77   - if(b){
78   - baseResponse.setErrorcode(0);
79   - baseResponse.setErrormsg("患者上传成功");
80   - }
81 75 }
82 76 return baseResponse;
83 77 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java View file @ 603ae45
... ... @@ -16,6 +16,7 @@
16 16 import org.springframework.beans.factory.annotation.Autowired;
17 17 import org.springframework.beans.factory.annotation.Value;
18 18 import org.springframework.stereotype.Service;
  19 +import org.springframework.transaction.annotation.Transactional;
19 20  
20 21 import java.util.*;
21 22  
22 23  
23 24  
... ... @@ -45,11 +46,23 @@
45 46 private LymsIllnessService lymsIllnessService;//疾病
46 47 @Autowired
47 48 private LymsTcardService lymsTcardService;//问诊卡信息
  49 + @Autowired
  50 + private LymsHisInfoService lymsHisInfoService;
48 51  
49 52  
50 53 @Override
  54 + @Transactional(rollbackFor = Exception.class)
51 55 public String upHisInfo(LymsHisInfo lymsHisInfo) {
52   - return collateData(lymsHisInfo);
  56 + String result=collateData(lymsHisInfo);
  57 + if(StringUtil.isEmpty(result)){
  58 + lymsHisInfo.setUpType(1);
  59 + lymsHisInfo.setUpTime(new Date());
  60 + final boolean b = lymsHisInfoService.updateById(lymsHisInfo);
  61 + if(!b){
  62 + result="更新HIS患者状态失败!";
  63 + }
  64 + }
  65 + return result;
53 66 }
54 67  
55 68 /**