From f0aa28dc29d454f136fc9aee391495a6dc31191b Mon Sep 17 00:00:00 2001 From: cfl Date: Tue, 31 Oct 2023 14:37:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BB=E7=94=9F=E8=AE=BE=E7=BD=AE=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E6=B6=88=E6=81=AF=E6=97=B6=E9=97=B4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../talkonlineweb/controller/DoctorController.java | 22 ++++ .../controller/DoctorWorktimeController.java | 125 +++++++++++++++++++++ .../com/lyms/talkonlineweb/domain/LymsDoctor.java | 15 +++ .../talkonlineweb/domain/LymsDoctorWorkTime.java | 57 ++++++++++ .../com/lyms/talkonlineweb/enums/MessageEnum.java | 3 +- .../talkonlineweb/mapper/LymsChatgroupMapper.java | 2 +- .../mapper/LymsDoctorWorktimeMapper.java | 17 +++ .../lyms/talkonlineweb/result/BaseResponse.java | 4 + .../talkonlineweb/service/LymsDoctorService.java | 2 + .../service/LymsDoctorWorktimeService.java | 13 +++ .../service/impl/LymsDoctorServiceImpl.java | 19 ++++ .../impl/LymsDoctorWorktimeServiceImpl.java | 22 ++++ .../src/main/resources/application-dev.yml | 2 +- talkonlineweb/src/main/resources/application.yml | 4 + .../resources/mapper/LymsDoctorWorktimeMapper.xml | 17 +++ 15 files changed, 321 insertions(+), 3 deletions(-) create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorWorktimeController.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDoctorWorkTime.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsDoctorWorktimeMapper.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDoctorWorktimeService.java create mode 100644 talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDoctorWorktimeServiceImpl.java create mode 100644 talkonlineweb/src/main/resources/mapper/LymsDoctorWorktimeMapper.xml diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorController.java index c22f57a..e6ea207 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorController.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorController.java @@ -254,6 +254,28 @@ public class DoctorController { return baseResponse; } + + @PostMapping("/gzopenid") + public BaseResponse gzopenid(@RequestBody LymsDoctor doctor){ + try { + if(StringUtil.isNotEmpty(doctor.getCode())&& null!= doctor.getDid()){ + String openid = WeiXinUtil.getWxGzOpenId(doctor.getCode()); + if(StringUtil.isNotEmpty(openid)){ + doctor.setGzopenid(openid); + //更新到登录患者的gzopenid + lymsDoctorService.updateById(doctor); + String subscribe = WeiXinUtil.getIsWxGZH(openid); + if(StringUtil.isNotEmpty(subscribe)){ + return BaseResponse.ok(); + } + } + } + } catch (Exception e) { + log.error("医生关注公众号异常",e); + } + return BaseResponse.error("失败"); + } + /** * 统计医生信息 * @return diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorWorktimeController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorWorktimeController.java new file mode 100644 index 0000000..b8e6b75 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/DoctorWorktimeController.java @@ -0,0 +1,125 @@ +package com.lyms.talkonlineweb.controller; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.lyms.talkonlineweb.annotation.TokenRequired; +import com.lyms.talkonlineweb.domain.*; +import com.lyms.talkonlineweb.result.BaseResponse; +import com.lyms.talkonlineweb.service.*; +import com.lyms.talkonlineweb.util.*; +import lombok.extern.log4j.Log4j2; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.DigestUtils; +import org.springframework.util.StringUtils; +import org.springframework.validation.BindingResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.text.NumberFormat; +import java.util.*; + +/** + * 医生管理 + */ +@RestController +@RequestMapping("doctor/worktime") +@Log4j2 +public class DoctorWorktimeController { + + + @Autowired + LymsDoctorWorktimeService lymsDoctorWorktimeService; + @Autowired + LymsDoctorService lymsDoctorService; + + /** + * 医生设置工作时间 新增或修改 + * @param doctorWorkTime + * @param authorization + * @return + */ + @PostMapping("save") + @TokenRequired + public BaseResponse saveDoctorWorktime(@RequestBody LymsDoctorWorkTime doctorWorkTime,@RequestHeader String authorization){ + if(StringUtil.isEmpty(doctorWorkTime.getStartTime()) || StringUtil.isEmpty(doctorWorkTime.getEndTime())){ + return BaseResponse.error("开始时间和结束时间必须填写"); + } + if(doctorWorkTime.getId() == null){ + if(doctorWorkTime.getDid() == null){ + LymsDoctor doctor = lymsDoctorService.getDoctorByToken(authorization); + doctorWorkTime.setDid(doctor.getDid()); + } + doctorWorkTime.setStatus(1); + doctorWorkTime.setCreatedtime(new Date()); + } + doctorWorkTime.setUpdatedtime(new Date()); + lymsDoctorWorktimeService.saveOrUpdate(doctorWorkTime); + return BaseResponse.ok(); + } + + /** + * 医生查询自己设置的工作时间 + * @param authorization + * @return + */ + @GetMapping("query") + @TokenRequired + public BaseResponse queryDoctorWorktime(@RequestHeader String authorization){ + LymsDoctor doctor = lymsDoctorService.getDoctorByToken(authorization); + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("did",doctor.getDid()); + LymsDoctorWorkTime doctorWorkTime = lymsDoctorWorktimeService.getOne(queryWrapper); + return BaseResponse.ok().setObject(doctorWorkTime); + } + + /** + * 根据医生的id查询 + * @param did + * @return + */ + @GetMapping("queryByDoctorId") + @TokenRequired + public BaseResponse queryByDoctorId(Integer did){ + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("did",did); + LymsDoctorWorkTime doctorWorkTime = lymsDoctorWorktimeService.getOne(queryWrapper); + /*if(doctorWorkTime != null){ + doctorWorkTime.setId(null); + doctorWorkTime.setCreatedtime(null); + doctorWorkTime.setUpdatedtime(null); + }*/ + return BaseResponse.ok().setObject(doctorWorkTime); + } + + /** + * 根据医生的登录账号查询 + * @param dlogin + * @return + */ + @GetMapping("queryByDoctorDlogin") + @TokenRequired + public BaseResponse queryByDoctorDlogin(String dlogin){ + QueryWrapper query = new QueryWrapper(); + query.eq("dlogin",dlogin); + LymsDoctor doctor = lymsDoctorService.getOne(query); + if(doctor != null){ + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("did",doctor.getDid()); + LymsDoctorWorkTime doctorWorkTime = lymsDoctorWorktimeService.getOne(queryWrapper); + /*if(doctorWorkTime != null){ + doctorWorkTime.setId(null); + doctorWorkTime.setCreatedtime(null); + doctorWorkTime.setUpdatedtime(null); + }*/ + return BaseResponse.ok().setObject(doctorWorkTime); + } + return BaseResponse.error("医生登录信息错误"); + } + + +} diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDoctor.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDoctor.java index 8cc4f33..f0a8426 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDoctor.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDoctor.java @@ -171,6 +171,21 @@ public class LymsDoctor implements Serializable { @TableField(value = "admin_type") private Integer adminType; + /** + * 医生小程序openid + */ + @TableField(value = "openid") + private String openid; + + /** + * 医生关注公众号的openid + */ + @TableField(value = "gzopenid") + private String gzopenid; + + @TableField(exist = false) + private String code; + @Override public boolean equals(Object that) { diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDoctorWorkTime.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDoctorWorkTime.java new file mode 100644 index 0000000..85622f1 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsDoctorWorkTime.java @@ -0,0 +1,57 @@ +package com.lyms.talkonlineweb.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 医生回复消息时间设置 + */ +@TableName(value ="lyms_doctor_worktime") +@Data +public class LymsDoctorWorkTime implements Serializable { + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + /** + * + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + /** + * 医生ID + */ + @TableField(value = "did") + private Integer did; + + /** + * 开始时间 + */ + @TableField(value = "start_time") + private String startTime; + + /** + * 结束时间 + */ + @TableField(value = "end_time") + private String endTime; + + /** + * 设置状态 1有效 0 无效 + */ + @TableField(value = "status") + private Integer status; + + private Date createdtime; + + + private Date updatedtime; + + +} diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/enums/MessageEnum.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/enums/MessageEnum.java index 112b7fe..2ec47d9 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/enums/MessageEnum.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/enums/MessageEnum.java @@ -6,7 +6,8 @@ import lombok.Getter; public enum MessageEnum { TEXT("TEXT","txt"), - IMAGE("IMAGE","img"); + IMAGE("IMAGE","img"), + AUDIO("AUDIO","audio"); private String code; private String name; diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsChatgroupMapper.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsChatgroupMapper.java index 5e3fd90..dae71ab 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsChatgroupMapper.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsChatgroupMapper.java @@ -19,7 +19,7 @@ import java.util.Map; @Mapper public interface LymsChatgroupMapper extends BaseMapper { - @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` " + + @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` " + "FROM lyms_patient p,lyms_tkrecord r,lyms_chatgroup cg,lyms_doctor d " + "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") List> getPinfoBySesson(@Param("froms") String froms,@Param("did") String did,@Param("groupid") String groupid); diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsDoctorWorktimeMapper.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsDoctorWorktimeMapper.java new file mode 100644 index 0000000..b44c249 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsDoctorWorktimeMapper.java @@ -0,0 +1,17 @@ +package com.lyms.talkonlineweb.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.lyms.talkonlineweb.domain.LymsDoctor; +import com.lyms.talkonlineweb.domain.LymsDoctorWorkTime; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.Map; + + +public interface LymsDoctorWorktimeMapper extends BaseMapper { +} + + + + diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/BaseResponse.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/BaseResponse.java index c50d488..04197ed 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/BaseResponse.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/BaseResponse.java @@ -32,4 +32,8 @@ public class BaseResponse { return ok; } + public BaseResponse setObject(Object object) { + this.object = object; + return this; + } } diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDoctorService.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDoctorService.java index 3e2c28a..7088d8a 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDoctorService.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDoctorService.java @@ -13,4 +13,6 @@ public interface LymsDoctorService extends IService { Map statDoctor(Integer hid,Integer dpid,String dname); LymsDoctor addDoctorHxId(LymsDoctor doctor); + + LymsDoctor getDoctorByToken(String token); } diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDoctorWorktimeService.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDoctorWorktimeService.java new file mode 100644 index 0000000..b69edc7 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsDoctorWorktimeService.java @@ -0,0 +1,13 @@ +package com.lyms.talkonlineweb.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.lyms.talkonlineweb.domain.LymsDoctorWorkTime; + +import java.util.Map; + +/** + * + */ +public interface LymsDoctorWorktimeService extends IService { + +} diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDoctorServiceImpl.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDoctorServiceImpl.java index cb3906a..1d3e652 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDoctorServiceImpl.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDoctorServiceImpl.java @@ -2,16 +2,20 @@ package com.lyms.talkonlineweb.service.impl; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.lyms.talkonlineweb.domain.LymsDoctor; import com.lyms.talkonlineweb.service.LymsDoctorService; import com.lyms.talkonlineweb.mapper.LymsDoctorMapper; import com.lyms.talkonlineweb.util.Constant; import com.lyms.talkonlineweb.util.HXService; +import com.lyms.talkonlineweb.util.JwtUtils; +import io.jsonwebtoken.Claims; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.HashMap; import java.util.Map; /** @@ -48,6 +52,21 @@ public class LymsDoctorServiceImpl extends ServiceImpl query = new QueryWrapper<>(); + query.eq("dlogin",username); + LymsDoctor lymsDoctor = lymsDoctorMapper.selectOne(query); + return lymsDoctor; + } } diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDoctorWorktimeServiceImpl.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDoctorWorktimeServiceImpl.java new file mode 100644 index 0000000..dc83580 --- /dev/null +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsDoctorWorktimeServiceImpl.java @@ -0,0 +1,22 @@ +package com.lyms.talkonlineweb.service.impl; + + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.lyms.talkonlineweb.domain.LymsDoctorWorkTime; +import com.lyms.talkonlineweb.mapper.LymsDoctorWorktimeMapper; +import com.lyms.talkonlineweb.service.LymsDoctorWorktimeService; +import org.springframework.stereotype.Service; + + +/** + * + */ +@Service +public class LymsDoctorWorktimeServiceImpl extends ServiceImpl + implements LymsDoctorWorktimeService{ + +} + + + + diff --git a/talkonlineweb/src/main/resources/application-dev.yml b/talkonlineweb/src/main/resources/application-dev.yml index b8c7729..9916886 100644 --- a/talkonlineweb/src/main/resources/application-dev.yml +++ b/talkonlineweb/src/main/resources/application-dev.yml @@ -57,4 +57,4 @@ platform: #微信公众号获取access_token(测试环境部署不要开启。会与线上环境冲突) getAccessToken: #on/off 会转义boolean - on_off: on \ No newline at end of file + on_off: off \ No newline at end of file diff --git a/talkonlineweb/src/main/resources/application.yml b/talkonlineweb/src/main/resources/application.yml index a631977..950c2cc 100644 --- a/talkonlineweb/src/main/resources/application.yml +++ b/talkonlineweb/src/main/resources/application.yml @@ -8,6 +8,10 @@ spring: time-zone: GMT+8 mvc: throw-exception-if-no-handler-found: true + servlet: + multipart: + max-file-size: 50MB + max-request-size: 50MB resources: add-mappings: false profiles: diff --git a/talkonlineweb/src/main/resources/mapper/LymsDoctorWorktimeMapper.xml b/talkonlineweb/src/main/resources/mapper/LymsDoctorWorktimeMapper.xml new file mode 100644 index 0000000..79f40fa --- /dev/null +++ b/talkonlineweb/src/main/resources/mapper/LymsDoctorWorktimeMapper.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + -- 1.8.3.1