提交 4de17a42 authored 作者: 杨凯's avatar 杨凯

合并分支 'test' 到 'master'

feat:家庭医生初始化

查看合并请求 !1
......@@ -17,4 +17,19 @@
<!-- <version>1.0.0</version>-->
<packaging>jar</packaging>
<dependencies>
<!--在线门诊实体服务-->
<dependency>
<groupId>com.ebaiyihui</groupId>
<artifactId>family-doctor-common</artifactId>
<version>0.0.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-openfeign-core</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.ebaiyihui.family.doctor.client;
import com.ebaiyihui.family.doctor.common.bo.MobileBenefitRes;
import com.ebaiyihui.family.doctor.common.bo.Result;
import com.ebaiyihui.family.doctor.common.dto.MobileBenefitPackageDTO;
import com.ebaiyihui.family.doctor.common.vo.RegisterPatientVo;
import com.ebaiyihui.framework.response.BaseResponse;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @ClassName: MobileBenefitPackageClient
* @Author:yanliang
* @Date:2024/3/19 11:35
* @Description
*/
@FeignClient(value = "byh-family-doctor")
public interface MobileBenefitPackageClient {
@GetMapping("/h5/login")
@ApiOperation(value = "登陆并注册就诊卡")
public BaseResponse<RegisterPatientVo> login(@RequestParam("token") String token);
@PostMapping("/benefit/add")
@ApiOperation(value = "生成权益订单同步推送")
public Result<MobileBenefitRes> addBenefitPackage(@RequestBody List<MobileBenefitPackageDTO> vos);
}
package com.ebaiyihui.family.doctor.client;
import com.ebaiyihui.family.doctor.common.dto.RequestServiceConfigDTO;
import com.ebaiyihui.framework.response.BaseResponse;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
* @ClassName: PatientSignClient
* @Author:yanliang
* @Date:2024/3/15 13:46
* @Description
*/
@FeignClient(value = "byh-family-doctor")
public interface PatientSignClient {
/**
* //添加/修改医生服务信息
*
* @param configVo
* @return com.ebaiyihui.framework.response.BaseResponse<java.lang.Object>
* @author:duanyl
* @Date 2020/8/11 9:34 AM
**/
@ApiOperation(value = "添加/修改医生服务信息", notes = "医生服务feign调用")
@RequestMapping(value = "/patientSign/saveServiceInfo", method = RequestMethod.POST)
public BaseResponse<Object> saveServiceInfo(@RequestBody RequestServiceConfigDTO configVo);
}
......@@ -37,6 +37,12 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.ebaiyihui</groupId>
<artifactId>byh-card-service-client</artifactId>
<version>${card.version}</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.ebaiyihui.family.doctor.common.bo;
import lombok.Data;
/**
* @ClassName: Components
* @Author:yanliang
* @Date:2024/3/15 10:22
* @Description
*/
@Data
public class Components {
private String sender;
private Integer sort;
private String content;
private Integer conditionFlag;
}
package com.ebaiyihui.family.doctor.common.bo;
import lombok.Data;
/**
* @ClassName: MobileBenefitResp
* @Author:yanliang
* @Date:2024/3/19 11:39
* @Description
*/
@Data
public class MobileBenefitRes {
private String orderStatus;
private String orderDesc;
}
package com.ebaiyihui.family.doctor.common.bo;
import lombok.Data;
import java.util.List;
/**
* @ClassName: MsgContent
* @Author:yanliang
* @Date:2024/3/15 10:20
* @Description
*/
@Data
public class MsgContent {
private List<Components> components;
}
package com.ebaiyihui.family.doctor.common.bo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
......@@ -42,7 +43,11 @@ public class PatientSignInfo {
* 患者名字
*/
private String patientName;
/**
* 患者手机号码
*/
private String patientPhone;
/**
* 团队当前处理人doctorId(个人这个值为null)
......
package com.ebaiyihui.family.doctor.common.bo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.beans.Transient;
import java.util.Objects;
/**
* @ClassName: Result
* @Author:yanliang
* @Date:2024/3/18 15:23
* @Description
*/
public class Result<T> {
public static final String DEFAULT_SUCCESS_MESSAGE = "success";
public static final String DEFAULT_ERROR_MESSAGE = "failed";
public static final String DEFAULT_SUCCESS_CODE = "200";
public static final String DEFAULT_ERROR_CODE = "0";
private String code;
private String message;
private T data;
public Result() {
}
public Result(String code, String message, T data) {
this.code = code;
this.data = data;
this.message = message;
}
public static <T> Result<T> success(Object t) {
Result<T> res = new Result();
res.setCode(DEFAULT_SUCCESS_CODE);
res.setMsg(DEFAULT_SUCCESS_MESSAGE);
res.setData((T) t);
return res;
}
public static <T> Result<T> success() {
Result<T> res = new Result();
res.setCode(DEFAULT_SUCCESS_CODE);
res.setMsg(DEFAULT_SUCCESS_MESSAGE);
res.setData((T) null);
return res;
}
public static <T> Result<T> error() {
Result<T> res = new Result();
res.setCode(DEFAULT_ERROR_CODE);
res.setMsg(DEFAULT_ERROR_MESSAGE);
res.setData((T) null);
return res;
}
public static <T> Result<T> error(Object t) {
Result<T> res = new Result();
res.setCode(DEFAULT_ERROR_CODE);
res.setMsg(DEFAULT_ERROR_MESSAGE);
res.setData((T) t);
return res;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public String getMsg() {
return this.message;
}
public void setMsg(String message) {
this.message = message;
}
public T getData() {
return this.data;
}
public void setData(T data) {
this.data = data;
}
@Transient
@JsonIgnore
public boolean isSuccess() {
return Objects.equals(this.code, "200");
}
public String toString() {
return "ResultResponse [code=" + this.code + ", message=" + this.message + ", data=" + this.data + "]";
}
}
package com.ebaiyihui.family.doctor.common.dto;
import lombok.Data;
/**
* @ClassName: AbnormalDataDTO
* @Author:yanliang
* @Date:2024/3/20 14:00
* @Description
*/
@Data
public class AbnormalDataDTO {
private String abnormalId;
private String phone;
}
package com.ebaiyihui.family.doctor.common.dto;
import lombok.Data;
/**
* @ClassName: DoctorListForScheduleReqDTO
* @Author:yanliang
* @Date:2024/3/22 09:07
* @Description
*/
@Data
public class DoctorListForScheduleReqDTO {
private Long hospitalId;
private Integer servType;
}
package com.ebaiyihui.family.doctor.common.dto;
import lombok.Data;
/**
* @ClassName: DoctorSchedDTO
* @Author:yanliang
* @Date:2024/3/25 14:29
* @Description
*/
@Data
public class DoctorSchedDTO {
private String doctorId;
}
package com.ebaiyihui.family.doctor.common.dto;
import lombok.Data;
/**
* @ClassName: FollowUpOrderDTO
* @Author:yanliang
* @Date:2024/3/20 14:22
* @Description
*/
@Data
public class FollowUpOrderDTO {
private String phone;
private String orderId;
private String doctorId;
private String consultOrderNo;
}
package com.ebaiyihui.family.doctor.common.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @ClassName: GoeasyPushMsgReqDTO
* @Author:yanliang
* @Date:2024/3/15 16:50
* @Description
*/
@Data
public class GoeasyPushMsgReqDTO {
@ApiModelProperty(value = "通知的主体内容")
private String body;
@ApiModelProperty(value = "业务编码")
private String busiCode;
@ApiModelProperty(value = "用户ID")
private String userId;
}
package com.ebaiyihui.family.doctor.common.dto;
import lombok.Data;
/**
* @ClassName: HealthSchStatusDTO
* @Author:yanliang
* @Date:2024/3/20 14:06
* @Description
*/
@Data
public class HealthInfoDTO {
private String phone;
}
package com.ebaiyihui.family.doctor.common.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @ClassName: ImAccountReqDTO
* @Author:yanliang
* @Date:2024/3/18 13:58
* @Description
*/
@Data
public class ImAccountReqDTO {
private String admissionId;
@NotBlank(message = "IM应用编码不能为空")
private String imAppCode;
/**
* 新增了团队就诊 在医生端获取账号时 需要传入登陆医生id
*/
private String doctorId;
}
package com.ebaiyihui.family.doctor.common.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @ClassName: MobileBenefitPackageVo
* @Author:yanliang
* @Date:2024/3/19 11:38
* @Description
*/
@Data
public class MobileBenefitPackageDTO {
@ApiModelProperty(value = "权益编码")
private String productId;
@ApiModelProperty(value = "手机号")
private String phone;
@ApiModelProperty(value = "外部用户id")
private String userId;
@ApiModelProperty(value = "外部订单id")
private String orderId;
@ApiModelProperty(value = "激活订单id")
private String activateOrderId;
@ApiModelProperty(value = "有效期开始时间")
private String benefitsStartTime;
@ApiModelProperty(value = "有效期结束时间")
private String benefitsEndTime;
@ApiModelProperty(value = "限制次数")
private Integer timeLimit;
@ApiModelProperty(value = "是否续订【1:自动续订,0:一次性】")
private String isRenew;
}
package com.ebaiyihui.family.doctor.common.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @ClassName: NotifyConsultDataDTO
* @Author:yanliang
* @Date:2024/3/19 14:27
* @Description
*/
@Data
public class NotifyConsultDataDTO {
private String supplierCode;
@ApiModelProperty(value = "激活订单ID", required = true)
// @NotBlank(message = "激活订单ID 不为空")
private String activateOrderId;
@ApiModelProperty(value = "问诊订单ID", required = true)
// @NotBlank(message = "问诊订单ID 不为空")
private String consultOrderNo;
@ApiModelProperty(value = "订单状态(服务方提供状态映射关系)", required = true)
// @NotBlank(message = "订单状态 不为空")
private String status;
@ApiModelProperty(value = "权益编码", required = true)
// @NotBlank(message = "权益编码 不为空")
private String productId;
@ApiModelProperty(value = "就诊人ID(首次推送必填)", required = false)
private String patientId;
@ApiModelProperty(value = "接诊医生", required = false)
private String expertName;
@ApiModelProperty(value = "下单时间(首次推送必填)格式:yyyy-MM-dd?HH:mm:ss||yyyy/MM/ddHH:mm:ss||yyyy.MM.ddHH:mm:ss||yyyy年MM月dd日HH:mm:ss", required = true)
private String orderDate;
@ApiModelProperty(value = "病情描述", required = false)
private String content;
@ApiModelProperty(value = "私参(JSONString)?具体参数根据服务方定义", required = false)
private String privateParams;
}
......@@ -12,6 +12,7 @@ import lombok.Data;
@Data
public class QueryFamousDTO {
@ApiModelProperty("患者的登录id")
private String userId;
@ApiModelProperty("医疗平台编号")
......@@ -47,9 +48,6 @@ public class QueryFamousDTO {
)
private Integer status;
@ApiModelProperty(value = "服务类型:在线咨询:2,在线复诊:3")
private Integer type;
@ApiModelProperty("预约时间")
private String reserveTime;
@ApiModelProperty("患者id")
private String patientId;
}
......@@ -14,12 +14,22 @@ import java.util.Date;
@Data
public class RequestGetScheduleForWeekDTO {
@ApiModelProperty("医院id")
private Long hospitalId;
@ApiModelProperty("部门id")
private Long deptId;
@ApiModelProperty("第几周")
private Integer week;
@ApiModelProperty("更多周")
private Integer[] weeks;
@ApiModelProperty("医生id")
private String doctorId;
@ApiModelProperty("医生名称")
private String doctorName;
@ApiModelProperty("业务类型")
......
package com.ebaiyihui.family.doctor.common.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @ClassName: RequestUpdateScheduleStatusDTO
* @Author:yanliang
* @Date:2024/3/25 11:21
* @Description
*/
@Data
public class RequestUpdateScheduleStatusDTO {
@ApiModelProperty("排班id")
private Long id;
@ApiModelProperty("停诊复诊:正常—— 1 停诊—— -1")
private Integer scheduleStatus;
@ApiModelProperty("需要停诊的日期 yyyy-MM-dd")
private String scheduleTime;
@ApiModelProperty("是否开启循环排班 1开启 -1关闭")
private Integer isCycleSchedule;
}
package com.ebaiyihui.family.doctor.common.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @ClassName: SearchDoctorDayScheduleReqDTO
* @Author:yanliang
* @Date:2024/3/22 14:25
* @Description
*/
@Data
public class SearchDoctorDayScheduleReqDTO {
private Long hospitalId;
private String doctorName;
private Integer servType;
@ApiModelProperty("选择的日期")
@NotBlank(message = "选择的日期不能为空")
private String scheduleTime;
private Integer pageNum;
private Integer pageSize;
private Integer week;
}
package com.ebaiyihui.family.doctor.common.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @ClassName: SendImMsgDTO
* @Author:yanliang
* @Date:2024/3/15 10:09
* @Description
*/
@Data
public class SendImMsgDTO {
@ApiModelProperty(value = "类型")
private Integer type;
@ApiModelProperty(value = "appCode")
private String appCode;
@ApiModelProperty(value = "医院编码")
private Long organId;
@ApiModelProperty(value = "签约编号")
private String oldAdmId;
@ApiModelProperty(value = "签约编号")
private String admId;
private String abnormalId;
private String intention;
}
package com.ebaiyihui.family.doctor.common.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
......@@ -13,26 +14,41 @@ import javax.validation.constraints.NotNull;
@Data
public class SignedDoctorDTO {
@ApiModelProperty("姓名")
private String name;
private String idCard;
@ApiModelProperty("身份证号码")
private String credNo;
@ApiModelProperty("手机号码")
private String phone;
@ApiModelProperty("医生id")
@NotNull(message = "医生ID不能为空")
private Long doctorId;
@ApiModelProperty("医生名称")
private String doctorName;
@ApiModelProperty("部门id")
private Long deptId;
@ApiModelProperty("部门名称")
private String deptName;
@ApiModelProperty("患者id")
private String patientId;
@ApiModelProperty("签约编号")
private String admId;
@ApiModelProperty("权益包id")
private String packageOrderId;
@ApiModelProperty("签约状态1.未签约2.已签约3:已解约")
private Integer signStatus;
@ApiModelProperty("签约id")
private String signSeqId;
}
package com.ebaiyihui.family.doctor.common.dto;
import lombok.Data;
/**
* @ClassName: SyncSignedOrderDTO
* @Author:yanliang
* @Date:2024/3/18 15:40
* @Description
*/
@Data
public class SyncSignedOrderDTO {
private String doctorId;
private String signSeqId;
private String phone;
private String signType;
private String benefitOrderId;
}
package com.ebaiyihui.family.doctor.common.dto;
import lombok.Data;
/**
* @ClassName: UserInfoDTO
* @Author:yanliang
* @Date:2024/3/20 14:25
* @Description
*/
@Data
public class UserInfoDTO {
private String phone;
}
package com.ebaiyihui.family.doctor.common.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @ClassName: AccessTokenVo
* @Author:yanliang
* @Date:2024/3/18 15:22
* @Description
*/
@Data
public class AccessTokenVo {
@ApiModelProperty(value = "鉴权token")
private String accessToken;
@ApiModelProperty(value = "refreshToken")
private String refreshToken;
@ApiModelProperty(value = "token类型")
private String tokenType;
@ApiModelProperty(value = "生效时间(毫秒)")
private Integer expiresIn;
}
package com.ebaiyihui.family.doctor.common.vo;
import lombok.Data;
/**
* @ClassName: DoctorListForScheduleResVo
* @Author:yanliang
* @Date:2024/3/22 09:08
* @Description
*/
@Data
public class DoctorListForScheduleResVo {
private String doctorId;
private String doctorName;
private String deptName;
private String deptId;
}
......@@ -12,23 +12,53 @@ import lombok.Data;
@Data
public class DoctorListVo {
@ApiModelProperty(value = "医生id")
private String doctorId;
@ApiModelProperty(value = "医生名称")
private String doctorName;
@ApiModelProperty(value = "医生code")
private String doctorCode;
private Long titleId;
@ApiModelProperty(value = "医生title")
private String title;
@ApiModelProperty(value = "医院编码")
private Integer organId;
@ApiModelProperty(value = "医院名称")
private String organName;
@ApiModelProperty(value = "部门Id")
private Integer deptId;
@ApiModelProperty(value = "部门名称")
private String deptName;
@ApiModelProperty(value = "二级部门编码")
private Long stdSecondDeptId;
@ApiModelProperty(value = "手机号码")
private String phoneNum;
@ApiModelProperty(value = "肖像")
private String portrait;
@ApiModelProperty(value = "性别")
private Integer gender;
@ApiModelProperty(value = "医生职业")
private String profession;
@ApiModelProperty(value = "医生简介")
private String introduction;
private String servConfig;
@ApiModelProperty(value = "医院编码")
private Integer organCode;
/**
......@@ -37,12 +67,6 @@ public class DoctorListVo {
@ApiModelProperty(value = "是否是上次签名 1是,0不是")
private Integer lastSign;
/**
* 服务金额ServiceConfigData
*/
// private ServiceConfigVo serviceConfigData;
private String doctorLabelName;
@ApiModelProperty(value = "医生是否在线 1在线 -1下线")
......
package com.ebaiyihui.family.doctor.common.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @ClassName: SignedDoctorVo
* @Author:yanliang
* @Date:2024/3/25 09:04
* @Description
*/
@Data
public class DoctorSchedVo {
@ApiModelProperty("平台code")
private String appCode;
@ApiModelProperty("组织id")
private Long organId;
@ApiModelProperty("组织名称")
private String organName;
@ApiModelProperty("医生id")
private Long doctorId;
@ApiModelProperty("医生名称")
private String doctorName;
@ApiModelProperty("部门id")
private Long deptId;
@ApiModelProperty("部门名称")
private String deptName;
@ApiModelProperty("医生头像")
private String doctorPortrait;
@ApiModelProperty("医生擅长")
private String doctorProfession;
@ApiModelProperty("医生职称")
private String doctorTitle;
}
package com.ebaiyihui.family.doctor.common.vo;
import lombok.Data;
import java.util.List;
/**
* @ClassName: DoctorScheduleInfoResVo
* @Author:yanliang
* @Date:2024/3/22 14:27
* @Description
*/
@Data
public class DoctorScheduleInfoResVo {
List<ScheduleInfoVo> scheduleInfos;
private String scheduleTime;
}
package com.ebaiyihui.family.doctor.common.vo;
import java.util.List;
/**
* @ClassName: ImAccountVo
* @Author:yanliang
* @Date:2024/3/18 13:59
* @Description
*/
public class ImAccountVo {
/**
* 1 个人医生
* 2 团队
*/
private Integer doctorType;
/**
* 如果是团队doctorType=2,则返回群组id
*/
private String groupId;
/**
* 医生imAccount
*/
private String docImAccount;
/**
* 病人imAccount
*/
private String patImAccount;
/**
* 房间号
*/
private Long roomNum;
/**
* 医生imAccount
*/
private List<TeamImAccount> teamImAccount;
public List<TeamImAccount> getTeamImAccount() {
return teamImAccount;
}
public void setTeamImAccount(List<TeamImAccount> teamImAccount) {
this.teamImAccount = teamImAccount;
}
public String getDocImAccount() {
return docImAccount;
}
public void setDocImAccount(String docImAccount) {
this.docImAccount = docImAccount;
}
public String getPatImAccount() {
return patImAccount;
}
public void setPatImAccount(String patImAccount) {
this.patImAccount = patImAccount;
}
public Integer getDoctorType() {
return doctorType;
}
public void setDoctorType(Integer doctorType) {
this.doctorType = doctorType;
}
public String getGroupId() {
return groupId;
}
public void setGroupId(String groupId) {
this.groupId = groupId;
}
public Long getRoomNum() {
return roomNum;
}
public void setRoomNum(Long roomNum) {
this.roomNum = roomNum;
}
@Override
public String toString() {
return "ImAccountVo{" +
"doctorType=" + doctorType +
", groupId='" + groupId + '\'' +
", docImAccount='" + docImAccount + '\'' +
", patImAccount='" + patImAccount + '\'' +
", roomNum=" + roomNum +
'}';
}
}
......@@ -3,6 +3,8 @@ package com.ebaiyihui.family.doctor.common.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @ClassName: ImInfoDetailDocResVo
* @Author:yanliang
......@@ -38,4 +40,6 @@ public class ImInfoDetailDocResVo {
@ApiModelProperty("科室名称")
private String deptName;
private Date signEndTime;
}
......@@ -43,7 +43,7 @@ public class ImInfoListResVo {
private Integer age;
@ApiModelProperty("身份证")
private String idCard;
private String credNo;
@ApiModelProperty("身份证")
private String patientId;
......
......@@ -27,12 +27,23 @@ public class ImInfoResVo {
private String sig;
private Long doctorId;
@ApiModelProperty("医生头像")
private String doctorPortrait;
@ApiModelProperty("医生姓名")
private String doctorName;
@ApiModelProperty("医生科室id")
private String deptId;
@ApiModelProperty("患者名称")
private String patientName;
@ApiModelProperty("患者头像")
private String patientPortrait;
@ApiModelProperty("IM历史消息")
private List<IMMsgResultVo> iMMsgVo;
}
package com.ebaiyihui.family.doctor.common.vo;
import com.ebaiyihui.card.common.vo.CardDetailsInfoRespVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @ClassName: RegistPatientVo
* @Author:yanliang
* @Date:2024/3/19 10:38
* @Description
*/
@Data
public class RegisterPatientVo {
@ApiModelProperty("就诊人信息")
CardDetailsInfoRespVO patientInfo;
@ApiModelProperty("激活权益订单号")
private String activateOrderId;
@ApiModelProperty("问诊订单ID")
private String admId;
@ApiModelProperty("排班标识")
private Integer scheduleFlag;
@ApiModelProperty("消息推送类型")
private Integer msgPushType;
@ApiModelProperty("签约id")
private String signSeqId;
private String abnormalId;
private String intention;
private String doctorId;
}
......@@ -13,7 +13,6 @@ import java.util.List;
@Data
public class ScheduleOfDayVo {
private ScheduleTimeSaveListVo scheduleTimeSaveListVo;
private List<ScheduleTimeSaveListVo> scheduleTimeSaveListVo;
private List<ScheduleRecordVo> recordVoList;
}
package com.ebaiyihui.family.doctor.common.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @ClassName: TeamImAccount
* @Author:yanliang
* @Date:2024/3/18 14:00
* @Description
*/
@Data
public class TeamImAccount {
@ApiModelProperty("医生头像")
private String portrait;
@ApiModelProperty("医生姓名")
private String doctorName;
@ApiModelProperty("职称")
private String title;
@ApiModelProperty("IM账号")
private String imAccount;
}
......@@ -84,6 +84,11 @@
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<!--swagger接口文档-->
<dependency>
<groupId>io.springfox</groupId>
......@@ -114,17 +119,17 @@
<version>5.1.30</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
<exclusions>
<exclusion>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.mybatis.spring.boot</groupId>-->
<!-- <artifactId>mybatis-spring-boot-starter</artifactId>-->
<!-- <version>1.3.2</version>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>org.mybatis</groupId>-->
<!-- <artifactId>mybatis</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->
<dependency>
<groupId>com.baomidou</groupId>
......@@ -141,13 +146,19 @@
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.5</version>
<version>1.2.12</version>
<exclusions>
<exclusion>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.amqp</groupId>-->
<!-- <artifactId>spring-rabbit</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>com.ning</groupId>
......@@ -206,6 +217,12 @@
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.ebaiyihui</groupId>
<artifactId>byh-card-service-client</artifactId>
<version>${card.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.ebaiyihui</groupId>-->
......@@ -236,6 +253,23 @@
<!-- <scope>compile</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.4.2</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>cn.6tail</groupId>-->
<!-- <artifactId>lunar</artifactId>-->
<!-- <version>1.6.3</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>cn.6tail</groupId>-->
<!-- <artifactId>tyme4j</artifactId>-->
<!-- <version>1.0.3</version>-->
<!-- </dependency>-->
</dependencies>
<build>
......
......@@ -3,22 +3,20 @@ package com.ebaiyihui.family.doctor.server.aspect;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Arrays;
import java.util.Objects;
/**
* @program chenmt-rides
......@@ -33,87 +31,47 @@ import java.util.Map;
public class LogAspect {
//xyz.chenmt.www.chenmtrides.controller包下的所有类中的所有方法,".."表示所有方法中的参数不限个数;
//切入点,其中execution用于使用切面的连接点。使用方法:execution(方法修饰符(可选)
// 返回类型 方法名 参数 异常模式(可选)) ,可以使用通配符匹配字符,*可以匹配任意字符。
@Pointcut("execution(public * com.ebaiyihui.family.doctor.server.controller.*.*(..))")
public void LogAspect(){}
public void LogAspect() {
}
//环绕通知,就是可以在执行前后都使用,这个方法参数必须为ProceedingJoinPoint,proceed()方法就是被切面的方法,
// 上面四个方法可以使用JoinPoint,JoinPoint包含了类名,被切面的方法名,参数等信息。
@Around("LogAspect()")
public Object deAround(ProceedingJoinPoint pjp) throws Throwable{
Long time = 0L;
RequestAttributes ra = RequestContextHolder.getRequestAttributes();
ServletRequestAttributes sra = (ServletRequestAttributes) ra;
HttpServletRequest request = sra.getRequest();
@Before("LogAspect()")
public void doBefore(JoinPoint joinPoint) throws Throwable {
time = System.currentTimeMillis();
/**
* 接收到请求,记录请求内容
*/
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
//ip地址
String ipaddress;
if (request.getHeader("x-forwarded-for") == null) {
ipaddress = request.getRemoteAddr();
} else {
ipaddress = request.getHeader("x-forwarded-for");
}
Method targetMethod = ((MethodSignature) joinPoint.getSignature()).getMethod();
String url = request.getRequestURL().toString();
String method = request.getMethod();
String queryString = request.getQueryString();
Object[] args = pjp.getArgs();
String params = "";
//获取请求参数集合并进行遍历拼接
if(args.length>0){
if("POST".equals(method)){
Object object = args[0];
Map map = getKeyAndValue(object);
params = JSON.toJSONString(map);
;
}else if("GET".equals(method)){
params = queryString;
}
}
Signature signature = pjp.getSignature();
MethodSignature methodSignature = (MethodSignature)signature;
Method targetMethod = methodSignature.getMethod();
Method realMethod = joinPoint.getTarget().getClass().getDeclaredMethod(joinPoint.getSignature().getName(), targetMethod.getParameterTypes());
Method realMethod = pjp.getTarget().getClass().getDeclaredMethod(signature.getName(), targetMethod.getParameterTypes());
ApiOperation operation = realMethod.getAnnotation(ApiOperation.class);
ApiOperation operation=realMethod.getAnnotation(ApiOperation.class);
if(null!=operation){
log.info("请求开始===方法描述:{},请求方法:{},请求地址:{},请求ip:{},请求类型:{},请求参数:{}",operation.value(),realMethod.getName(),url,ipaddress,method,params);
}else{
log.info("请求开始===请求方法:{},请求地址:{},请求ip:{},请求类型:{},请求参数:{}",realMethod.getName(),url,ipaddress,method,params);
/**
* 记录下请求内容
*/
if (Objects.nonNull(operation)){
log.info("请求开始===方法描述:{},\n请求方法:{},\n请求地址:{},\n请求ip:{},\n请求类型:{},\n请求参数:{}", operation.value(), joinPoint.getSignature().getName(), request.getRequestURL().toString(),
request.getRemoteAddr(), request.getMethod(), JSON.toJSONString(Arrays.toString(joinPoint.getArgs())));
}
// result的值就是被拦截方法的返回值
// Object result = pjp.proceed();
// log.info("请求结束===返回值{}",JSONObject.toJSON(result));
return pjp.proceed();
}
@AfterReturning(returning = "ret", pointcut = "LogAspect()")
public void doAfterReturning(Object ret) throws Throwable {
public static Map<String, Object> getKeyAndValue(Object obj) {
Map<String, Object> map = new HashMap<String, Object>();
// 得到类对象
Class userCla = (Class) obj.getClass();
/* 得到类中的所有属性集合 */
Field[] fs = userCla.getDeclaredFields();
for (int i = 0; i < fs.length; i++) {
Field f = fs[i];
f.setAccessible(true); // 设置些属性是可以访问的
Object val;
try {
val = f.get(obj);
// 得到此属性的值
map.put(f.getName(), val);// 设置键值
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
return map;
/**
* 处理完请求,返回内容
*/
log.info("请求结束===返回值==>{}", JSON.toJSONString(ret));
log.info("=======请求接口所需时间====>{}", JSON.toJSONString((System.currentTimeMillis() - time)));
}
}
......@@ -131,4 +131,17 @@ public class CommonConstants {
public static final String ORGAN_NAME = "南昌众康医院";
public static final Long ORGAN_CODE = 130188L;
public static final Integer DAY = 30;
public static final String GRANT_TYPE = "client_credentials";
public static final String DES_SECRET = "zk26rdgfsg23j42fewegfr234h23423g44323";
public static final String SIGN_SECRET = "123456";
public static final String SUPPLIER_CODE = "ZhongKang";
public static final String SUPPLIER_CODE_JTYS = "zhongkang_mfd";
}
......@@ -92,7 +92,7 @@ public class IMInformConstants {
/**
* im系统在线门诊(咨询)业务区分code
*/
public static final String IM_SYSTEM_BUSINESS_CODE = "zxzx";
public static final String IM_SYSTEM_BUSINESS_CODE = "jtys";
public static final String REFERRAL_CARD = "referralCard";
......
......@@ -12,7 +12,7 @@ public class ImConstants {
/**
* im服务中查询在线咨询内容需要的code
*/
public static final String IM_QUERY_ACCOUNT_CODE = "zxzx";
public static final String IM_QUERY_ACCOUNT_CODE = "jtys";
/**
* 区分imaccount-医生
......
package com.ebaiyihui.family.doctor.server.common.constants;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @ClassName: ProjProperties
* @Author:yanliang
* @Date:2024/3/15 16:45
* @Description
*/
@Data
@Component
@ConfigurationProperties(prefix = "projprops")
public class ProjProperties {
private String userFindUserId;
private String userInfo;
private String baseAddress;
private String familyDoctorThirdUrl;
private String familyDoctorThirdClientId;
private String familyDoctorThirdClientSecret;
}
package com.ebaiyihui.family.doctor.server.common.constants;
/**
* @ClassName: UrlConstants
* @Author:yanliang
* @Date:2024/3/15 16:49
* @Description
*/
public class UrlConstants {
public static final String GO_EASY_PUSH = "/cloud/push/goeasy/pushgoeasyuserid";
/**
* 获取token地址
*/
public static final String GET_TOKEN_URL = "/auth/v1.0.0/oauth/token";
/**
* 订单同步地址
*/
public static final String PUSH_DATA_URL = "/notify_consult/v1.0.1/data";
/**
* 签约信息同步
*/
public static final String SYNC_SIGNED_ORDER_URL = "/auth/v1.0.1/signature/info";
/**
* 修改签约信息
*/
public static final String UPDATE_SIGNED_ORDER_URL = "/auth/v1.0.1/signature/changeSign";
/**
* 获取异常数据
*/
public static final String ABNORMAL_DATA_URL = "/auth/v1.0.0/abnormal/detail";
/**
* 查询用户健康计划是否开启状态
*/
public static final String HEALTH_SCHEDULE_STATUS_URL = "/auth/v1.0.0/healthSchedule/status";
/**
* 查询用户健康档案30天内是否有更新
*/
public static final String HEALTH_RECORD_WHETHER_UPDATE_URL = "/auth/v1.0.0/healthRecordWhetherUpdate";
/**
* 推送创建家庭医生图文随访订单
*/
public static final String PUSH_FOLLOW_UP_ORDER_URL = "/auth/v1.0.0/push/follow_up_order";
/**
* 查询用户头像
*/
public static final String USER_PIC_URL = "/auth/v1.0.0/userPicUrl";
/**
* 查询用户基础信息
*/
public static final String USER_BASIC_INFO_URL = "/auth/v1.0.0/userBasicInformation";
/**
* 查询用户基础指标信息
*/
public static final String USER_BASIC_IND_URL = "/auth/v1.0.0/userBasicIndicators";
}
package com.ebaiyihui.family.doctor.server.common.enums;
/**
* @ClassName: SignStatus
* @Author:yanliang
* @Date:2024/3/15 17:50
* @Description
*/
public enum ContentType {
// 内容中的占位符
DOCTOR("医生", 1),
PATIENT("患者", 2);
private String desc;
private Integer value;
private ContentType(String desc, Integer value) {
this.desc = desc;
this.value = value;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
}
package com.ebaiyihui.family.doctor.server.common.enums;
/**
* @ClassName: SignImStatus
* @Author:yanliang
* @Date:2024/3/15 17:33
* @Description
*/
public enum ImSignStatus {
SIGN_SUC("签约成功", 1),
REISSUE_SUC("改签成功", 2),
INQUIRY_DOC("问医生", 3),
INQUIRY_SCH_DOC("问值班医生", 4),
HEALTH_ILLNESS_CONSULT("健康/疾病咨询", 5),
MEDIC_GUID("用药指导", 6),
REPORT_INTERPRET("报告解读", 7),
PRES_MEDIC("处方开药", 8),
REPORT_EXC("报告异常", 9),
HEALTH_EVAL("完成健康评估后", 10);
private String desc;
private Integer value;
private ImSignStatus(String desc, Integer value) {
this.desc = desc;
this.value = value;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
}
package com.ebaiyihui.family.doctor.server.common.enums;
/**
* @ClassName: MsgTempTypeEnum
* @Author:yanliang
* @Date:2024/3/20 17:59
* @Description
*/
public enum MsgTempTypeEnum {
SIG_SUC("签约成功", 1),
UP_SUC("改签成功", 2),
HP_INQ_DOCTOR("家庭主页问医生", 3),
HP_INQ_DUTY_DOCTOR("家庭主页问联系值班医生", 4),
HEAL_DIS_CON("健康/疾病咨询", 5),
MED_GUD("用药指导", 6),
REP_INTER("报告解读", 7),
PRES_MED("处方开药", 8),
REP_ANO("报告异常", 9),
AFTER_HEAL_ASSE("完成健康评估后", 10),
ACT_PUSH_HEAL_REC("健康档案未完善主动推送", 11),
ACT__SIG_SUC("签约完成主动随访", 12),
ACT_FU_REP_ANO("报告异常主动随访", 13),
ACT_FU_UN_CON("未进行沟通主动随访", 14),
ACT_FU_TSD("清明节主动随访", 15),
ACT_FU_LD("劳动节主动随访", 16),
ACT_FU_TDBF("端午节主动随访", 17),
ACT_FU_MAF("中秋节主动随访", 18),
ACT_FU_ND("国庆节主动随访", 19);
private String desc;
private Integer value;
private MsgTempTypeEnum(String desc, Integer value) {
this.desc = desc;
this.value = value;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
}
package com.ebaiyihui.family.doctor.server.common.enums;
/**
* @ClassName: SenderEnum
* @Author:yanliang
* @Date:2024/3/15 10:59
* @Description
*/
public enum SenderEnum {
DOCTOR("doctor", 1),
PATIENT("patient", 2);
private String desc;
private Integer value;
private SenderEnum(String desc, Integer value) {
this.desc = desc;
this.value = value;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
}
package com.ebaiyihui.family.doctor.server.common.enums;
/**
* @ClassName: SignStatus
* @Author:yanliang
* @Date:2024/3/15 17:50
* @Description
*/
public enum SignStatus {
// 签约状态1.未签约2.已签约3:已解约
NORMAL("未签约", 1),
SIGNED("已签约", 2),
CANCEL("已解约", 3);
private String desc;
private Integer value;
private SignStatus(String desc, Integer value) {
this.desc = desc;
this.value = value;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
}
package com.ebaiyihui.family.doctor.server.common.enums;
/**
* @ClassName: SignTypeEnum
* @Author:yanliang
* @Date:2024/3/18 16:06
* @Description
*/
public enum SignTypeEnum {
// 1:签约团体,2:签约医生
SIGNED_MEMBER("签名团体", "1"),
SIGNED_DOCTOR("签名医生", "2");
public String desc;
public String value;
private SignTypeEnum(String desc, String value) {
this.desc = desc;
this.value = value;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
package com.ebaiyihui.family.doctor.server.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.HashMap;
/**
* @ClassName: RabbitMqConfig
* @Author:yanliang
* @Date:2024/3/20 11:05
* @Description
*/
@Configuration
@Slf4j
public class RabbitMqConfig {
/**
* 延迟队列 TTL 名称
*/
public static final String ORDER_DELAY_QUEUE_1 = "byh-family-doctor-delay-queue";
/**
* 延迟交换机
*/
public static final String ORDER_DELAY_EXCHANGE = "byh-family-doctor-delay-exchange";
public static final String ORDER_ROUTING_KEY_5 = "family-doctor-order-key";
public static final String INQUIRY_END_PRE_QUEUE_NAME = "family.doctor.end.pre";
public static final String INQUIRY_END_PRE_KEY = "family.doctor-end-pre-key";
@Bean
public Queue queue() {
// 队列持久
return new Queue("family-doctor", true);
}
@Bean
DirectExchange exchange() {
// 交换机
return new DirectExchange("family-doctor-exchange", false, false);
}
@Bean
public Binding binding() {
// 消息队列绑定交换机
return BindingBuilder.bind(queue()).to(exchange()).with("family-doctor");
}
@Bean
public Queue delayedQueue() {
return new Queue(ORDER_DELAY_QUEUE_1, true);
}
@Bean
public CustomExchange orderDelayExchange1() {
HashMap param = new HashMap(10);
param.put("x-delayed-type", "direct");
return new CustomExchange(ORDER_DELAY_EXCHANGE, "x-delayed-message", true, false, param);
}
@Bean
public Binding orderBinding5() {
return BindingBuilder.bind(delayedQueue()).to(orderDelayExchange1()).with(ORDER_ROUTING_KEY_5).noargs();
}
@Bean
public Queue familyDoctorEndPreQueue() {
return new Queue(INQUIRY_END_PRE_QUEUE_NAME, true);
}
@Bean
public Binding familyDoctorEndPreBinding() {
return BindingBuilder.bind(familyDoctorEndPreQueue()).to(orderDelayExchange1()).with(INQUIRY_END_PRE_KEY).noargs();
}
}
package com.ebaiyihui.family.doctor.server.controller;
import com.ebaiyihui.family.doctor.common.dto.DoctorListForScheduleReqDTO;
import com.ebaiyihui.family.doctor.common.dto.DoctorSchedDTO;
import com.ebaiyihui.family.doctor.common.dto.QueryDoctorsDTO;
import com.ebaiyihui.family.doctor.common.dto.SearchDoctorDayScheduleReqDTO;
import com.ebaiyihui.family.doctor.common.vo.DoctorListForScheduleResVo;
import com.ebaiyihui.family.doctor.common.vo.DoctorListVo;
import com.ebaiyihui.family.doctor.common.vo.DoctorSchedVo;
import com.ebaiyihui.family.doctor.common.vo.DoctorScheduleInfoResVo;
import com.ebaiyihui.family.doctor.server.service.DoctorService;
import com.ebaiyihui.framework.page.PageResult;
import com.ebaiyihui.framework.response.BaseResponse;
......@@ -15,6 +21,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @ClassName: DoctorController
* @Author:yanliang
......@@ -31,19 +39,48 @@ public class DoctorController {
private DoctorService doctorService;
@ApiOperation(value = "获取医生列表和服务次数信息", notes = "医生服务feign调用")
@RequestMapping(value = "/getDoctorList", method = RequestMethod.POST)
public BaseResponse<PageResult<DoctorListVo>> getDoctorList(@RequestBody QueryDoctorsDTO reqVo,
BindingResult bindingResult) {
@RequestMapping(value = "/getSignedDoctorList", method = RequestMethod.POST)
public BaseResponse<PageResult<DoctorListVo>> getSignedDoctorList(@RequestBody QueryDoctorsDTO reqVo,
BindingResult bindingResult) {
BaseResponse<PageResult<DoctorListVo>> doctorListVo = null;
try {
doctorListVo = doctorService.getDoctorList(reqVo);
doctorListVo = doctorService.getSignedDoctorList(reqVo);
} catch (Exception e) {
log.error("获取医生列表异常",e);
return BaseResponse.error(e.getMessage());
}
return doctorListVo;
}
@ApiOperation(value = "管理端分类获取开通在线问诊的医生列表")
@RequestMapping(value = "/getDoctorListForSchedule", method = RequestMethod.POST)
public BaseResponse<List<DoctorListForScheduleResVo>> getDoctorListForSchedule(@RequestBody DoctorListForScheduleReqDTO req) {
return doctorService.getDoctorListForSchedule(req);
}
@ApiOperation(value = "管理端搜索医生某天的排班")
@RequestMapping(value = "/searchDoctorDaySchedule", method = RequestMethod.POST)
public BaseResponse<DoctorScheduleInfoResVo> searchDoctorDaySchedule(@RequestBody SearchDoctorDayScheduleReqDTO reqDTO) {
return doctorService.searchDoctorDaySchedule(reqDTO);
}
@ApiOperation(value = "获取医生排班信息", notes = "医生服务feign调用")
@RequestMapping(value = "/getDoctorSched", method = RequestMethod.POST)
public BaseResponse<DoctorSchedVo> getDoctorSched(@RequestBody DoctorSchedDTO reqVo,
BindingResult bindingResult) {
BaseResponse<DoctorSchedVo> response = null;
try {
response = doctorService.getDoctorSched(reqVo);
} catch (Exception e) {
return BaseResponse.error(e.getMessage());
}
return response;
}
}
package com.ebaiyihui.family.doctor.server.controller;
import com.ebaiyihui.family.doctor.common.dto.SendImMsgDTO;
import com.ebaiyihui.family.doctor.server.service.ImMsgTemplateService;
import com.ebaiyihui.framework.response.BaseResponse;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
/**
* @ClassName: ImMsgTemplateController
* @Author:yanliang
* @Date:2024/3/15 10:07
* @Description
*/
@RestController
@RequestMapping("/imMsgTemplate")
@Api(tags = "消息发送API")
@Slf4j
public class ImMsgTemplateController {
@Autowired
private ImMsgTemplateService imMsgTemplateService;
@RequestMapping(value = "/sendImMsg", method = RequestMethod.POST)
public BaseResponse<String> sendImMsg(@RequestBody SendImMsgDTO reqVo,
BindingResult bindingResult) {
BaseResponse<String> response = null;
try {
response = imMsgTemplateService.sendImMsg(reqVo);
} catch (Exception e) {
return BaseResponse.error(e.getMessage());
}
return BaseResponse.success("消息推送成功");
}
}
package com.ebaiyihui.family.doctor.server.controller;
import com.ebaiyihui.family.doctor.common.bo.MobileBenefitRes;
import com.ebaiyihui.family.doctor.common.bo.Result;
import com.ebaiyihui.family.doctor.common.dto.MobileBenefitPackageDTO;
import com.ebaiyihui.family.doctor.common.vo.RegisterPatientVo;
import com.ebaiyihui.family.doctor.server.service.MobileBenefitPackageService;
import com.ebaiyihui.framework.response.BaseResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @ClassName: MobileBenefitPackageController
* @Author:yanliang
* @Date:2024/3/19 10:36
* @Description
*/
@Slf4j
@RestController
@RequestMapping("/mobile/v1.0.0")
@Api(tags = "众康移动对接相关API")
public class MobileBenefitPackageController {
@Autowired
private MobileBenefitPackageService mobileBenefitPackageService;
@GetMapping("/h5/login")
@ApiOperation(value = "登陆并注册就诊卡")
public BaseResponse<RegisterPatientVo> login(@RequestParam("token") String token) {
return mobileBenefitPackageService.register(token);
}
@PostMapping("/benefit/activate")
@ApiOperation(value = "生成权益订单同步推送")
public Result<MobileBenefitRes> addBenefitPackage(@RequestBody List<MobileBenefitPackageDTO> vos){
return mobileBenefitPackageService.addBenefitPackage(vos);
}
}
......@@ -44,7 +44,7 @@ public class PatientController {
return response;
}
@ApiOperation(value = "签约医生", notes = "医生服务feign调用")
@ApiOperation(value = "获取签约医生信息", notes = "医生服务feign调用")
@RequestMapping(value = "/getSignedDoctor", method = RequestMethod.POST)
public BaseResponse<PatientSignEntity> getSignedDoctor(@RequestBody SignedDoctorDTO reqVo,
BindingResult bindingResult) {
......
package com.ebaiyihui.family.doctor.server.controller;
import com.ebaiyihui.family.doctor.common.dto.ImInfoDetailDocReqDTO;
import com.ebaiyihui.family.doctor.common.dto.ImInfoListDocReqDTO;
import com.ebaiyihui.family.doctor.common.dto.RequestGetDoctorOfficeStatusDTO;
import com.ebaiyihui.family.doctor.common.dto.RequestServiceConfigDTO;
import com.ebaiyihui.family.doctor.common.vo.ImInfoDetailDocResVo;
import com.ebaiyihui.family.doctor.common.vo.ImInfoListResVo;
import com.ebaiyihui.family.doctor.common.vo.RequestOnlineOrOfflineVo;
import com.ebaiyihui.family.doctor.common.vo.ImInfoResVo;
import com.ebaiyihui.family.doctor.common.dto.*;
import com.ebaiyihui.family.doctor.common.vo.*;
import com.ebaiyihui.family.doctor.server.service.PatientSignService;
import com.ebaiyihui.family.doctor.server.service.ServiceConfigService;
import com.ebaiyihui.family.doctor.server.util.PageUtil;
import com.ebaiyihui.framework.response.BaseResponse;
import com.ebaiyihui.imforward.client.vo.IMQueryMsgReqVO;
import com.ebaiyihui.imforward.client.vo.IMQueryUserLoginReqVO;
import com.ebaiyihui.imforward.client.vo.IMQueryUserLoginRspVO;
import com.ebaiyihui.imforward.client.vo.IMSingleMsgResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -101,4 +97,20 @@ public class PatientSignController {
}
return serviceConfigService.saveServiceInfo(serviceConfigDTO);
}
@ApiOperation(value = "获取im账号,==聊天界面", notes = "获取医生和病人的im账号")
@RequestMapping(value = "/queryImAccount", method = RequestMethod.POST)
public BaseResponse<ImAccountVo> queryImAccount(@RequestBody @Validated ImAccountReqDTO param,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return BaseResponse.error(bindingResult.getFieldError().getDefaultMessage());
}
return patientSignService.queryImAccount(param);
}
@ApiOperation(value = "查询APP客户端是或否需要登陆IM", httpMethod = "POST", notes = "查询APP客户端是或否需要登陆IM")
@RequestMapping(value = "/querysdklogin", method = RequestMethod.POST)
public BaseResponse<IMQueryUserLoginRspVO> querySdkLogin(@RequestBody IMQueryUserLoginReqVO reqVO) {
return patientSignService.querySdkLogin(reqVO);
}
}
......@@ -2,6 +2,7 @@ package com.ebaiyihui.family.doctor.server.controller;
import com.ebaiyihui.family.doctor.common.dto.InsertScheduleRecordReqDTO;
import com.ebaiyihui.family.doctor.common.dto.RequestGetScheduleForWeekDTO;
import com.ebaiyihui.family.doctor.common.dto.RequestUpdateScheduleStatusDTO;
import com.ebaiyihui.family.doctor.common.dto.ScheduleForWeekReqDTO;
import com.ebaiyihui.family.doctor.common.vo.ResponseGetScheduleForWeekVo;
import com.ebaiyihui.family.doctor.common.vo.ScheduleForWeekResVo;
......@@ -56,4 +57,10 @@ public class ScheduleRecordController {
return scheduleRecordService.scheduleForWeekNew(scheduleForWeekReqDTO);
}
@RequestMapping(value = "/updateStatus", method = RequestMethod.POST)
@ApiOperation("更新或者删除排班")
public BaseResponse<String> updateStatus(@RequestBody RequestUpdateScheduleStatusDTO updateScheduleStatusDTO) {
return scheduleRecordService.updateStatus(updateScheduleStatusDTO);
}
}
package com.ebaiyihui.family.doctor.server.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
/**
* @ClassName: ImMsgTemplate
* @Author:yanliang
* @Date:2024/3/15 09:59
* @Description
*/
@Data
@TableName(value = "im_msg_template")
public class ImMsgTemplateEntity {
@TableId
private Long id;
private Integer type;
private String appCode;
private Long organId;
private String content;
private Date createTime;
private Date updateTime;
private String templateName;
private String remark;
}
package com.ebaiyihui.family.doctor.server.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @ClassName: MobileBenefitPackageEntity
* @Author:yanliang
* @Date:2024/3/19 10:35
* @Description
*/
@Data
@TableName(value = "mobile_benefit_package")
public class MobileBenefitPackageEntity {
/**
* 主键ID
*/
private String xId;
/**
* 创建时间
*/
private Date xCreateTime;
/**
* 更新时间
*/
private Date xUpdateTime;
@ApiModelProperty(value = "权益编码")
private String productId;
@ApiModelProperty(value = "手机号")
private String phone;
@ApiModelProperty(value = "外部用户id")
private String userId;
@ApiModelProperty(value = "外部订单id")
private String orderId;
@ApiModelProperty(value = "激活订单id")
private String activateOrderId;
@ApiModelProperty(value = "有效期开始时间")
private String benefitsStartTime;
@ApiModelProperty(value = "有效期结束时间")
private String benefitsEndTime;
@ApiModelProperty(value = "限制次数")
private Integer timeLimit;
@ApiModelProperty(value = "是否续订【1:自动续订,0:一次性】")
private String isRenew;
@ApiModelProperty(value = "使用次数")
private Integer used;
@ApiModelProperty(value = "医生id")
private String doctorId;
private Integer version;
}
package com.ebaiyihui.family.doctor.server.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
......@@ -11,8 +14,10 @@ import java.util.Date;
* @Description
*/
@Data
@TableName(value = "patient")
public class PatientEntity {
@TableId(type = IdType.ID_WORKER_STR)
private String id;
private Date createTime;
......
package com.ebaiyihui.family.doctor.server.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
......@@ -11,43 +14,73 @@ import java.util.Date;
* @Description
*/
@Data
@TableName(value = "patient_sign")
public class PatientSignEntity {
@ApiModelProperty("主键id")
@TableId
private Long id;
@ApiModelProperty("签约编号")
private String admId;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("更新时间")
private Date updateTime;
@ApiModelProperty("平台code")
private String appCode;
@ApiModelProperty("组织id")
private Long organId;
@ApiModelProperty("组织名称")
private String organName;
@ApiModelProperty("患者id")
private String patientId;
@ApiModelProperty("患者im用户id")
private String patientUserId;
@ApiModelProperty("患者名称")
private String patientName;
@ApiModelProperty("患者手机号码")
private String patientPhone;
@ApiModelProperty("身份证号码")
private String credNo;
@ApiModelProperty("医生id")
private Long doctorId;
@ApiModelProperty("医生名称")
private String doctorName;
@ApiModelProperty("部门id")
private Long deptId;
@ApiModelProperty("部门名称")
private String deptName;
@ApiModelProperty("签约状态1.未签约2.已签约3:已解约")
private Integer signStatus;
@ApiModelProperty("改签状态1、正常2、已改签")
private Integer subStatus;
@ApiModelProperty("业务状态2:进行中3:已完成4:已过期")
private Integer status;
@ApiModelProperty("权益包id")
private String packageOrderId;
@ApiModelProperty("签名结束时间")
private Date signEndTime;
@ApiModelProperty("签约关联id")
private Long signId;
}
package com.ebaiyihui.family.doctor.server.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -14,10 +17,10 @@ import java.util.Date;
* @Description
*/
@Data
//@TableName("schedule_record")
@TableName("schedule_record")
public class ScheduleRecordEntity {
// @TableId
@TableId(type = IdType.AUTO)
private Long id;
/**
* 创建时间
......@@ -62,7 +65,7 @@ public class ScheduleRecordEntity {
@ApiModelProperty(value = "号源日期")
@NotBlank(message = "号源日期")
@JsonFormat(pattern = "yyyy-MM-dd" ,timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date scheduleDate;
@ApiModelProperty(value = "排班类型0 全天 1 上午 2下午 3夜间门诊")
......
package com.ebaiyihui.family.doctor.server.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -13,9 +15,11 @@ import java.util.Date;
* @Description
*/
@Data
@TableName(value = "service_config")
public class ServiceConfigEntity {
private String id;
@TableId
private Long id;
/**
* 创建时间
*/
......
package com.ebaiyihui.family.doctor.server.feign;
import com.doctor.basedata.api.DepartmentInfoApi;
import org.springframework.cloud.openfeign.FeignClient;
/**
* @ClassName: DepartmentFeignClient
* @Author:yanliang
* @Date:2024/3/22 09:24
* @Description
*/
@FeignClient(name = "doctoruser-service-api", url = "${cloudDoctorUrl}")
public interface DepartmentFeignClient extends DepartmentInfoApi {
}
package com.ebaiyihui.family.doctor.server.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ebaiyihui.family.doctor.server.entity.ImMsgTemplateEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* @ClassName: ImMsgTemplateMapper
* @Author:yanliang
* @Date:2024/3/15 10:05
* @Description
*/
@Mapper
public interface ImMsgTemplateMapper extends BaseMapper<ImMsgTemplateEntity> {
}
package com.ebaiyihui.family.doctor.server.mapper;
import com.ebaiyihui.family.doctor.server.entity.MobileBenefitPackageEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @ClassName: MobileBenefitPackageMapper
* @Author:yanliang
* @Date:2024/3/19 10:56
* @Description
*/
@Mapper
public interface MobileBenefitPackageMapper {
void insert(MobileBenefitPackageEntity entity);
MobileBenefitPackageEntity queryByPhone(@Param("mobile") String mobile, @Param("activateOrderId") String activateOrderId);
void updateUsed(MobileBenefitPackageEntity entity);
// MobileBenefitPackageEntity queryByOrderId(@Param("orderId") String orderId);
void update(MobileBenefitPackageEntity entity);
void updateDoctorId(MobileBenefitPackageEntity entity);
void updateVersion(MobileBenefitPackageEntity entity);
List<String> getPatientIdsByPhoneAndOrderId(@Param("phone") String phone);
List<MobileBenefitPackageEntity> queryMaxOneList();
}
......@@ -3,6 +3,9 @@ package com.ebaiyihui.family.doctor.server.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ebaiyihui.family.doctor.server.entity.ScheduleRecordEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @ClassName: ScheduleRecordMapper
......@@ -12,4 +15,10 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ScheduleRecordMapper extends BaseMapper<ScheduleRecordEntity> {
List<ScheduleRecordEntity> selectByDate(@Param("hospitalId") String hospitalId,
@Param("servType") Integer servType,
@Param("scheduleDate") String scheduleDate,
@Param("status") Integer status,
@Param("endStart") String endStart);
}
package com.ebaiyihui.family.doctor.server.rabbitmq;
import com.ebaiyihui.family.doctor.server.common.enums.StatusEnum;
import com.ebaiyihui.family.doctor.server.config.RabbitMqConfig;
import com.ebaiyihui.family.doctor.server.entity.PatientSignEntity;
import com.ebaiyihui.family.doctor.server.mapper.PatientSignMapper;
import com.ebaiyihui.family.doctor.server.vo.OrderTaskVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;
import java.util.Date;
/**
* @ClassName: RabbitConsumer
* @Author:yanliang
* @Date:2024/3/20 11:19
* @Description
*/
@Slf4j
@Component
public class RabbitConsumer {
@Autowired
private PatientSignMapper patientSignMapper;
@RabbitListener(queues = RabbitMqConfig.ORDER_DELAY_QUEUE_1)
public void orderDelayQueue1(@Payload OrderTaskVo orderTaskVo) {
log.info("定时任务监听结果:{}", orderTaskVo.toString());
try {
String id = orderTaskVo.getId();
log.info("【orderDelayQueue 监听的消息】 - 【消费时间】 - [{}]- 【订单ID】 - [{}]", new Date(), id);
PatientSignEntity patientSignEntity = patientSignMapper.selectById(id);
if (null == patientSignEntity) {
return;
}
// 存在进行中订单则将订单状态改为失效
if (StatusEnum.IN_CONSULTATION.getValue().equals(patientSignEntity.getStatus())) {
patientSignEntity.setStatus(StatusEnum.FINISH_APPLY.getValue());
patientSignMapper.updateById(patientSignEntity);
}
} catch (Exception e) {
log.info("orderDelayQueue监听异常", e);
return;
}
}
}
package com.ebaiyihui.family.doctor.server.rabbitmq;
import com.ebaiyihui.family.doctor.server.config.RabbitMqConfig;
import com.ebaiyihui.family.doctor.server.vo.OrderTaskVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.core.MessageDeliveryMode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Objects;
/**
* @ClassName: RabbitProduct
* @Author:yanliang
* @Date:2024/3/20 11:19
* @Description
*/
@Component
@Slf4j
public class RabbitProduct {
/**
* 24小时医生未接待
*/
private static final long EXPIRE_TIME_MAX = 24 * 60 * 60 * 1000;
@Autowired
private AmqpTemplate rabbitTemplate;
public void sendDelay(OrderTaskVo orderTaskVo) {
// 家庭医生排班医生24小时消息过期
if (orderTaskVo.getType() == 1) {
long time = EXPIRE_TIME_MAX;
if (Objects.nonNull(orderTaskVo.getExpireTime())) {
time = Long.valueOf(orderTaskVo.getExpireTime());
}
log.info("过期时间:{}", time);
long finalTime = time;
this.rabbitTemplate.convertAndSend(RabbitMqConfig.ORDER_DELAY_EXCHANGE,
RabbitMqConfig.ORDER_ROUTING_KEY_5, orderTaskVo, message -> {
message.getMessageProperties().setHeader("x-delay", finalTime);
message.getMessageProperties().setDeliveryMode(MessageDeliveryMode.PERSISTENT);
return message;
});
}
}
}
package com.ebaiyihui.family.doctor.server.service;
import com.ebaiyihui.family.doctor.common.dto.DoctorListForScheduleReqDTO;
import com.ebaiyihui.family.doctor.common.dto.DoctorSchedDTO;
import com.ebaiyihui.family.doctor.common.dto.QueryDoctorsDTO;
import com.ebaiyihui.family.doctor.common.dto.SearchDoctorDayScheduleReqDTO;
import com.ebaiyihui.family.doctor.common.vo.DoctorListForScheduleResVo;
import com.ebaiyihui.family.doctor.common.vo.DoctorListVo;
import com.ebaiyihui.family.doctor.common.vo.DoctorSchedVo;
import com.ebaiyihui.family.doctor.common.vo.DoctorScheduleInfoResVo;
import com.ebaiyihui.framework.page.PageResult;
import com.ebaiyihui.framework.response.BaseResponse;
import java.util.List;
/**
* @ClassName: DoctorService
* @Author:yanliang
......@@ -14,5 +22,11 @@ import com.ebaiyihui.framework.response.BaseResponse;
public interface DoctorService {
BaseResponse<PageResult<DoctorListVo>> getDoctorList(QueryDoctorsDTO reqVo);
BaseResponse<PageResult<DoctorListVo>> getSignedDoctorList(QueryDoctorsDTO reqVo);
BaseResponse<List<DoctorListForScheduleResVo>> getDoctorListForSchedule(DoctorListForScheduleReqDTO req);
BaseResponse<DoctorScheduleInfoResVo> searchDoctorDaySchedule(SearchDoctorDayScheduleReqDTO reqDTO);
BaseResponse<DoctorSchedVo> getDoctorSched(DoctorSchedDTO reqVo);
}
package com.ebaiyihui.family.doctor.server.service;
/**
* @ClassName: GoEasyPushService
* @Author:yanliang
* @Date:2024/3/15 16:29
* @Description
*/
public interface GoEasyPushService {
void newOrderToReceive(String admId);
}
package com.ebaiyihui.family.doctor.server.service;
import com.ebaiyihui.family.doctor.common.bo.Components;
import com.ebaiyihui.family.doctor.common.dto.SendImMsgDTO;
import com.ebaiyihui.family.doctor.server.entity.PatientSignEntity;
import com.ebaiyihui.framework.response.BaseResponse;
import com.ebaiyihui.imforward.client.vo.IMQueryTargetSdkAccountRspVO;
import java.util.List;
/**
* @ClassName: ImChatTemplate
* @Author:yanliang
......@@ -25,4 +29,6 @@ public interface ImChatTemplate {
IMQueryTargetSdkAccountRspVO queryImAccount(String admId, String imAppCode, String doctorId);
void doctorPrompted(String admId);
Boolean sendMsg(List<Components> componentsList, SendImMsgDTO sendImMsgDTO);
}
package com.ebaiyihui.family.doctor.server.service;
import com.ebaiyihui.family.doctor.common.dto.SendImMsgDTO;
import com.ebaiyihui.framework.response.BaseResponse;
/**
* @ClassName: ImMsgTemplateService
* @Author:yanliang
* @Date:2024/3/15 10:06
* @Description
*/
public interface ImMsgTemplateService {
BaseResponse<String> sendImMsg(SendImMsgDTO reqVo);
}
package com.ebaiyihui.family.doctor.server.service;
import com.ebaiyihui.family.doctor.common.bo.MobileBenefitRes;
import com.ebaiyihui.family.doctor.common.bo.Result;
import com.ebaiyihui.family.doctor.common.dto.MobileBenefitPackageDTO;
import com.ebaiyihui.family.doctor.common.vo.RegisterPatientVo;
import com.ebaiyihui.framework.response.BaseResponse;
import java.util.List;
/**
* @ClassName: MobileBenefitPackageService
* @Author:yanliang
* @Date:2024/3/19 10:37
* @Description
*/
public interface MobileBenefitPackageService {
BaseResponse<RegisterPatientVo> register(String token);
Result<MobileBenefitRes> addBenefitPackage(List<MobileBenefitPackageDTO> vos);
}
package com.ebaiyihui.family.doctor.server.service;
import com.ebaiyihui.family.doctor.common.dto.SignedDoctorDTO;
import com.ebaiyihui.family.doctor.common.vo.DoctorSchedVo;
import com.ebaiyihui.family.doctor.server.entity.PatientSignEntity;
import com.ebaiyihui.framework.response.BaseResponse;
......
package com.ebaiyihui.family.doctor.server.service;
import com.ebaiyihui.family.doctor.common.dto.ImAccountReqDTO;
import com.ebaiyihui.family.doctor.common.dto.ImInfoDetailDocReqDTO;
import com.ebaiyihui.family.doctor.common.dto.ImInfoListDocReqDTO;
import com.ebaiyihui.family.doctor.common.vo.ImAccountVo;
import com.ebaiyihui.family.doctor.common.vo.ImInfoDetailDocResVo;
import com.ebaiyihui.family.doctor.common.vo.ImInfoListResVo;
import com.ebaiyihui.family.doctor.common.vo.ImInfoResVo;
import com.ebaiyihui.family.doctor.server.entity.PatientSignEntity;
import com.ebaiyihui.family.doctor.server.util.PageUtil;
import com.ebaiyihui.framework.response.BaseResponse;
import com.ebaiyihui.imforward.client.vo.IMQueryMsgReqVO;
import com.ebaiyihui.imforward.client.vo.IMQueryUserLoginReqVO;
import com.ebaiyihui.imforward.client.vo.IMQueryUserLoginRspVO;
import com.ebaiyihui.imforward.client.vo.IMSingleMsgResultVO;
import java.util.List;
......@@ -35,4 +40,14 @@ public interface PatientSignService {
BaseResponse<PageUtil<ImInfoListResVo>> queryImInfoList(ImInfoListDocReqDTO param);
BaseResponse<ImInfoDetailDocResVo> queryImInfoDetail(ImInfoDetailDocReqDTO param);
BaseResponse<ImAccountVo> queryImAccount(ImAccountReqDTO param);
BaseResponse<IMQueryUserLoginRspVO> querySdkLogin(IMQueryUserLoginReqVO reqVO);
List<PatientSignEntity> selectList(PatientSignEntity patientSignEntity);
PatientSignEntity getOneByPhone(String phone);
int updateById(PatientSignEntity patientSignEntity);
}
......@@ -2,6 +2,7 @@ package com.ebaiyihui.family.doctor.server.service;
import com.ebaiyihui.family.doctor.common.dto.InsertScheduleRecordReqDTO;
import com.ebaiyihui.family.doctor.common.dto.RequestGetScheduleForWeekDTO;
import com.ebaiyihui.family.doctor.common.dto.RequestUpdateScheduleStatusDTO;
import com.ebaiyihui.family.doctor.common.dto.ScheduleForWeekReqDTO;
import com.ebaiyihui.family.doctor.common.vo.ResponseGetScheduleForWeekVo;
import com.ebaiyihui.family.doctor.common.vo.ScheduleForWeekResVo;
......@@ -23,4 +24,6 @@ public interface ScheduleRecordService {
BaseResponse<List<ResponseGetScheduleForWeekVo>> getScheduleForWeek(RequestGetScheduleForWeekDTO requestGetScheduleForWeekDTO);
BaseResponse<List<ScheduleForWeekResVo>> scheduleForWeekNew(ScheduleForWeekReqDTO scheduleForWeekReqDTO);
BaseResponse<String> updateStatus(RequestUpdateScheduleStatusDTO updateScheduleStatusDTO);
}
package com.ebaiyihui.family.doctor.server.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.doctoruser.api.pojo.vo.*;
import com.ebaiyihui.family.doctor.common.dto.GoeasyPushMsgReqDTO;
import com.ebaiyihui.family.doctor.server.common.constants.IMInformConstants;
import com.ebaiyihui.family.doctor.server.common.constants.ProjProperties;
import com.ebaiyihui.family.doctor.server.common.constants.UrlConstants;
import com.ebaiyihui.family.doctor.server.common.enums.StatusEnum;
import com.ebaiyihui.family.doctor.server.entity.PatientSignEntity;
import com.ebaiyihui.family.doctor.server.mapper.PatientSignMapper;
import com.ebaiyihui.family.doctor.server.service.GoEasyPushService;
import com.ebaiyihui.family.doctor.server.util.UserRestTemplateUtil;
import com.ebaiyihui.framework.utils.HttpKit;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* @ClassName: GoEasyPushServiceImpl
* @Author:yanliang
* @Date:2024/3/15 16:30
* @Description
*/
@Service
@Slf4j
public class GoEasyPushServiceImpl implements GoEasyPushService {
@Autowired
private ProjProperties projProperties;
@Autowired
private PatientSignMapper patientSignMapper;
@Async
@Override
public void newOrderToReceive(String admId) {
log.info("医生web端推送开始:{}", admId);
QueryWrapper<PatientSignEntity> wrapper = new QueryWrapper<>();
PatientSignEntity patientSign = new PatientSignEntity();
patientSign.setAdmId(admId);
wrapper.setEntity(patientSign);
PatientSignEntity patientSignEntity = patientSignMapper.selectOne(wrapper);
//是否订单
boolean isOrder = Objects.equals(StatusEnum.IN_CONSULTATION.getValue(), patientSignEntity.getStatus());
if (isOrder) {
UserInfoByUserIdRespVO userInfoByUserIdRespVO = queryDocAccountInfo(String.valueOf(patientSignEntity.getDoctorId()));
String userId = userInfoByUserIdRespVO.getUserId();
Map<String, String> map = new HashMap<>();
map.put("id", patientSignEntity.getAdmId());
map.put("body", "您有一笔新的家庭医生订单待处理,请及时查看");
map.put("type", "jtys_new_order");
map.put("title", "家庭医生订单提醒");
map.put("subTitle", "家庭医生订单提醒");
map.put("pushCode", "1");
goEasyPush(userId, JSON.toJSONString(map), IMInformConstants.IM_SYSTEM_BUSINESS_CODE);
}
}
/**
* @param docId 医生ID
* @return 医生userId
*/
private UserInfoByUserIdRespVO queryDocAccountInfo(String docId) {
// 查询医生userId
FindUserIdListReq findUserIdListReq = new FindUserIdListReq();
FindUserIdReqVO findUserIdReqVO = new FindUserIdReqVO();
findUserIdReqVO.setReqId(docId);
findUserIdReqVO.setUserType((short) 1);
List<FindUserIdReqVO> findUserIdReqVOList = new ArrayList<>(1);
findUserIdReqVOList.add(findUserIdReqVO);
findUserIdListReq.setFindUserIdReqVOS(findUserIdReqVOList);
log.info("findUserIdListReq:{}", JSON.toJSONString(findUserIdListReq));
//查询医生userId
List<com.doctoruser.api.pojo.vo.FindUserIdRespVO> findUserIdRespVOS =
UserRestTemplateUtil.queryUserIdList(findUserIdListReq, projProperties.getUserFindUserId());
log.info("00001查询用户Id请求对象:{}", JSON.toJSONString(findUserIdRespVOS));
if (null == findUserIdRespVOS) {
return null;
}
FindUserIdRespVO findUserIdRespVO = findUserIdRespVOS.get(0);
log.info("000========:{}", JSON.toJSONString(findUserIdRespVO));
// 查询医生账号信息
GetUserInfoByUserIdReqVO getUserInfoByUserIdReqVO = new GetUserInfoByUserIdReqVO();
getUserInfoByUserIdReqVO.setUserId(findUserIdRespVO.getUserId());
log.info("0002获取用户基础资料请求对象入参:{}", JSON.toJSONString(getUserInfoByUserIdReqVO));
//获取用户基础资料
UserInfoByUserIdRespVO userInfo =
UserRestTemplateUtil.getUserInfo(getUserInfoByUserIdReqVO, projProperties.getUserInfo());
log.info("0002获取用户基础资料请求对象出参:{}", JSON.toJSONString(userInfo));
if (null != userInfo) {
return userInfo;
}
return null;
}
public void goEasyPush(String userId, String text, String busiCode) {
String url = projProperties.getBaseAddress() + UrlConstants.GO_EASY_PUSH;
try {
log.info("goeasy推送url----------->{}", url);
GoeasyPushMsgReqDTO vo = new GoeasyPushMsgReqDTO();
vo.setBusiCode(busiCode);
vo.setBody(text);
vo.setUserId(userId);
log.info("=======>goeasy推送参数----->{}", JSON.toJSONString(vo));
String httpResult = HttpKit.jsonPost(url, JSON.toJSONString(vo));
log.info("=======>goeasy推送返回结果----->{}", httpResult);
} catch (Exception e) {
log.info("=======>goeasy推送 - 获取异常", e);
}
}
}
......@@ -9,9 +9,13 @@ import com.doctoruser.api.pojo.vo.UserInfoByDoctorIdRespVO;
import com.doctoruser.api.pojo.vo.UserInfoByUserIdRespVO;
import com.ebaiyihui.family.doctor.common.bo.*;
import com.ebaiyihui.family.doctor.common.dto.DoctorIdDTO;
import com.ebaiyihui.family.doctor.common.dto.HealthInfoDTO;
import com.ebaiyihui.family.doctor.common.dto.SendImMsgDTO;
import com.ebaiyihui.family.doctor.server.common.constants.CommonConstants;
import com.ebaiyihui.family.doctor.server.common.constants.IMInformConstants;
import com.ebaiyihui.family.doctor.server.common.constants.ImConstants;
import com.ebaiyihui.family.doctor.server.common.enums.MsgTempTypeEnum;
import com.ebaiyihui.family.doctor.server.common.enums.SenderEnum;
import com.ebaiyihui.family.doctor.server.entity.PatientSignEntity;
import com.ebaiyihui.family.doctor.server.exception.BusinessException;
import com.ebaiyihui.family.doctor.server.feign.DoctorInfofeignClient;
......@@ -21,6 +25,7 @@ import com.ebaiyihui.family.doctor.server.feign.UserApiFeignClient;
import com.ebaiyihui.family.doctor.server.mapper.PatientSignMapper;
import com.ebaiyihui.family.doctor.server.service.ImChatTemplate;
import com.ebaiyihui.family.doctor.server.util.JsonUtil;
import com.ebaiyihui.family.doctor.server.util.ThirdOrderPushUtil;
import com.ebaiyihui.framework.response.BaseResponse;
import com.ebaiyihui.imforward.client.vo.*;
import lombok.extern.slf4j.Slf4j;
......@@ -29,6 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
......@@ -58,6 +64,9 @@ public class ImChatTemplateImpl implements ImChatTemplate {
@Autowired
private PatientSignMapper patientSignMapper;
@Autowired
private ThirdOrderPushUtil thirdOrderPushUtil;
@Override
public BaseResponse createImSession(PatientSignEntity patientSignEntity) {
......@@ -139,6 +148,67 @@ public class ImChatTemplateImpl implements ImChatTemplate {
}
}
@Override
public Boolean sendMsg(List<Components> componentsList, SendImMsgDTO sendImMsgDTO) {
Boolean flag = false;
if (!componentsList.isEmpty()) {
log.info("componentsList={}", componentsList);
for (int i = 0; i < componentsList.size(); i++) {
String content = componentsList.get(i).getContent();
List<MessageInfo> messageInfos = new ArrayList<>();
PatientSignInfo patientSignInfo = getPatientSignInfo(sendImMsgDTO.getAdmId());
MessageInfo messageInfo = new MessageInfo();
content = MessageFormat.format(content, patientSignInfo.getDoctorName());
if (!StringUtils.isEmpty(sendImMsgDTO.getOldAdmId())) {
PatientSignInfo oldPatientSignInfo = getPatientSignInfo(sendImMsgDTO.getOldAdmId());
content = MessageFormat.format(content, oldPatientSignInfo.getDoctorName(), patientSignInfo.getDoctorName());
// 改签的时候判断患者健康计划是否开启,开启则不发送健康计划信息
if (MsgTempTypeEnum.UP_SUC.getValue().equals(sendImMsgDTO.getType())) {
if (!Objects.nonNull(componentsList.get(i).getConditionFlag())
&& CommonConstants.STATUS_VALID.equals(componentsList.get(i).getConditionFlag())) {
// 查询用户健康计划是否开启状态
HealthInfoDTO healthInfoDTO = new HealthInfoDTO();
healthInfoDTO.setPhone(patientSignInfo.getPatientPhone());
String result = thirdOrderPushUtil.getHealthSchStatus(healthInfoDTO);
if (!StringUtils.isEmpty(result)) {
Result<String> hssResult = JSON.parseObject(result, Result.class);
if (hssResult.isSuccess() && CommonConstants.STATUS_VALID.equals(hssResult.getData())) {
continue;
}
}
}
}
}
// 报告异常特殊处理
if (MsgTempTypeEnum.REP_ANO.getValue().equals(sendImMsgDTO.getType())) {
content = MessageFormat.format(content, patientSignInfo.getDoctorName(), sendImMsgDTO.getIntention());
}
if (SenderEnum.DOCTOR.getDesc().equals(componentsList.get(i).getSender())) {
messageInfo = getDoctorInformRefreshPatientParam(patientSignInfo, IMInformConstants.REFRESH);
} else {
messageInfo = getInformRefreshPatientParam(patientSignInfo, IMInformConstants.REFRESH);
}
messageInfos.add(messageInfo);
PersonImInformReq parameter = new PersonImInformReq();
parameter.setMessageInfos(messageInfos);
parameter.setAdmissionId(sendImMsgDTO.getAdmId());
parameter.setBusiCode(IMInformConstants.IM_SYSTEM_BUSINESS_CODE);
log.info("推送家庭医生提示语推送:{}" + JSON.toJSONString(parameter.getMessageInfos()));
Long syncFlag = i * 100L;
if (personUserImInform(parameter, content, syncFlag)) {
log.info("推送家庭医生提示语推送成功,admissionId:{}", sendImMsgDTO.getAdmId());
flag = true;
}
}
}
return flag;
}
/**
* 获取im推送需要的信息
* 1.serviceType 2.0 病人账号 2.1 病人名字 3.3 医生生名字 账号 6.拒绝理由 7.订单号
......@@ -160,7 +230,7 @@ public class ImChatTemplateImpl implements ImChatTemplate {
return new PatientSignInfo();
}
PatientSignInfo patientSignInfo = new PatientSignInfo();
BeanUtils.copyProperties(patientSign, patientSignInfo);
BeanUtils.copyProperties(patientSignEntity, patientSignInfo);
// 获取医生基本信息
QueryPersonnelInfoReq queryPersonnelInfoReq = new QueryPersonnelInfoReq();
......@@ -199,24 +269,19 @@ public class ImChatTemplateImpl implements ImChatTemplate {
return messageInfo;
}
private <T> MessageInfo getInformRefreshPatientParam(PatientSignInfo patientSignInfo, T content, Integer isRefresh) {
String patientUserId = patientSignInfo.getPatientUserId();
if (org.apache.commons.lang3.StringUtils.isEmpty(patientUserId)) {
private <T> MessageInfo getInformRefreshPatientParam(PatientSignInfo patientSignInfo, Integer isRefresh) {
String doctorUserId = patientSignInfo.getDoctorUserId();
if (StringUtils.isEmpty(doctorUserId)) {
log.error("IM INFORM ERROR : 无法查询到接收人信息");
return new MessageInfo();
}
MessageInfo messageInfo = new MessageInfo();
Message<T> message = new Message<>();
message.setMessageType(IMInformConstants.SERVICE_SYSTEM_FIXATION_TYPE);
message.setAdmissionId(patientSignInfo.getAdmId());
message.setApplicationCode(IMInformConstants.IM_SYSTEM_BUSINESS_CODE);
message.setIsRefresh(isRefresh);
message.setData(content);
messageInfo.setMessage(message);
// message.setData(content);
// messageInfo.setMessage(message);
message.setApplicationCode(IMInformConstants.IM_SYSTEM_BUSINESS_CODE);
messageInfo.setSingleAccount(newAccount(IMInformConstants.PATIENT_APPLICATION_CODE, patientUserId));
messageInfo.setSelfAccount(newAccount(IMInformConstants.DOCTOR_APPLICATION_CODE,
patientSignInfo.getDoctorUserId()));
messageInfo.setSingleAccount(newAccount(IMInformConstants.DOCTOR_APPLICATION_CODE, doctorUserId));
messageInfo.setSelfAccount(newAccount(IMInformConstants.PATIENT_APPLICATION_CODE, patientSignInfo.getPatientUserId()));
messageInfo.setMessage(message);
return messageInfo;
}
......
package com.ebaiyihui.family.doctor.server.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ebaiyihui.family.doctor.common.bo.Components;
import com.ebaiyihui.family.doctor.common.bo.MsgContent;
import com.ebaiyihui.family.doctor.common.dto.SendImMsgDTO;
import com.ebaiyihui.family.doctor.server.entity.ImMsgTemplateEntity;
import com.ebaiyihui.family.doctor.server.exception.BusinessException;
import com.ebaiyihui.family.doctor.server.mapper.ImMsgTemplateMapper;
import com.ebaiyihui.family.doctor.server.service.ImChatTemplate;
import com.ebaiyihui.family.doctor.server.service.ImMsgTemplateService;
import com.ebaiyihui.framework.response.BaseResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
* @ClassName: ImMsgTemplateServiceImpl
* @Author:yanliang
* @Date:2024/3/15 10:06
* @Description
*/
@Service
public class ImMsgTemplateServiceImpl implements ImMsgTemplateService {
@Autowired
private ImMsgTemplateMapper imMsgTemplateMapper;
@Autowired
private ImChatTemplate imChatTemplate;
@Async
@Override
public BaseResponse<String> sendImMsg(SendImMsgDTO sendImMsgDTO) {
QueryWrapper<ImMsgTemplateEntity> wrapper = new QueryWrapper<>();
ImMsgTemplateEntity imMsgTemplate = new ImMsgTemplateEntity();
imMsgTemplate.setAppCode(sendImMsgDTO.getAppCode());
imMsgTemplate.setOrganId(sendImMsgDTO.getOrganId());
imMsgTemplate.setType(sendImMsgDTO.getType());
wrapper.setEntity(imMsgTemplate);
ImMsgTemplateEntity imMsgTemplateEntity = imMsgTemplateMapper.selectOne(wrapper);
String components = imMsgTemplateEntity.getContent();
MsgContent msgContent = JSON.parseObject(components, MsgContent.class);
List<Components> componentsList = msgContent.getComponents().stream().sorted(Comparator.comparing(Components::getSort)).collect(Collectors.toList());
Boolean flag = imChatTemplate.sendMsg(componentsList, sendImMsgDTO);
if (!flag) {
throw new BusinessException("消息推送失败");
}
return BaseResponse.success("消息推送成功");
}
}
package com.ebaiyihui.family.doctor.server.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ebaiyihui.card.common.CardServiceApi;
import com.ebaiyihui.card.common.vo.CardDetailsInfoRespVO;
import com.ebaiyihui.card.common.vo.RegisterCardReqVO;
import com.ebaiyihui.family.doctor.common.bo.MobileBenefitRes;
import com.ebaiyihui.family.doctor.common.bo.Result;
import com.ebaiyihui.family.doctor.common.dto.MobileBenefitPackageDTO;
import com.ebaiyihui.family.doctor.common.vo.RegisterPatientVo;
import com.ebaiyihui.family.doctor.server.common.constants.CommonConstants;
import com.ebaiyihui.family.doctor.server.entity.MobileBenefitPackageEntity;
import com.ebaiyihui.family.doctor.server.entity.PatientEntity;
import com.ebaiyihui.family.doctor.server.entity.PatientSignEntity;
import com.ebaiyihui.family.doctor.server.mapper.MobileBenefitPackageMapper;
import com.ebaiyihui.family.doctor.server.mapper.PatientMapper;
import com.ebaiyihui.family.doctor.server.mapper.PatientSignMapper;
import com.ebaiyihui.family.doctor.server.service.MobileBenefitPackageService;
import com.ebaiyihui.family.doctor.server.util.DESUtils;
import com.ebaiyihui.framework.response.BaseResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* @ClassName: MobileBenefitPackageServiceImpl
* @Author:yanliang
* @Date:2024/3/19 10:37
* @Description
*/
@Slf4j
@Service
public class MobileBenefitPackageServiceImpl implements MobileBenefitPackageService {
@Autowired
private CardServiceApi cardServiceFeignClient;
@Autowired
private PatientMapper patientMapper;
@Autowired
private PatientSignMapper patientSignMapper;
@Autowired
private MobileBenefitPackageMapper mobileBenefitPackageMapper;
@Override
public BaseResponse<RegisterPatientVo> register(String token) {
token = token.replace(" ", "+");
Map<String, String> map = JSONObject.parseObject(DESUtils.decrypt(token, CommonConstants.DES_SECRET), Map.class);
log.info("解析token结果:{}", map);
RegisterPatientVo registerPatientVo = new RegisterPatientVo();
MobileBenefitPackageEntity entity = new MobileBenefitPackageEntity();
if (Objects.nonNull(map.get("activateOrderId"))) {
entity = mobileBenefitPackageMapper.queryByPhone(map.get("mobile"), map.get("activateOrderId"));
if (ObjectUtils.isEmpty(entity)) {
return BaseResponse.error("没有查询到有关权益");
}
}
//注册就诊卡
RegisterCardReqVO registerCardReqVO = new RegisterCardReqVO();
registerCardReqVO.setAppCode("NCZK");
registerCardReqVO.setChannelCode("PATIENT_WX");
registerCardReqVO.setChannelName("PATIENT_WX");
registerCardReqVO.setPatientName(map.get("patientName"));
registerCardReqVO.setCredNo(map.get("card_no"));
registerCardReqVO.setCredTypeCode("01");
registerCardReqVO.setCredTypeName("居民身份证");
registerCardReqVO.setCardTypeCode("1703");
registerCardReqVO.setCardTypeName("虚拟就诊卡");
registerCardReqVO.setOrganCode("130188");
registerCardReqVO.setOrganName("南昌众康医院");
registerCardReqVO.setTel(map.get("mobile"));
log.info("注册就诊卡请求:{}", registerCardReqVO);
BaseResponse<CardDetailsInfoRespVO> response = cardServiceFeignClient.registerOrBindCard(registerCardReqVO);
log.info("注册就诊卡结果:{}", response);
if (!response.isSuccess() || StringUtils.isEmpty(response)) {
return BaseResponse.error("注册就诊卡失败");
}
CardDetailsInfoRespVO data = response.getData();
registerPatientVo.setPatientInfo(data);
registerPatientVo.setActivateOrderId(map.get("activateOrderId"));
if (Objects.nonNull(map.get("admId"))) {
registerPatientVo.setAdmId(map.get("admId"));
// 更新权益医生id
QueryWrapper<PatientSignEntity> psWrapper = new QueryWrapper<>();
PatientSignEntity patientSign = new PatientSignEntity();
patientSign.setAdmId(map.get("admId"));
psWrapper.setEntity(patientSign);
PatientSignEntity patientSignEntity = patientSignMapper.selectOne(psWrapper);
if (Objects.nonNull(patientSignEntity)) {
entity.setDoctorId(String.valueOf(patientSignEntity.getDoctorId()));
mobileBenefitPackageMapper.updateDoctorId(entity);
}
}
if (Objects.nonNull(map.get("scheduleFlag"))) {
registerPatientVo.setScheduleFlag(Integer.valueOf(map.get("scheduleFlag")));
}
if (Objects.nonNull(map.get("msgPushType"))) {
registerPatientVo.setMsgPushType(Integer.valueOf(map.get("msgPushType")));
}
if (Objects.nonNull(map.get("abnormalId"))) {
registerPatientVo.setAbnormalId(map.get("abnormalId"));
}
if (Objects.nonNull(map.get("intention"))) {
registerPatientVo.setIntention(map.get("intention"));
}
if (Objects.nonNull(map.get("doctorId"))) {
registerPatientVo.setDoctorId(map.get("doctorId"));
}
if (Objects.nonNull(map.get("signSeqId"))) {
registerPatientVo.setSignSeqId(map.get("signSeqId"));
PatientSignEntity patientSignEntity = patientSignMapper.selectById(Long.valueOf(map.get("signSeqId")));
registerPatientVo.setAdmId(patientSignEntity.getAdmId());
// 更新权益医生id
if (Objects.nonNull(patientSignEntity)) {
entity.setDoctorId(String.valueOf(patientSignEntity.getDoctorId()));
mobileBenefitPackageMapper.updateDoctorId(entity);
}
}
String patientId = map.get("patient_id");
if (Objects.nonNull(map.get("activateOrderId")) && !StringUtils.isEmpty(patientId)) {
// 查询患者信息
QueryWrapper<PatientEntity> wrapper = new QueryWrapper<>();
PatientEntity patient = new PatientEntity();
patient.setId(data.getPatientId());
wrapper.setEntity(patient);
PatientEntity patientEntity = patientMapper.selectOne(wrapper);
if (Objects.isNull(patientEntity)) {
patientEntity = new PatientEntity();
patientEntity.setId(data.getPatientId());
patientEntity.setPatientName(data.getPatientName());
patientEntity.setPhone(data.getTel());
patientEntity.setPatientType(CommonConstants.PATIENT_TYPE);
patientEntity.setGender(Integer.valueOf(data.getGender()));
patientEntity.setBirthDates(data.getBirth());
patientEntity.setCredNo(data.getCredNo());
patientEntity.setUserId(entity.getUserId());
log.info("数据库不存在添加患者: {}", JSON.toJSONString(patientEntity));
patientMapper.insert(patientEntity);
}
//保存就诊人id
entity.setUserId(map.get("patient_id"));
mobileBenefitPackageMapper.update(entity);
}
return BaseResponse.success(registerPatientVo);
}
@Override
public Result<MobileBenefitRes> addBenefitPackage(List<MobileBenefitPackageDTO> vos) {
log.info("推送订单信息:{}", vos);
try {
vos.forEach(vo -> {
MobileBenefitPackageEntity entity = new MobileBenefitPackageEntity();
BeanUtils.copyProperties(vo, entity);
mobileBenefitPackageMapper.insert(entity);
});
} catch (Exception e) {
log.error("保存权益包信息失败:{}", e.getMessage());
return Result.error(failed());
}
return Result.success(success());
}
private MobileBenefitRes success() {
MobileBenefitRes resp = new MobileBenefitRes();
resp.setOrderStatus("OOS");
resp.setOrderDesc("成功");
return resp;
}
private MobileBenefitRes failed() {
MobileBenefitRes resp = new MobileBenefitRes();
resp.setOrderStatus("OOF");
resp.setOrderDesc("失败");
return resp;
}
}
......@@ -5,10 +5,13 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.doctoruser.api.pojo.base.dto.doctor.QueryPersonnelInfoReq;
import com.doctoruser.api.pojo.base.vo.doctor.PersonnelInfo;
import com.ebaiyihui.family.doctor.common.dto.ImAccountReqDTO;
import com.ebaiyihui.family.doctor.common.dto.ImInfoDetailDocReqDTO;
import com.ebaiyihui.family.doctor.common.dto.ImInfoListDocReqDTO;
import com.ebaiyihui.family.doctor.common.vo.*;
import com.ebaiyihui.family.doctor.server.common.constants.IMInformConstants;
import com.ebaiyihui.family.doctor.server.common.constants.ImConstants;
import com.ebaiyihui.family.doctor.server.common.enums.SignStatus;
import com.ebaiyihui.family.doctor.server.common.enums.StatusEnum;
import com.ebaiyihui.family.doctor.server.entity.PatientEntity;
import com.ebaiyihui.family.doctor.server.entity.PatientSignEntity;
......@@ -111,9 +114,9 @@ public class PatientSignServiceImpl implements PatientSignService {
log.info("获取IM登录信息:{}", imSysResult);
IMQueryMsgReqVO imQueryMsgReqVO = new IMQueryMsgReqVO();
imQueryMsgReqVO.setAppCode("EHOS_PATIENT");
imQueryMsgReqVO.setAppCode(IMInformConstants.PATIENT_APPLICATION_CODE);
imQueryMsgReqVO.setUserId(patientSignEntity.getPatientUserId());
imQueryMsgReqVO.setBusinessCode("zxzx");
imQueryMsgReqVO.setBusinessCode(IMInformConstants.IM_SYSTEM_BUSINESS_CODE);
imQueryMsgReqVO.setMsgType("1");
imQueryMsgReqVO.setPageSize(999);
imQueryMsgReqVO.setSortOrder("ASC");
......@@ -126,12 +129,18 @@ public class PatientSignServiceImpl implements PatientSignService {
.sig(imSysResult.getData().getSig())
.doctorName(patientSignEntity.getDoctorName())
.build();
// 患者信息
resVo.setPatientName(patientSignEntity.getPatientName());
resVo.setPatientPortrait("");
resVo.setDoctorId(patientSignEntity.getDoctorId());
QueryPersonnelInfoReq queryPersonnelInfoReq = new QueryPersonnelInfoReq();
queryPersonnelInfoReq.setDoctorId(String.valueOf(patientSignEntity.getDoctorId()));
BaseResponse<PersonnelInfo> res = doctorCilent.queryPersonnelInfo(queryPersonnelInfoReq);
if (res.isSuccess()) {
resVo.setDoctorPortrait(res.getData().getPortrait());
resVo.setDeptId(String.valueOf(res.getData().getDeptId()));
}
List<String> appointmentId = new ArrayList<>();
......@@ -171,8 +180,8 @@ public class PatientSignServiceImpl implements PatientSignService {
List<ImInfoListResVo> zkFbImInfoListResVos = collect.get(key);
List<String> admIds = zkFbImInfoListResVos.stream().map(ImInfoListResVo::getAdmId).collect(Collectors.toList());
ImInfoListResVo record = zkFbImInfoListResVos.get(0);
Integer age = IDCardUtil.getAge(record.getIdCard());
Integer gender = IDCardUtil.getGenderForInteger(record.getIdCard());
Integer age = IDCardUtil.getAge(record.getCredNo());
Integer gender = IDCardUtil.getGenderForInteger(record.getCredNo());
record.setAge(age);
record.setGender(gender);
......@@ -185,7 +194,7 @@ public class PatientSignServiceImpl implements PatientSignService {
resVo.add(record);
}
resVo = resVo.stream().sorted(Comparator.comparing(ImInfoListResVo::getUpdateTime).reversed()).collect(Collectors.toList());
resVo = resVo.stream().sorted(Comparator.comparing(ImInfoListResVo::getUpdateTime)).collect(Collectors.toList());
PageUtil pageUtil = new PageUtil();
......@@ -213,9 +222,10 @@ public class PatientSignServiceImpl implements PatientSignService {
resVo.setStatus(patientSignEntity.getStatus());
resVo.setDeptId(patientSignEntity.getDeptId().toString());
resVo.setDeptName(patientSignEntity.getDeptName());
resVo.setSignEndTime(patientSignEntity.getSignEndTime());
//患者信息
PatientEntity patientEntity = patientMapper.selectById(patientSign.getPatientId());
PatientEntity patientEntity = patientMapper.selectById(patientSignEntity.getPatientId());
PatientInfoVo patientInfoVo = new PatientInfoVo();
patientInfoVo.setPatientName(patientEntity.getPatientName());
patientInfoVo.setPatientId(patientEntity.getId());
......@@ -239,4 +249,99 @@ public class PatientSignServiceImpl implements PatientSignService {
return BaseResponse.success(resVo);
}
@Override
public BaseResponse<ImAccountVo> queryImAccount(ImAccountReqDTO param) {
// 转换imAppCode
if (ImConstants.IM_DOC_ACCOUNT_NUM.equals(param.getImAppCode())) {
param.setImAppCode(ImConstants.IM_PAT_ACCOUNT_NUM);
} else if (ImConstants.IM_PAT_ACCOUNT_NUM.equals(param.getImAppCode())) {
param.setImAppCode(ImConstants.IM_DOC_ACCOUNT_NUM);
}
String admissionId = param.getAdmissionId();
QueryWrapper<PatientSignEntity> psWrapper = new QueryWrapper<>();
PatientSignEntity patientSign = new PatientSignEntity();
patientSign.setAdmId(param.getAdmissionId());
psWrapper.setEntity(patientSign);
PatientSignEntity patientSignEntity = patientSignMapper.selectOne(psWrapper);
if (StringUtils.isEmpty(param.getDoctorId())) {
param.setDoctorId(String.valueOf(patientSignEntity.getDoctorId()));
}
return BaseResponse.success(getImAccounts(patientSignEntity, admissionId, param.getImAppCode(), param.getDoctorId()));
}
@Override
public BaseResponse<IMQueryUserLoginRspVO> querySdkLogin(IMQueryUserLoginReqVO reqVO) {
BaseResponse<IMQueryUserLoginRspVO> imSysResult = imApiFeignClient.queryUserLogin(reqVO);
if (imSysResult == null) {
return BaseResponse.error(imSysResult.getMsg());
}
if (BaseResponse.DEFAULT_ERROR_CODE.equals(imSysResult.getCode())) {
return BaseResponse.error(imSysResult.getMsg());
}
return BaseResponse.success(imSysResult.getData());
}
@Override
public List<PatientSignEntity> selectList(PatientSignEntity patientSignEntity) {
QueryWrapper<PatientSignEntity> listWrapper = new QueryWrapper<>();
patientSignEntity.setStatus(StatusEnum.IN_CONSULTATION.getValue());
patientSignEntity.setSignStatus(SignStatus.SIGNED.getValue());
listWrapper.setEntity(patientSignEntity);
List<PatientSignEntity> patientSignEntities = patientSignMapper.selectList(listWrapper);
return patientSignEntities;
}
@Override
public PatientSignEntity getOneByPhone(String phone) {
QueryWrapper<PatientSignEntity> psWrapper = new QueryWrapper<>();
PatientSignEntity patientSign = new PatientSignEntity();
patientSign.setPatientPhone(phone);
psWrapper.setEntity(patientSign);
psWrapper.orderByDesc("createTime");
psWrapper.last("limit 1");
PatientSignEntity pse = patientSignMapper.selectOne(psWrapper);
return pse;
}
@Override
public int updateById(PatientSignEntity patientSignEntity) {
return patientSignMapper.updateById(patientSignEntity);
}
public ImAccountVo getImAccounts(PatientSignEntity patientSignEntity, String admId, String imAppCode, String doctorId) {
ImAccountVo admission = new ImAccountVo();
IMQueryTargetSdkAccountRspVO imAccountRes = imChatTemplate.queryImAccount(admId, imAppCode, doctorId);
if (imAccountRes == null) {
//查寻Im账户为空,直接新创建,在重新查
imChatTemplate.createImSession(patientSignEntity);
IMQueryTargetSdkAccountRspVO imAccountRes1 = imChatTemplate.queryImAccount(admId, imAppCode, doctorId);
if (imAccountRes1 == null) {
log.info("IM ERROR 没有查询到IM账户-admId:{}", admId);
return admission;
}
log.info("imAccountRes1:{}" + JSON.toJSONString(imAccountRes1));
if (ImConstants.IM_DOC_ACCOUNT_NUM.equals(imAppCode)) {
admission.setDocImAccount(imAccountRes1.getSdkAccount());
} else if (ImConstants.IM_PAT_ACCOUNT_NUM.equals(imAppCode)) {
admission.setPatImAccount(imAccountRes1.getSdkAccount());
}
// 设置房间号
admission.setRoomNum(imAccountRes1.getRoomNum());
return admission;
}
log.info("imAccountRes:{}" + JSON.toJSONString(imAccountRes));
if (ImConstants.IM_DOC_ACCOUNT_NUM.equals(imAppCode)) {
admission.setDocImAccount(imAccountRes.getSdkAccount());
} else if (ImConstants.IM_PAT_ACCOUNT_NUM.equals(imAppCode)) {
admission.setPatImAccount(imAccountRes.getSdkAccount());
}
// 设置房间号
admission.setRoomNum(imAccountRes.getRoomNum());
return admission;
}
}
......@@ -47,7 +47,7 @@ public class ServiceConfigServiceImpl implements ServiceConfigService {
requestOnlineOrOfflineVo.setAppCode(serviceConfigEntity.getAppCode());
requestOnlineOrOfflineVo.setDoctorId(serviceConfigEntity.getDoctorId());
requestOnlineOrOfflineVo.setHospitalId(serviceConfigEntity.getOrganId());
requestOnlineOrOfflineVo.setDeptId(String.valueOf(serviceConfigEntity.getDeptId()));
requestOnlineOrOfflineVo.setOfficeStatus(serviceConfigEntity.getOfficeStatus());
return requestOnlineOrOfflineVo;
......@@ -59,6 +59,7 @@ public class ServiceConfigServiceImpl implements ServiceConfigService {
ServiceConfigEntity wrapperEntity = new ServiceConfigEntity();
wrapperEntity.setOrganId(requestOnlineOrOfflineVo.getHospitalId());
wrapperEntity.setAppCode(requestOnlineOrOfflineVo.getAppCode());
wrapperEntity.setDeptId(Long.valueOf(requestOnlineOrOfflineVo.getDeptId()));
wrapperEntity.setDoctorId(requestOnlineOrOfflineVo.getDoctorId());
queryWrapper.setEntity(wrapperEntity);
queryWrapper.last("limit 1");
......@@ -70,7 +71,7 @@ public class ServiceConfigServiceImpl implements ServiceConfigService {
serviceConfigEntity.setOfficeStatus(requestOnlineOrOfflineVo.getOfficeStatus());
int flag = serviceConfigMapper.updateById(serviceConfigEntity);
if (flag > 0) {
if (flag <= 0) {
if (requestOnlineOrOfflineVo.getOfficeStatus().equals(1)) {
throw new BusinessException("上线失败");
} else {
......
package com.ebaiyihui.family.doctor.server.task;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ebaiyihui.family.doctor.server.common.enums.WhetherEnum;
import com.ebaiyihui.family.doctor.server.entity.ScheduleRecordEntity;
import com.ebaiyihui.family.doctor.server.mapper.ScheduleRecordMapper;
import com.ebaiyihui.family.doctor.server.util.DateUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @ClassName: TaskSchedule
* @Author:yanliang
* @Date:2024/3/20 17:29
* @Description
*/
@Component
@Slf4j
public class ScheduleTask {
private static final String MONDAY = "星期一";
@Autowired
private ScheduleRecordMapper scheduleRecordMapper;
@Scheduled(cron = "0 0 0 * * ?")
public void regularTimeExport() {
/*
* 某天
* 某业务
* 某医生
* 某科室 下的开通循环排班的数据
*
* 此条件下 第5周 开通排班 未停诊 的数据
*
* 对比这两个list 去掉重复 新增(不停诊 日期为第5周的当天)
*
* 定时任务时间修改
*
*/
String currentDateSimpleToString = DateUtils.getCurrentDateSimpleToString();
log.info("当前时间{}", JSON.toJSONString(currentDateSimpleToString));
String weekChinese = DateUtils.getWeekChinese(currentDateSimpleToString);
log.info("当前时间是{}", JSON.toJSONString(weekChinese));
if (!MONDAY.equals(weekChinese)) {
return;
}
//周末
String oneDayForWeekLast = DateUtils.getOneDayForWeekLast(currentDateSimpleToString);
Date weekDateFirst = DateUtils.strToDateNoTry(currentDateSimpleToString);
Date weekDateLast = DateUtils.strToDateNoTry(oneDayForWeekLast);
List<String> dateRange = DateUtils.getDateRange(weekDateFirst, weekDateLast);
log.info("一周的日期{}", JSON.toJSONString(dateRange));
for (String schDate : dateRange) {
QueryWrapper<ScheduleRecordEntity> schWapper = new QueryWrapper<>();
ScheduleRecordEntity scheduleRecordEntity = new ScheduleRecordEntity();
scheduleRecordEntity.setIsCycleSchedule(WhetherEnum.ALLOW.getValue());
scheduleRecordEntity.setScheduleDate(DateUtils.strToDateNoTry(schDate));
schWapper.setEntity(scheduleRecordEntity);
log.info("某天开通循环排班列表入参{}", JSON.toJSONString(schWapper));
List<ScheduleRecordEntity> list = scheduleRecordMapper.selectList(schWapper);
log.info("某天开通循环排班列表出参{}", JSON.toJSONString(list));
if (CollectionUtils.isEmpty(list)) {
continue;
}
//根据业务分组
Map<Integer, List<ScheduleRecordEntity>> servTypeCollect =
list.stream().collect(Collectors.groupingBy(ScheduleRecordEntity::getServType));
for (Integer servType : servTypeCollect.keySet()) {
List<ScheduleRecordEntity> servTypeList = servTypeCollect.get(servType);
//根据医生分组
Map<String, List<ScheduleRecordEntity>> doctorCollect =
servTypeList.stream().collect(Collectors.groupingBy(ScheduleRecordEntity::getDoctorId));
for (String docId : doctorCollect.keySet()) {
List<ScheduleRecordEntity> scheduleDeptList = doctorCollect.get(docId);
//根据科室分组
Map<String, List<ScheduleRecordEntity>> deptCollect =
scheduleDeptList.stream().collect(Collectors.groupingBy(ScheduleRecordEntity::getDeptId));
for (String deptId : deptCollect.keySet()) {
//某天某医生某科室的所有排班
List<ScheduleRecordEntity> rangeList = deptCollect.get(deptId);
QueryWrapper<ScheduleRecordEntity> nextWrapper = new QueryWrapper<>();
ScheduleRecordEntity nextSchedule = new ScheduleRecordEntity();
nextSchedule.setStatus(WhetherEnum.ALLOW.getValue());
nextSchedule.setDoctorId(docId);
nextSchedule.setDeptId(deptId);
nextSchedule.setServType(servType);
nextSchedule.setScheduleDate(DateUtils.getNextWeek(schDate, 3));
nextWrapper.setEntity(nextSchedule);
log.info("第5周当天排班入参{}", JSON.toJSONString(schWapper));
List<ScheduleRecordEntity> nextScheList = scheduleRecordMapper.selectList(nextWrapper);
log.info("第5周当天排班出参{}", JSON.toJSONString(nextScheList));
if (CollectionUtils.isEmpty(nextScheList)) {
rangeList.stream().forEach(rangeVo -> {
ScheduleRecordEntity schedule = new ScheduleRecordEntity();
BeanUtils.copyProperties(rangeVo, schedule);
schedule.setStatus(WhetherEnum.ALLOW.getValue());
schedule.setScheduleDate(DateUtils.getNextWeek(schDate, 3));
// schedule.setAvailableCount(rangeVo.getTotalCount());
log.info("排班新增入参:" + schedule.toString());
scheduleRecordMapper.insert(schedule);
});
continue;
}
ArrayList<ScheduleRecordEntity> rangeSch = new ArrayList<>();
//如果第5周有排班 和当前对比 去除重复的时段
for (ScheduleRecordEntity rangeReq : rangeList) {
Boolean flag = false;
for (ScheduleRecordEntity rangeRes : nextScheList) {
Boolean aBoolean = DateUtils.rangeCompare(DateUtils.strToDateNoTryForMinute(rangeReq.getStartTime()),
DateUtils.strToDateNoTryForMinute(rangeReq.getEndTime()),
DateUtils.strToDateNoTryForMinute(rangeRes.getStartTime()),
DateUtils.strToDateNoTryForMinute(rangeRes.getEndTime()));
if (aBoolean) {
flag = true;
break;
}
}
if (flag) {
continue;
} else {
rangeSch.add(rangeReq);
}
}
if (CollectionUtils.isEmpty(rangeSch)) {
continue;
}
log.info("rangeList{}", JSON.toJSONString(rangeSch));
rangeSch.stream().forEach(rangeVo -> {
ScheduleRecordEntity schedule = new ScheduleRecordEntity();
BeanUtils.copyProperties(rangeVo, schedule);
schedule.setStatus(WhetherEnum.ALLOW.getValue());
schedule.setScheduleDate(DateUtils.getNextWeek(schDate, 3));
// schedule.setAvailableCount(rangeVo.getTotalCount());
log.info("排班新增入参:" + schedule.toString());
scheduleRecordMapper.insert(schedule);
});
continue;
}
}
}
}
}
}
package com.ebaiyihui.family.doctor.server.util;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESedeKeySpec;
import java.nio.charset.StandardCharsets;
/**
* @ClassName: DESUtils
* @Author:yanliang
* @Date:2024/3/19 11:10
* @Description
*/
@Slf4j
public class DESUtils {
/**
* DES 加密
*
* <dependency>* <groupId>commons-codec</groupId>
* <artifactId>commons-codec</artifactId>
* <version>1.14</version>
* </dependency>
* <p>
* org.apache.commons.codec.binary.Base64
*
* @param originData 原始数据,未加密
* @param secret 加密秘钥
* @return
*/
public static String encrypt(String originData, String secret) {
try {
DESedeKeySpec dks = new
DESedeKeySpec(secret.getBytes(StandardCharsets.UTF_8));
SecretKeyFactory keyFactory =
SecretKeyFactory.getInstance("DESede");
SecretKey securekey = keyFactory.generateSecret(dks);
Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, securekey);
byte[] b = cipher.doFinal(originData.getBytes());
return new String(Base64.encodeBase64(b),
StandardCharsets.UTF_8).replaceAll("\r", "").replaceAll("\n", "");
} catch (Exception e) {
log.error("加密异常:{}", e);
return "";
}
}
/**
* DES 解密
*
* @param encryptData 加密串
* @param secret 加密/解密 secret
* @return
*/
public static String decrypt(String encryptData, String secret) {
try {
// --通过 base64,将字符串转成 byte 数组
byte[] bytesrc = Base64.decodeBase64(encryptData.getBytes());
// --解密的 key
DESedeKeySpec dks = new DESedeKeySpec(secret.getBytes(StandardCharsets.UTF_8));
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DESede");
SecretKey securekey = keyFactory.generateSecret(dks);
// --Chipher 对象解密
Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, securekey);
byte[] retByte = cipher.doFinal(bytesrc);
return new String(retByte);
} catch (Exception e) {
log.error("解密异常:", e);
return "";
}
}
}
......@@ -35,6 +35,8 @@ public class DateUtils {
public final static String SIMPLE_TIME_FORMAT = "HH:mm:ss";
public final static String SIMPLE_TIME_FORMAT_MINUTE = "mm:ss";
public final static String YEAR = "yyyy";
/**
* 分钟 转 天时分
......@@ -2085,4 +2087,99 @@ public class DateUtils {
}
return age;
}
/**
* 将某个时间往后推day天
*
* @param currentDate
* @param day
* @return
*/
public static Date getAfterDay(Date currentDate, int day) {
// 创建Calendar对象并设置为当前日期
Calendar calendar = Calendar.getInstance();
calendar.setTime(currentDate);
// 往后推30天
calendar.add(Calendar.DAY_OF_MONTH, day);
// 获取推迟后的日期
Date futureDate = calendar.getTime();
return futureDate;
}
public static Date getQingMingBeforeDay(Date currentDate) throws ParseException {
// 设置清明节日期为4月4日或4月5日
String qingMingDateStr = getFormatDateString(currentDate, YEAR) + "-04-04"; // 以2024年为例
Date qingMingDate = parseDate(qingMingDateStr, SIMPLE_FORMAT);
// 使用Calendar类处理日期
Calendar calendar = Calendar.getInstance();
calendar.setTime(qingMingDate);
calendar.add(Calendar.DAY_OF_YEAR, -1); // 获取清明节前一天
// 将获取到的日期转换为Date对象
Date qingMingEveDate = calendar.getTime();
return qingMingEveDate;
}
public static Date getLaborBeforeDay(Date currentDate) throws ParseException {
// 设置劳动节日期为5月1日
String laborDayStr = getFormatDateString(currentDate, YEAR) + "-05-01"; // 以2024年为例
Date laborDay = parseDate(laborDayStr, SIMPLE_FORMAT);
// 使用Calendar类处理日期
Calendar calendar = Calendar.getInstance();
calendar.setTime(laborDay);
calendar.add(Calendar.DAY_OF_YEAR, -1); // 获取劳动节前一天
// 将获取到的日期转换为Date对象
Date laborDayEve = calendar.getTime();
return laborDayEve;
}
public static Date getDuanWuBeforeDay(Date currentDate) throws ParseException {
// 设置端午节日期为6月8日
String duanWuDayStr = getFormatDateString(currentDate, YEAR) + "-06-08"; // 以2024年为例
Date duanWuDay = parseDate(duanWuDayStr, SIMPLE_FORMAT);
Calendar calendar = Calendar.getInstance();
calendar.setTime(duanWuDay);
// 往前推一天
calendar.add(Calendar.DAY_OF_YEAR, -1);
Date duanwuDayEve = calendar.getTime();
return duanwuDayEve;
}
public static Date getZhongQiuBeforeDay(Date currentDate) throws ParseException {
// 设置端午节日期为6月8日
String zhongQiuDayStr = getFormatDateString(currentDate, YEAR) + "-09-14"; // 以2024年为例
Date zhongQiuDay = parseDate(zhongQiuDayStr, SIMPLE_FORMAT);
Calendar calendar = Calendar.getInstance();
calendar.setTime(zhongQiuDay);
// 往前推一天
calendar.add(Calendar.DAY_OF_YEAR, -1);
Date zhongQiuDayEve = calendar.getTime();
return zhongQiuDayEve;
}
public static Date getGuoQingBeforeDay(Date currentDate) throws ParseException {
// 设置国庆节日期为10月01日
String guoQingDayStr = getFormatDateString(currentDate, YEAR) + "-10-01"; // 以2024年为例
Date guoQingDay = parseDate(guoQingDayStr, SIMPLE_FORMAT);
Calendar calendar = Calendar.getInstance();
calendar.setTime(guoQingDay);
// 往前推一天
calendar.add(Calendar.DAY_OF_YEAR, -1);
Date guoQingDayEve = calendar.getTime();
return guoQingDayEve;
}
}
package com.ebaiyihui.family.doctor.server.util;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.crypto.digest.DigestAlgorithm;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import lombok.extern.slf4j.Slf4j;
import java.lang.reflect.Field;
import java.security.MessageDigest;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
/**
* @ClassName: SignUtils
* @Author:yanliang
* @Date:2024/3/18 14:52
* @Description
*/
@Slf4j
public class SignUtils {
public final static String NO_STR = "0";
public static String getSignatureToStr(Map<String, String> params, String secret) {
// 先将参数以其参数名的字典序升序进行排序
Map<String, String> sortedParams = new TreeMap<String, String>(params);
Set<Map.Entry<String, String>> entrys = sortedParams.entrySet();
// 遍历排序后的字典,将所有参数按"key=value"格式拼接在一起
StringBuilder basestring = new StringBuilder();
for (Map.Entry<String, String> param : entrys) {
basestring.append(param.getKey()).append("=").append(param.getValue());
}
basestring.append(secret);
log.info("加密前参数:{}", basestring.toString());
// 使用MD5对待签名串求签
byte[] bytes = null;
try {
MessageDigest md5 = MessageDigest.getInstance(DigestAlgorithm.MD5.getValue());
bytes = md5.digest(basestring.toString().getBytes(CharsetUtil.CHARSET_UTF_8));
} catch (Exception ex) {
log.error("错误信息:{}", ex);
}
// 将MD5输出的二进制结果转换为小写的十六进制
StringBuilder sign = new StringBuilder();
for (int i = 0; i < bytes.length; i++) {
String hex = Integer.toHexString(bytes[i] & 0xFF);
if (hex.length() == 1) {
sign.append(NO_STR);
}
sign.append(hex);
}
return sign.toString();
}
/**
* 检验参数 并返回Map
*/
public static Map<String, String> paramToMap(Object obj) {
/*** 过滤多余参数 并转换为Map<String, String> ***/
Map<String, Object> objMap = convertObjectToMap(obj);
// 类型转换
Map<String, String> strMap = JSON.parseObject(
JSON.toJSONString(objMap),
new TypeReference<HashMap<String, String>>() {
}
);
return strMap;
}
public static Map<String, Object> convertObjectToMap(Object object) {
Map<String, Object> map = new HashMap<>();
try {
Class<?> clazz = object.getClass();
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
String fieldName = field.getName();
Object fieldValue = field.get(object);
map.put(fieldName, fieldValue);
}
} catch (Exception e) {
e.printStackTrace();
}
return map;
}
}
package com.ebaiyihui.family.doctor.server.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @ClassName: OrderTaskVo
* @Author:yanliang
* @Date:2024/3/20 11:23
* @Description
*/
@Data
public class OrderTaskVo implements Serializable {
private static final long serialVersionUID = 1L;
private String id;
private Integer type;
private Integer expireTime;
}
......@@ -14,8 +14,8 @@ spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
username: root
password: Bykf@2020@..
url: jdbc:mysql://192.168.0.103:3310/byh-family-doctor?useUnicode=true&characterEncoding=utf8
password: byh@ycrmyy..
url: jdbc:mysql://192.168.0.106:3310/byh-family-doctor?useUnicode=true&characterEncoding=utf8
cache:
cache-names: dataCache
type: REDIS
......
......@@ -14,16 +14,16 @@ spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
username: root
password: Lyt#2021...
url: jdbc:mysql://192.168.0.103:3310/byh-family-doctor?useUnicode=true&characterEncoding=utf8
password: byh@ycrmyy..
url: jdbc:mysql://192.168.0.106:3310/byh-family-doctor?useUnicode=true&characterEncoding=utf8
cache:
cache-names: dataCache
type: REDIS
# rabbitmq:
# host: 123.57.93.190
# port: 5672
# username: byh
# password: byh2019@ZW..
rabbitmq:
host: rabbitmq
port: 5672
username: byh
password: byh@ycrmyy..
jackson:
serialization:
WRITE_DATES_AS_TIMESTAMPS: true
......@@ -63,4 +63,12 @@ swagger:
enabled: true
cloudDoctorUrl: https://testapi.chinachdu.com/cloud/doctorbasedata/
cloudDoctorUserUrl: https://testapi.chinachdu.com/cloud/doctoruser/
\ No newline at end of file
cloudDoctorUserUrl: https://testapi.chinachdu.com/cloud/doctoruser/
projprops:
userFindUserId: https://testapi.chinachdu.com/cloud/doctoruser/user/finduserid
userInfo: https://testapi.chinachdu.com/cloud/doctoruser/user/getuserinfoByUserId
baseAddress: https://testapi.chinachdu.com/
familyDoctorThirdUrl: http://47.100.107.19:30002/open-api/app
familyDoctorThirdClientId: 202305062345
familyDoctorThirdClientSecret: test2020145634
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论