Commit f0aa28dc29d454f136fc9aee391495a6dc31191b
1 parent
a1fbb42f92
Exists in
dev
医生设置回复消息时间功能
Showing 15 changed files with 321 additions and 3 deletions
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorWorktimeController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDoctor.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDoctorWorkTime.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/enums/MessageEnum.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsChatgroupMapper.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsDoctorWorktimeMapper.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/BaseResponse.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDoctorService.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDoctorWorktimeService.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDoctorServiceImpl.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDoctorWorktimeServiceImpl.java
- talkonlineweb/src/main/resources/application-dev.yml
- talkonlineweb/src/main/resources/application.yml
- talkonlineweb/src/main/resources/mapper/LymsDoctorWorktimeMapper.xml
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorController.java
View file @
f0aa28d
| ... | ... | @@ -254,6 +254,28 @@ |
| 254 | 254 | return baseResponse; |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | + | |
| 258 | + @PostMapping("/gzopenid") | |
| 259 | + public BaseResponse gzopenid(@RequestBody LymsDoctor doctor){ | |
| 260 | + try { | |
| 261 | + if(StringUtil.isNotEmpty(doctor.getCode())&& null!= doctor.getDid()){ | |
| 262 | + String openid = WeiXinUtil.getWxGzOpenId(doctor.getCode()); | |
| 263 | + if(StringUtil.isNotEmpty(openid)){ | |
| 264 | + doctor.setGzopenid(openid); | |
| 265 | + //更新到登录患者的gzopenid | |
| 266 | + lymsDoctorService.updateById(doctor); | |
| 267 | + String subscribe = WeiXinUtil.getIsWxGZH(openid); | |
| 268 | + if(StringUtil.isNotEmpty(subscribe)){ | |
| 269 | + return BaseResponse.ok(); | |
| 270 | + } | |
| 271 | + } | |
| 272 | + } | |
| 273 | + } catch (Exception e) { | |
| 274 | + log.error("医生关注公众号异常",e); | |
| 275 | + } | |
| 276 | + return BaseResponse.error("失败"); | |
| 277 | + } | |
| 278 | + | |
| 257 | 279 | /** |
| 258 | 280 | * 统计医生信息 |
| 259 | 281 | * @return |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorWorktimeController.java
View file @
f0aa28d
| 1 | +package com.lyms.talkonlineweb.controller; | |
| 2 | + | |
| 3 | +import com.alibaba.fastjson.JSONArray; | |
| 4 | +import com.alibaba.fastjson.JSONObject; | |
| 5 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
| 6 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
| 7 | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |
| 8 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
| 9 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
| 10 | +import com.lyms.talkonlineweb.annotation.TokenRequired; | |
| 11 | +import com.lyms.talkonlineweb.domain.*; | |
| 12 | +import com.lyms.talkonlineweb.result.BaseResponse; | |
| 13 | +import com.lyms.talkonlineweb.service.*; | |
| 14 | +import com.lyms.talkonlineweb.util.*; | |
| 15 | +import lombok.extern.log4j.Log4j2; | |
| 16 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 17 | +import org.springframework.util.DigestUtils; | |
| 18 | +import org.springframework.util.StringUtils; | |
| 19 | +import org.springframework.validation.BindingResult; | |
| 20 | +import org.springframework.validation.annotation.Validated; | |
| 21 | +import org.springframework.web.bind.annotation.*; | |
| 22 | + | |
| 23 | +import java.text.NumberFormat; | |
| 24 | +import java.util.*; | |
| 25 | + | |
| 26 | +/** | |
| 27 | + * 医生管理 | |
| 28 | + */ | |
| 29 | +@RestController | |
| 30 | +@RequestMapping("doctor/worktime") | |
| 31 | +@Log4j2 | |
| 32 | +public class DoctorWorktimeController { | |
| 33 | + | |
| 34 | + | |
| 35 | + @Autowired | |
| 36 | + LymsDoctorWorktimeService lymsDoctorWorktimeService; | |
| 37 | + @Autowired | |
| 38 | + LymsDoctorService lymsDoctorService; | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 医生设置工作时间 新增或修改 | |
| 42 | + * @param doctorWorkTime | |
| 43 | + * @param authorization | |
| 44 | + * @return | |
| 45 | + */ | |
| 46 | + @PostMapping("save") | |
| 47 | + @TokenRequired | |
| 48 | + public BaseResponse saveDoctorWorktime(@RequestBody LymsDoctorWorkTime doctorWorkTime,@RequestHeader String authorization){ | |
| 49 | + if(StringUtil.isEmpty(doctorWorkTime.getStartTime()) || StringUtil.isEmpty(doctorWorkTime.getEndTime())){ | |
| 50 | + return BaseResponse.error("开始时间和结束时间必须填写"); | |
| 51 | + } | |
| 52 | + if(doctorWorkTime.getId() == null){ | |
| 53 | + if(doctorWorkTime.getDid() == null){ | |
| 54 | + LymsDoctor doctor = lymsDoctorService.getDoctorByToken(authorization); | |
| 55 | + doctorWorkTime.setDid(doctor.getDid()); | |
| 56 | + } | |
| 57 | + doctorWorkTime.setStatus(1); | |
| 58 | + doctorWorkTime.setCreatedtime(new Date()); | |
| 59 | + } | |
| 60 | + doctorWorkTime.setUpdatedtime(new Date()); | |
| 61 | + lymsDoctorWorktimeService.saveOrUpdate(doctorWorkTime); | |
| 62 | + return BaseResponse.ok(); | |
| 63 | + } | |
| 64 | + | |
| 65 | + /** | |
| 66 | + * 医生查询自己设置的工作时间 | |
| 67 | + * @param authorization | |
| 68 | + * @return | |
| 69 | + */ | |
| 70 | + @GetMapping("query") | |
| 71 | + @TokenRequired | |
| 72 | + public BaseResponse queryDoctorWorktime(@RequestHeader String authorization){ | |
| 73 | + LymsDoctor doctor = lymsDoctorService.getDoctorByToken(authorization); | |
| 74 | + QueryWrapper queryWrapper = new QueryWrapper(); | |
| 75 | + queryWrapper.eq("did",doctor.getDid()); | |
| 76 | + LymsDoctorWorkTime doctorWorkTime = lymsDoctorWorktimeService.getOne(queryWrapper); | |
| 77 | + return BaseResponse.ok().setObject(doctorWorkTime); | |
| 78 | + } | |
| 79 | + | |
| 80 | + /** | |
| 81 | + * 根据医生的id查询 | |
| 82 | + * @param did | |
| 83 | + * @return | |
| 84 | + */ | |
| 85 | + @GetMapping("queryByDoctorId") | |
| 86 | + @TokenRequired | |
| 87 | + public BaseResponse queryByDoctorId(Integer did){ | |
| 88 | + QueryWrapper<LymsDoctorWorkTime> queryWrapper = new QueryWrapper(); | |
| 89 | + queryWrapper.eq("did",did); | |
| 90 | + LymsDoctorWorkTime doctorWorkTime = lymsDoctorWorktimeService.getOne(queryWrapper); | |
| 91 | + /*if(doctorWorkTime != null){ | |
| 92 | + doctorWorkTime.setId(null); | |
| 93 | + doctorWorkTime.setCreatedtime(null); | |
| 94 | + doctorWorkTime.setUpdatedtime(null); | |
| 95 | + }*/ | |
| 96 | + return BaseResponse.ok().setObject(doctorWorkTime); | |
| 97 | + } | |
| 98 | + | |
| 99 | + /** | |
| 100 | + * 根据医生的登录账号查询 | |
| 101 | + * @param dlogin | |
| 102 | + * @return | |
| 103 | + */ | |
| 104 | + @GetMapping("queryByDoctorDlogin") | |
| 105 | + @TokenRequired | |
| 106 | + public BaseResponse queryByDoctorDlogin(String dlogin){ | |
| 107 | + QueryWrapper<LymsDoctor> query = new QueryWrapper(); | |
| 108 | + query.eq("dlogin",dlogin); | |
| 109 | + LymsDoctor doctor = lymsDoctorService.getOne(query); | |
| 110 | + if(doctor != null){ | |
| 111 | + QueryWrapper<LymsDoctorWorkTime> queryWrapper = new QueryWrapper(); | |
| 112 | + queryWrapper.eq("did",doctor.getDid()); | |
| 113 | + LymsDoctorWorkTime doctorWorkTime = lymsDoctorWorktimeService.getOne(queryWrapper); | |
| 114 | + /*if(doctorWorkTime != null){ | |
| 115 | + doctorWorkTime.setId(null); | |
| 116 | + doctorWorkTime.setCreatedtime(null); | |
| 117 | + doctorWorkTime.setUpdatedtime(null); | |
| 118 | + }*/ | |
| 119 | + return BaseResponse.ok().setObject(doctorWorkTime); | |
| 120 | + } | |
| 121 | + return BaseResponse.error("医生登录信息错误"); | |
| 122 | + } | |
| 123 | + | |
| 124 | + | |
| 125 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDoctor.java
View file @
f0aa28d
| ... | ... | @@ -171,6 +171,21 @@ |
| 171 | 171 | @TableField(value = "admin_type") |
| 172 | 172 | private Integer adminType; |
| 173 | 173 | |
| 174 | + /** | |
| 175 | + * 医生小程序openid | |
| 176 | + */ | |
| 177 | + @TableField(value = "openid") | |
| 178 | + private String openid; | |
| 179 | + | |
| 180 | + /** | |
| 181 | + * 医生关注公众号的openid | |
| 182 | + */ | |
| 183 | + @TableField(value = "gzopenid") | |
| 184 | + private String gzopenid; | |
| 185 | + | |
| 186 | + @TableField(exist = false) | |
| 187 | + private String code; | |
| 188 | + | |
| 174 | 189 | |
| 175 | 190 | @Override |
| 176 | 191 | public boolean equals(Object that) { |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDoctorWorkTime.java
View file @
f0aa28d
| 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 | + */ | |
| 15 | +@TableName(value ="lyms_doctor_worktime") | |
| 16 | +@Data | |
| 17 | +public class LymsDoctorWorkTime implements Serializable { | |
| 18 | + | |
| 19 | + @TableField(exist = false) | |
| 20 | + private static final long serialVersionUID = 1L; | |
| 21 | + /** | |
| 22 | + * | |
| 23 | + */ | |
| 24 | + @TableId(value = "id", type = IdType.AUTO) | |
| 25 | + private Integer id; | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 医生ID | |
| 29 | + */ | |
| 30 | + @TableField(value = "did") | |
| 31 | + private Integer did; | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 开始时间 | |
| 35 | + */ | |
| 36 | + @TableField(value = "start_time") | |
| 37 | + private String startTime; | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 结束时间 | |
| 41 | + */ | |
| 42 | + @TableField(value = "end_time") | |
| 43 | + private String endTime; | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * 设置状态 1有效 0 无效 | |
| 47 | + */ | |
| 48 | + @TableField(value = "status") | |
| 49 | + private Integer status; | |
| 50 | + | |
| 51 | + private Date createdtime; | |
| 52 | + | |
| 53 | + | |
| 54 | + private Date updatedtime; | |
| 55 | + | |
| 56 | + | |
| 57 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/enums/MessageEnum.java
View file @
f0aa28d
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsChatgroupMapper.java
View file @
f0aa28d
| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | @Mapper |
| 20 | 20 | public interface LymsChatgroupMapper extends BaseMapper<LymsChatgroup> { |
| 21 | 21 | |
| 22 | - @Select("SELECT p.`id`, `pname`, `idno`, `ppasswd`, p.`sex`, `birth`, IFNULL(p.`headimg`,'') headimg, `ccnt`, `islogin`, `openid`, p.`hxid`, `pid`, r.`pcid`, r.id as `rid`,r.`did`, `cid`, `fid`, r.`stat` " + | |
| 22 | + @Select("SELECT p.`id`, p.`pname`, p.`idno`, p.`ppasswd`, p.`sex`, p.`birth`, IFNULL(p.`headimg`,'') headimg, p.`ccnt`, p.`islogin`, p.`openid`, p.`hxid`, `pid`, r.`pcid`, r.id as `rid`,r.`did`, `cid`, `fid`, r.`stat` " + | |
| 23 | 23 | "FROM lyms_patient p,lyms_tkrecord r,lyms_chatgroup cg,lyms_doctor d " + |
| 24 | 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") |
| 25 | 25 | List<Map<String, Object>> getPinfoBySesson(@Param("froms") String froms,@Param("did") String did,@Param("groupid") String groupid); |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsDoctorWorktimeMapper.java
View file @
f0aa28d
| 1 | +package com.lyms.talkonlineweb.mapper; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
| 4 | +import com.lyms.talkonlineweb.domain.LymsDoctor; | |
| 5 | +import com.lyms.talkonlineweb.domain.LymsDoctorWorkTime; | |
| 6 | +import org.apache.ibatis.annotations.Param; | |
| 7 | +import org.apache.ibatis.annotations.Select; | |
| 8 | + | |
| 9 | +import java.util.Map; | |
| 10 | + | |
| 11 | + | |
| 12 | +public interface LymsDoctorWorktimeMapper extends BaseMapper<LymsDoctorWorkTime> { | |
| 13 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/BaseResponse.java
View file @
f0aa28d
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDoctorService.java
View file @
f0aa28d
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDoctorWorktimeService.java
View file @
f0aa28d
| 1 | +package com.lyms.talkonlineweb.service; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.extension.service.IService; | |
| 4 | +import com.lyms.talkonlineweb.domain.LymsDoctorWorkTime; | |
| 5 | + | |
| 6 | +import java.util.Map; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * | |
| 10 | + */ | |
| 11 | +public interface LymsDoctorWorktimeService extends IService<LymsDoctorWorkTime> { | |
| 12 | + | |
| 13 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDoctorServiceImpl.java
View file @
f0aa28d
| ... | ... | @@ -2,16 +2,20 @@ |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.fastjson.JSONArray; |
| 4 | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
| 5 | 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| 6 | 7 | import com.lyms.talkonlineweb.domain.LymsDoctor; |
| 7 | 8 | import com.lyms.talkonlineweb.service.LymsDoctorService; |
| 8 | 9 | import com.lyms.talkonlineweb.mapper.LymsDoctorMapper; |
| 9 | 10 | import com.lyms.talkonlineweb.util.Constant; |
| 10 | 11 | import com.lyms.talkonlineweb.util.HXService; |
| 12 | +import com.lyms.talkonlineweb.util.JwtUtils; | |
| 13 | +import io.jsonwebtoken.Claims; | |
| 11 | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | 15 | import org.springframework.stereotype.Service; |
| 13 | 16 | |
| 14 | 17 | import javax.annotation.Resource; |
| 18 | +import java.util.HashMap; | |
| 15 | 19 | import java.util.Map; |
| 16 | 20 | |
| 17 | 21 | /** |
| ... | ... | @@ -46,6 +50,21 @@ |
| 46 | 50 | updateById(lymsDoctor); |
| 47 | 51 | } |
| 48 | 52 | } |
| 53 | + return lymsDoctor; | |
| 54 | + } | |
| 55 | + | |
| 56 | + @Override | |
| 57 | + public LymsDoctor getDoctorByToken(String token) { | |
| 58 | + Claims claims = null; | |
| 59 | + try { | |
| 60 | + claims = JwtUtils.parseJWT(token); | |
| 61 | + } catch (Exception e) { | |
| 62 | + e.printStackTrace(); | |
| 63 | + } | |
| 64 | + String username=claims.getSubject(); | |
| 65 | + QueryWrapper<LymsDoctor> query = new QueryWrapper<>(); | |
| 66 | + query.eq("dlogin",username); | |
| 67 | + LymsDoctor lymsDoctor = lymsDoctorMapper.selectOne(query); | |
| 49 | 68 | return lymsDoctor; |
| 50 | 69 | } |
| 51 | 70 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDoctorWorktimeServiceImpl.java
View file @
f0aa28d
| 1 | +package com.lyms.talkonlineweb.service.impl; | |
| 2 | + | |
| 3 | + | |
| 4 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
| 5 | +import com.lyms.talkonlineweb.domain.LymsDoctorWorkTime; | |
| 6 | +import com.lyms.talkonlineweb.mapper.LymsDoctorWorktimeMapper; | |
| 7 | +import com.lyms.talkonlineweb.service.LymsDoctorWorktimeService; | |
| 8 | +import org.springframework.stereotype.Service; | |
| 9 | + | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * | |
| 13 | + */ | |
| 14 | +@Service | |
| 15 | +public class LymsDoctorWorktimeServiceImpl extends ServiceImpl<LymsDoctorWorktimeMapper, LymsDoctorWorkTime> | |
| 16 | + implements LymsDoctorWorktimeService{ | |
| 17 | + | |
| 18 | +} |
talkonlineweb/src/main/resources/application-dev.yml
View file @
f0aa28d
talkonlineweb/src/main/resources/application.yml
View file @
f0aa28d
talkonlineweb/src/main/resources/mapper/LymsDoctorWorktimeMapper.xml
View file @
f0aa28d
| 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.LymsDoctorWorktimeMapper"> | |
| 6 | + | |
| 7 | + <resultMap id="BaseResultMap" type="com.lyms.talkonlineweb.domain.LymsDoctorWorkTime"> | |
| 8 | + <id property="id" column="id" jdbcType="INTEGER"/> | |
| 9 | + <result property="did" column="did" jdbcType="INTEGER"/> | |
| 10 | + <result property="startTime" column="start_time" jdbcType="VARCHAR"/> | |
| 11 | + <result property="endTime" column="end_time" jdbcType="VARCHAR"/> | |
| 12 | + <result property="status" column="status" jdbcType="INTEGER"/> | |
| 13 | + <result property="createdtime" column="createdtime" jdbcType="TIMESTAMP"/> | |
| 14 | + <result property="updatedtime" column="updatedtime" jdbcType="TIMESTAMP"/> | |
| 15 | + </resultMap> | |
| 16 | + | |
| 17 | +</mapper> |