Commit 01054ed761beab7feabd4053e95f6c86cb95b533
1 parent
5714942e99
Exists in
dev
#fix 新增服务推送、一键上传接口,优化问诊卡消耗的bug等
Showing 18 changed files with 538 additions and 128 deletions
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ChatGroupController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/LymsHisInfoController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PushMessageController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/TkRecordController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsHisInfo.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPushMessage.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsPushMessageMapper.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/PushOrderResult.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsHisInfoService.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsPushMessageService.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsPushMessageServiceImpl.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/HisPatientsAutoUploadTask.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/ServiceContentTask.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/Constant.java
- talkonlineweb/src/main/resources/mapper/LymsOrderMapper.xml
- talkonlineweb/src/main/resources/mapper/LymsTcardMapper.xml
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ChatGroupController.java
View file @
01054ed
| ... | ... | @@ -274,6 +274,10 @@ |
| 274 | 274 | tkrecord.setId((Integer) tmpList.get(0).get("rid")); |
| 275 | 275 | tkrecord.setStat(0); |
| 276 | 276 | lymsTkrecordService.updateById(tkrecord); |
| 277 | + if (chatgroup.getId()!=null){ | |
| 278 | + chatgroup.setStat(0); | |
| 279 | + lymsChatgroupService.updateById(chatgroup); | |
| 280 | + } | |
| 277 | 281 | tmpList.get(0).put("stat", 0); |
| 278 | 282 | rs.put("sess", tmpList.get(0)); |
| 279 | 283 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/LymsHisInfoController.java
View file @
01054ed
| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 5 | 5 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 6 | 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| 7 | +import com.lyms.talkonlineweb.annotation.Resubmit; | |
| 7 | 8 | import com.lyms.talkonlineweb.annotation.TokenRequired; |
| 8 | 9 | import com.lyms.talkonlineweb.domain.LymsDict; |
| 9 | 10 | import com.lyms.talkonlineweb.domain.LymsHisInfo; |
| ... | ... | @@ -94,7 +95,21 @@ |
| 94 | 95 | } |
| 95 | 96 | return baseResponse; |
| 96 | 97 | } |
| 97 | - | |
| 98 | + /** | |
| 99 | + * 一键上传his患者信息 | |
| 100 | + * @param | |
| 101 | + * @return | |
| 102 | + */ | |
| 103 | + @PostMapping("upAllHisInfo") | |
| 104 | + @TokenRequired | |
| 105 | + @Resubmit | |
| 106 | + public BaseResponse upAllHisInfo(){ | |
| 107 | + BaseResponse baseResponse=new BaseResponse(); | |
| 108 | + baseResponse.setErrorcode(0); | |
| 109 | + baseResponse.setErrormsg("一键上传成功"); | |
| 110 | + lymsHisInfoService.upAllHisInfo(); | |
| 111 | + return baseResponse; | |
| 112 | + } | |
| 98 | 113 | /** |
| 99 | 114 | * 修改his医院患者身份证号码 |
| 100 | 115 | * @param hisInfo |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java
View file @
01054ed
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 9 | 9 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| 10 | 10 | import com.baomidou.mybatisplus.extension.service.IService; |
| 11 | +import com.google.common.base.Strings; | |
| 11 | 12 | import com.lyms.talkonlineweb.annotation.TokenRequired; |
| 12 | 13 | import com.lyms.talkonlineweb.domain.*; |
| 13 | 14 | import com.lyms.talkonlineweb.request.PatientInfoRequest; |
| ... | ... | @@ -20,6 +21,7 @@ |
| 20 | 21 | import lombok.extern.log4j.Log4j2; |
| 21 | 22 | import org.apache.ibatis.annotations.Delete; |
| 22 | 23 | import org.springframework.beans.factory.annotation.Autowired; |
| 24 | +import org.springframework.beans.factory.annotation.Value; | |
| 23 | 25 | import org.springframework.util.DigestUtils; |
| 24 | 26 | import org.springframework.util.StringUtils; |
| 25 | 27 | import org.springframework.validation.BindingResult; |
| ... | ... | @@ -1444,6 +1446,30 @@ |
| 1444 | 1446 | patient.setPpasswd(DigestUtils.md5DigestAsHex(Constant.COMMON_PASSWD.getBytes())); |
| 1445 | 1447 | boolean save = lymsPatientService.save(patient); |
| 1446 | 1448 | return BaseResponse.ok(); |
| 1449 | + } | |
| 1450 | + /** | |
| 1451 | + * 孕产婴平台地址 | |
| 1452 | + */ | |
| 1453 | + @Value("${platform.url}") | |
| 1454 | + private String platformUrl; | |
| 1455 | + | |
| 1456 | + @GetMapping("/getLastMenses/{idNo}") | |
| 1457 | + @TokenRequired | |
| 1458 | + public BaseResponse getLastMenses(@PathVariable("idNo") String idNo){ | |
| 1459 | + BaseResponse baseResponse=new BaseResponse(); | |
| 1460 | + baseResponse.setErrorcode(0); | |
| 1461 | + baseResponse.setErrormsg("成功"); | |
| 1462 | + try { | |
| 1463 | + String result= HttpUtil.getData(platformUrl+Constant.PLATFORM_LASTMENSES_URL+"?idNo="+idNo); | |
| 1464 | + //log.info("getLastMenses->?result,"+result); | |
| 1465 | + if (!Strings.isNullOrEmpty(result)){ | |
| 1466 | + JSONObject json= JSONObject.parseObject(result); | |
| 1467 | + baseResponse.setObject(json.getInteger("object")); | |
| 1468 | + } | |
| 1469 | + }catch (Exception e){ | |
| 1470 | + log.error("Exception--->"+e.getMessage()); | |
| 1471 | + } | |
| 1472 | + return baseResponse; | |
| 1447 | 1473 | } |
| 1448 | 1474 | |
| 1449 | 1475 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PushMessageController.java
View file @
01054ed
| 1 | +package com.lyms.talkonlineweb.controller; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
| 4 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
| 5 | +import com.lyms.talkonlineweb.annotation.TokenRequired; | |
| 6 | +import com.lyms.talkonlineweb.domain.LymsPushMessage; | |
| 7 | +import com.lyms.talkonlineweb.result.BaseResponse; | |
| 8 | +import com.lyms.talkonlineweb.service.LymsPushMessageService; | |
| 9 | +import com.lyms.talkonlineweb.util.StringUtil; | |
| 10 | +import lombok.RequiredArgsConstructor; | |
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 12 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 13 | +import org.springframework.web.bind.annotation.PathVariable; | |
| 14 | +import org.springframework.web.bind.annotation.RestController; | |
| 15 | + | |
| 16 | +import java.util.ArrayList; | |
| 17 | +import java.util.List; | |
| 18 | + | |
| 19 | +@RestController | |
| 20 | +@RequiredArgsConstructor(onConstructor =@_(@Autowired)) | |
| 21 | +public class PushMessageController { | |
| 22 | + | |
| 23 | + private final LymsPushMessageService lymsPushMessageService; | |
| 24 | + | |
| 25 | + @GetMapping("getPushMessage/{messageType}") | |
| 26 | + @TokenRequired | |
| 27 | + public BaseResponse getAllPerm(@PathVariable("messageType") Integer messageType | |
| 28 | + ,String diagnose,Integer type,Integer status,String cid,Integer isRead | |
| 29 | + ,String startTime,String endTime,int current,int size){ | |
| 30 | + if (messageType==null){ | |
| 31 | + return BaseResponse.error("推送类型不能为空"); | |
| 32 | + } | |
| 33 | + QueryWrapper<LymsPushMessage> queryWrapper=new QueryWrapper<>(); | |
| 34 | + List<Integer> list=new ArrayList<>(); | |
| 35 | + list.add(messageType); | |
| 36 | + list.add(3); | |
| 37 | + queryWrapper.in("message_type",list); | |
| 38 | + if (cid!=null){ | |
| 39 | + queryWrapper.eq("cid",cid); | |
| 40 | + } | |
| 41 | + if (StringUtil.isNotEmpty(diagnose)){ | |
| 42 | + queryWrapper.eq("diagnose",diagnose); | |
| 43 | + } | |
| 44 | + if (StringUtil.isNotEmpty(startTime)&&StringUtil.isNotEmpty(endTime)){ | |
| 45 | + queryWrapper.ge("push_time",startTime).le("push_time",endTime); | |
| 46 | + } | |
| 47 | + if (type!=null){ | |
| 48 | + queryWrapper.eq("type",type); | |
| 49 | + } | |
| 50 | + if (status!=null){ | |
| 51 | + queryWrapper.eq("status",status); | |
| 52 | + } | |
| 53 | + if (isRead!=null){ | |
| 54 | + queryWrapper.eq("is_read",isRead); | |
| 55 | + } | |
| 56 | + Page<LymsPushMessage> page=new Page<>(current,size); | |
| 57 | + page=lymsPushMessageService.page(page,queryWrapper); | |
| 58 | + return BaseResponse.ok(page); | |
| 59 | + } | |
| 60 | + @GetMapping("readMessage/{id}") | |
| 61 | + @TokenRequired | |
| 62 | + public BaseResponse isRead(@PathVariable("id") Integer id){ | |
| 63 | + LymsPushMessage lymsPushMessage= lymsPushMessageService.getById(id); | |
| 64 | + if (lymsPushMessage==null){ | |
| 65 | + return BaseResponse.error("数据异常"); | |
| 66 | + } | |
| 67 | + lymsPushMessage.setIsRead(1); | |
| 68 | + lymsPushMessageService.updateById(lymsPushMessage); | |
| 69 | + return BaseResponse.ok(); | |
| 70 | + } | |
| 71 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/TkRecordController.java
View file @
01054ed
| ... | ... | @@ -9,6 +9,7 @@ |
| 9 | 9 | import com.lyms.talkonlineweb.result.BaseResponse; |
| 10 | 10 | import com.lyms.talkonlineweb.service.*; |
| 11 | 11 | import com.lyms.talkonlineweb.util.Constant; |
| 12 | +import com.lyms.talkonlineweb.util.DateUtil; | |
| 12 | 13 | import com.lyms.talkonlineweb.util.HXService; |
| 13 | 14 | import com.lyms.talkonlineweb.util.StringUtil; |
| 14 | 15 | import lombok.extern.log4j.Log4j2; |
| ... | ... | @@ -20,6 +21,7 @@ |
| 20 | 21 | |
| 21 | 22 | import java.util.ArrayList; |
| 22 | 23 | import java.util.Arrays; |
| 24 | +import java.util.Date; | |
| 23 | 25 | import java.util.List; |
| 24 | 26 | |
| 25 | 27 | @RestController |
| ... | ... | @@ -225,6 +227,7 @@ |
| 225 | 227 | try { |
| 226 | 228 | LymsTcard card = new LymsTcard(); |
| 227 | 229 | card.setPcid(pcid); |
| 230 | + card.setOrderNo(DateUtil.getDateTime(new Date(),DateUtil.YYYY_MM_DD_HH_MM_SS)); | |
| 228 | 231 | Integer count = lymsTcardService.queryUnusedCount(card); |
| 229 | 232 | baseResponse.setObject(count == null ? 0 : count); |
| 230 | 233 | baseResponse.setErrormsg("成功"); |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsHisInfo.java
View file @
01054ed
| ... | ... | @@ -93,7 +93,7 @@ |
| 93 | 93 | private String hospitalId; |
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | - * 上传问诊平台状态。0:未上传 1:已上传 | |
| 96 | + * 上传问诊平台状态。0:未上传 1:已上传 2:上传失败 | |
| 97 | 97 | */ |
| 98 | 98 | @TableField(value = "up_type") |
| 99 | 99 | @NotNull(message = "upType不能为空") |
| ... | ... | @@ -120,6 +120,11 @@ |
| 120 | 120 | @TableField(value = "created") |
| 121 | 121 | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| 122 | 122 | private Date created; |
| 123 | + /** | |
| 124 | + * 失败原因 | |
| 125 | + */ | |
| 126 | + @TableField(value = "remark") | |
| 127 | + private String remark; | |
| 123 | 128 | |
| 124 | 129 | /** |
| 125 | 130 | * 筛选开始时间 |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPushMessage.java
View file @
01054ed
| 1 | +package com.lyms.talkonlineweb.domain; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.annotation.IdType; | |
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 7 | +import lombok.Data; | |
| 8 | + | |
| 9 | +import java.io.Serializable; | |
| 10 | +import java.util.Date; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 服务推送记录 | |
| 14 | + * @TableName lyms_push_message | |
| 15 | + */ | |
| 16 | +@TableName(value ="lyms_push_message") | |
| 17 | +@Data | |
| 18 | +public class LymsPushMessage implements Serializable { | |
| 19 | + /** | |
| 20 | + *ID | |
| 21 | + */ | |
| 22 | + @TableId(value = "id", type = IdType.AUTO) | |
| 23 | + private Integer id; | |
| 24 | + /** | |
| 25 | + * 推送类型 1:问诊 2:公众号 3:全部 | |
| 26 | + */ | |
| 27 | + @TableField(value = "message_type") | |
| 28 | + private Integer messageType; | |
| 29 | + @TableField(value = "title") | |
| 30 | + private String title; | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 医院名称 | |
| 34 | + */ | |
| 35 | + @TableField(value = "hospital") | |
| 36 | + private String hospital; | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 科室 | |
| 40 | + */ | |
| 41 | + @TableField(value = "dept") | |
| 42 | + private String dept; | |
| 43 | + | |
| 44 | + /** | |
| 45 | + * 患者名称 | |
| 46 | + */ | |
| 47 | + @TableField(value = "name") | |
| 48 | + private String name; | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * 患者身份证号码 | |
| 54 | + */ | |
| 55 | + @TableField(value = "idno") | |
| 56 | + private String idno; | |
| 57 | + | |
| 58 | + /** | |
| 59 | + * 疾病 | |
| 60 | + */ | |
| 61 | + @TableField(value = "diagnose") | |
| 62 | + private String diagnose; | |
| 63 | + /** | |
| 64 | + * 病例ID | |
| 65 | + */ | |
| 66 | + @TableField(value = "cid") | |
| 67 | + private int cid; | |
| 68 | + /** | |
| 69 | + * 类型 0:上传推送 1:7日推送 2:14日推送 | |
| 70 | + */ | |
| 71 | + @TableField(value = "type") | |
| 72 | + private int type; | |
| 73 | + /** | |
| 74 | + * 推送类型 1为服务内容推送 | |
| 75 | + */ | |
| 76 | + @TableField(value = "push_type") | |
| 77 | + private int pushType; | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * 1已读 0未读 | |
| 81 | + */ | |
| 82 | + @TableField(value = "is_read") | |
| 83 | + private int isRead; | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * 推送时间 | |
| 87 | + */ | |
| 88 | + @TableField(value = "push_time") | |
| 89 | + private Date pushTime; | |
| 90 | + /** | |
| 91 | + * 推送状态 1:成功 0:失败 | |
| 92 | + */ | |
| 93 | + @TableField(value = "status") | |
| 94 | + private int status; | |
| 95 | + | |
| 96 | + /** | |
| 97 | + * 备注 | |
| 98 | + */ | |
| 99 | + @TableField(value = "remark") | |
| 100 | + private String remark; | |
| 101 | + | |
| 102 | + /** | |
| 103 | + * 创建时间 | |
| 104 | + */ | |
| 105 | + @TableField(value = "created_time") | |
| 106 | + private Date createdTime; | |
| 107 | + | |
| 108 | + @TableField(exist = false) | |
| 109 | + private static final long serialVersionUID = 1L; | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsPushMessageMapper.java
View file @
01054ed
talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/PushOrderResult.java
View file @
01054ed
| ... | ... | @@ -2,6 +2,8 @@ |
| 2 | 2 | |
| 3 | 3 | import lombok.Data; |
| 4 | 4 | |
| 5 | +import java.util.Date; | |
| 6 | + | |
| 5 | 7 | @Data |
| 6 | 8 | public class PushOrderResult { |
| 7 | 9 | private Integer id; |
| ... | ... | @@ -10,5 +12,9 @@ |
| 10 | 12 | private String dname; |
| 11 | 13 | private String hname; |
| 12 | 14 | private String pname; |
| 15 | + private String idno; | |
| 16 | + private Date service_start_time; | |
| 17 | + private String iname; | |
| 18 | + private Integer cid; | |
| 13 | 19 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsHisInfoService.java
View file @
01054ed
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsPushMessageService.java
View file @
01054ed
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java
View file @
01054ed
| 1 | 1 | package com.lyms.talkonlineweb.service.impl; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
| 3 | 4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 4 | 5 | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| 5 | 6 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 6 | 7 | |
| 7 | 8 | |
| 8 | 9 | |
| 9 | 10 | |
| 10 | 11 | |
| ... | ... | @@ -56,74 +57,124 @@ |
| 56 | 57 | private LymsOrderService lymsOrderService; |
| 57 | 58 | @Autowired |
| 58 | 59 | private LymsUserService lymsUserService; |
| 60 | + @Autowired | |
| 61 | + private ArticleInfoService articleInfoService; | |
| 62 | + @Autowired | |
| 63 | + private LymsChatInfoService lymsChatInfoService; | |
| 64 | + @Autowired | |
| 65 | + private LymsPushMessageService lymsPushMessageService; | |
| 59 | 66 | |
| 60 | 67 | |
| 61 | 68 | @Override |
| 62 | 69 | @Transactional(rollbackFor = {Exception.class,RuntimeException.class}) |
| 63 | 70 | public String upHisInfo(LymsHisInfo lymsHisInfo) throws Exception,RuntimeException { |
| 64 | 71 | String result=collateData(lymsHisInfo); |
| 72 | + Integer type; | |
| 65 | 73 | if(StringUtil.isEmpty(result)){ |
| 66 | - lymsHisInfo.setUpType(1); | |
| 74 | + type=1; | |
| 67 | 75 | lymsHisInfo.setUpTime(new Date()); |
| 68 | - boolean b = updateById(lymsHisInfo); | |
| 69 | - if(!b){ | |
| 70 | - //这里想触发事务回滚需抛运行时异常 | |
| 71 | - throw new Exception("更新HIS患者信息返回值失败状态!"); | |
| 72 | - } | |
| 73 | - new Thread(new Runnable() { | |
| 74 | - @Override | |
| 75 | - public void run() { | |
| 76 | - try { | |
| 77 | - Thread.sleep(5000); | |
| 78 | - LymsPatient patient =null; | |
| 79 | - String idCard = lymsHisInfo.getIdcard(); | |
| 80 | - if (StringUtil.isEmpty(idCard)) { | |
| 81 | - QueryWrapper<LymsPatient> queryWrapper = new QueryWrapper<>(); | |
| 82 | - queryWrapper.eq("pname",lymsHisInfo.getName()); | |
| 83 | - queryWrapper.eq("enrolment_phone",lymsHisInfo.getPhone()); | |
| 84 | - List<LymsPatient> list = lymsPatientService.list(queryWrapper); | |
| 85 | - if(CollectionUtils.isNotEmpty(list)){ | |
| 86 | - patient=list.get(0); | |
| 87 | - } | |
| 88 | - }else { | |
| 89 | - //判断患者是否存在 | |
| 90 | - LymsPatient patientQuery = new LymsPatient(); | |
| 91 | - patientQuery.setIdno(idCard.toLowerCase()); | |
| 92 | - patient = lymsPatientService.getOne(Wrappers.query(patientQuery)); | |
| 93 | - } | |
| 94 | - if (patient!=null){ | |
| 95 | - List<PushOrderResult> orderList= lymsOrderService.selectPushOrder(patient.getId()); | |
| 96 | - log.info("SendWeChatMsg--->orderList,"+orderList.toString()); | |
| 97 | - if (CollectionUtils.isNotEmpty(orderList)){ | |
| 98 | - PushOrderResult order= orderList.get(0); | |
| 99 | - //推送微信公众号 | |
| 100 | - Map<String,Object> map=new HashMap<>(); | |
| 101 | - map.put("keyword1",new DataEntity(order.getPname(),"#173177")); | |
| 102 | - map.put("keyword2",new DataEntity(order.getHname(),"#173177")); | |
| 103 | - map.put("keyword3",new DataEntity(order.getDname()+"【点击此提醒可查看服务具体内容】","#173177")); | |
| 104 | - | |
| 105 | - //公众号跳转小程序需要的登录信息 | |
| 106 | - Map<String,Object> mapInfo =lymsUserService.pLoginInfo(order.getPid(),3); | |
| 107 | - try { | |
| 108 | - log.info("SendWeChatMsg--->startup"); | |
| 109 | - Integer code= WeiXinUtil.SendWeChatMsg(order.getGzopenid(),Constant.GZ_TEMPLATE_ID,map,mapInfo); | |
| 110 | - log.info("SendWeChatMsg--->code, "+code); | |
| 111 | - } catch (Exception e) { | |
| 112 | - log.error("serviceContent Exception,"+e.getMessage()); | |
| 113 | - } | |
| 114 | - } | |
| 115 | - } | |
| 116 | - }catch (Exception e){ | |
| 117 | - log.error("upHisInfo---> Thread Exception"+e.getMessage()); | |
| 118 | - } | |
| 119 | - } | |
| 120 | - }).start(); | |
| 121 | - | |
| 76 | + }else { | |
| 77 | + type=2; | |
| 122 | 78 | } |
| 79 | + lymsHisInfo.setUpType(type); | |
| 80 | + boolean b = updateById(lymsHisInfo); | |
| 81 | + if(!b){ | |
| 82 | + //这里想触发事务回滚需抛运行时异常 | |
| 83 | + throw new Exception("更新HIS患者信息返回值失败状态!"); | |
| 84 | + } | |
| 85 | + if (type==1){ | |
| 86 | + new Thread(new Runnable() { | |
| 87 | + @Override | |
| 88 | + public void run() { | |
| 89 | + try { | |
| 90 | + Thread.sleep(3000); | |
| 91 | + LymsPatient patient =null; | |
| 92 | + String idCard = lymsHisInfo.getIdcard(); | |
| 93 | + if (StringUtil.isEmpty(idCard)) { | |
| 94 | + QueryWrapper<LymsPatient> queryWrapper = new QueryWrapper<>(); | |
| 95 | + queryWrapper.eq("pname",lymsHisInfo.getName()); | |
| 96 | + queryWrapper.eq("enrolment_phone",lymsHisInfo.getPhone()); | |
| 97 | + List<LymsPatient> list = lymsPatientService.list(queryWrapper); | |
| 98 | + if(CollectionUtils.isNotEmpty(list)){ | |
| 99 | + patient=list.get(0); | |
| 100 | + } | |
| 101 | + }else { | |
| 102 | + //判断患者是否存在 | |
| 103 | + LymsPatient patientQuery = new LymsPatient(); | |
| 104 | + patientQuery.setIdno(idCard.toLowerCase()); | |
| 105 | + patient = lymsPatientService.getOne(Wrappers.query(patientQuery)); | |
| 106 | + } | |
| 107 | + if (patient!=null){ | |
| 108 | + List<PushOrderResult> orderList= lymsOrderService.selectPushOrder(patient.getId()); | |
| 109 | + log.info("SendWeChatMsg--->orderList,"+orderList.toString()); | |
| 110 | + if (CollectionUtils.isNotEmpty(orderList)){ | |
| 111 | + LymsPushMessage lymsPushMessage=new LymsPushMessage(); | |
| 112 | + PushOrderResult order= orderList.get(0); | |
| 113 | + lymsPushMessage.setIdno(patient.getIdno()); | |
| 114 | + lymsPushMessage.setHospital(order.getHname()); | |
| 115 | + lymsPushMessage.setDept(order.getDname()); | |
| 116 | + lymsPushMessage.setCid(order.getCid()); | |
| 117 | + lymsPushMessage.setDiagnose(order.getIname()); | |
| 118 | + lymsPushMessage.setMessageType(3); | |
| 119 | + lymsPushMessage.setPushType(1); | |
| 120 | + lymsPushMessage.setTitle("通知:您有一条服务内容推送消息,请点击此处及时查看。"); | |
| 121 | + lymsPushMessage.setName(patient.getPname()); | |
| 122 | + lymsPushMessage.setPushTime(new Date()); | |
| 123 | + lymsPushMessage.setType(0); | |
| 124 | + //推送微信公众号 | |
| 125 | + Map<String,Object> map=new HashMap<>(); | |
| 126 | + map.put("keyword1",new DataEntity(order.getPname(),"#173177")); | |
| 127 | + map.put("keyword2",new DataEntity(order.getHname(),"#173177")); | |
| 128 | + map.put("keyword3",new DataEntity(order.getDname()+"【点击此提醒可查看服务具体内容】","#173177")); | |
| 129 | + | |
| 130 | + //公众号跳转小程序需要的登录信息 | |
| 131 | + Map<String,Object> mapInfo =lymsUserService.pLoginInfo(order.getPid(),3); | |
| 132 | + try { | |
| 133 | + log.info("SendWeChatMsg--->startup"); | |
| 134 | + Integer code= WeiXinUtil.SendWeChatMsg(order.getGzopenid(),Constant.GZ_TEMPLATE_ID,map,mapInfo); | |
| 135 | + log.info("SendWeChatMsg--->code, "+code); | |
| 136 | + if (null == code || code != 0) { | |
| 137 | + lymsPushMessage.setStatus(0); | |
| 138 | + }else { | |
| 139 | + lymsPushMessage.setStatus(1); | |
| 140 | + } | |
| 141 | + lymsPushMessageService.save(lymsPushMessage); | |
| 142 | + } catch (Exception e) { | |
| 143 | + log.error("serviceContent Exception,"+e.getMessage()); | |
| 144 | + } | |
| 145 | + } | |
| 146 | + } | |
| 147 | + }catch (Exception e){ | |
| 148 | + log.error("upHisInfo---> Thread Exception"+e.getMessage()); | |
| 149 | + } | |
| 150 | + } | |
| 151 | + }).start(); | |
| 152 | + } | |
| 123 | 153 | return result; |
| 124 | 154 | } |
| 125 | 155 | |
| 126 | 156 | @Override |
| 157 | + public void upAllHisInfo() { | |
| 158 | + LambdaQueryWrapper<LymsHisInfo> query = new QueryWrapper<LymsHisInfo>() | |
| 159 | + .lambda().eq(LymsHisInfo::getUpType, 0); | |
| 160 | + List<LymsHisInfo> list = this.list(query); | |
| 161 | + if (CollectionUtils.isNotEmpty(list)){ | |
| 162 | + for(LymsHisInfo hisInfo : list){ | |
| 163 | + try{ | |
| 164 | + String result = upHisInfo(hisInfo); | |
| 165 | + if(StringUtil.isNotEmpty(result)){ | |
| 166 | + log.error("upAllHisInfo--->his患者上传失败,result={},info={}",result,hisInfo); | |
| 167 | + } | |
| 168 | + | |
| 169 | + }catch (Exception e){ | |
| 170 | + log.error("upAllHisInfo--->his患者信息自动上传任务异常",e); | |
| 171 | + } | |
| 172 | + } | |
| 173 | + } | |
| 174 | + | |
| 175 | + } | |
| 176 | + | |
| 177 | + @Override | |
| 127 | 178 | public Diagnose getDiagnoseByName(String diagnoseName) { |
| 128 | 179 | LymsDict dict = new LymsDict(); |
| 129 | 180 | dict.setVtype(3); |
| 130 | 181 | |
| ... | ... | @@ -165,8 +216,18 @@ |
| 165 | 216 | if(null!=lymsHisInfo) { |
| 166 | 217 | //姓名 |
| 167 | 218 | String name = lymsHisInfo.getName(); |
| 219 | + if (StringUtil.isEmpty(name)){ | |
| 220 | + String remark= "患者姓名不能为空,请补全信息后再上传。"; | |
| 221 | + lymsHisInfo.setRemark(remark); | |
| 222 | + return remark; | |
| 223 | + } | |
| 168 | 224 | //性别 |
| 169 | 225 | Integer sex = null; |
| 226 | + if (StringUtil.isEmpty(lymsHisInfo.getSex())){ | |
| 227 | + String remark= "患者性别不能为空,请补全信息后再上传。"; | |
| 228 | + lymsHisInfo.setRemark(remark); | |
| 229 | + return remark; | |
| 230 | + } | |
| 170 | 231 | if("男".equals(lymsHisInfo.getSex())){ |
| 171 | 232 | sex=1; |
| 172 | 233 | }else if("女".equals(lymsHisInfo.getSex())){ |
| 173 | 234 | |
| ... | ... | @@ -174,8 +235,61 @@ |
| 174 | 235 | } |
| 175 | 236 | //生日 |
| 176 | 237 | String birthday = lymsHisInfo.getBirthday(); |
| 238 | + if (StringUtil.isEmpty(birthday)){ | |
| 239 | + String remark= "患者生日不能为空,请补全信息后再上传。"; | |
| 240 | + lymsHisInfo.setRemark(remark); | |
| 241 | + return remark; | |
| 242 | + } | |
| 177 | 243 | //电话 |
| 178 | 244 | String phone = lymsHisInfo.getPhone(); |
| 245 | + if (StringUtil.isEmpty(phone)){ | |
| 246 | + String remark= "患者电话不能为空,请补全信息后再上传。"; | |
| 247 | + lymsHisInfo.setRemark(remark); | |
| 248 | + return remark; | |
| 249 | + } | |
| 250 | + //患者(身份证) | |
| 251 | + String idCard = lymsHisInfo.getIdcard(); | |
| 252 | + if (StringUtil.isEmpty(idCard)) { | |
| 253 | + QueryWrapper<LymsPatient> queryWrapper = new QueryWrapper<>(); | |
| 254 | + queryWrapper.eq("pname",lymsHisInfo.getName()); | |
| 255 | + queryWrapper.eq("enrolment_phone",lymsHisInfo.getPhone()); | |
| 256 | + List<LymsPatient> list = lymsPatientService.list(queryWrapper); | |
| 257 | + if(CollectionUtils.isNotEmpty(list)){ | |
| 258 | + String idno = list.get(0).getIdno(); | |
| 259 | + lymsHisInfo.setIdcard(idno); | |
| 260 | + this.updateById(lymsHisInfo); | |
| 261 | + }else{ | |
| 262 | + String remark= "患者身份证号不存在,请等待患者注册补全身份证信息后再上传。"; | |
| 263 | + lymsHisInfo.setRemark(remark); | |
| 264 | + return remark; | |
| 265 | + } | |
| 266 | + } | |
| 267 | + | |
| 268 | + //判断患者是否存在 | |
| 269 | + LymsPatient patientQuery = new LymsPatient(); | |
| 270 | + patientQuery.setIdno(idCard.toLowerCase()); | |
| 271 | + LymsPatient patient = lymsPatientService.getOne(Wrappers.query(patientQuery)); | |
| 272 | + | |
| 273 | + //判断医院是否平台收费,是否存在订单 | |
| 274 | + LymsHospital lymsHospital = lymsHospitalService.getById(Integer.valueOf(lymsHisInfo.getHospitalId())); | |
| 275 | + if(ChargeWay.PLATFORM.getCode()==lymsHospital.getChargeWay()){ | |
| 276 | + if(patient == null){ | |
| 277 | + String remark= "患者还没有缴费,暂时不能上传"; | |
| 278 | + lymsHisInfo.setRemark(remark); | |
| 279 | + return remark; | |
| 280 | + } | |
| 281 | + QueryWrapper<LymsOrder> queryWrapper = new QueryWrapper<>(); | |
| 282 | + queryWrapper.eq("pid",patient.getId()); | |
| 283 | + queryWrapper.gt("status",0); | |
| 284 | + queryWrapper.gt("createdtime", DateUtil.addDay(new Date(),-2)); | |
| 285 | + List<LymsOrder> list = lymsOrderService.list(queryWrapper); | |
| 286 | + if(CollectionUtils.isEmpty(list)){ | |
| 287 | + String remark= "患者还没有缴费,暂时不能上传"; | |
| 288 | + lymsHisInfo.setRemark(remark); | |
| 289 | + return remark; | |
| 290 | + } | |
| 291 | + } | |
| 292 | + | |
| 179 | 293 | //科室 |
| 180 | 294 | Integer deptId = null;//科室id |
| 181 | 295 | String deptName = lymsHisInfo.getDept(); |
| ... | ... | @@ -186,7 +300,9 @@ |
| 186 | 300 | if (null!=lymsHdeparts) { |
| 187 | 301 | deptId = lymsHdeparts.getDid(); |
| 188 | 302 | }else { |
| 189 | - return "医院科室不存在,请增加"+deptName; | |
| 303 | + String remark="医院科室不存在,请增加"+deptName; | |
| 304 | + lymsHisInfo.setRemark(remark); | |
| 305 | + return remark; | |
| 190 | 306 | } |
| 191 | 307 | //医生 |
| 192 | 308 | Integer doctorId = null;//医生id |
| ... | ... | @@ -199,7 +315,9 @@ |
| 199 | 315 | if (CollectionUtils.isNotEmpty(lymsDoctors)) { |
| 200 | 316 | doctorId = lymsDoctors.get(0).getDid(); |
| 201 | 317 | }else { |
| 202 | - return "医生不存在,请在"+deptName+"下面增加"+doctorName+"医生!"; | |
| 318 | + String remark= "医生不存在,请在"+deptName+"下面增加"+doctorName+"医生!"; | |
| 319 | + lymsHisInfo.setRemark(remark); | |
| 320 | + return remark; | |
| 203 | 321 | } |
| 204 | 322 | |
| 205 | 323 | //疾病 |
| 206 | 324 | |
| ... | ... | @@ -209,12 +327,19 @@ |
| 209 | 327 | for(String diagnoseName: diagnoses){ |
| 210 | 328 | Diagnose diagnose = this.getDiagnoseByName(diagnoseName); |
| 211 | 329 | if(diagnose == null){ |
| 212 | - return "疾病["+diagnoseName+"]不存在,请在设置-字典管理中添加疾病或在疾病映射中添加映射关系。"; | |
| 330 | + String remark= "疾病["+diagnoseName+"]不存在,请在设置-字典管理中添加疾病或在疾病映射中添加映射关系。"; | |
| 331 | + lymsHisInfo.setRemark(remark); | |
| 332 | + return remark; | |
| 213 | 333 | } |
| 214 | 334 | diagnoseIds.add(diagnose.getDiagnoseCode().toString()); |
| 215 | 335 | diagnoseMap.put(diagnoseName,diagnose); |
| 216 | 336 | } |
| 217 | 337 | |
| 338 | + if (diagnoseIds.size()>1){ | |
| 339 | + String remark= "该患者存在多种疾病,请手动上传"; | |
| 340 | + lymsHisInfo.setRemark(remark); | |
| 341 | + return remark; | |
| 342 | + } | |
| 218 | 343 | /* |
| 219 | 344 | List<String> diagnoseOrmIds = new ArrayList<>();//疾病映射ids |
| 220 | 345 | if (null != diagnoses) { |
| 221 | 346 | |
| 222 | 347 | |
| 223 | 348 | |
| ... | ... | @@ -249,47 +374,22 @@ |
| 249 | 374 | return "疾病不存在,请在设置-字典管理中添加疾病或在疾病映射中添加映射关系。"; |
| 250 | 375 | } |
| 251 | 376 | }*/ |
| 252 | - //患者(身份证) | |
| 253 | - String idCard = lymsHisInfo.getIdcard(); | |
| 254 | - if (StringUtil.isEmpty(idCard)) { | |
| 255 | - QueryWrapper<LymsPatient> queryWrapper = new QueryWrapper<>(); | |
| 256 | - queryWrapper.eq("pname",lymsHisInfo.getName()); | |
| 257 | - queryWrapper.eq("enrolment_phone",lymsHisInfo.getPhone()); | |
| 258 | - List<LymsPatient> list = lymsPatientService.list(queryWrapper); | |
| 259 | - if(CollectionUtils.isNotEmpty(list)){ | |
| 260 | - String idno = list.get(0).getIdno(); | |
| 261 | - lymsHisInfo.setIdcard(idno); | |
| 262 | - this.updateById(lymsHisInfo); | |
| 263 | - }else{ | |
| 264 | - return "患者身份证号不存在,请等待患者注册补全身份证信息后再上传。"; | |
| 265 | - } | |
| 266 | 377 | |
| 267 | - //return "患者身份证号不存在,请等待患者注册补全身份证信息后再上传。"; | |
| 268 | - //idCard=lymsHisInfo.getVccardno(); | |
| 378 | + //知识库 | |
| 379 | + List<ArticleInfo> articleList= articleInfoService.list(new QueryWrapper<ArticleInfo>() | |
| 380 | + .in("iid",diagnoseIds)); | |
| 381 | + if (CollectionUtils.isEmpty(articleList)||articleList.size()<18){ | |
| 382 | + String remark= "该患者疾病文章不足18篇"; | |
| 383 | + lymsHisInfo.setRemark(remark); | |
| 384 | + return remark; | |
| 269 | 385 | } |
| 270 | - //判断患者是否存在 | |
| 271 | - LymsPatient patientQuery = new LymsPatient(); | |
| 272 | - patientQuery.setIdno(idCard.toLowerCase()); | |
| 273 | - LymsPatient patient = lymsPatientService.getOne(Wrappers.query(patientQuery)); | |
| 274 | - | |
| 275 | - //判断医院是否平台收费,是否存在订单 | |
| 276 | - LymsHospital lymsHospital = lymsHospitalService.getById(Integer.valueOf(lymsHisInfo.getHospitalId())); | |
| 277 | - if(ChargeWay.PLATFORM.getCode()==lymsHospital.getChargeWay()){ | |
| 278 | - if(patient == null){ | |
| 279 | - return "患者还没有缴费,暂时不能上传"; | |
| 280 | - } | |
| 281 | - QueryWrapper<LymsOrder> queryWrapper = new QueryWrapper<>(); | |
| 282 | - queryWrapper.eq("pid",patient.getId()); | |
| 283 | - queryWrapper.gt("status",0); | |
| 284 | - queryWrapper.gt("createdtime", DateUtil.addDay(new Date(),-2)); | |
| 285 | - List<LymsOrder> list = lymsOrderService.list(queryWrapper); | |
| 286 | - if(CollectionUtils.isEmpty(list)){ | |
| 287 | - return "患者还没有缴费,暂时不能上传"; | |
| 288 | - } | |
| 386 | + //随访 | |
| 387 | + List<LymsChatInfo> chatList= lymsChatInfoService.list(new QueryWrapper<LymsChatInfo>().in("illid",diagnoseIds)); | |
| 388 | + if (CollectionUtils.isEmpty(chatList)){ | |
| 389 | + String remark= "该患者疾病没有设置回访内容"; | |
| 390 | + lymsHisInfo.setRemark(remark); | |
| 391 | + return remark; | |
| 289 | 392 | } |
| 290 | - | |
| 291 | - | |
| 292 | - | |
| 293 | 393 | if (null != patient) { |
| 294 | 394 | QueryWrapper<LymsPcase> queryWrapper = new QueryWrapper<>(); |
| 295 | 395 | queryWrapper.eq("pid", patient.getId()); |
| ... | ... | @@ -439,7 +539,5 @@ |
| 439 | 539 | baseResponse.setErrorcode(f == true ? 0 : 1); |
| 440 | 540 | return baseResponse; |
| 441 | 541 | } |
| 442 | - | |
| 443 | - | |
| 444 | 542 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsPushMessageServiceImpl.java
View file @
01054ed
| 1 | +package com.lyms.talkonlineweb.service.impl; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
| 4 | +import com.lyms.talkonlineweb.domain.LymsPushMessage; | |
| 5 | +import com.lyms.talkonlineweb.mapper.LymsPushMessageMapper; | |
| 6 | +import com.lyms.talkonlineweb.service.LymsPushMessageService; | |
| 7 | +import org.springframework.stereotype.Service; | |
| 8 | + | |
| 9 | +@Service | |
| 10 | +public class LymsPushMessageServiceImpl extends ServiceImpl<LymsPushMessageMapper, LymsPushMessage> | |
| 11 | + implements LymsPushMessageService { | |
| 12 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/HisPatientsAutoUploadTask.java
View file @
01054ed
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 4 | 4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 5 | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |
| 5 | 6 | import com.lyms.talkonlineweb.domain.LymsHisInfo; |
| 6 | 7 | import com.lyms.talkonlineweb.domain.LymsHospital; |
| 7 | 8 | import com.lyms.talkonlineweb.domain.LymsOrder; |
| ... | ... | @@ -37,7 +38,7 @@ |
| 37 | 38 | @Autowired |
| 38 | 39 | private LymsHospitalService lymsHospitalService; //医院 |
| 39 | 40 | |
| 40 | - @Scheduled(cron = "0 0 13,21 * * ?") | |
| 41 | + // @Scheduled(cron = "0 0 13,21 * * ?") | |
| 41 | 42 | public void hisPatientsAutoUploadTask(){ |
| 42 | 43 | if(!on_off){ |
| 43 | 44 | return; |
| 44 | 45 | |
| ... | ... | @@ -49,15 +50,17 @@ |
| 49 | 50 | .ge(LymsHisInfo::getCreatedtime, DateUtil.addDay(new Date(),-3)); |
| 50 | 51 | List<LymsHisInfo> list = lymsHisInfoService.list(query); |
| 51 | 52 | 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 | - } | |
| 53 | + if (CollectionUtils.isNotEmpty(list)){ | |
| 54 | + for(LymsHisInfo hisInfo : list){ | |
| 55 | + try{ | |
| 56 | + String result = lymsHisInfoService.upHisInfo(hisInfo); | |
| 57 | + if(StringUtil.isNotEmpty(result)){ | |
| 58 | + log.error("his患者上传失败,result={},info={}",result,hisInfo); | |
| 59 | + } | |
| 58 | 60 | |
| 59 | - }catch (Exception e){ | |
| 60 | - log.error("his患者信息自动上传任务异常",e); | |
| 61 | + }catch (Exception e){ | |
| 62 | + log.error("his患者信息自动上传任务异常",e); | |
| 63 | + } | |
| 61 | 64 | } |
| 62 | 65 | } |
| 63 | 66 |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/ServiceContentTask.java
View file @
01054ed
| ... | ... | @@ -2,19 +2,15 @@ |
| 2 | 2 | |
| 3 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 4 | 4 | import com.lyms.oss.utils.DateUtils; |
| 5 | -import com.lyms.talkonlineweb.domain.LymsMessage; | |
| 6 | -import com.lyms.talkonlineweb.domain.LymsOrder; | |
| 7 | -import com.lyms.talkonlineweb.domain.LymsPatient; | |
| 8 | -import com.lyms.talkonlineweb.domain.PatientInfo; | |
| 5 | +import com.lyms.talkonlineweb.domain.*; | |
| 9 | 6 | import com.lyms.talkonlineweb.param.DataEntity; |
| 10 | 7 | import com.lyms.talkonlineweb.result.PushOrderResult; |
| 11 | -import com.lyms.talkonlineweb.service.LymsOrderService; | |
| 12 | -import com.lyms.talkonlineweb.service.LymsPatientService; | |
| 13 | -import com.lyms.talkonlineweb.service.LymsUserService; | |
| 14 | -import com.lyms.talkonlineweb.service.PatientInfoService; | |
| 8 | +import com.lyms.talkonlineweb.service.*; | |
| 15 | 9 | import com.lyms.talkonlineweb.util.Constant; |
| 10 | +import com.lyms.talkonlineweb.util.DateUtil; | |
| 16 | 11 | import com.lyms.talkonlineweb.util.StringUtil; |
| 17 | 12 | import com.lyms.talkonlineweb.util.WeiXinUtil; |
| 13 | +import lombok.RequiredArgsConstructor; | |
| 18 | 14 | import lombok.extern.slf4j.Slf4j; |
| 19 | 15 | import org.apache.commons.collections.CollectionUtils; |
| 20 | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 21 | 17 | |
| 22 | 18 | |
| ... | ... | @@ -22,19 +18,16 @@ |
| 22 | 18 | import org.springframework.scheduling.annotation.Scheduled; |
| 23 | 19 | import org.springframework.stereotype.Component; |
| 24 | 20 | |
| 25 | -import java.util.Date; | |
| 26 | -import java.util.HashMap; | |
| 27 | -import java.util.List; | |
| 28 | -import java.util.Map; | |
| 21 | +import java.util.*; | |
| 29 | 22 | |
| 30 | 23 | @Component |
| 31 | 24 | @Slf4j |
| 25 | +@RequiredArgsConstructor(onConstructor =@_(@Autowired)) | |
| 32 | 26 | public class ServiceContentTask { |
| 33 | 27 | |
| 34 | - @Autowired | |
| 35 | - private LymsOrderService lymsOrderService; | |
| 36 | - @Autowired | |
| 37 | - private LymsUserService lymsUserService; | |
| 28 | + private final LymsOrderService lymsOrderService; | |
| 29 | + private final LymsUserService lymsUserService; | |
| 30 | + private final LymsPushMessageService lymsPushMessageService; | |
| 38 | 31 | /** |
| 39 | 32 | * 定时推送 |
| 40 | 33 | * 公众号提醒(开通服务后第7天、开通服务后第14天) |
| 41 | 34 | |
| ... | ... | @@ -50,7 +43,21 @@ |
| 50 | 43 | List<PushOrderResult> orderList= lymsOrderService.selectOrderTaskList( |
| 51 | 44 | seven+startStr,seven+endStr,fourteen+startStr,fourteen+endStr); |
| 52 | 45 | if (CollectionUtils.isNotEmpty(orderList)){ |
| 46 | + String fourteenTime=fourteen+endStr; | |
| 47 | + List<LymsPushMessage> list=new ArrayList<>(); | |
| 53 | 48 | orderList.stream().forEach(order -> { |
| 49 | + LymsPushMessage lymsPushMessage=new LymsPushMessage(); | |
| 50 | + lymsPushMessage.setIdno(order.getIdno()); | |
| 51 | + lymsPushMessage.setHospital(order.getHname()); | |
| 52 | + lymsPushMessage.setDept(order.getDname()); | |
| 53 | + lymsPushMessage.setCid(order.getCid()); | |
| 54 | + lymsPushMessage.setDiagnose(order.getIname()); | |
| 55 | + lymsPushMessage.setMessageType(3); | |
| 56 | + lymsPushMessage.setPushType(1); | |
| 57 | + lymsPushMessage.setTitle("通知:您有一条服务内容推送消息,请点击此处及时查看。"); | |
| 58 | + lymsPushMessage.setName(order.getPname()); | |
| 59 | + lymsPushMessage.setPushTime(new Date()); | |
| 60 | + lymsPushMessage.setType(checkTime(fourteenTime,order.getService_start_time())); | |
| 54 | 61 | //推送微信公众号 |
| 55 | 62 | Map<String,Object> map=new HashMap<>(); |
| 56 | 63 | map.put("keyword1",new DataEntity(order.getPname(),"#173177")); |
| 57 | 64 | |
| 58 | 65 | |
| ... | ... | @@ -63,13 +70,27 @@ |
| 63 | 70 | log.info("serviceContent-->SendWeChatMsg--->start up"); |
| 64 | 71 | Integer code= WeiXinUtil.SendWeChatMsg(order.getGzopenid(),Constant.GZ_TEMPLATE_ID,map,mapInfo); |
| 65 | 72 | log.info("SendWeChatMsg--->code, "+code); |
| 73 | + if (null == code || code != 0) { | |
| 74 | + lymsPushMessage.setStatus(0); | |
| 75 | + }else { | |
| 76 | + lymsPushMessage.setStatus(1); | |
| 77 | + } | |
| 78 | + list.add(lymsPushMessage); | |
| 66 | 79 | } catch (Exception e) { |
| 67 | 80 | log.error("serviceContent Exception,"+e.getMessage()); |
| 68 | 81 | } |
| 69 | 82 | }); |
| 83 | + lymsPushMessageService.saveBatch(list); | |
| 70 | 84 | } |
| 71 | 85 | log.info("serviceContent end"); |
| 72 | 86 | } |
| 73 | 87 | |
| 88 | + private int checkTime(String time,Date date){ | |
| 89 | + Date endTime= DateUtils.parse(time,DateUtil.YYYY_MM_DD_HH_MM_SS); | |
| 90 | + if (endTime.compareTo(date)<0){ | |
| 91 | + return 1; | |
| 92 | + } | |
| 93 | + return 2; | |
| 94 | + } | |
| 74 | 95 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/Constant.java
View file @
01054ed
talkonlineweb/src/main/resources/mapper/LymsOrderMapper.xml
View file @
01054ed
| ... | ... | @@ -72,11 +72,12 @@ |
| 72 | 72 | </select> |
| 73 | 73 | <select id="selectOrderTaskList" resultType="com.lyms.talkonlineweb.result.PushOrderResult"> |
| 74 | 74 | SELECT |
| 75 | - o.id,o.pid,pc.dname,pc.hname,p.pname,p.gzopenid | |
| 75 | + o.id,o.pid,pc.dname,pc.hname,p.pname,p.gzopenid,p.idno,o.service_start_time,pi.iname,pi.cid | |
| 76 | 76 | FROM |
| 77 | 77 | `lyms_order` o |
| 78 | 78 | INNER JOIN lyms_patient p ON o.pid = p.id |
| 79 | 79 | INNER JOIN lyms_pcase pc on pc.pid =o.pid |
| 80 | + inner join patient_info pi on pi.idno=p.idno | |
| 80 | 81 | WHERE |
| 81 | 82 | (( |
| 82 | 83 | <![CDATA[o.service_start_time >= #{sevenStart} |
| 83 | 84 | |
| ... | ... | @@ -87,11 +88,12 @@ |
| 87 | 88 | </select> |
| 88 | 89 | <select id="selectPushOrder" resultType="com.lyms.talkonlineweb.result.PushOrderResult"> |
| 89 | 90 | SELECT |
| 90 | - o.id,o.pid,pc.dname,pc.hname,p.pname,p.gzopenid | |
| 91 | + o.id,o.pid,pc.dname,pc.hname,p.pname,p.gzopenid,pi.iname,pi.cid | |
| 91 | 92 | FROM |
| 92 | 93 | `lyms_order` o |
| 93 | 94 | INNER JOIN lyms_patient p ON o.pid = p.id |
| 94 | 95 | INNER JOIN lyms_pcase pc on pc.pid =o.pid |
| 96 | + inner join patient_info pi on pi.idno=p.idno | |
| 95 | 97 | WHERE |
| 96 | 98 | o.pid=#{pId} |
| 97 | 99 | and `status`=1 |
talkonlineweb/src/main/resources/mapper/LymsTcardMapper.xml
View file @
01054ed
| ... | ... | @@ -61,7 +61,16 @@ |
| 61 | 61 | and card.fid = #{fid} |
| 62 | 62 | </if> |
| 63 | 63 | and not EXISTS ( SELECT r.cid FROM lyms_tkrecord r where r.cid = card.id ) |
| 64 | - | |
| 64 | + AND EXISTS ( | |
| 65 | + SELECT | |
| 66 | + o.id | |
| 67 | + FROM | |
| 68 | + lyms_order o | |
| 69 | + WHERE | |
| 70 | + o.pid = card.pid | |
| 71 | + AND o. STATUS = 1 | |
| 72 | + <![CDATA[ AND o.service_end_time >= #{orderNo}]]> | |
| 73 | + ) | |
| 65 | 74 | </select> |
| 66 | 75 | </mapper> |