Commit 00901f8a900e72d797a57acd5b3a3669f2c0130c
1 parent
9f218cb902
Exists in
master
and in
1 other branch
医生回访功能
Showing 10 changed files with 236 additions and 31 deletions
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ChatGroupController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/CommonController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DepartController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/TkRecordController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsChatgroup.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsTkrecord.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsChatgroupMapper.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsChatgroupService.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsChatgroupServiceImpl.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/DateUtil.java
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ChatGroupController.java
View file @
00901f8
| ... | ... | @@ -5,13 +5,17 @@ |
| 5 | 5 | import com.alibaba.fastjson.JSONObject; |
| 6 | 6 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 7 | 7 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 8 | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |
| 8 | 9 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 9 | 10 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| 10 | 11 | import com.lyms.talkonlineweb.annotation.TokenRequired; |
| 12 | +import com.lyms.talkonlineweb.constants.ErrorCodeConstants; | |
| 11 | 13 | import com.lyms.talkonlineweb.domain.*; |
| 12 | 14 | import com.lyms.talkonlineweb.result.BaseResponse; |
| 13 | 15 | import com.lyms.talkonlineweb.service.*; |
| 16 | +import com.lyms.talkonlineweb.util.DateUtil; | |
| 14 | 17 | import com.lyms.talkonlineweb.util.HXService; |
| 18 | +import com.lyms.talkonlineweb.util.StringUtil; | |
| 15 | 19 | import lombok.extern.log4j.Log4j2; |
| 16 | 20 | import org.apache.commons.io.IOUtils; |
| 17 | 21 | import org.springframework.beans.BeanUtils; |
| 18 | 22 | |
| ... | ... | @@ -120,12 +124,14 @@ |
| 120 | 124 | log.info(">>>>>>>>>>chatgroup:" + chatgroup); |
| 121 | 125 | BaseResponse baseResponse = new BaseResponse(); |
| 122 | 126 | Map<String, Object> rs = new HashMap<>(); |
| 123 | - | |
| 127 | + //不作为条件查询 | |
| 128 | + Integer type=chatgroup.getType(); | |
| 129 | + chatgroup.setType(null); | |
| 124 | 130 | // chatgroup = lymsChatgroupService.getOne(Wrappers.query(chatgroup)); |
| 125 | 131 | List<LymsChatgroup> gLst = lymsChatgroupService.list(Wrappers.query(chatgroup).orderByDesc("id")); |
| 126 | 132 | |
| 127 | 133 | if (gLst.size()>0){ |
| 128 | - chatgroup=gLst.get(0); | |
| 134 | + chatgroup = gLst.get(0); | |
| 129 | 135 | } |
| 130 | 136 | LymsDoctor doctor = new LymsDoctor(); |
| 131 | 137 | doctor = lymsDoctorService.getOne(Wrappers.query(doctor).eq("dlogin", chatgroup.getTarget())); |
| ... | ... | @@ -137,7 +143,24 @@ |
| 137 | 143 | |
| 138 | 144 | List<Map<String, Object>> tmpList = lymsChatgroupService.getPinfoBySesson(null, doctor.getDid().toString(), chatgroup.getHxgroupid()); |
| 139 | 145 | if (tmpList.size() > 0) { |
| 140 | - rs.put("sess",tmpList.get(0)); | |
| 146 | + if(null==type) { | |
| 147 | + rs.put("sess", tmpList.get(0)); | |
| 148 | + }else { | |
| 149 | + //修改为恢复聊天状态 | |
| 150 | + LymsTkrecord tkrecord=new LymsTkrecord(); | |
| 151 | + tkrecord.setId((Integer) tmpList.get(0).get("rid")); | |
| 152 | + tkrecord.setStat(0); | |
| 153 | + lymsTkrecordService.updateById(tkrecord); | |
| 154 | + tmpList.get(0).put("stat", 0); | |
| 155 | + rs.put("sess", tmpList.get(0)); | |
| 156 | + } | |
| 157 | + }else { | |
| 158 | + //防止重复创建组 | |
| 159 | + if(null!=type && 1==type && CollectionUtils.isNotEmpty(gLst)){ | |
| 160 | + Map<String, Object> map=new HashMap<>(); | |
| 161 | + map.put("stat", 0); | |
| 162 | + rs.put("sess", tmpList.add(map)); | |
| 163 | + } | |
| 141 | 164 | } |
| 142 | 165 | |
| 143 | 166 | rs.put("doctor", doctor); |
| ... | ... | @@ -194,6 +217,7 @@ |
| 194 | 217 | /** |
| 195 | 218 | * 根据环信传入的会话,获取用户信息 |
| 196 | 219 | * @param request |
| 220 | + * @param type 医生回访停止回话用 | |
| 197 | 221 | * @return |
| 198 | 222 | */ |
| 199 | 223 | @PostMapping("getSessionListInfo") |
| ... | ... | @@ -226,7 +250,6 @@ |
| 226 | 250 | if(rLst.size()>0){ |
| 227 | 251 | payload.put("stat",rLst.get(0).getStat()); |
| 228 | 252 | } |
| 229 | - | |
| 230 | 253 | LymsChatgroup chatgroup=new LymsChatgroup(); |
| 231 | 254 | chatgroup.setHxgroupid(to); |
| 232 | 255 | List<LymsChatgroup> cLst=lymsChatgroupService.list(Wrappers.query(chatgroup)); |
| ... | ... | @@ -245,6 +268,11 @@ |
| 245 | 268 | if(dLst.size()>0){ |
| 246 | 269 | payload.put("doc",dLst.get(0)); |
| 247 | 270 | } |
| 271 | + if(CollectionUtils.isEmpty(rLst)){ | |
| 272 | + if (1==cLst.get(0).getType()) { | |
| 273 | + payload.put("stat",cLst.get(0).getStat()); | |
| 274 | + } | |
| 275 | + } | |
| 248 | 276 | } |
| 249 | 277 | |
| 250 | 278 | payload.put("timestamp",row.getJSONObject("meta").get("timestamp")); |
| ... | ... | @@ -269,6 +297,60 @@ |
| 269 | 297 | @GetMapping("getPreMsg") |
| 270 | 298 | @TokenRequired |
| 271 | 299 | public BaseResponse getPreMsg(HttpServletRequest request){ |
| 300 | + BaseResponse baseResponse =new BaseResponse(); | |
| 301 | + Map<String,Object> param=new HashMap<>(); | |
| 302 | + param.put("vtype",998); | |
| 303 | + List<LymsDict> dLst=lymsDictService.listByMap(param); | |
| 304 | + if(dLst.size()>0){ | |
| 305 | + baseResponse.setObject(dLst.get(0)); | |
| 306 | + } | |
| 307 | + return baseResponse; | |
| 308 | + } | |
| 309 | + /** | |
| 310 | + * 医生端获取自己的患者列表 | |
| 311 | + * @param doctorId | |
| 312 | + * @param current 页数 | |
| 313 | + * @param size 条数 | |
| 314 | + * @param synthesisQuery 综合筛选条件 | |
| 315 | + * @return | |
| 316 | + */ | |
| 317 | + @GetMapping("getDoctorPatient") | |
| 318 | + @TokenRequired | |
| 319 | + public BaseResponse getDoctorPatient(Integer doctorId,Integer current, Integer size,String synthesisQuery){ | |
| 320 | + BaseResponse baseResponse =new BaseResponse(); | |
| 321 | + if(null==doctorId){ | |
| 322 | + baseResponse.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); | |
| 323 | + baseResponse.setErrormsg("参数错误"); | |
| 324 | + return baseResponse; | |
| 325 | + } | |
| 326 | + Page<Map<String,Object>> page=new Page<>(current,size); | |
| 327 | + QueryWrapper queryWrapper=new QueryWrapper<>(); | |
| 328 | + queryWrapper.eq("dtid", doctorId); | |
| 329 | + if (StringUtil.isNotEmpty(synthesisQuery)){ | |
| 330 | + queryWrapper.like("pname", synthesisQuery); | |
| 331 | + } | |
| 332 | + List<Map<String,Object>> list=lymsChatgroupService.getDoctorPatient(page,queryWrapper); | |
| 333 | + for (Map<String, Object> map : list) { | |
| 334 | + if(map.get("sex")!=null) { | |
| 335 | + map.put("sex",(int)map.get("sex")==1?"男":"女"); | |
| 336 | + } | |
| 337 | + if(map.get("birth")!=null){ | |
| 338 | + map.put("birth", DateUtil.getAge(DateUtil.parseYMD(map.get("birth").toString()))); | |
| 339 | + } | |
| 340 | + } | |
| 341 | + page.setRecords(list); | |
| 342 | + baseResponse.setObject(page); | |
| 343 | + return baseResponse; | |
| 344 | + } | |
| 345 | + | |
| 346 | + /** | |
| 347 | + * 进入医生回访聊天 | |
| 348 | + * @param request | |
| 349 | + * @return | |
| 350 | + */ | |
| 351 | + @GetMapping("getDoctorCallback") | |
| 352 | + @TokenRequired | |
| 353 | + public BaseResponse getDoctorCallback(HttpServletRequest request){ | |
| 272 | 354 | BaseResponse baseResponse =new BaseResponse(); |
| 273 | 355 | Map<String,Object> param=new HashMap<>(); |
| 274 | 356 | param.put("vtype",998); |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/CommonController.java
View file @
00901f8
| 1 | 1 | package com.lyms.talkonlineweb.controller; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |
| 3 | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 4 | 5 | import com.fasterxml.jackson.databind.ser.Serializers; |
| 5 | 6 | import com.lyms.talkonlineweb.annotation.TokenRequired; |
| ... | ... | @@ -64,6 +65,14 @@ |
| 64 | 65 | boolean f=lymsTkrecordService.saveOrUpdate(tkrecord); |
| 65 | 66 | |
| 66 | 67 | baseResponse.setErrorcode(f==true?0:1); |
| 68 | + }else { | |
| 69 | + if (CollectionUtils.isNotEmpty(gLst) && gLst.get(0).getType()==1) { | |
| 70 | + LymsChatgroup lymsChatgroup= new LymsChatgroup(); | |
| 71 | + lymsChatgroup.setId(gLst.get(0).getId()); | |
| 72 | + lymsChatgroup.setStat(1); | |
| 73 | + lymsChatgroupService.updateById(lymsChatgroup); | |
| 74 | + baseResponse.setErrorcode(0); | |
| 75 | + } | |
| 67 | 76 | } |
| 68 | 77 | if(baseResponse.getErrorcode()==1){ |
| 69 | 78 | baseResponse.setErrormsg("该问诊已结束!"); |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DepartController.java
View file @
00901f8
| ... | ... | @@ -55,7 +55,7 @@ |
| 55 | 55 | // Page<LymsHdepart> departPage=lymsHdepartService.page(page, Wrappers.query(depart).orderByDesc("updated_time","createdtime")); |
| 56 | 56 | // addIll(departPage); |
| 57 | 57 | Page<HdepartInfo> page=new Page<>(current,size); |
| 58 | - Page<HdepartInfo> departPage=hdepartInfoService.page(page, Wrappers.query(depart).orderByDesc("updated_time","createdtime")); | |
| 58 | + Page<HdepartInfo> departPage=hdepartInfoService.page(page, Wrappers.query(depart).orderByDesc("createdtime")); | |
| 59 | 59 | addIll(departPage); |
| 60 | 60 | baseResponse.setObject(departPage); |
| 61 | 61 |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/TkRecordController.java
View file @
00901f8
| ... | ... | @@ -46,34 +46,34 @@ |
| 46 | 46 | public BaseResponse saveTkRecord(@RequestBody @Validated LymsTkrecord tkrecord){ |
| 47 | 47 | BaseResponse baseResponse=new BaseResponse(); |
| 48 | 48 | try { |
| 49 | - | |
| 50 | - LymsTcard tcard=new LymsTcard(); | |
| 51 | - tcard.setPid(tkrecord.getPid()); | |
| 52 | - tcard.setPcid(tkrecord.getPcid()); | |
| 49 | + if(null==tkrecord.getType()) { | |
| 50 | + LymsTcard tcard = new LymsTcard(); | |
| 51 | + tcard.setPid(tkrecord.getPid()); | |
| 52 | + tcard.setPcid(tkrecord.getPcid()); | |
| 53 | 53 | // 获取问诊卡按照先从医院购买的问诊卡消费 |
| 54 | - List<LymsTcard> rLst=lymsTcardService.list(Wrappers.query(tcard).notInSql("id","SELECT r.cid FROM lyms_tkrecord r").orderByDesc("fid")); | |
| 54 | + List<LymsTcard> rLst = lymsTcardService.list(Wrappers.query(tcard).notInSql("id", "SELECT r.cid FROM lyms_tkrecord r").orderByDesc("fid")); | |
| 55 | 55 | |
| 56 | 56 | // 小程序购买的问诊卡 |
| 57 | - tcard.setPcid(null); | |
| 58 | - tcard.setFid(1); | |
| 59 | - List<LymsTcard> xLst=lymsTcardService.list(Wrappers.query(tcard).notInSql("id","SELECT r.cid FROM lyms_tkrecord r").orderByDesc("fid")); | |
| 57 | + tcard.setPcid(null); | |
| 58 | + tcard.setFid(1); | |
| 59 | + List<LymsTcard> xLst = lymsTcardService.list(Wrappers.query(tcard).notInSql("id", "SELECT r.cid FROM lyms_tkrecord r").orderByDesc("fid")); | |
| 60 | 60 | |
| 61 | - if(rLst.size()>0 || xLst.size()>0){ | |
| 62 | - if(rLst.size()>0){ | |
| 63 | - tkrecord.setCid(rLst.get(0).getId()); | |
| 64 | - tkrecord.setFid((byte) 2); | |
| 65 | - }else{ | |
| 66 | - tkrecord.setCid(xLst.get(0).getId()); | |
| 67 | - tkrecord.setFid((byte) 1); | |
| 68 | - } | |
| 61 | + if (rLst.size() > 0 || xLst.size() > 0) { | |
| 62 | + if (rLst.size() > 0) { | |
| 63 | + tkrecord.setCid(rLst.get(0).getId()); | |
| 64 | + tkrecord.setFid((byte) 2); | |
| 65 | + } else { | |
| 66 | + tkrecord.setCid(xLst.get(0).getId()); | |
| 67 | + tkrecord.setFid((byte) 1); | |
| 68 | + } | |
| 69 | 69 | |
| 70 | - }else{ | |
| 71 | - baseResponse.setErrorcode(1); | |
| 72 | - baseResponse.setErrormsg("已经没有了问诊卡"); | |
| 73 | - return baseResponse; | |
| 70 | + } else { | |
| 71 | + baseResponse.setErrorcode(1); | |
| 72 | + baseResponse.setErrormsg("已经没有了问诊卡"); | |
| 73 | + return baseResponse; | |
| 74 | + } | |
| 74 | 75 | } |
| 75 | 76 | |
| 76 | - | |
| 77 | 77 | LymsChatgroup group =new LymsChatgroup(); |
| 78 | 78 | LymsDoctor doctor=lymsDoctorService.getById(tkrecord.getDid()); |
| 79 | 79 | LymsPatient patient=lymsPatientService.getById(tkrecord.getPid()); |
| ... | ... | @@ -91,9 +91,13 @@ |
| 91 | 91 | |
| 92 | 92 | //环信群组名称更改为姓名串-用于PC端问诊展示 |
| 93 | 93 | group.setGroupname(patient.getPname() + "," + doctor.getDname()); |
| 94 | - | |
| 95 | - lymsChatgroupService.saveOrUpdate(group); | |
| 96 | - lymsTkrecordService.save(tkrecord); | |
| 94 | + if(null==tkrecord.getType()) { | |
| 95 | + lymsChatgroupService.saveOrUpdate(group); | |
| 96 | + lymsTkrecordService.save(tkrecord); | |
| 97 | + }else { | |
| 98 | + group.setType(1); | |
| 99 | + lymsChatgroupService.saveOrUpdate(group); | |
| 100 | + } | |
| 97 | 101 | baseResponse.setObject(group); |
| 98 | 102 | |
| 99 | 103 | baseResponse.setErrormsg("成功"); |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsChatgroup.java
View file @
00901f8
| ... | ... | @@ -62,6 +62,20 @@ |
| 62 | 62 | */ |
| 63 | 63 | @TableField(value = "ctime") |
| 64 | 64 | private Date ctime; |
| 65 | + /** | |
| 66 | + * 发起聊天医生回访状态 | |
| 67 | + * 0:未回访 | |
| 68 | + * 1:已回访 | |
| 69 | + */ | |
| 70 | + @TableField(value = "type") | |
| 71 | + private Integer type; | |
| 72 | + /** | |
| 73 | + * 发回访状态 | |
| 74 | + * 0:未结束 | |
| 75 | + * 1:已结束 | |
| 76 | + */ | |
| 77 | + @TableField(value = "stat") | |
| 78 | + private Integer stat; | |
| 65 | 79 | |
| 66 | 80 | @TableField(exist = false) |
| 67 | 81 | private static final long serialVersionUID = 1L; |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsTkrecord.java
View file @
00901f8
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsChatgroupMapper.java
View file @
00901f8
| 1 | 1 | package com.lyms.talkonlineweb.mapper; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
| 4 | +import com.baomidou.mybatisplus.core.toolkit.Constants; | |
| 5 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
| 3 | 6 | import com.lyms.talkonlineweb.domain.LymsChatgroup; |
| 4 | 7 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| 8 | +import org.apache.ibatis.annotations.Mapper; | |
| 5 | 9 | import org.apache.ibatis.annotations.Param; |
| 6 | 10 | import org.apache.ibatis.annotations.Select; |
| 7 | 11 | |
| 12 | +import java.sql.Wrapper; | |
| 8 | 13 | import java.util.List; |
| 9 | 14 | import java.util.Map; |
| 10 | 15 | |
| 11 | 16 | /** |
| 12 | 17 | * @Entity com.lyms.talkonlineweb.domain.LymsChatgroup |
| 13 | 18 | */ |
| 19 | +@Mapper | |
| 14 | 20 | public interface LymsChatgroupMapper extends BaseMapper<LymsChatgroup> { |
| 15 | 21 | |
| 16 | - @Select("SELECT p.`id`, `pname`, `idno`, `ppasswd`, p.`sex`, `birth`, IFNULL(p.`headimg`,'') headimg, `ccnt`, `islogin`, `openid`, p.`hxid`, `pid`, `pcid`, r.`did`, `cid`, `fid`, r.`stat` " + | |
| 22 | + @Select("SELECT p.`id`, `pname`, `idno`, `ppasswd`, p.`sex`, `birth`, IFNULL(p.`headimg`,'') headimg, `ccnt`, `islogin`, `openid`, p.`hxid`, `pid`, `pcid`, r.id as `rid`,r.`did`, `cid`, `fid`, r.`stat` " + | |
| 17 | 23 | "FROM lyms_patient p,lyms_tkrecord r,lyms_chatgroup cg,lyms_doctor d " + |
| 18 | 24 | "WHERE p.`id`=r.`pid` AND p.`idno`=cg.`fromp` AND r.`did`=d.`did` AND cg.`target`=d.`dlogin` AND r.`did`=#{did} AND cg.`hxgroupid`=#{groupid} ORDER BY r.`createdtime` DESC") |
| 19 | 25 | List<Map<String, Object>> getPinfoBySesson(@Param("froms") String froms,@Param("did") String did,@Param("groupid") String groupid); |
| 26 | + | |
| 27 | + @Select({"<script>", | |
| 28 | + "SELECT " , | |
| 29 | + "p.id as `pid`," , | |
| 30 | + "p.pname," , | |
| 31 | + "p.sex," , | |
| 32 | + "p.birth," , | |
| 33 | + "p.idno," , | |
| 34 | + "p.enrolment_phone," , | |
| 35 | + "pc.mobile," , | |
| 36 | + "pc.pcid," , | |
| 37 | + "pc.dtid," , | |
| 38 | + "pc.dtname," , | |
| 39 | + "i.iname, " , | |
| 40 | + "i.createdtime " , | |
| 41 | + "FROM " , | |
| 42 | + "(`lyms_illness` i " , | |
| 43 | + "left join `lyms_pcase` pc ON (pc.pcid = i.pcid) " , | |
| 44 | + "left join `lyms_patient` p ON (p.id = pc.pid)) " , | |
| 45 | + "${ew.customSqlSegment}", | |
| 46 | + "</script>"}) | |
| 47 | +// "WHERE " + | |
| 48 | +// "dtid=#{doctorId}") | |
| 49 | + List<Map<String, Object>> getDoctorPatient(Page<Map<String,Object>> page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper); | |
| 20 | 50 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsChatgroupService.java
View file @
00901f8
| 1 | 1 | package com.lyms.talkonlineweb.service; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
| 4 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
| 3 | 5 | import com.lyms.talkonlineweb.domain.LymsChatgroup; |
| 4 | 6 | import com.baomidou.mybatisplus.extension.service.IService; |
| 5 | 7 | |
| ... | ... | @@ -18,5 +20,7 @@ |
| 18 | 20 | * @return |
| 19 | 21 | */ |
| 20 | 22 | List<Map<String, Object>> getPinfoBySesson(String froms, String did,String groupid); |
| 23 | + | |
| 24 | + List<Map<String, Object>> getDoctorPatient(Page<Map<String, Object>> page, QueryWrapper queryWrapper); | |
| 21 | 25 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsChatgroupServiceImpl.java
View file @
00901f8
| 1 | 1 | package com.lyms.talkonlineweb.service.impl; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
| 4 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
| 3 | 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| 4 | 6 | import com.lyms.talkonlineweb.domain.LymsChatgroup; |
| 5 | 7 | import com.lyms.talkonlineweb.service.LymsChatgroupService; |
| ... | ... | @@ -7,6 +9,7 @@ |
| 7 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | 10 | import org.springframework.stereotype.Service; |
| 9 | 11 | |
| 12 | +import java.sql.Wrapper; | |
| 10 | 13 | import java.util.List; |
| 11 | 14 | import java.util.Map; |
| 12 | 15 | |
| ... | ... | @@ -23,6 +26,11 @@ |
| 23 | 26 | @Override |
| 24 | 27 | public List<Map<String, Object>> getPinfoBySesson(String froms, String did,String groupid) { |
| 25 | 28 | return lymsChatgroupMapper.getPinfoBySesson(froms,did,groupid); |
| 29 | + } | |
| 30 | + | |
| 31 | + @Override | |
| 32 | + public List<Map<String, Object>> getDoctorPatient(Page<Map<String,Object>> page, QueryWrapper queryWrapper) { | |
| 33 | + return lymsChatgroupMapper.getDoctorPatient(page, queryWrapper); | |
| 26 | 34 | } |
| 27 | 35 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/util/DateUtil.java
View file @
00901f8
| ... | ... | @@ -65,6 +65,21 @@ |
| 65 | 65 | return getDateTime(datetime, YYYY_MM_DD_HH_MM_SS); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | + public static Date parseYMD(String s) { | |
| 69 | + if (s == null) { | |
| 70 | + return null; | |
| 71 | + } | |
| 72 | + lock.lock(); | |
| 73 | + try { | |
| 74 | + | |
| 75 | + return y_m_d.parse(s); | |
| 76 | + } catch (Exception e) { | |
| 77 | + return null; | |
| 78 | + } finally { | |
| 79 | + lock.unlock(); | |
| 80 | + } | |
| 81 | + } | |
| 82 | + | |
| 68 | 83 | public static String getDateTime(Date date, String pattern) { |
| 69 | 84 | if (date == null) { |
| 70 | 85 | return ""; |
| ... | ... | @@ -135,6 +150,38 @@ |
| 135 | 150 | } finally { |
| 136 | 151 | lock.unlock(); |
| 137 | 152 | } |
| 153 | + } | |
| 154 | + public static Integer getAge(Date birth) { | |
| 155 | + if (null == birth) { | |
| 156 | + return null; | |
| 157 | + } | |
| 158 | + java.util.Calendar calendar = Calendar.getInstance(); | |
| 159 | + Date date = new Date(); | |
| 160 | + calendar.setTime(date); | |
| 161 | + | |
| 162 | + Calendar c1 = Calendar.getInstance(); | |
| 163 | + Calendar c2 = Calendar.getInstance(); | |
| 164 | + c1.setTime(date); | |
| 165 | + c2.setTime(birth); | |
| 166 | + int year1 = c1.get(Calendar.YEAR); | |
| 167 | + int year2 = c2.get(Calendar.YEAR); | |
| 168 | + | |
| 169 | + int mouth1 = c1.get(Calendar.MONTH);//0当前 | |
| 170 | + int mouth2 = c2.get(Calendar.MONTH);//4 | |
| 171 | + int i = 0; | |
| 172 | + | |
| 173 | + if (mouth2 == mouth1) { | |
| 174 | + int days1 = c1.get(Calendar.DAY_OF_MONTH);//当前10 | |
| 175 | + int days2 = c2.get(Calendar.DAY_OF_MONTH);//1 | |
| 176 | + if (days1 < days2) { | |
| 177 | + i = i - 1; | |
| 178 | + } else if (days1 > days2) { | |
| 179 | + } | |
| 180 | + } else if (mouth2 > mouth1) { | |
| 181 | + i = i - 1; | |
| 182 | + } | |
| 183 | + | |
| 184 | + return (Math.abs(year1 - year2) + i); | |
| 138 | 185 | } |
| 139 | 186 | } |