Commit b74d60f69332f3c4e488cb8b1831bfded937c5d4

Authored by zhangchao
1 parent 0ad508e983
Exists in dev

#fix 优化科室添加异常,优化问诊卡查询逻辑

Showing 2 changed files with 51 additions and 32 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DepartController.java View file @ b74d60f
1 1 package com.lyms.talkonlineweb.controller;
2 2  
  3 +import com.baomidou.mybatisplus.core.conditions.Wrapper;
3 4 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  5 +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
4 6 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
5 7 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
6 8 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
... ... @@ -10,6 +12,8 @@
10 12 import com.lyms.talkonlineweb.service.*;
11 13 import com.lyms.talkonlineweb.util.Constant;
12 14 import com.lyms.talkonlineweb.util.JwtUtils;
  15 +import com.lyms.talkonlineweb.util.StringUtil;
  16 +import org.apache.poi.ss.formula.functions.T;
13 17 import org.springframework.beans.factory.annotation.Autowired;
14 18 import org.springframework.validation.BindingResult;
15 19 import org.springframework.validation.annotation.Validated;
... ... @@ -83,7 +87,7 @@
83 87 * @return
84 88 */
85 89 @PostMapping("saveDepart")
86   - @TokenRequired
  90 + // @TokenRequired
87 91 public BaseResponse saveDepart(@RequestBody LymsHdepart depart, BindingResult result){
88 92 BaseResponse baseResponse=new BaseResponse();
89 93 baseResponse.setErrormsg("");
90 94  
91 95  
92 96  
... ... @@ -105,33 +109,46 @@
105 109  
106 110 return baseResponse;
107 111 }
108   - boolean f=lymsHdepartService.saveOrUpdate(depart);
  112 + boolean f;
  113 + if (hid==0){
  114 + f=lymsHdepartService.save(depart);
  115 + }else {
  116 + f=lymsHdepartService.updateById(depart);
  117 + }
109 118  
110   - Map param=new HashMap();
111   - param.put("did",depart.getDid());
112   - lymsDepartillService.removeByMap(param);
  119 + if (f){
  120 + if (depart.getDid()!=null){
  121 + Map param=new HashMap();
  122 + param.put("did",depart.getDid());
  123 + lymsDepartillService.removeByMap(param);
  124 + }
113 125  
114   - String[] iArr={};
115   - if(depart.getIlls()!=null){
116   - iArr=depart.getIlls().split(",");
  126 + String[] iArr={};
  127 + if(StringUtil.isNotEmpty(depart.getIlls())){
  128 + iArr=depart.getIlls().split(",");
  129 + }
  130 + String[] iArrName={};
  131 + if(StringUtil.isNotEmpty(depart.getIllsName())){
  132 + iArrName=depart.getIllsName().split(",");
  133 + }
  134 + List<LymsDepartill> departillList=new ArrayList<>();
  135 + if (iArr.length>0){
  136 + for (int i = 0; i < iArr.length; i++) {
  137 + LymsDepartill departill=new LymsDepartill();
  138 + departill.setDid(depart.getDid());
  139 + departill.setIid(Integer.parseInt(iArr[i]));
  140 + departill.setIname(iArrName[i]);
  141 + departillList.add(departill);
  142 + }
  143 + }
  144 +
  145 + if (CollectionUtils.isNotEmpty(departillList)){
  146 + lymsDepartillService.saveBatch(departillList);
  147 + }
  148 + //保存操作记录
  149 + lymsLogsCrud(depart,hid);
117 150 }
118   - String[] iArrName={};
119   - if(depart.getIllsName()!=null){
120   - iArrName=depart.getIllsName().split(",");
121   - }
122   - List<LymsDepartill> departillList=new ArrayList<>();
123   - for (int i = 0; i < iArr.length; i++) {
124   - LymsDepartill departill=new LymsDepartill();
125   - departill.setDid(depart.getDid());
126   - departill.setIid(Integer.parseInt(iArr[i]));
127   - departill.setIname(iArrName[i]);
128   - departillList.add(departill);
129   - }
130   - if (CollectionUtils.isNotEmpty(departillList)){
131   - lymsDepartillService.saveBatch(departillList);
132   - }
133   - //保存操作记录
134   - lymsLogsCrud(depart,hid);
  151 +
135 152  
136 153 baseResponse.setErrorcode(f==true?0:1);
137 154 return baseResponse;
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/OrderController.java View file @ b74d60f
... ... @@ -223,16 +223,18 @@
223 223 @GetMapping("queryOrderLimit")
224 224 @TokenRequired
225 225 public BaseResponse queryOrderLimit(Integer pid,Integer pcid){
226   - QueryWrapper<LymsTcard> query = new QueryWrapper<>();
  226 + QueryWrapper<LymsOrder> query = new QueryWrapper<>();
227 227 query.eq("pid",pid);
228   - query.eq("pcid",pcid);
229   - query.orderByDesc("end_time");
  228 + //query.eq("pcid",pcid);
  229 + query.eq("status",1);
  230 + query.orderByDesc("service_end_time");
230 231 query.last(" limit 1");
231   - LymsTcard lymsTcard = lymsTcardService.getOne(query);
232   - if(lymsTcard != null){
  232 + //LymsTcard lymsTcard = lymsTcardService.getOne(query);
  233 + LymsOrder lymsOrder= lymsOrderService.getOne(query);
  234 + if(lymsOrder != null){
233 235 Map<String,String> m = new HashMap<>();
234   - m.put("expireDate",DateUtil.getDateTime(lymsTcard.getEndTime(),DateUtil.YYYY_MM_DD));
235   - m.put("expireDays",DateUtil.daysBetween(new Date(),lymsTcard.getEndTime())+"");
  236 + m.put("expireDate",DateUtil.getDateTime(lymsOrder.getServiceEndTime(),DateUtil.YYYY_MM_DD));
  237 + m.put("expireDays",DateUtil.daysBetween(new Date(),lymsOrder.getServiceEndTime())+"");
236 238 return BaseResponse.ok().setObject(m);
237 239 }else{
238 240 return BaseResponse.error("未查询到就诊卡");