Commit 5bf07843b5d2bf99ac6783236fed0f5589f88b68
1 parent
b4274a1381
Exists in
master
and in
1 other branch
自动回访功能增加推送公众号
Showing 14 changed files with 549 additions and 225 deletions
- 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/TestController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPushVisitRecord.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/enums/VisitEnum.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsPushVisitRecordMapper.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsHisInfoService.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsPushVisitRecordService.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsPushVisitRecordServiceImpl.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/PushChatInfoTask.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/Constant.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/WeiXinUtil.java
- talkonlineweb/src/main/resources/mapper/LymsPushVisitRecordMapper.xml
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/LymsHisInfoController.java
View file @
5bf0784
| ... | ... | @@ -79,12 +79,16 @@ |
| 79 | 79 | @TokenRequired |
| 80 | 80 | public BaseResponse upHisInfo( @RequestBody @Validated LymsHisInfo lymsHisInfo){ |
| 81 | 81 | BaseResponse baseResponse=new BaseResponse(); |
| 82 | - baseResponse.setErrorcode(0); | |
| 83 | - baseResponse.setErrormsg("患者上传成功"); | |
| 84 | - String result = lymsHisInfoService.upHisInfo(lymsHisInfo); | |
| 85 | - if(StringUtil.isNotEmpty(result)){ | |
| 86 | - baseResponse.setErrorcode(1); | |
| 87 | - baseResponse.setErrormsg(result); | |
| 82 | + try { | |
| 83 | + baseResponse.setErrorcode(0); | |
| 84 | + baseResponse.setErrormsg("患者上传成功"); | |
| 85 | + String result = lymsHisInfoService.upHisInfo(lymsHisInfo); | |
| 86 | + if(StringUtil.isNotEmpty(result)){ | |
| 87 | + baseResponse.setErrorcode(1); | |
| 88 | + baseResponse.setErrormsg(result); | |
| 89 | + } | |
| 90 | + } catch (Exception e) { | |
| 91 | + e.printStackTrace(); | |
| 88 | 92 | } |
| 89 | 93 | return baseResponse; |
| 90 | 94 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java
View file @
5bf0784
| ... | ... | @@ -83,6 +83,8 @@ |
| 83 | 83 | |
| 84 | 84 | @Autowired |
| 85 | 85 | private RegisterPatientInfoService registerPatientInfoService; |
| 86 | + @Autowired | |
| 87 | + private LymsPushVisitRecordService lymsPushVisitRecordService; | |
| 86 | 88 | |
| 87 | 89 | /** |
| 88 | 90 | * 获取患者列表 |
| ... | ... | @@ -1164,5 +1166,29 @@ |
| 1164 | 1166 | } |
| 1165 | 1167 | return baseResponse; |
| 1166 | 1168 | } |
| 1169 | + | |
| 1170 | + /** | |
| 1171 | + * PC-查看医生回访推送公众号记录 | |
| 1172 | + * @param getPushVisitRecord | |
| 1173 | + * @param current | |
| 1174 | + * @param size | |
| 1175 | + * @return | |
| 1176 | + */ | |
| 1177 | + @GetMapping("getPushVisitRecord") | |
| 1178 | + @TokenRequired | |
| 1179 | + public BaseResponse getPushVisitRecord(LymsPushVisitRecord visitRecord, int current, int size) { | |
| 1180 | + BaseResponse baseResponse = new BaseResponse(); | |
| 1181 | + try { | |
| 1182 | + QueryWrapper<LymsPushVisitRecord> query=new QueryWrapper(); | |
| 1183 | + query.orderByDesc("createdtime"); | |
| 1184 | + Page<LymsPushVisitRecord> page= new Page<>(current,size); | |
| 1185 | + Page<LymsPushVisitRecord> visitRecordPage = lymsPushVisitRecordService.page(page,query); | |
| 1186 | + baseResponse.setObject(visitRecordPage); | |
| 1187 | + } catch (Exception e) { | |
| 1188 | + e.printStackTrace(); | |
| 1189 | + } | |
| 1190 | + return baseResponse; | |
| 1191 | + } | |
| 1192 | + | |
| 1167 | 1193 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/TestController.java
View file @
5bf0784
| 1 | 1 | package com.lyms.talkonlineweb.controller; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | +import com.alibaba.fastjson.JSONArray; | |
| 5 | +import com.alibaba.fastjson.JSONObject; | |
| 4 | 6 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 7 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
| 5 | 8 | import com.lyms.talkonlineweb.annotation.TokenRequired; |
| 9 | +import com.lyms.talkonlineweb.domain.LymsGroupOrder; | |
| 10 | +import com.lyms.talkonlineweb.domain.LymsPatient; | |
| 6 | 11 | import com.lyms.talkonlineweb.domain.LymsPcase; |
| 12 | +import com.lyms.talkonlineweb.domain.LymsTcard; | |
| 13 | +import com.lyms.talkonlineweb.service.LymsGroupOrderService; | |
| 14 | +import com.lyms.talkonlineweb.service.LymsPatientService; | |
| 7 | 15 | import com.lyms.talkonlineweb.service.LymsPcaseService; |
| 16 | +import com.lyms.talkonlineweb.service.LymsTcardService; | |
| 8 | 17 | import com.lyms.talkonlineweb.task.*; |
| 18 | +import com.lyms.talkonlineweb.util.Constant; | |
| 19 | +import com.lyms.talkonlineweb.util.HXService; | |
| 20 | +import com.lyms.talkonlineweb.util.StringUtil; | |
| 9 | 21 | import lombok.extern.java.Log; |
| 10 | 22 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | 23 | import org.springframework.web.bind.annotation.GetMapping; |
| 12 | 24 | import org.springframework.web.bind.annotation.RestController; |
| 13 | 25 | |
| 14 | -import java.util.Calendar; | |
| 15 | -import java.util.Date; | |
| 16 | -import java.util.List; | |
| 26 | +import java.lang.reflect.Array; | |
| 27 | +import java.util.*; | |
| 17 | 28 | |
| 18 | 29 | @RestController |
| 19 | 30 | @Log |
| 20 | 31 | |
| ... | ... | @@ -30,11 +41,24 @@ |
| 30 | 41 | private PushIllnessTypeData pushIllnessTypeData; |
| 31 | 42 | @Autowired |
| 32 | 43 | private PushIllnessTypeTask pushIllnessTypeTask; |
| 44 | + @Autowired | |
| 45 | + private LymsGroupOrderService lymsGroupOrderService; | |
| 46 | + @Autowired | |
| 47 | + private LymsPatientService lymsPatientService;//患者 | |
| 48 | + @Autowired | |
| 49 | + private LymsTcardService lymsTcardService;//问诊卡信息 | |
| 50 | + @Autowired | |
| 51 | + private HXService hxService; | |
| 52 | + @Autowired | |
| 53 | + private PushChatInfoTask pushChatInfoTask; | |
| 33 | 54 | |
| 34 | 55 | @GetMapping("test") |
| 35 | 56 | @TokenRequired |
| 36 | 57 | public void test() throws Exception { |
| 37 | - getPatientInfoTask.getPatientInfo(); | |
| 58 | + LymsGroupOrder a=new LymsGroupOrder(); | |
| 59 | + a.setTotalPrices(465); | |
| 60 | + lymsGroupOrderService.save(a); | |
| 61 | + System.out.println(a); | |
| 38 | 62 | } |
| 39 | 63 | |
| 40 | 64 | @GetMapping("test9") |
| ... | ... | @@ -58,6 +82,12 @@ |
| 58 | 82 | @TokenRequired |
| 59 | 83 | public void test2() { |
| 60 | 84 | pushIllnessTypeTask.PushIllnessTypeTask(); |
| 85 | + } | |
| 86 | + | |
| 87 | + @GetMapping("test3") | |
| 88 | + @TokenRequired | |
| 89 | + public void test3() { | |
| 90 | + pushChatInfoTask.pushChatInfo(); | |
| 61 | 91 | } |
| 62 | 92 | |
| 63 | 93 |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPushVisitRecord.java
View file @
5bf0784
| 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 java.io.Serializable; | |
| 8 | +import java.util.Date; | |
| 9 | +import lombok.Data; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * | |
| 13 | + * @TableName lyms_push_visit_record | |
| 14 | + */ | |
| 15 | +@TableName(value ="lyms_push_visit_record") | |
| 16 | +@Data | |
| 17 | +public class LymsPushVisitRecord implements Serializable { | |
| 18 | + /** | |
| 19 | + * | |
| 20 | + */ | |
| 21 | + @TableId(value = "id", type = IdType.AUTO) | |
| 22 | + private Integer id; | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 患者id | |
| 26 | + */ | |
| 27 | + @TableField(value = "pid") | |
| 28 | + private Integer pid; | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 患者姓名 | |
| 32 | + */ | |
| 33 | + @TableField(value = "pname") | |
| 34 | + private String pname; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 疾病id | |
| 38 | + */ | |
| 39 | + @TableField(value = "iid") | |
| 40 | + private Integer iid; | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * 疾病名称 | |
| 44 | + */ | |
| 45 | + @TableField(value = "iiname") | |
| 46 | + private String iiname; | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * 回访医生id | |
| 50 | + */ | |
| 51 | + @TableField(value = "did") | |
| 52 | + private Integer did; | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 回访医生姓名 | |
| 56 | + */ | |
| 57 | + @TableField(value = "dname") | |
| 58 | + private String dname; | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * 自动回复类型-1:第二天2:第五天3:第十天4:第二十天5:第三十天 | |
| 62 | + */ | |
| 63 | + @TableField(value = "type") | |
| 64 | + private Integer type; | |
| 65 | + | |
| 66 | + /** | |
| 67 | + * 回访内容 | |
| 68 | + */ | |
| 69 | + @TableField(value = "content") | |
| 70 | + private String content; | |
| 71 | + | |
| 72 | + /** | |
| 73 | + * 推送状态: 1成功 2失败。(在备注写失败原因) | |
| 74 | + */ | |
| 75 | + @TableField(value = "state") | |
| 76 | + private Integer state; | |
| 77 | + | |
| 78 | + /** | |
| 79 | + * 备注 | |
| 80 | + */ | |
| 81 | + @TableField(value = "remark") | |
| 82 | + private String remark; | |
| 83 | + | |
| 84 | + /** | |
| 85 | + * 创建时间 | |
| 86 | + */ | |
| 87 | + @TableField(value = "createdtime") | |
| 88 | + private Date createdtime; | |
| 89 | + | |
| 90 | + /** | |
| 91 | + * 修改时间 | |
| 92 | + */ | |
| 93 | + @TableField(value = "update_time") | |
| 94 | + private Date updateTime; | |
| 95 | + | |
| 96 | + @TableField(exist = false) | |
| 97 | + private static final long serialVersionUID = 1L; | |
| 98 | + | |
| 99 | + @Override | |
| 100 | + public boolean equals(Object that) { | |
| 101 | + if (this == that) { | |
| 102 | + return true; | |
| 103 | + } | |
| 104 | + if (that == null) { | |
| 105 | + return false; | |
| 106 | + } | |
| 107 | + if (getClass() != that.getClass()) { | |
| 108 | + return false; | |
| 109 | + } | |
| 110 | + LymsPushVisitRecord other = (LymsPushVisitRecord) that; | |
| 111 | + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) | |
| 112 | + && (this.getPid() == null ? other.getPid() == null : this.getPid().equals(other.getPid())) | |
| 113 | + && (this.getPname() == null ? other.getPname() == null : this.getPname().equals(other.getPname())) | |
| 114 | + && (this.getIid() == null ? other.getIid() == null : this.getIid().equals(other.getIid())) | |
| 115 | + && (this.getIiname() == null ? other.getIiname() == null : this.getIiname().equals(other.getIiname())) | |
| 116 | + && (this.getDid() == null ? other.getDid() == null : this.getDid().equals(other.getDid())) | |
| 117 | + && (this.getDname() == null ? other.getDname() == null : this.getDname().equals(other.getDname())) | |
| 118 | + && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType())) | |
| 119 | + && (this.getContent() == null ? other.getContent() == null : this.getContent().equals(other.getContent())) | |
| 120 | + && (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState())) | |
| 121 | + && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark())) | |
| 122 | + && (this.getCreatedtime() == null ? other.getCreatedtime() == null : this.getCreatedtime().equals(other.getCreatedtime())) | |
| 123 | + && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())); | |
| 124 | + } | |
| 125 | + | |
| 126 | + @Override | |
| 127 | + public int hashCode() { | |
| 128 | + final int prime = 31; | |
| 129 | + int result = 1; | |
| 130 | + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); | |
| 131 | + result = prime * result + ((getPid() == null) ? 0 : getPid().hashCode()); | |
| 132 | + result = prime * result + ((getPname() == null) ? 0 : getPname().hashCode()); | |
| 133 | + result = prime * result + ((getIid() == null) ? 0 : getIid().hashCode()); | |
| 134 | + result = prime * result + ((getIiname() == null) ? 0 : getIiname().hashCode()); | |
| 135 | + result = prime * result + ((getDid() == null) ? 0 : getDid().hashCode()); | |
| 136 | + result = prime * result + ((getDname() == null) ? 0 : getDname().hashCode()); | |
| 137 | + result = prime * result + ((getType() == null) ? 0 : getType().hashCode()); | |
| 138 | + result = prime * result + ((getContent() == null) ? 0 : getContent().hashCode()); | |
| 139 | + result = prime * result + ((getState() == null) ? 0 : getState().hashCode()); | |
| 140 | + result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode()); | |
| 141 | + result = prime * result + ((getCreatedtime() == null) ? 0 : getCreatedtime().hashCode()); | |
| 142 | + result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); | |
| 143 | + return result; | |
| 144 | + } | |
| 145 | + | |
| 146 | + @Override | |
| 147 | + public String toString() { | |
| 148 | + StringBuilder sb = new StringBuilder(); | |
| 149 | + sb.append(getClass().getSimpleName()); | |
| 150 | + sb.append(" ["); | |
| 151 | + sb.append("Hash = ").append(hashCode()); | |
| 152 | + sb.append(", id=").append(id); | |
| 153 | + sb.append(", pid=").append(pid); | |
| 154 | + sb.append(", pname=").append(pname); | |
| 155 | + sb.append(", iid=").append(iid); | |
| 156 | + sb.append(", iiname=").append(iiname); | |
| 157 | + sb.append(", did=").append(did); | |
| 158 | + sb.append(", dname=").append(dname); | |
| 159 | + sb.append(", type=").append(type); | |
| 160 | + sb.append(", content=").append(content); | |
| 161 | + sb.append(", state=").append(state); | |
| 162 | + sb.append(", remark=").append(remark); | |
| 163 | + sb.append(", createdtime=").append(createdtime); | |
| 164 | + sb.append(", updateTime=").append(updateTime); | |
| 165 | + sb.append(", serialVersionUID=").append(serialVersionUID); | |
| 166 | + sb.append("]"); | |
| 167 | + return sb.toString(); | |
| 168 | + } | |
| 169 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/enums/VisitEnum.java
View file @
5bf0784
| 1 | +package com.lyms.talkonlineweb.enums; | |
| 2 | + | |
| 3 | +import lombok.Getter; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * 回访状态 | |
| 7 | + * 自动回复周期上传病例后- 1:第二天 2:第五天 3:第十天 4:第二十天 5:第三十天 | |
| 8 | + */ | |
| 9 | +@Getter | |
| 10 | +public enum VisitEnum { | |
| 11 | + | |
| 12 | + a(1, "第二天"), | |
| 13 | + b(2, "第五天"), | |
| 14 | + c(3, "第十天"), | |
| 15 | + d(4, "第十天"), | |
| 16 | + e(5, "第三十天"); | |
| 17 | + | |
| 18 | + private Integer code; | |
| 19 | + private String name; | |
| 20 | + | |
| 21 | + VisitEnum(Integer code, String name){ | |
| 22 | + this.code = code; | |
| 23 | + this.name = name; | |
| 24 | + } | |
| 25 | + | |
| 26 | + public static String getName(Integer code) { | |
| 27 | + VisitEnum[] values = VisitEnum.values(); | |
| 28 | + for (VisitEnum value : values) { | |
| 29 | + if (value.getCode().equals(code)) { | |
| 30 | + return value.getName(); | |
| 31 | + } | |
| 32 | + } | |
| 33 | + return ""; | |
| 34 | + } | |
| 35 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsPushVisitRecordMapper.java
View file @
5bf0784
| 1 | +package com.lyms.talkonlineweb.mapper; | |
| 2 | + | |
| 3 | +import com.lyms.talkonlineweb.domain.LymsPushVisitRecord; | |
| 4 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * @Entity com.lyms.talkonlineweb.domain.LymsPushVisitRecord | |
| 8 | + */ | |
| 9 | +public interface LymsPushVisitRecordMapper extends BaseMapper<LymsPushVisitRecord> { | |
| 10 | + | |
| 11 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsHisInfoService.java
View file @
5bf0784
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsPushVisitRecordService.java
View file @
5bf0784
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java
View file @
5bf0784
| ... | ... | @@ -51,8 +51,8 @@ |
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | @Override |
| 54 | - @Transactional(rollbackFor = Exception.class) | |
| 55 | - public String upHisInfo(LymsHisInfo lymsHisInfo) { | |
| 54 | + @Transactional(rollbackFor = {Exception.class,RuntimeException.class}) | |
| 55 | + public String upHisInfo(LymsHisInfo lymsHisInfo) throws Exception,RuntimeException { | |
| 56 | 56 | String result=collateData(lymsHisInfo); |
| 57 | 57 | if(StringUtil.isEmpty(result)){ |
| 58 | 58 | lymsHisInfo.setUpType(1); |
| ... | ... | @@ -60,7 +60,7 @@ |
| 60 | 60 | boolean b = lymsHisInfoService.updateById(lymsHisInfo); |
| 61 | 61 | if(!b){ |
| 62 | 62 | //这里想触发事务回滚需抛运行时异常 |
| 63 | - throw new RuntimeException("更新HIS患者信息返回值失败状态!"); | |
| 63 | + throw new Exception("更新HIS患者信息返回值失败状态!"); | |
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | return result; |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsPushVisitRecordServiceImpl.java
View file @
5bf0784
| 1 | +package com.lyms.talkonlineweb.service.impl; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
| 4 | +import com.lyms.talkonlineweb.domain.LymsPushVisitRecord; | |
| 5 | +import com.lyms.talkonlineweb.service.LymsPushVisitRecordService; | |
| 6 | +import com.lyms.talkonlineweb.mapper.LymsPushVisitRecordMapper; | |
| 7 | +import org.springframework.stereotype.Service; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * | |
| 11 | + */ | |
| 12 | +@Service | |
| 13 | +public class LymsPushVisitRecordServiceImpl extends ServiceImpl<LymsPushVisitRecordMapper, LymsPushVisitRecord> | |
| 14 | + implements LymsPushVisitRecordService{ | |
| 15 | + | |
| 16 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/PushChatInfoTask.java
View file @
5bf0784
| ... | ... | @@ -6,6 +6,7 @@ |
| 6 | 6 | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| 7 | 7 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 8 | 8 | import com.lyms.talkonlineweb.domain.*; |
| 9 | +import com.lyms.talkonlineweb.enums.VisitEnum; | |
| 9 | 10 | import com.lyms.talkonlineweb.service.*; |
| 10 | 11 | import com.lyms.talkonlineweb.util.*; |
| 11 | 12 | import lombok.Data; |
| ... | ... | @@ -61,6 +62,10 @@ |
| 61 | 62 | |
| 62 | 63 | @Autowired |
| 63 | 64 | private LymsTkrecordService lymsTkrecordService; |
| 65 | + @Autowired | |
| 66 | + private LymsPushVisitRecordService lymsPushVisitRecordService; | |
| 67 | + @Autowired | |
| 68 | + private PushArticleTask pushArticleTask; | |
| 64 | 69 | |
| 65 | 70 | /** |
| 66 | 71 | * 每天19点执行自动回访功能 |
| ... | ... | @@ -70,7 +75,7 @@ |
| 70 | 75 | * 第二十天:就诊医生 |
| 71 | 76 | * 第三十天:值班医生 |
| 72 | 77 | */ |
| 73 | - @Scheduled(cron = "0 0 19 * * ?") | |
| 78 | +// @Scheduled(cron = "0 0 19 * * ?") | |
| 74 | 79 | public void pushChatInfo() { |
| 75 | 80 | //用户下的病例信息。每个环信群组代表一个病例,一个病例下有多个疾病种类。 |
| 76 | 81 | List<Map<String,Object>> PcInfoList=lymsPatientService.getPcInfoList(); |
| 77 | 82 | |
| 78 | 83 | |
| 79 | 84 | |
| 80 | 85 | |
| 81 | 86 | |
| 82 | 87 | |
| ... | ... | @@ -83,38 +88,25 @@ |
| 83 | 88 | //医生信息 |
| 84 | 89 | LymsDoctor doctor= lymsDoctorService.getOne(new QueryWrapper<LymsDoctor>() |
| 85 | 90 | .lambda().eq(LymsDoctor::getDlogin, map.get("dlogin").toString())); |
| 86 | - //回访记录 | |
| 87 | - final List<LymsReturnVisitRecord> returnVisitRecords = lymsReturnVisitRecordService.list(new QueryWrapper<LymsReturnVisitRecord>() | |
| 88 | - .lambda().eq(LymsReturnVisitRecord::getPcid, (Integer)map.get("pcid")) | |
| 89 | - .eq(LymsReturnVisitRecord::getType, 0)); | |
| 91 | + | |
| 90 | 92 | //计算(自动回复周期上传病例后- 1:第二天2:第五天3:第十天4:第二十天5:第三十天) |
| 91 | 93 | int day = DateUtil.daysBetween(DateUtil.parseYMD(map.get("createdtime").toString()),new Date()); |
| 92 | - switch (returnVisitRecords.size()) { | |
| 93 | - case 0: | |
| 94 | - if (day==1) { | |
| 95 | - getEverydayInfo(map,patient,doctor,0,1); | |
| 96 | - } | |
| 97 | - break; | |
| 94 | + switch (day) { | |
| 98 | 95 | case 1: |
| 99 | - if (day==4) { | |
| 100 | - getEverydayInfo(map,patient,doctor,2,2); | |
| 101 | - } | |
| 96 | + getEverydayInfo(map,patient,doctor,0,1); | |
| 102 | 97 | break; |
| 103 | - case 2: | |
| 104 | - if (day==9) { | |
| 105 | - getEverydayInfo(map,patient,doctor,1,3); | |
| 106 | - } | |
| 98 | + case 4: | |
| 99 | + getEverydayInfo(map,patient,doctor,2,2); | |
| 107 | 100 | break; |
| 108 | - case 3: | |
| 109 | - if (day==19) { | |
| 110 | - getEverydayInfo(map,patient,doctor,0,4); | |
| 111 | - } | |
| 101 | + case 9: | |
| 102 | + getEverydayInfo(map,patient,doctor,1,3); | |
| 112 | 103 | break; |
| 113 | - case 4: | |
| 114 | - if (day==29) { | |
| 115 | - getEverydayInfo(map,patient,doctor,1,5); | |
| 116 | - } | |
| 104 | + case 19: | |
| 105 | + getEverydayInfo(map,patient,doctor,0,4); | |
| 117 | 106 | break; |
| 107 | + case 20: | |
| 108 | + getEverydayInfo(map,patient,doctor,1,5); | |
| 109 | + break; | |
| 118 | 110 | } |
| 119 | 111 | } catch (Exception e) { |
| 120 | 112 | e.printStackTrace(); |
| 121 | 113 | |
| 122 | 114 | |
| 123 | 115 | |
| 124 | 116 | |
| 125 | 117 | |
| 126 | 118 | |
| 127 | 119 | |
| 128 | 120 | |
| 129 | 121 | |
| ... | ... | @@ -131,199 +123,187 @@ |
| 131 | 123 | * @param adminType 0:就诊医生 1:值班医生 2:值班护士 |
| 132 | 124 | * @param ChatInfoType 自动回复周期上传病例后- 1:第二天2:第五天3:第十天4:第二十天5:第三十天 |
| 133 | 125 | */ |
| 134 | - @Transactional(rollbackFor = Exception.class) | |
| 135 | - public void getEverydayInfo(Map<String,Object> map,LymsPatient patient,LymsDoctor doctor,int adminType,int ChatInfoType){ | |
| 136 | - //值班医生/值班护士信息 | |
| 137 | - List<LymsDoctor> doctorAminList= lymsDoctorService.list(new QueryWrapper<LymsDoctor>() | |
| 138 | - .lambda().eq(LymsDoctor::getDpid, doctor.getDpid()) | |
| 139 | - .in(LymsDoctor::getAdminType, Arrays.asList(1,2)) | |
| 140 | - .orderByAsc(LymsDoctor::getAdminType)); | |
| 141 | - //环信群组信息 | |
| 142 | - LymsChatgroup chatgroup = lymsChatgroupService.getOne(new QueryWrapper<LymsChatgroup>() | |
| 143 | - .lambda().eq(LymsChatgroup::getPcid, (Integer)map.get("pcid"))); | |
| 144 | - if(null==chatgroup){ | |
| 145 | - //创建聊天群组 | |
| 146 | - chatgroup=addChatGroup(map,patient,doctor); | |
| 147 | - } | |
| 148 | - //获取 就诊医生/值班医生/值班护士账号 | |
| 149 | - String dlogin=""; | |
| 150 | - if(adminType!=0) { | |
| 151 | - for (LymsDoctor lymsDoctor : doctorAminList) { | |
| 152 | - if (lymsDoctor.getAdminType() == adminType) { | |
| 153 | - dlogin = lymsDoctor.getDlogin(); | |
| 154 | - break; | |
| 126 | + @Transactional(rollbackFor = {Exception.class,RuntimeException.class}) | |
| 127 | + public void getEverydayInfo(Map<String,Object> map,LymsPatient patient,LymsDoctor doctor,int adminType,int ChatInfoType) throws Exception,RuntimeException { | |
| 128 | + try { | |
| 129 | + //值班医生/值班护士信息 | |
| 130 | + List<LymsDoctor> doctorAminList= lymsDoctorService.list(new QueryWrapper<LymsDoctor>() | |
| 131 | + .lambda().eq(LymsDoctor::getDpid, doctor.getDpid()) | |
| 132 | + .in(LymsDoctor::getAdminType, Arrays.asList(1,2)) | |
| 133 | + .orderByAsc(LymsDoctor::getAdminType)); | |
| 134 | + //获取 就诊医生/值班医生/值班护士账号 | |
| 135 | + LymsDoctor doctor2=new LymsDoctor(); | |
| 136 | + if(adminType!=0) { | |
| 137 | + for (LymsDoctor lymsDoctor : doctorAminList) { | |
| 138 | + if (lymsDoctor.getAdminType() == adminType) { | |
| 139 | + doctor2 = lymsDoctor; | |
| 140 | + break; | |
| 141 | + } | |
| 155 | 142 | } |
| 156 | - } | |
| 157 | - }else { | |
| 158 | - dlogin=doctor.getDlogin(); | |
| 159 | - } | |
| 160 | - //病例下的疾病 | |
| 161 | - final List<LymsIllness> lymsIllnessList = lymsIllnessService.list(new QueryWrapper<LymsIllness>() | |
| 162 | - .lambda().eq(LymsIllness::getPcid, (Integer) map.get("pcid"))); | |
| 163 | - for (LymsIllness lymsIllness : lymsIllnessList) { | |
| 164 | - //要推送的疾病对应的话术 | |
| 165 | - final LymsChatInfo chatInfo = lymsChatInfoService.getOne(new QueryWrapper<LymsChatInfo>() | |
| 166 | - .lambda().eq(LymsChatInfo::getIllid, lymsIllness.getIid()) | |
| 167 | - .eq(LymsChatInfo::getType, ChatInfoType)); | |
| 168 | - ///推送回访 | |
| 169 | - if (null!=chatInfo && StringUtil.isNotEmpty(chatgroup.getHxgroupid()) && null!=doctor) { | |
| 170 | - //推送回访消息和保存发送记录 | |
| 171 | - pushOrMessage(dlogin,chatgroup,chatInfo,doctor); | |
| 172 | 143 | }else { |
| 173 | - throw new RuntimeException("参数不符合"); | |
| 144 | + doctor2=doctor; | |
| 174 | 145 | } |
| 175 | - } | |
| 176 | - //增加回访记录,修改环信群组状态,修改问诊记录状态 | |
| 177 | - addReturnVisitRecordOrUpdate(dlogin,chatgroup ,patient,doctor); | |
| 178 | - } | |
| 179 | - | |
| 180 | - /** | |
| 181 | - * 创建环信群组 | |
| 182 | - * @param map | |
| 183 | - * @param patient | |
| 184 | - * @param doctor | |
| 185 | - * @return | |
| 186 | - */ | |
| 187 | - @Transactional(rollbackFor = Exception.class) | |
| 188 | - public LymsChatgroup addChatGroup(Map<String,Object> map,LymsPatient patient,LymsDoctor doctor){ | |
| 189 | - List<String> adminDlogins=new ArrayList<>(); | |
| 190 | - adminDlogins.add(patient.getIdno()); | |
| 191 | - List<String> groupnames=new ArrayList<>(); | |
| 192 | - groupnames.add(patient.getPname()); | |
| 193 | - //患者注册环信 | |
| 194 | - if (StringUtil.isEmpty(patient.getHxid())) { | |
| 195 | - JSONObject json = hxService.addUser(patient.getIdno(), Constant.COMMON_PASSWD, patient.getPname()); | |
| 196 | - JSONArray rArr = json.getJSONArray("entities"); | |
| 197 | - if (rArr.size() > 0) { | |
| 198 | - patient.setHxid(rArr.getJSONObject(0).getString("uuid")); | |
| 199 | - final boolean b = lymsPatientService.updateById(patient); | |
| 200 | - if (!b) { | |
| 201 | - throw new RuntimeException("回滚状态,执行失败,请联系管理员"); | |
| 202 | - } | |
| 203 | - }else { | |
| 204 | - throw new RuntimeException("回滚状态,执行失败,请联系管理员"); | |
| 205 | - } | |
| 206 | - } | |
| 207 | - //查询值班医生/值班护士 | |
| 208 | - List<LymsDoctor> doctorAminList= lymsDoctorService.list(new QueryWrapper<LymsDoctor>() | |
| 209 | - .lambda().eq(LymsDoctor::getDpid, doctor.getDpid()) | |
| 210 | - .in(LymsDoctor::getAdminType, Arrays.asList(1,2)) | |
| 211 | - .orderByAsc(LymsDoctor::getAdminType)); | |
| 212 | - //科室值班医生注册环信 | |
| 213 | - for (LymsDoctor lymsDoctor : doctorAminList) { | |
| 214 | - if(StringUtil.isEmpty(lymsDoctor.getHxid())) { | |
| 215 | - JSONObject json = hxService.addUser(lymsDoctor.getDlogin(), Constant.COMMON_PASSWD, lymsDoctor.getDname()); | |
| 216 | - JSONArray rArr = json.getJSONArray("entities"); | |
| 217 | - if (rArr.size() > 0) { | |
| 218 | - lymsDoctor.setHxid(rArr.getJSONObject(0).getString("uuid")); | |
| 219 | - final boolean b = lymsDoctorService.updateById(lymsDoctor); | |
| 220 | - if (!b) { | |
| 221 | - throw new RuntimeException("回滚状态,执行失败,请联系管理员"); | |
| 146 | + //环信群组 | |
| 147 | + LymsChatgroup chatgroup=null; | |
| 148 | + //病例下的疾病 | |
| 149 | + final List<LymsIllness> lymsIllnessList = lymsIllnessService.list(new QueryWrapper<LymsIllness>() | |
| 150 | + .lambda().eq(LymsIllness::getPcid, (Integer) map.get("pcid"))); | |
| 151 | + for (LymsIllness lymsIllness : lymsIllnessList) { | |
| 152 | + //要推送的疾病对应的话术 | |
| 153 | + final LymsChatInfo chatInfo = lymsChatInfoService.getOne(new QueryWrapper<LymsChatInfo>() | |
| 154 | + .lambda().eq(LymsChatInfo::getIllid, lymsIllness.getIid()) | |
| 155 | + .eq(LymsChatInfo::getType, ChatInfoType)); | |
| 156 | + ///推送回访 | |
| 157 | + if (null!=chatInfo && null!=doctor2) { | |
| 158 | + //环信群组信息 | |
| 159 | + chatgroup = lymsChatgroupService.getOne(new QueryWrapper<LymsChatgroup>() | |
| 160 | + .lambda().eq(LymsChatgroup::getPcid, (Integer)map.get("pcid"))); | |
| 161 | + if(null==chatgroup){ | |
| 162 | + //创建聊天群组 | |
| 163 | + List<String> adminDlogins=new ArrayList<>(); | |
| 164 | + adminDlogins.add(patient.getIdno()); | |
| 165 | + List<String> groupnames=new ArrayList<>(); | |
| 166 | + groupnames.add(patient.getPname()); | |
| 167 | + //患者注册环信 | |
| 168 | + if (StringUtil.isEmpty(patient.getHxid())) { | |
| 169 | + JSONObject json = hxService.addUser(patient.getIdno(), Constant.COMMON_PASSWD, patient.getPname()); | |
| 170 | + JSONArray rArr = json.getJSONArray("entities"); | |
| 171 | + if (rArr.size() > 0) { | |
| 172 | + patient.setHxid(rArr.getJSONObject(0).getString("uuid")); | |
| 173 | + final boolean b = lymsPatientService.updateById(patient); | |
| 174 | + if (!b) { | |
| 175 | + throw new Exception("回滚状态,执行失败,请联系管理员"); | |
| 176 | + } | |
| 177 | + }else { | |
| 178 | + throw new Exception("回滚状态,执行失败,请联系管理员"); | |
| 179 | + } | |
| 180 | + } | |
| 181 | + //科室值班医生注册环信 | |
| 182 | + for (LymsDoctor lymsDoctor : doctorAminList) { | |
| 183 | + if(StringUtil.isEmpty(lymsDoctor.getHxid())) { | |
| 184 | + JSONObject json = hxService.addUser(lymsDoctor.getDlogin(), Constant.COMMON_PASSWD, lymsDoctor.getDname()); | |
| 185 | + JSONArray rArr = json.getJSONArray("entities"); | |
| 186 | + if (rArr.size() > 0) { | |
| 187 | + lymsDoctor.setHxid(rArr.getJSONObject(0).getString("uuid")); | |
| 188 | + final boolean b = lymsDoctorService.updateById(lymsDoctor); | |
| 189 | + if (!b) { | |
| 190 | + throw new Exception("回滚状态,执行失败,请联系管理员"); | |
| 191 | + } | |
| 192 | + } | |
| 193 | + } | |
| 194 | + adminDlogins.add(lymsDoctor.getDlogin()); | |
| 195 | + groupnames.add(lymsDoctor.getDname()); | |
| 196 | + } | |
| 197 | + if ( ! adminDlogins.contains(doctor.getDlogin())) { | |
| 198 | + //医生注册环信 | |
| 199 | + if (StringUtil.isEmpty(doctor.getHxid())) { | |
| 200 | + JSONObject json = hxService.addUser(doctor.getDlogin(), Constant.COMMON_PASSWD, doctor.getDname()); | |
| 201 | + JSONArray rArr = json.getJSONArray("entities"); | |
| 202 | + if (rArr.size() > 0) { | |
| 203 | + doctor.setHxid(rArr.getJSONObject(0).getString("uuid")); | |
| 204 | + final boolean b = lymsDoctorService.updateById(doctor); | |
| 205 | + if (!b) { | |
| 206 | + throw new Exception("回滚状态,执行失败,请联系管理员"); | |
| 207 | + } | |
| 208 | + } | |
| 209 | + } | |
| 210 | + adminDlogins.add(doctor.getDlogin()); | |
| 211 | + groupnames.add(doctor.getDname()); | |
| 212 | + } | |
| 213 | + JSONObject rJson = hxService.addChatGroups(StringUtils.join(adminDlogins.toArray(), ","), hxuser, adminDlogins.toArray(new String[adminDlogins.size()])); | |
| 214 | + LymsChatgroup group =new LymsChatgroup(); | |
| 215 | + group.setGroupname(StringUtils.join(groupnames.toArray(), ",")); | |
| 216 | + group.setDescription(StringUtils.join(adminDlogins.toArray(), ",")); | |
| 217 | + group.setOwnerk(hxuser); | |
| 218 | + group.setFromp(patient.getIdno()); | |
| 219 | + group.setHxgroupid(rJson.getJSONObject("data").getString("groupid")); | |
| 220 | + group.setTarget(doctor.getDlogin()); | |
| 221 | + group.setType(1); | |
| 222 | + group.setStat(0); | |
| 223 | + group.setPcid((Integer)map.get("pcid")); | |
| 224 | + final boolean save = lymsChatgroupService.save(group); | |
| 225 | + if (!save) { | |
| 226 | + throw new Exception("回滚状态,执行失败,请联系管理员"); | |
| 227 | + } | |
| 228 | + chatgroup=group; | |
| 222 | 229 | } |
| 223 | - } | |
| 224 | - } | |
| 225 | - adminDlogins.add(lymsDoctor.getDlogin()); | |
| 226 | - groupnames.add(lymsDoctor.getDname()); | |
| 227 | - } | |
| 228 | - if ( ! adminDlogins.contains(doctor.getDlogin())) { | |
| 229 | - //医生注册环信 | |
| 230 | - if (StringUtil.isEmpty(doctor.getHxid())) { | |
| 231 | - JSONObject json = hxService.addUser(doctor.getDlogin(), Constant.COMMON_PASSWD, doctor.getDname()); | |
| 232 | - JSONArray rArr = json.getJSONArray("entities"); | |
| 233 | - if (rArr.size() > 0) { | |
| 234 | - doctor.setHxid(rArr.getJSONObject(0).getString("uuid")); | |
| 235 | - final boolean b = lymsDoctorService.updateById(doctor); | |
| 236 | - if (!b) { | |
| 237 | - throw new RuntimeException("回滚状态,执行失败,请联系管理员"); | |
| 230 | + //推送回访消息和保存发送记录 | |
| 231 | + JSONObject jsonObject = hxService.sendGroupMsg(new String[]{chatgroup.getHxgroupid()}, chatInfo.getConten(), doctor2.getDlogin()); | |
| 232 | + if (null!=jsonObject) { | |
| 233 | + //保存发送消息记录 | |
| 234 | + LymsMessage message=new LymsMessage(); | |
| 235 | + message.setContent(chatInfo.getConten()); | |
| 236 | + message.setFromid(doctor2.getDlogin()); | |
| 237 | + message.setTargetid(chatgroup.getHxgroupid()); | |
| 238 | + message.setMtype("TEXT"); | |
| 239 | + message.setSendtime(new Date()); | |
| 240 | + message.setType(1); | |
| 241 | + final boolean save = lymsMessageService.save(message); | |
| 242 | + if (! save) { | |
| 243 | + throw new Exception("回滚状态,执行失败,请联系管理员"); | |
| 244 | + } | |
| 245 | + }else { | |
| 246 | + throw new Exception("回滚状态,执行失败,请联系管理员"); | |
| 238 | 247 | } |
| 248 | + //同时推送公众号消息 | |
| 249 | + Map<String,Object> mapTemplate=new HashMap<>(); | |
| 250 | + String content=chatInfo.getConten().substring(0,50)+"..."; | |
| 251 | + mapTemplate.put("first",new DataEntity(content,"#173177")); | |
| 252 | + mapTemplate.put("keyword1",new DataEntity(doctor2.getDname(),"#173177")); | |
| 253 | + mapTemplate.put("keyword2",new DataEntity(DateUtil.getyyyy_MM_dd1(new Date()),"#173177")); | |
| 254 | + mapTemplate.put("remark",new DataEntity("请点击下方进入小程序,根据病例点咨询查看医生回访信息。","#173177")); | |
| 255 | + Map<String,Object> mapInfo = pushArticleTask.pLoginInfo(patient.getId()); | |
| 256 | + Integer code= WeiXinUtil.SendWeChatMsg(patient.getGzopenid(),Constant.GZ_TEMPLATE_ID_DOCTOR_VISIT,mapTemplate,mapInfo); | |
| 257 | + //保存推送记录 | |
| 258 | + LymsPushVisitRecord lymsPushVisitRecord=new LymsPushVisitRecord(); | |
| 259 | + lymsPushVisitRecord.setPid(patient.getId()); | |
| 260 | + lymsPushVisitRecord.setPname(patient.getPname()); | |
| 261 | + lymsPushVisitRecord.setIid(lymsIllness.getIid()); | |
| 262 | + lymsPushVisitRecord.setIiname(lymsIllness.getIname()); | |
| 263 | + lymsPushVisitRecord.setDid(doctor2.getDid()); | |
| 264 | + lymsPushVisitRecord.setDname(doctor2.getDname()); | |
| 265 | + lymsPushVisitRecord.setType(chatInfo.getType()); | |
| 266 | + lymsPushVisitRecord.setContent(chatInfo.getConten()); | |
| 267 | + lymsPushVisitRecord.setState((null==code||code!=0)?2:1);//推送状态: 1成功 2失败。 | |
| 268 | + lymsPushVisitRecord.setRemark("推送短消息-> " + VisitEnum.getName(chatInfo.getType())+" - "+patient.getPname()+" ;回访医生:"+doctor2.getDname()+";疾病名称:"+ lymsIllness.getIname() + "; [ "+(lymsPushVisitRecord.getState()==1?"成功":"失败")+"]; code:" + code); | |
| 269 | + lymsPushVisitRecordService.save(lymsPushVisitRecord); | |
| 270 | + }else { | |
| 271 | + throw new Exception("回滚操作,没有疾病话术。"); | |
| 239 | 272 | } |
| 240 | 273 | } |
| 241 | - adminDlogins.add(doctor.getDlogin()); | |
| 242 | - groupnames.add(doctor.getDname()); | |
| 243 | - } | |
| 244 | - JSONObject rJson = hxService.addChatGroups(StringUtils.join(adminDlogins.toArray(), ","), hxuser, adminDlogins.toArray(new String[adminDlogins.size()])); | |
| 245 | - LymsChatgroup group =new LymsChatgroup(); | |
| 246 | - group.setGroupname(StringUtils.join(groupnames.toArray(), ",")); | |
| 247 | - group.setDescription(StringUtils.join(adminDlogins.toArray(), ",")); | |
| 248 | - group.setOwnerk(hxuser); | |
| 249 | - group.setFromp(patient.getIdno()); | |
| 250 | - group.setHxgroupid(rJson.getJSONObject("data").getString("groupid")); | |
| 251 | - group.setTarget(doctor.getDlogin()); | |
| 252 | - group.setType(1); | |
| 253 | - group.setStat(0); | |
| 254 | - group.setPcid((Integer)map.get("pcid")); | |
| 255 | - final boolean save = lymsChatgroupService.save(group); | |
| 256 | - if (!save) { | |
| 257 | - throw new RuntimeException("回滚状态,执行失败,请联系管理员"); | |
| 258 | - } | |
| 259 | - return group; | |
| 260 | - } | |
| 261 | - | |
| 262 | - /** | |
| 263 | - * 推送回访消息和保存发送记录 | |
| 264 | - * @param dlogin 发送医生 | |
| 265 | - * @param chatgroup | |
| 266 | - * @param chatInfo | |
| 267 | - * @param doctor | |
| 268 | - */ | |
| 269 | - @Transactional(rollbackFor = Exception.class) | |
| 270 | - public void pushOrMessage(String dlogin,LymsChatgroup chatgroup,LymsChatInfo chatInfo,LymsDoctor doctor) { | |
| 271 | - JSONObject jsonObject = hxService.sendGroupMsg(new String[]{chatgroup.getHxgroupid()}, chatInfo.getConten(), StringUtil.isEmpty(dlogin)? doctor.getDlogin():dlogin); | |
| 272 | - if (null!=jsonObject) { | |
| 273 | - //保存发送消息记录 | |
| 274 | - LymsMessage message=new LymsMessage(); | |
| 275 | - message.setContent(chatInfo.getConten()); | |
| 276 | - message.setFromid(dlogin); | |
| 277 | - message.setTargetid(chatgroup.getHxgroupid()); | |
| 278 | - message.setMtype("TEXT"); | |
| 279 | - message.setSendtime(new Date()); | |
| 280 | - message.setType(1); | |
| 281 | - final boolean save = lymsMessageService.save(message); | |
| 282 | - if (! save) { | |
| 283 | - throw new RuntimeException("回滚状态,执行失败,请联系管理员"); | |
| 274 | + //增加回访记录,修改环信群组状态,修改问诊记录状态 | |
| 275 | + LymsReturnVisitRecord returnVisitRecord=new LymsReturnVisitRecord(); | |
| 276 | + returnVisitRecord.setDlogin(doctor2.getDlogin()); | |
| 277 | + returnVisitRecord.setDpid(doctor2.getDpid()); | |
| 278 | + returnVisitRecord.setIdno(patient.getIdno()); | |
| 279 | + returnVisitRecord.setType(0); | |
| 280 | + returnVisitRecord.setHxgroupid(chatgroup.getHxgroupid()); | |
| 281 | + returnVisitRecord.setPcid(chatgroup.getPcid()); | |
| 282 | + final boolean save = lymsReturnVisitRecordService.save(returnVisitRecord); | |
| 283 | + if (!save) { | |
| 284 | + throw new Exception("回滚状态,执行失败,请联系管理员"); | |
| 284 | 285 | } |
| 285 | - }else { | |
| 286 | - throw new RuntimeException("回滚状态,执行失败,请联系管理员"); | |
| 287 | - } | |
| 288 | - } | |
| 289 | - | |
| 290 | - /** | |
| 291 | - * 增加回访记录,修改环信群组状态,修改问诊记录状态 | |
| 292 | - * @param dlogin | |
| 293 | - * @param chatgroup | |
| 294 | - * @param patient | |
| 295 | - * @param doctor | |
| 296 | - */ | |
| 297 | - @Transactional(rollbackFor = Exception.class) | |
| 298 | - public void addReturnVisitRecordOrUpdate(String dlogin,LymsChatgroup chatgroup ,LymsPatient patient,LymsDoctor doctor) { | |
| 299 | - //增加回访记录 | |
| 300 | - LymsReturnVisitRecord returnVisitRecord=new LymsReturnVisitRecord(); | |
| 301 | - returnVisitRecord.setDlogin(dlogin); | |
| 302 | - returnVisitRecord.setDpid(doctor.getDpid()); | |
| 303 | - returnVisitRecord.setIdno(patient.getIdno()); | |
| 304 | - returnVisitRecord.setType(0); | |
| 305 | - returnVisitRecord.setHxgroupid(chatgroup.getHxgroupid()); | |
| 306 | - returnVisitRecord.setPcid(chatgroup.getPcid()); | |
| 307 | - final boolean save = lymsReturnVisitRecordService.save(returnVisitRecord); | |
| 308 | - if (!save) { | |
| 309 | - throw new RuntimeException("回滚状态,执行失败,请联系管理员"); | |
| 310 | - } | |
| 311 | - chatgroup.setType(1); | |
| 312 | - chatgroup.setStat(0); | |
| 313 | - final boolean b = lymsChatgroupService.updateById(chatgroup); | |
| 314 | - if (!b) { | |
| 315 | - throw new RuntimeException("回滚状态,执行失败,请联系管理员"); | |
| 316 | - } | |
| 317 | - //修改同一群组记录的状态 | |
| 318 | - final List<LymsTkrecord> tkrecordList = lymsTkrecordService.list(new QueryWrapper<LymsTkrecord>() | |
| 319 | - .lambda().eq(LymsTkrecord::getHxgroupid, chatgroup.getHxgroupid())); | |
| 320 | - for (LymsTkrecord lymsTkrecord : tkrecordList) { | |
| 321 | - lymsTkrecord.setStat(0); | |
| 322 | - final boolean saveOrUpdate = lymsTkrecordService.updateById(lymsTkrecord); | |
| 323 | - if (!saveOrUpdate) { | |
| 324 | - throw new RuntimeException("回滚状态,执行失败,请联系管理员"); | |
| 286 | + chatgroup.setType(1); | |
| 287 | + chatgroup.setStat(0); | |
| 288 | + final boolean b = lymsChatgroupService.updateById(chatgroup); | |
| 289 | + if (!b) { | |
| 290 | + throw new Exception("回滚状态,执行失败,请联系管理员"); | |
| 325 | 291 | } |
| 292 | + //修改同一群组记录的状态 | |
| 293 | + final List<LymsTkrecord> tkrecordList = lymsTkrecordService.list(new QueryWrapper<LymsTkrecord>() | |
| 294 | + .lambda().eq(LymsTkrecord::getHxgroupid, chatgroup.getHxgroupid())); | |
| 295 | + for (LymsTkrecord lymsTkrecord : tkrecordList) { | |
| 296 | + lymsTkrecord.setStat(0); | |
| 297 | + final boolean saveOrUpdate = lymsTkrecordService.updateById(lymsTkrecord); | |
| 298 | + if (!saveOrUpdate) { | |
| 299 | + throw new Exception("回滚状态,执行失败,请联系管理员"); | |
| 300 | + } | |
| 301 | + } | |
| 302 | + } catch (Exception e) { | |
| 303 | + e.printStackTrace(); | |
| 304 | + throw new Exception("回滚状态,执行失败,请联系管理员"); | |
| 326 | 305 | } |
| 327 | 306 | } |
| 307 | + | |
| 328 | 308 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/Constant.java
View file @
5bf0784
| ... | ... | @@ -14,11 +14,11 @@ |
| 14 | 14 | */ |
| 15 | 15 | public static final String MCHID = "1426009502"; |
| 16 | 16 | |
| 17 | + | |
| 17 | 18 | /** |
| 18 | 19 | * 患者小程序appid |
| 19 | 20 | */ |
| 20 | 21 | public static final String PAT_APP_ID = "wxe3b5c34317a0f85b"; |
| 21 | - | |
| 22 | 22 | /** |
| 23 | 23 | * 签名加密 key |
| 24 | 24 | */ |
| ... | ... | @@ -54,6 +54,10 @@ |
| 54 | 54 | * 公众号发送消息模板-复诊提醒消息 |
| 55 | 55 | */ |
| 56 | 56 | public static final String GZ_TEMPLATE_ID_RETURN_VISIT ="1xjLJ7LzI-v7qy12QBOKqfv0j3sbN-2lmeXH5GHz7YA"; |
| 57 | + /** | |
| 58 | + * 公众号发送消息模板-医生回访提醒消息 | |
| 59 | + */ | |
| 60 | + public static final String GZ_TEMPLATE_ID_DOCTOR_VISIT ="81VRsOtBixUDZV2_XRTIPYPNnFjzo6X_d4jN5D4JVb8"; | |
| 57 | 61 | /** |
| 58 | 62 | * 公众号的appid |
| 59 | 63 | */ |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/WeiXinUtil.java
View file @
5bf0784
| ... | ... | @@ -93,7 +93,7 @@ |
| 93 | 93 | miniprogram.put("appid",Constant.PAT_APP_ID); |
| 94 | 94 | //登录数据 |
| 95 | 95 | if(CollectionUtils.isNotEmpty(mapInfo) && null!=mapInfo.get("plogin") && null!=mapInfo.get("passwd")){ |
| 96 | - if(null==mapInfo.get("type") || 1==(int) mapInfo.get("type")) {//null是正常推送状态。 有值是亲属关注时的状态 | |
| 96 | + if(null==mapInfo.get("type") || 1==(int) mapInfo.get("type")) {//null是正常推送状态。 1有值是亲属关注时的状态 2没有病例的时候 | |
| 97 | 97 | miniprogram.put("pagepath", "pages/news/news?plogin=" + mapInfo.get("plogin") + "&passwd=" + mapInfo.get("passwd"));// 注意,这里是支持传参的!!! |
| 98 | 98 | }else { |
| 99 | 99 | miniprogram.put("pagepath","pages/concernList/concernList?plogin="+mapInfo.get("plogin")+"&passwd="+mapInfo.get("passwd"));// 没有病例跳转地址 |
talkonlineweb/src/main/resources/mapper/LymsPushVisitRecordMapper.xml
View file @
5bf0784
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper | |
| 3 | + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |
| 4 | + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 5 | +<mapper namespace="com.lyms.talkonlineweb.mapper.LymsPushVisitRecordMapper"> | |
| 6 | + | |
| 7 | + <resultMap id="BaseResultMap" type="com.lyms.talkonlineweb.domain.LymsPushVisitRecord"> | |
| 8 | + <id property="id" column="id" jdbcType="INTEGER"/> | |
| 9 | + <result property="pid" column="pid" jdbcType="INTEGER"/> | |
| 10 | + <result property="pname" column="pname" jdbcType="VARCHAR"/> | |
| 11 | + <result property="iid" column="iid" jdbcType="INTEGER"/> | |
| 12 | + <result property="iiname" column="iiname" jdbcType="VARCHAR"/> | |
| 13 | + <result property="did" column="did" jdbcType="INTEGER"/> | |
| 14 | + <result property="dname" column="dname" jdbcType="VARCHAR"/> | |
| 15 | + <result property="type" column="type" jdbcType="INTEGER"/> | |
| 16 | + <result property="content" column="content" jdbcType="VARCHAR"/> | |
| 17 | + <result property="state" column="state" jdbcType="INTEGER"/> | |
| 18 | + <result property="remark" column="remark" jdbcType="VARCHAR"/> | |
| 19 | + <result property="createdtime" column="createdtime" jdbcType="TIMESTAMP"/> | |
| 20 | + <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> | |
| 21 | + </resultMap> | |
| 22 | + | |
| 23 | + <sql id="Base_Column_List"> | |
| 24 | + id,pid,pname, | |
| 25 | + iid,iiname,did, | |
| 26 | + dname,type,content, | |
| 27 | + state,remark,createdtime, | |
| 28 | + update_time | |
| 29 | + </sql> | |
| 30 | +</mapper> |