Commit bbc2c94c56772d7f067605d7d5d5ae8b2b6158ef

Authored by cfl
1 parent 3ec16c51f3
Exists in dev

各种bug修改

Showing 17 changed files with 290 additions and 65 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ChatGroupController.java View file @ bbc2c94
... ... @@ -769,13 +769,14 @@
769 769 log.error("updateGroupStat回滚LymsChatgroup失败,{}",chatgroup);
770 770 throw new RuntimeException("回滚状态,执行失败,请联系管理员");
771 771 }
772   - final PatientInfo patientInfo = patientInfoService.getOne(new QueryWrapper<PatientInfo>()
773   - .lambda().eq(PatientInfo::getCid, chatgroup.getPcid()));
774   - if (null==patientInfo) {
  772 + final List<PatientInfo> patientInfos = patientInfoService.list(new QueryWrapper<PatientInfo>()
  773 + .lambda().eq(PatientInfo::getCid, chatgroup.getPcid()).last(" limit 1"));
  774 + if (CollectionUtils.isEmpty(patientInfos)) {
775 775 baseResponse.setErrorcode(1);
776 776 log.error("updateGroupStat回滚查询患者信息失败,{}",chatgroup);
777 777 throw new RuntimeException("回滚状态,执行失败,请联系管理员");
778 778 }
  779 + PatientInfo patientInfo = patientInfos.get(0);
779 780 LymsTkrecord tkrecord=new LymsTkrecord();
780 781 LymsTcard tcard = new LymsTcard();
781 782 tcard.setPid(patientInfo.getId());
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorController.java View file @ bbc2c94
... ... @@ -270,6 +270,25 @@
270 270 return BaseResponse.error("失败");
271 271 }
272 272  
  273 +
  274 + @PostMapping("/openid")
  275 + public BaseResponse getWxOpenId(@RequestBody LymsDoctor doctor){
  276 + try {
  277 + if(StringUtil.isNotEmpty(doctor.getCode())&& null!= doctor.getDid()){
  278 + String openid = WeiXinUtil.getWxOpenId(doctor.getCode());
  279 + if(StringUtil.isNotEmpty(openid)){
  280 + doctor.setOpenid(openid);
  281 + //更新到登录患者的gzopenid
  282 + lymsDoctorService.updateById(doctor);
  283 + return BaseResponse.ok();
  284 + }
  285 + }
  286 + } catch (Exception e) {
  287 + log.error("医生小程序获取openid异常",e);
  288 + }
  289 + return BaseResponse.error("失败");
  290 + }
  291 +
273 292 /**
274 293 * 统计医生信息
275 294 * @return
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/OrderController.java View file @ bbc2c94
... ... @@ -150,7 +150,7 @@
150 150  
151 151 LymsOrder updateOrder = new LymsOrder();
152 152 updateOrder.setId(lymsOrder.getId());
153   - updateOrder.setPayorderid(data.get("payId"));
  153 + updateOrder.setPayorderid(data.get("packageValue"));
154 154 //根据订单号更新支付订单号
155 155 lymsOrderService.updateById(updateOrder);
156 156 data.put("orderNo",orderNo);
... ... @@ -195,6 +195,25 @@
195 195 return BaseResponse.ok(orderListResponses);
196 196 }
197 197  
  198 +
  199 + /**
  200 + *
  201 + * @param authorization
  202 + * @return
  203 + */
  204 + @PostMapping("queryPatientsUnpayOrders")
  205 + @TokenRequired
  206 + public BaseResponse queryPatiensOrders(@RequestHeader String authorization){
  207 +
  208 + LymsPatient patient = lymsPatientService.getPatientByToken(authorization);
  209 + QueryWrapper<LymsOrder> queryWrapper = new QueryWrapper<>();
  210 + queryWrapper.eq("pid",patient.getId());
  211 + queryWrapper.eq("status",0);
  212 + queryWrapper.ge("createdtime",DateUtil.addDay(new Date(),-1));
  213 + List<LymsOrder> list = lymsOrderService.list(queryWrapper);
  214 + return BaseResponse.ok(list);
  215 + }
  216 +
198 217 @GetMapping("queryOrderLimit")
199 218 @TokenRequired
200 219 public BaseResponse queryOrderLimit(Integer pid,Integer pcid){
... ... @@ -355,7 +374,7 @@
355 374 order.setPayTime(new Date());
356 375 lymsOrderService.update(order, wrapper);
357 376 }else{
358   - result.put("return_code","SUCCESS>");
  377 + result.put("return_code","SUCCESS");
359 378 result.put("return_msg","OK");
360 379 outResult(response, XmlUtil.mapToXml(result));
361 380 log.info("已经处理过,重复通知!");
... ... @@ -366,7 +385,7 @@
366 385 boolean flag = lymsOrderService.handleOrder(lymsOrders,true);
367 386 if (flag)
368 387 {
369   - result.put("return_code","SUCCESS>");
  388 + result.put("return_code","SUCCESS");
370 389 result.put("return_msg","OK");
371 390 }
372 391 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java View file @ bbc2c94
... ... @@ -468,8 +468,8 @@
468 468 @TokenRequired
469 469 public BaseResponse queryPatient(PatientInfo patientInfo) {
470 470 BaseResponse baseResponse = new BaseResponse();
471   - PatientInfo patientInfo2 = patientInfoService.getOne(Wrappers.query(patientInfo));
472   - baseResponse.setObject(patientInfo2);
  471 + List<PatientInfo> patientInfos = patientInfoService.list(Wrappers.query(patientInfo));
  472 + baseResponse.setObject(patientInfos.get(0));
473 473 return baseResponse;
474 474 }
475 475 /**
... ... @@ -514,7 +514,7 @@
514 514 */
515 515 @GetMapping("getPatientHospitalPcase")
516 516 @TokenRequired
517   - public BaseResponse getPatientHospitalPcase(int pid, int hid,
  517 + public BaseResponse getPatientHospitalPcase(Integer pid, Integer hid,
518 518 @RequestParam(required = false) String keyword) {
519 519 BaseResponse baseResponse = new BaseResponse();
520 520 Map data = new HashMap(5);
521 521  
... ... @@ -523,9 +523,12 @@
523 523 data.put("patient", patient);
524 524  
525 525 //医院信息
526   - LymsHospital hospital = lymsHospitalService.getById(pid);
527   - data.put("hospital", hospital);
  526 + if(hid != null){
  527 + LymsHospital hospital = lymsHospitalService.getById(hid);
  528 + data.put("hospital", hospital);
  529 + }
528 530  
  531 +
529 532 List<Integer> ilist = new ArrayList<>();
530 533 if (StringUtil.isNotEmpty(keyword)) {
531 534 LambdaQueryWrapper<LymsIllness> iwrapper = new QueryWrapper().lambda();
... ... @@ -540,7 +543,10 @@
540 543 //查询患者的就诊记录
541 544 LambdaQueryWrapper<LymsPcase> wrapper = new QueryWrapper().lambda();
542 545 wrapper.eq(LymsPcase::getPid, pid);
543   - wrapper.eq(LymsPcase::getHid, hid);
  546 + if(hid != null){
  547 + wrapper.eq(LymsPcase::getHid, hid);
  548 + }
  549 +
544 550 if (StringUtil.isNotEmpty(keyword)) {
545 551 wrapper.and(i -> i.like(LymsPcase::getDname, keyword).or().like(LymsPcase::getDtname, keyword));
546 552 if (CollectionUtils.isNotEmpty(ilist)) {
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsHospital.java View file @ bbc2c94
... ... @@ -64,6 +64,13 @@
64 64 @TableField(value = "haddr")
65 65 private String haddr;
66 66  
  67 +
  68 + /**
  69 + * 医院问诊收费方式 1 平台收费 2 医院his收费
  70 + */
  71 + @TableField(value = "charge_way")
  72 + private Integer chargeWay;
  73 +
67 74 /**
68 75 * 创建人
69 76 */
talkonlineweb/src/main/java/com/lyms/talkonlineweb/enums/ChargeWay.java View file @ bbc2c94
  1 +package com.lyms.talkonlineweb.enums;
  2 +
  3 +import lombok.Getter;
  4 +
  5 +/**
  6 + *
  7 + */
  8 +@Getter
  9 +public enum ChargeWay {
  10 + PLATFORM(1, "平台收费"),
  11 + HIS(2, "医院his收费");
  12 +
  13 + private Integer code;
  14 + private String name;
  15 +
  16 + ChargeWay(Integer code, String name){
  17 + this.code = code;
  18 + this.name = name;
  19 + }
  20 +
  21 + public static String getName(Integer code) {
  22 + ChargeWay[] values = ChargeWay.values();
  23 + for (ChargeWay value : values) {
  24 + if (value.getCode().equals(code)) {
  25 + return value.getName();
  26 + }
  27 + }
  28 + return "";
  29 + }
  30 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsChatgroupMapper.java View file @ bbc2c94
... ... @@ -38,15 +38,17 @@
38 38 "pc.dtid," ,
39 39 "pc.dtname," ,
40 40 "d.dlogin," ,
41   - "i.iname, " ,
42   - "i.iid, " ,
43   - "i.createdtime " ,
  41 + "GROUP_CONCAT(i.iname) as iname, " ,
  42 + "GROUP_CONCAT(i.iid) as iid, " ,
  43 + "pc.createdtime " ,
44 44 "FROM " ,
45   - "(`lyms_illness` i " ,
46   - "left join `lyms_pcase` pc ON (pc.pcid = i.pcid) " ,
47   - "left join `lyms_patient` p ON (p.id = pc.pid) " ,
48   - "left join `lyms_doctor` d ON (d.did = pc.dtid)) " ,
49   - "${ew.customSqlSegment}",
  45 + "( ",
  46 + "`lyms_pcase` pc " ,
  47 + "left join `lyms_illness` i ON (pc.pcid = i.pcid) " ,
  48 + "left join `lyms_patient` p ON (pc.pid = p.id ) " ,
  49 + "left join `lyms_doctor` d ON (pc.dtid = d.did )) " ,
  50 + "${ew.customSqlSegment} ",
  51 + "group by pc.pcid ",
50 52 "</script>"})
51 53 // "WHERE " +
52 54 // "dtid=#{doctorId}")
talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/OrderListResponse.java View file @ bbc2c94
... ... @@ -13,6 +13,8 @@
13 13  
14 14 private String idno;
15 15  
  16 + private String phone;
  17 +
16 18 private String birth;
17 19  
18 20 private String orderno;
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java View file @ bbc2c94
... ... @@ -5,6 +5,7 @@
5 5 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
6 6 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 7 import com.lyms.talkonlineweb.domain.*;
  8 +import com.lyms.talkonlineweb.enums.ChargeWay;
8 9 import com.lyms.talkonlineweb.result.BaseResponse;
9 10 import com.lyms.talkonlineweb.result.Diagnose;
10 11 import com.lyms.talkonlineweb.service.*;
... ... @@ -37,6 +38,8 @@
37 38 @Autowired
38 39 private LymsPatientService lymsPatientService;//患者
39 40 @Autowired
  41 + private LymsHospitalService lymsHospitalService; //医院
  42 + @Autowired
40 43 private LymsHdepartService lymsHdepartService;//科室
41 44 @Autowired
42 45 private LymsDoctorService lymsDoctorService;//医生
43 46  
44 47  
45 48  
46 49  
47 50  
... ... @@ -203,23 +206,37 @@
203 206 queryWrapper.eq("pname",lymsHisInfo.getName());
204 207 queryWrapper.eq("enrolment_phone",lymsHisInfo.getPhone());
205 208 List<LymsPatient> list = lymsPatientService.list(queryWrapper);
206   - /*if(CollectionUtils.isNotEmpty(list)){
  209 + if(CollectionUtils.isNotEmpty(list)){
207 210 String idno = list.get(0).getIdno();
208   - //是否需要去查询订单 todo
209 211 lymsHisInfo.setIdcard(idno);
210 212 this.updateById(lymsHisInfo);
211   -
212 213 }else{
213 214 return "患者身份证号不存在,请等待患者注册补全身份证信息后再上传。";
214   - }*/
  215 + }
215 216  
216   - return "患者身份证号不存在,请等待患者注册补全身份证信息后再上传。";
  217 + //return "患者身份证号不存在,请等待患者注册补全身份证信息后再上传。";
217 218 //idCard=lymsHisInfo.getVccardno();
218 219 }
219 220 //判断患者是否存在
220 221 LymsPatient patientQuery = new LymsPatient();
221 222 patientQuery.setIdno(idCard.toLowerCase());
222 223 LymsPatient patient = lymsPatientService.getOne(Wrappers.query(patientQuery));
  224 +
  225 + //判断医院是否平台收费,是否存在订单
  226 + LymsHospital lymsHospital = lymsHospitalService.getById(Integer.valueOf(lymsHisInfo.getHospitalId()));
  227 + if(ChargeWay.PLATFORM.getCode()==lymsHospital.getChargeWay()){
  228 + QueryWrapper<LymsOrder> queryWrapper = new QueryWrapper<>();
  229 + queryWrapper.eq("pid",patient.getId());
  230 + queryWrapper.gt("status",0);
  231 + queryWrapper.gt("createdtime", DateUtil.addDay(new Date(),-2));
  232 + List<LymsOrder> list = lymsOrderService.list(queryWrapper);
  233 + if(CollectionUtils.isEmpty(list)){
  234 + return "患者还没有缴费,暂时不能上传";
  235 + }
  236 + }
  237 +
  238 +
  239 +
223 240 if (null != patient) {
224 241 QueryWrapper<LymsPcase> queryWrapper = new QueryWrapper<>();
225 242 queryWrapper.eq("pid", patient.getId());
226 243  
... ... @@ -244,13 +261,14 @@
244 261 }
245 262 //添加患者信息及病例
246 263 LymsPatient patient2 = new LymsPatient();
247   - LymsPcase pcase = new LymsPcase();
248 264 patient2.setPname(name);
249 265 patient2.setIdno(idCard);
250 266 patient2.setBirth(birthday);
251 267 patient2.setSex(sex);
252 268 patient2.setCcnt(0);
253 269 patient2.setCreatedby(1);
  270 +
  271 + LymsPcase pcase = new LymsPcase();
254 272 pcase.setMobile(phone);
255 273 pcase.setHid(Integer.valueOf(lymsHisInfo.getHospitalId()));
256 274 pcase.setHname(lymsHdeparts.getHname());
... ... @@ -272,6 +290,7 @@
272 290 }
273 291  
274 292 //添加修改患者方法
  293 + @Transactional
275 294 public BaseResponse saveOrUpdatePatient(LymsPatient patient, LymsPcase pcase, Map<String,Diagnose> diagnoseMap) {
276 295 BaseResponse baseResponse = new BaseResponse();
277 296 log.info(">>>>>>>>>>>>>>>登记病例");
278 297  
... ... @@ -294,14 +313,14 @@
294 313 patient.setOpenid(WeiXinUtil.getWxOpenId(patient.getCode()));
295 314 }
296 315 //his患者上传默认给4张问诊卡
297   - patient.setCcnt(Constant.CARD_COUNT_MONTH);
298   - boolean f = lymsPatientService.saveOrUpdate(patient);
  316 + //patient.setCcnt(Constant.CARD_COUNT_MONTH);
  317 + lymsPatientService.saveOrUpdate(patient);
299 318  
300 319 // 添加病例
301 320 pcase.setCreatedby(patient.getCreatedby());
302 321 pcase.setPid(patient.getId());
303 322 pcase.setCreatedtime(new Date());
304   - f = lymsPcaseService.saveOrUpdate(pcase);
  323 + boolean f = lymsPcaseService.saveOrUpdate(pcase);
305 324  
306 325  
307 326 log.info(patient);
308 327  
... ... @@ -341,8 +360,12 @@
341 360 List<LymsOrder> list = lymsOrderService.list(queryWrapper);
342 361  
343 362 if(CollectionUtils.isNotEmpty(list)){
344   - lymsOrderService.handleOrder(list.get(0),false);
  363 + LymsOrder lymsOrder = list.get(0);
  364 + lymsOrder.setPcid(pcase.getPcid());
  365 + lymsOrderService.handleOrder(lymsOrder,false);
345 366 }else{
  367 + patient.setCcnt(Constant.CARD_COUNT_MONTH);
  368 + lymsPatientService.saveOrUpdate(patient);
346 369 //不是通过订单生成的问诊卡
347 370 for (int i = 0; i < patient.getCcnt() && Objects.nonNull(patient.getCcnt()); i++) {
348 371 LymsTcard tcard = new LymsTcard();
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsOrderServiceImpl.java View file @ bbc2c94
... ... @@ -17,6 +17,7 @@
17 17 import com.lyms.talkonlineweb.result.OrderListResponse;
18 18 import com.lyms.talkonlineweb.service.LymsAttentionService;
19 19 import com.lyms.talkonlineweb.service.LymsOrderService;
  20 +import com.lyms.talkonlineweb.service.LymsTcardService;
20 21 import com.lyms.talkonlineweb.util.Constant;
21 22 import com.lyms.talkonlineweb.util.DateUtil;
22 23 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -39,7 +40,7 @@
39 40 private LymsPatientMapper lymsPatientMapper;
40 41  
41 42 @Resource
42   - private LymsTcardMapper lymsTcardMapper;
  43 + private LymsTcardService lymsTcardService;
43 44  
44 45 @Resource
45 46 private LymsOrderMapper lymsOrderMapper;
... ... @@ -47,7 +48,7 @@
47 48 @Override
48 49 @Transactional(rollbackFor = Exception.class)
49 50 public boolean handleOrder(LymsOrder lymsOrders,boolean isPayCallBack) {
50   - Date currentTime = new Date();
  51 + Date startDate = null;
51 52 //说明是
52 53 if (lymsOrders != null) {
53 54 LymsPatient patient = lymsPatientMapper.selectById(lymsOrders.getPid());
54 55  
... ... @@ -55,19 +56,37 @@
55 56 {
56 57 return false;
57 58 }
58   - lymsOrders.setStatus(PayStatus.SUCCESS.getCode());
59   - lymsOrders.setServiceStartTime(currentTime);
60   - lymsOrders.setServiceEndTime(DateUtil.addMonth(currentTime,lymsOrders.getCnt()));
61   - lymsOrders.setUpdatedtime(new Date());
62   - updateById(lymsOrders);
  59 +
  60 + //病例不为空 续费 查询问诊卡得
  61 + if(lymsOrders.getPcid() != null){
  62 + QueryWrapper<LymsTcard> query = new QueryWrapper<>();
  63 + query.eq("pid",patient.getId());
  64 + query.eq("pcid",lymsOrders.getPcid());
  65 + query.orderByDesc("end_time");
  66 + query.last(" limit 1");
  67 + LymsTcard one = lymsTcardService.getOne(query);
  68 + startDate = one != null && one.getEndTime() != null?
  69 + DateUtil.addDay(DateUtil.getYmdDate(one.getEndTime()),1) : new Date();
  70 + }
  71 +
  72 + startDate = startDate== null?new Date():startDate;
  73 + //支付回调
  74 + if(isPayCallBack){
  75 + lymsOrders.setStatus(PayStatus.SUCCESS.getCode());
  76 + lymsOrders.setServiceStartTime(startDate);
  77 + lymsOrders.setServiceEndTime(DateUtil.addMonth(startDate,lymsOrders.getCnt()));
  78 + lymsOrders.setUpdatedtime(new Date());
  79 + updateById(lymsOrders);
  80 + }
  81 +
63 82 //pcid不为空,说明是续期购买,直接生成生成问诊卡 或者his上传
64 83 if(lymsOrders.getPcid() != null || !isPayCallBack){
65 84  
66 85 //数量代表购买几个月
67 86 int months = lymsOrders.getCnt();
68 87 for(int j = 0 ;j < months ; j++){
69   - Date startTime = DateUtil.addMonth(currentTime,j);
70   - Date endTime = DateUtil.addMonth(currentTime,j+1);
  88 + Date startTime = DateUtil.addMonth(startDate,j);
  89 + Date endTime = DateUtil.addMonth(startDate,j+1);
71 90 for (int i = 0; i < Constant.CARD_COUNT_MONTH; i++)
72 91 {
73 92 LymsTcard tcard = new LymsTcard();
... ... @@ -78,8 +97,8 @@
78 97 tcard.setEndTime(endTime);
79 98 tcard.setOrderNo(lymsOrders.getOrderno());
80 99 tcard.setPrice(lymsOrders.getPrice());
81   - tcard.setCreatedtime(currentTime);
82   - lymsTcardMapper.insert(tcard);
  100 + tcard.setCreatedtime(new Date());
  101 + lymsTcardService.save(tcard);
83 102 }
84 103 }
85 104 //更新患者的卡的数量,患者信息上的问诊卡数量其实没啥意义了
talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/AutoEndChatTask.java View file @ bbc2c94
... ... @@ -6,6 +6,7 @@
6 6 import com.lyms.talkonlineweb.domain.LymsTkrecord;
7 7 import com.lyms.talkonlineweb.service.LymsChatgroupService;
8 8 import com.lyms.talkonlineweb.service.LymsTkrecordService;
  9 +import com.lyms.talkonlineweb.util.DateUtil;
9 10 import lombok.extern.log4j.Log4j2;
10 11 import org.springframework.beans.factory.annotation.Autowired;
11 12 import org.springframework.scheduling.annotation.Scheduled;
... ... @@ -29,7 +30,7 @@
29 30 private LymsChatgroupService lymsChatgroupService;
30 31  
31 32 @Scheduled(cron = "0 59 23 * * ?")
32   - public void PushIllnessTypeData(){
  33 + public void autoEndChatTask(){
33 34  
34 35 log.info("自动结束聊天任务开始>>>>>>>>>>auto end chart");
35 36 LymsTkrecord tkrecord = new LymsTkrecord();
... ... @@ -72,6 +73,35 @@
72 73 }
73 74  
74 75 }
  76 +
  77 + }
  78 +
  79 +
  80 + @Scheduled(cron = "0 1 1 * * ?")
  81 + public void autoEndDoctorChatTask(){
  82 + log.info("自动结束医生回访聊天组任务开始...");
  83 + QueryWrapper<LymsChatgroup> queryWrapper = new QueryWrapper<>();
  84 + queryWrapper.eq("type",1);
  85 + queryWrapper.eq("stat",0);
  86 + queryWrapper.eq("yn",1);
  87 + List<LymsChatgroup> hxGroupList = lymsChatgroupService.list(queryWrapper);
  88 + log.info("自动结束医生回访聊天组任,size={}",hxGroupList.size());
  89 + for(int i = 0; i < hxGroupList.size(); i++){
  90 + LymsChatgroup lymsChatgroup = hxGroupList.get(i);
  91 + if(lymsChatgroup.getCtime().getTime() > DateUtil.addDay(new Date() ,-3).getTime()){
  92 + log.info("3天前的任务,需结束,{}",lymsChatgroup);
  93 + lymsChatgroup.setStat(1);
  94 + try{
  95 + lymsChatgroupService.updateById(lymsChatgroup);
  96 + }catch (Exception e){
  97 + log.error("自动结束聊天组异常",e);
  98 + }
  99 + }
  100 +
  101 +
  102 + }
  103 +
  104 + log.info("自动结束医生回访聊天组任务结束...");
75 105  
76 106 }
77 107  
talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/DoctorMsgNotifyTask.java View file @ bbc2c94
... ... @@ -43,24 +43,24 @@
43 43 List<DoctorChatCount> doctorChatCounts = doctorWorktimeService.selectDoctorChatCount(startTime);
44 44 int size = doctorChatCounts.size();
45 45 log.info("医生消息提醒,数量:{}",size);
46   - for(DoctorChatCount doctorChatCount: doctorChatCounts) {
47   - if(StringUtil.isEmpty(doctorChatCount.getGzopenid())){
48   - log.warn("医生消息提醒,未获取到公众号openid:{}",doctorChatCount);
  46 + for(DoctorChatCount doctor: doctorChatCounts) {
  47 + if(StringUtil.isEmpty(doctor.getGzopenid())){
  48 + log.warn("医生消息提醒,未获取到公众号openid:{}",doctor);
49 49 continue;
50 50 }
51 51 Map<String,Object> mapTemplate=new HashMap<>();
52 52 mapTemplate.put("first","医生消息提醒");
53   - mapTemplate.put("keyword1","尊敬的医生:"+doctorChatCount.getDname());
54   - mapTemplate.put("keyword2","您有患者消息"+doctorChatCount.getCount()+"条,请及时查看");
  53 + mapTemplate.put("keyword1","尊敬的医生:"+doctor.getDname());
  54 + mapTemplate.put("keyword2","您有患者消息"+doctor.getCount()+"条,请及时查看");
55 55 mapTemplate.put("remark","请点击下方进入小程序,根据病例点咨询查看医生回访信息。");
56 56 Map<String,Object> map=new HashMap<>();
57   - map.put("plogin", doctorChatCount.getDlogin());
58   - map.put("passwd", doctorChatCount.getDpasswd());
  57 + map.put("plogin", doctor.getDlogin());
  58 + map.put("passwd", doctor.getDpasswd());
59 59 try {
60   - Integer code= WeiXinUtil.DoctorSendWeChatMsg(doctorChatCount.getGzopenid(), Constant.GZ_TEMPLATE_ID_DOCTOR_VISIT,mapTemplate,map);
61   - log.info("医生消息提醒,code:{},{}",code,doctorChatCount);
  60 + Integer code= WeiXinUtil.DoctorSendWeChatMsg(doctor.getGzopenid(), Constant.GZ_TEMPLATE_ID_DOCTOR_VISIT,mapTemplate,map);
  61 + log.info("医生消息提醒,code:{},{}",code,doctor);
62 62 } catch (Exception e) {
63   - log.error("医生消息提醒异常,{}",doctorChatCount,e);
  63 + log.error("医生消息提醒异常,{}",doctor,e);
64 64 }
65 65  
66 66 }
talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/HisPatientsAutoUploadTask.java View file @ bbc2c94
  1 +package com.lyms.talkonlineweb.task;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4 +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  5 +import com.lyms.talkonlineweb.domain.LymsHisInfo;
  6 +import com.lyms.talkonlineweb.domain.LymsHospital;
  7 +import com.lyms.talkonlineweb.domain.LymsOrder;
  8 +import com.lyms.talkonlineweb.enums.ChargeWay;
  9 +import com.lyms.talkonlineweb.service.LymsHisInfoService;
  10 +import com.lyms.talkonlineweb.service.LymsHospitalService;
  11 +import com.lyms.talkonlineweb.util.DateUtil;
  12 +import com.lyms.talkonlineweb.util.StringUtil;
  13 +import lombok.extern.log4j.Log4j2;
  14 +import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.beans.factory.annotation.Value;
  16 +import org.springframework.scheduling.annotation.Scheduled;
  17 +import org.springframework.stereotype.Component;
  18 +
  19 +import java.util.Date;
  20 +import java.util.HashMap;
  21 +import java.util.List;
  22 +import java.util.Map;
  23 +
  24 +/**
  25 + * his患者信息自动上传功能
  26 + */
  27 +@Component
  28 +@Log4j2
  29 +public class HisPatientsAutoUploadTask {
  30 +
  31 + @Value("${getAccessToken.on_off}")
  32 + public boolean on_off;//配置yml 微信公众号获取access_token(测试环境部署不要开启。会与线上环境冲突)
  33 +
  34 + @Autowired
  35 + private LymsHisInfoService lymsHisInfoService;
  36 +
  37 + @Autowired
  38 + private LymsHospitalService lymsHospitalService; //医院
  39 +
  40 + @Scheduled(cron = "0 0 13,21 * * ?")
  41 + public void autoEndChatTask(){
  42 + if(!on_off){
  43 + return;
  44 + }
  45 + log.info("his患者信息自动上传任务开始...");
  46 + //查询3天内未上传的数据
  47 + LambdaQueryWrapper<LymsHisInfo> query = new QueryWrapper<LymsHisInfo>()
  48 + .lambda().eq(LymsHisInfo::getUpType, 0)
  49 + .ge(LymsHisInfo::getCreatedtime, DateUtil.addDay(new Date(),-3));
  50 + List<LymsHisInfo> list = lymsHisInfoService.list(query);
  51 + log.info("his患者信息自动上传任务,size={}",list.size());
  52 + for(LymsHisInfo hisInfo : list){
  53 + try{
  54 + String result = lymsHisInfoService.upHisInfo(hisInfo);
  55 + if(StringUtil.isNotEmpty(result)){
  56 + log.error("his患者上传失败,result={},info={}",result,hisInfo);
  57 + }
  58 +
  59 + }catch (Exception e){
  60 + log.error("his患者信息自动上传任务异常",e);
  61 + }
  62 + }
  63 +
  64 + log.info("his患者信息自动上传任务结束...");
  65 +
  66 +
  67 + }
  68 +}
talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/WeiXinUtil.java View file @ bbc2c94
... ... @@ -145,15 +145,10 @@
145 145 miniprogram.put("appid",Constant.DOCTOR_APP_ID);
146 146 //登录数据
147 147 if(CollectionUtils.isNotEmpty(mapInfo) && null!=mapInfo.get("plogin") && null!=mapInfo.get("passwd")){
148   - if(null==mapInfo.get("type") || 1==(int) mapInfo.get("type")) {//null是正常推送状态。 1有值是亲属关注时的状态 2没有病例的时候
149   - miniprogram.put("pagepath", "pages/news/news?plogin=" + mapInfo.get("plogin") + "&passwd=" + mapInfo.get("passwd"));// 注意,这里是支持传参的!!!
150   - }else {
151   - miniprogram.put("pagepath","pages/concernList/concernList?plogin="+mapInfo.get("plogin")+"&passwd="+mapInfo.get("passwd"));// 没有病例跳转地址
152   - }
153   -
  148 + miniprogram.put("pagepath","pages/talkOnline/talkOnline?plogin="+mapInfo.get("plogin")+"&passwd="+mapInfo.get("passwd"));
154 149 }else {
155 150 //意外情况自行登录
156   - miniprogram.put("pagepath","pages/enroll/enroll");// 注意,这里是支持传参的!!!
  151 + miniprogram.put("pagepath","pages/login/login");// 注意,这里是支持传参的!!!
157 152 }
158 153 paramMap.put("miniprogram", miniprogram);
159 154 paramMap.put("data", dataMap);
talkonlineweb/src/main/resources/mapper/LymsHospitalMapper.xml View file @ bbc2c94
... ... @@ -13,6 +13,7 @@
13 13 <result property="city" column="city" jdbcType="INTEGER"/>
14 14 <result property="regin" column="regin" jdbcType="INTEGER"/>
15 15 <result property="haddr" column="haddr" jdbcType="VARCHAR"/>
  16 + <result property="chargeWay" column="charge_way" jdbcType="INTEGER"/>
16 17 <result property="createdby" column="createdby" jdbcType="INTEGER"/>
17 18 <result property="createdtime" column="createdtime" jdbcType="TIMESTAMP"/>
18 19 <result property="updatedby" column="updatedby" jdbcType="INTEGER"/>
... ... @@ -22,8 +23,8 @@
22 23 <sql id="Base_Column_List">
23 24 hid,hname,hlevel,
24 25 htype,prov,city,
25   - regin,haddr,createdby,
26   - createdtime,updatedby,updatedtime
  26 + regin,haddr,charge_way,
  27 + createdby,createdtime,updatedby,updatedtime
27 28 </sql>
28 29 </mapper>
talkonlineweb/src/main/resources/mapper/LymsOrderMapper.xml View file @ bbc2c94
... ... @@ -37,6 +37,7 @@
37 37 p.sex,
38 38 p.birth,
39 39 p.idno,
  40 + p.enrolment_phone as phone,
40 41 o.orderno,
41 42 o.pay_time as payTime,
42 43 goods.name as goodName,
talkonlineweb/src/main/resources/mapper/LymsTcardMapper.xml View file @ bbc2c94
... ... @@ -10,6 +10,9 @@
10 10 <result property="fid" column="fid" jdbcType="INTEGER"/>
11 11 <result property="cnt" column="cnt" jdbcType="INTEGER"/>
12 12 <result property="price" column="price" jdbcType="INTEGER"/>
  13 + <result property="startTime" column="start_time" jdbcType="TIMESTAMP"/>
  14 + <result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
  15 + <result property="orderNo" column="order_no" jdbcType="TIMESTAMP"/>
13 16 <result property="createdby" column="createdby" jdbcType="INTEGER"/>
14 17 <result property="createdtime" column="createdtime" jdbcType="TIMESTAMP"/>
15 18 <result property="updatedby" column="updatedby" jdbcType="INTEGER"/>
16 19  
... ... @@ -17,13 +20,12 @@
17 20 </resultMap>
18 21  
19 22 <sql id="Base_Column_List">
20   - id,pid,fid,
21   - cnt,price,createdby,
22   - createdtime,updatedby,updated_time
  23 + id,pid,fid,cnt,price,
  24 + start_time,end_time,order_no,
  25 + createdby,createdtime,updatedby,updated_time
23 26 </sql>
24 27  
25 28 <select id="queryUnused" parameterType="com.lyms.talkonlineweb.domain.LymsTcard" resultMap="BaseResultMap">
26   -
27 29 select
28 30 <include refid="Base_Column_List"></include>
29 31 from lyms_tcard card