Merge branch '3.11_院后第二增量' of http://182.92.166.109:3000/jihan/PostDischargePatientManage into 3.11_院后第二增量

This commit is contained in:
haown 2024-04-09 17:22:42 +08:00
commit d3495fa180
110 changed files with 5636 additions and 160 deletions

View File

@ -34,6 +34,7 @@
<jwt.version>0.9.1</jwt.version>
<lombok.version>1.18.4</lombok.version>
<knife4j.version>3.0.3</knife4j.version>
<simple-xml.version>2.7.1</simple-xml.version>
</properties>
<!-- 依赖声明 -->
@ -184,6 +185,12 @@
<artifactId>postdischarge-mobile</artifactId>
<version>${xinelu.version}</version>
</dependency>
<!-- xml文件序列化和反序列化 -->
<dependency>
<groupId>org.simpleframework</groupId>
<artifactId>simple-xml</artifactId>
<version>${simple-xml.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

View File

@ -102,6 +102,8 @@ token:
secret: DIweGcEWJTbvo48dnvOMR8GsDW
# 令牌有效期默认30分钟
expireTime: 30
# 请求拦截白名单
ant-matchers: /postDischarge/**,/testMobile/**
## MyBatis-Plus配置
mybatis-plus:
@ -184,3 +186,39 @@ xss:
excludes: /system/notice,/system/specialDiseaseNode/add,/system/specialDiseaseNode/edit
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
# 院后微信小程序参数配置信息
wechat-applet-chat-config:
# 微信小程序idwxdec3416aa3d60cab
applet-id: wxdc32268eca6b78f9
# 微信小程序密钥f58e19be0380c2ebc6e9e9684c0dacce
secret: 0d0e41432908750460aef2bf0aa871ae
# 微信小程序返回国家语言
lang: zh_CN
# 微信小程序授权类型
grant-type: authorization_code
# 微信小程序事件回调令牌
token: uI1NGHesp7ylIYVYQvp0TlcDmUTKCHj2
# 微信小程序事件回调消息加密密钥
encoding-aes-key: 5rbyhMBpdnxTEVT54zeHMNcXi3ccilQZ209QqGi89EW
# 优惠券领取模板id
coupon-receive-template-id: e1JRZaw1OfTz2b6X9DTqqaJtV4rXEt7uhwXoZLDb_eA
# 商品订单支付成功通知模板id
goods-order-template-id: -IxZeEkkXFhoSwGtBHbipKQ6kjEmkdTkswKeOypSsNQ
# 预约服务订单通知模板id
appoint-order-template-id: nUB9HRbqQXOVuTpkKBIHMgzWlNq6touzxf5QYBiMkbU
# 签到成功通知模板id
sign-template-id: S_c9bR4znSWpXg-6ACIMn7AkaR11dzo113XM8w4CKz0
# 院后微信公众号参数配置
wechat-official-account-config:
# 微信公众号id
official-account-app-id: wx9d87c7c73ef1ebde
# 微信公众号secret
official-account-app-secret: 20ab2c266b1da75d71e9932e7d28326e
# 微信公众号事件回调令牌
official-account-token: xinyilu
# 微信公众号事件回调消息加密密钥
official-account-encoding-aes-key: Awcn7nvDU4bcfBwAZmiRbB3lFgXAm2RIg45utdb5Zt3
# 测试模板id
test-template-id: WUCYtSbH-QFRV_fMcfmn86QLsz1zo881QW7fQNTWOjc

View File

@ -111,6 +111,12 @@
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- httpclient 依赖-->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,67 @@
package com.xinelu.common.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @Description 新医路院后微信小程序参数配置类
* @Author 纪寒
* @Date 2024-03-19 15:52:38
* @Version 1.0
*/
@Data
@Component
@ConfigurationProperties(prefix = "wechat-applet-chat-config")
public class WeChatAppletChatConfig {
/**
* 小程序id
*/
private String appletId;
/**
* 小程序secret
*/
private String secret;
/**
* 返回国家地区语言版本zh_CN 简体zh_TW 繁体en 英语
*/
private String lang;
/**
* 授权类型
*/
private String grantType;
/**
* 微信小程序事件回调令牌
*/
private String token;
/**
* 微信小程序事件回调消息加密密钥
*/
private String encodingAesKey;
/**
* 优惠券领取模板id
*/
private String couponReceiveTemplateId;
/**
* 商品订单支付成功通知模板id
*/
private String goodsOrderTemplateId;
/**
* 预约服务订单通知模板id
*/
private String appointOrderTemplateId;
/**
* 签到通知模板
*/
private String signTemplateId;
}

View File

@ -0,0 +1,36 @@
package com.xinelu.common.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @Description 新医路院后微信公众号参数配置类
* @Author 纪寒
* @Date 2024-03-21 11:12:04
* @Version 1.0
*/
@Data
@Component
@ConfigurationProperties(prefix = "wechat-official-account-config")
public class WeChatOfficialAccountConfig {
/**
* 微信公众号id
*/
private String officialAccountAppId;
/**
* 微信公众号secret
*/
private String officialAccountAppSecret;
/**
* 微信公众号事件回调令牌
*/
private String officialAccountToken;
/**
* 微信公众号事件回调消息加密密钥
*/
private String officialAccountEncodingAesKey;
}

View File

@ -228,4 +228,59 @@ public class Constants {
* 路径编码
*/
public static final String ROUTE_CODE = "RC";
/**
* 院后微信小程序accessToken的redis的键前缀
*/
public static final String WE_CHAT_APPLET_ACCESS_TOKEN = "WE_CHAT_APPLET_ACCESS_TOKEN_";
/**
* 院后微信公众号accessToken的redis的键前缀
*/
public static final String WE_CHAT_OFFICIAL_ACCOUNT_ACCESS_TOKEN = "WE_CHAT_OFFICIAL_ACCOUNT_ACCESS_TOKEN_";
/**
* 获取微信小程序和微信公众号accessToken的url地址
*/
public static final String WE_CHAT_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential";
/**
* 微信公众号模板消息推送发送接口地址
*/
public static final String OFFICIAL_ACCOUNT_TEMPLATE_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=";
/**
* 获取 access_token AppSecret 错误或者 access_token 无效请开发者认真比对 AppSecret 的正确性或查看是否正在为恰当的公众号调用接口
*/
public static final int INVALID_CREDENTIAL_ACCESS_TOKEN_ISINVALID_OR_NOT_LATEST = 40001;
/**
* 不合法的 OpenID 请开发者确认 OpenID 该用户是否已关注公众号或是否是其他公众号的 OpenID
*/
public static final int INVALID_OPENID = 40003;
/**
* 不合法的 access_token 请开发者认真比对 access_token 的有效性如是否过期或查看是否正在为恰当的公众号调用接口
*/
public static final int INVALID_ACCESS_TOKEN = 40014;
/**
* 不合法的 template_id
*/
public static final int INVALID_TEMPLATE_ID = 40037;
/**
* 用户拒接订阅
*/
public static final int DENY_SUBSCRIPTION = 43101;
/**
* 参数无效
*/
public static final int ARGUMENT_INVALID = 47003;
/**
* 成功
*/
public static final int SUCCESS_ERROR_CODE = 0;
}

View File

@ -0,0 +1,44 @@
package com.xinelu.common.entity;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 微信小程序和微信公众号accessToken信息实体类
* @Author 纪寒
* @Date 2024-03-21 14:00:10
* @Version 1.0
*/
@Data
public class AccessToken implements Serializable {
private static final long serialVersionUID = -7751995012730354177L;
/**
* accessToken值
*/
@JSONField(name = "access_token")
private String accessToken;
/**
* access_token有效时间有效时间为7200秒
*/
@JSONField(name = "expires_in")
private String expiresIn;
/**
* 错误状态码
* 40001AppSecret 错误或者 AppSecret 不属于这个小程序请开发者确认 AppSecret 的正确性
* 40002请确保 grant_type 字段值为 client_credential
* 40013不合法的 AppID请开发者检查 AppID 的正确性避免异常字符注意大小写
*/
private Integer errcode;
/**
* 错误状态值
* 40001AppSecret 错误或者 AppSecret 不属于这个小程序请开发者确认 AppSecret 的正确性
* 40002请确保 grant_type 字段值为 client_credential
* 40013不合法的 AppID请开发者检查 AppID 的正确性避免异常字符注意大小写
*/
private String errmsg;
}

View File

@ -0,0 +1,21 @@
package com.xinelu.common.entity;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 消息推送信息实体类
* @Author 纪寒
* @Date 2024-03-26 17:09:50
*/
@Data
public class MessageValueEntity implements Serializable {
private static final long serialVersionUID = -1257378392221120423L;
private String value;
public MessageValueEntity(String value) {
this.value = value;
}
}

View File

@ -0,0 +1,27 @@
package com.xinelu.common.enums;
import lombok.Getter;
/**
* @Description 小程序消息推送结果状态枚举
* @Author 纪寒
* @Date 2024-03-19 10:57:43
* @Version 1.0
*/
@Getter
public enum ErrorStatusEnum {
/**
* 成功
*/
success("success"),
/**
* 失败
*/
fail("fail");
final private String value;
ErrorStatusEnum(String value) {
this.value = value;
}
}

View File

@ -0,0 +1,43 @@
package com.xinelu.common.enums;
import lombok.Getter;
/**
* @Description 消息推送枚举
* @Author 纪寒
* @Date 2024-03-19 10:12:39
* @Version 1.0
*/
@Getter
public enum MessageTypeEnum {
/**
* 电话外呼
*/
PHONE_OUTBOUND("PHONE_OUTBOUND"),
/**
* 问卷量表
*/
QUESTIONNAIRE_SCALE("QUESTIONNAIRE_SCALE"),
/**
* 宣教文章
*/
PROPAGANDA_ARTICLE("QUESTIONNAIRE_SCALE"),
/**
* 文字提醒
*/
TEXT_REMIND("TEXT_REMIND"),
/**
* 人工随访
*/
ARTIFICIAL_FOLLOW_UP("ARTIFICIAL_FOLLOW_UP"),
;
final private String value;
MessageTypeEnum(String value) {
this.value = value;
}
}

View File

@ -0,0 +1,34 @@
package com.xinelu.common.enums;
import lombok.Getter;
/**
* @Description 微信公众号事件枚举
* @Author 纪寒
* @Date 2024-03-25 14:38:27
* @Version 1.0
*/
@Getter
public enum OfficialAccountEventEnum {
/**
* 模板消息推送事件
*/
TEMPLATESENDJOBFINISH("TEMPLATESENDJOBFINISH"),
/**
* 关系公众号事件
*/
SUBSCRIBE("subscribe"),
/**
* 取关公众号事件
*/
UNSUBSCRIBE("unsubscribe"),
;
final private String info;
OfficialAccountEventEnum(String info) {
this.info = info;
}
}

View File

@ -0,0 +1,34 @@
package com.xinelu.common.enums;
import lombok.Getter;
/**
* 发布状态枚举类
*
* @author haown
* @date 2024-04-08
*/
@Getter
public enum ReleaseStatusEnum {
/**
* 同意
*/
PUBLISHED("PUBLISHED"),
/**
* 不同意
*/
UNPUBLISHED("UNPUBLISHED"),
/**
* 不同意
*/
ALL("ALL"),
;
final private String info;
ReleaseStatusEnum(String info) {
this.info = info;
}
}

View File

@ -1,19 +1,28 @@
package com.xinelu.common.enums;
import lombok.Getter;
/**
* 节点审核状态枚举类
*
* @author haown
* @date 2024-04-01
*/
@Getter
public enum RouteCheckStatusEnum {
/**
* 同意
*/
AGREE,
/**
* 同意
*/
AGREE("AGREE"),
/**
* 不同意
*/
DISAGREE
/**
* 不同意
*/
DISAGREE("DISAGREE"),
;
final private String info;
RouteCheckStatusEnum(String info) {
this.info = info;
}
}

View File

@ -0,0 +1,40 @@
package com.xinelu.common.enums;
import lombok.Getter;
/**
* @Description 微信小程序订阅消息记录表 订阅消息类型枚举
* @Date 2024-03-19 17:16:06
* @Author 纪寒
* @Version 1.0
*/
@Getter
public enum SubscribeMessageTypeEnum {
/**
* 预约服务付款通知提醒
*/
APPOINT_ORDER_MESSAGE_PUSH("APPOINT_ORDER_MESSAGE_PUSH"),
/**
* 优惠券领取提醒
*/
COUPON_RECEIVE_MESSAGE_PUSH("COUPON_RECEIVE_MESSAGE_PUSH"),
/**
* 商品订单支付成功提醒
*/
GOODS_ORDER_MESSAGE_PUSH("GOODS_ORDER_MESSAGE_PUSH"),
/**
* 签到积分通知提醒
*/
SIGN_MESSAGE_PUSH("SIGN_MESSAGE_PUSH"),
;
final private String info;
SubscribeMessageTypeEnum(String info) {
this.info = info;
}
}

View File

@ -0,0 +1,28 @@
package com.xinelu.common.enums;
import lombok.Getter;
/**
* @Description 订阅状态枚举
* @Author 纪寒
* @Date 2024-03-19 10:20:05
* @Version 1.0
*/
@Getter
public enum SubscribeStatusEnum {
/**
* 接受
*/
accept("accept"),
/**
* 拒绝
*/
rejet("rejet");
final private String value;
SubscribeStatusEnum(String value) {
this.value = value;
}
}

View File

@ -167,7 +167,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
* @param date LocalDate
* @param pattern 解析格式
* @return 日期字符串
* @Author jihan
* @Author 纪寒
*/
public static String formatDateToString(LocalDate date, String pattern) {
if (Objects.isNull(date)) {
@ -181,7 +181,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
*
* @param date 指定日期,如果为null,默认为当天
* @return 结束日期
* @author jihan
* @author 纪寒
*/
public static LocalDateTime end(LocalDate date) {
return LocalDateTime.of(null == date ? LocalDate.now() : date, LocalTime.MAX);
@ -193,7 +193,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
* @param beginTime 开始时间
* @param endTime 结束时间可以为null, 如果为null则表示now
* @return 分钟差值
* @author jihan
* @author 纪寒
*/
public static long differenceMinutes(LocalDateTime beginTime, LocalDateTime endTime) {
if (null == beginTime) {
@ -201,4 +201,15 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
}
return ChronoUnit.MINUTES.between(beginTime, null == endTime ? LocalDateTime.now() : endTime);
}
/**
* 时间戳转LocalDateTime
*
* @param timestamp 时间戳
* @return java.time.LocalDateTime
* @author 纪寒
*/
public static LocalDateTime timestampToLocalDateTime(long timestamp) {
return LocalDateTime.ofEpochSecond(timestamp / 1000, 0, ZoneOffset.ofHours(8));
}
}

View File

@ -0,0 +1,55 @@
package com.xinelu.common.utils.aes;
/**
* @Description 微信AES解密异常信息类
* @Author WeChat
* @Date 2024-03-21 10:17:50
*/
@SuppressWarnings("serial")
public class AesException extends Exception {
public final static int OK = 0;
public final static int VALIDATE_SIGNATURE_ERROR = -40001;
public final static int PARSE_XML_ERROR = -40002;
public final static int COMPUTE_SIGNATURE_ERROR = -40003;
public final static int ILLEGAL_AES_KEY = -40004;
public final static int VALIDATE_APP_ID_ERROR = -40005;
public final static int ENCRYPT_AES_ERROR = -40006;
public final static int DECRYPT_AES_ERROR = -40007;
public final static int ILLEGAL_BUFFER = -40008;
private final int code;
private static String getMessage(int code) {
switch (code) {
case VALIDATE_SIGNATURE_ERROR:
return "签名验证错误";
case PARSE_XML_ERROR:
return "xml解析失败";
case COMPUTE_SIGNATURE_ERROR:
return "sha加密生成签名失败";
case ILLEGAL_AES_KEY:
return "SymmetricKey非法";
case VALIDATE_APP_ID_ERROR:
return "appid校验失败";
case ENCRYPT_AES_ERROR:
return "aes加密失败";
case DECRYPT_AES_ERROR:
return "aes解密失败";
case ILLEGAL_BUFFER:
return "解密后得到的buffer非法";
default:
return null;
}
}
public int getCode() {
return code;
}
AesException(int code) {
super(getMessage(code));
this.code = code;
}
}

View File

@ -0,0 +1,31 @@
package com.xinelu.common.utils.aes;
import java.util.ArrayList;
import java.util.List;
/**
* @Description 字节数组
* @Author WeChat
* @Date 2024-03-21 10:17:56
*/
class ByteGroup {
List<Byte> byteContainer = new ArrayList<>();
public byte[] toBytes() {
byte[] bytes = new byte[byteContainer.size()];
for (int i = 0; i < byteContainer.size(); i++) {
bytes[i] = byteContainer.get(i);
}
return bytes;
}
public void addBytes(byte[] bytes) {
for (byte b : bytes) {
byteContainer.add(b);
}
}
public int size() {
return byteContainer.size();
}
}

View File

@ -0,0 +1,62 @@
package com.xinelu.common.utils.aes;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
/**
* @Description 提供基于PKCS7算法的加解密接口
* @Author WeChat
* @Date 2024-03-21 10:18:21
*/
class PKCS7Encoder {
static Charset CHARSET = StandardCharsets.UTF_8;
static int BLOCK_SIZE = 32;
/**
* 获得对明文进行补位填充的字节.
*
* @param count 需要进行填充补位操作的明文字节个数
* @return 补齐用的字节数组
*/
static byte[] encode(int count) {
// 计算需要填充的位数
int amountToPad = BLOCK_SIZE - (count % BLOCK_SIZE);
if (amountToPad == 0) {
amountToPad = BLOCK_SIZE;
}
// 获得补位所用的字符
char padChr = chr(amountToPad);
StringBuilder tmp = new StringBuilder();
for (int index = 0; index < amountToPad; index++) {
tmp.append(padChr);
}
return tmp.toString().getBytes(CHARSET);
}
/**
* 删除解密后明文的补位字符
*
* @param decrypted 解密后的明文
* @return 删除补位字符后的明文
*/
static byte[] decode(byte[] decrypted) {
int pad = decrypted[decrypted.length - 1];
if (pad < 1 || pad > 32) {
pad = 0;
}
return Arrays.copyOfRange(decrypted, 0, decrypted.length - pad);
}
/**
* 将数字转化成ASCII码对应的字符用于对明文进行补码
*
* @param a 需要转化的数字
* @return 转化得到的字符
*/
static char chr(int a) {
byte target = (byte) (a & 0xFF);
return (char) target;
}
}

View File

@ -0,0 +1,94 @@
package com.xinelu.common.utils.aes;
import org.apache.commons.lang3.BooleanUtils;
import java.security.MessageDigest;
import java.util.Arrays;
/**
* SHA1 class
* <p>
*
* @Description 计算公众平台的消息签名接口
* @Author WeChat
* @Date 2024-03-21 10:19:50
*/
class SHA1 {
/**
* 用SHA1算法生成安全签名
*
* @param token 票据
* @param timestamp 时间戳
* @param nonce 随机字符串
* @param encrypt 密文
* @return 安全签名
* @throws AesException 异常信息
*/
public static String getShaOne(String token, String timestamp, String nonce, String encrypt) throws AesException {
return signatureByShaOne(token, timestamp, nonce, encrypt, true);
}
/**
* 用SHA1算法生成安全签名小程序回调设置验证URL时计算签名使用
*
* @param token 票据
* @param timestamp 时间戳
* @param nonce 随机字符串
* @return 安全签名
* @throws AesException 异常信息
*/
public static String getShaTwo(String token, String timestamp, String nonce) throws AesException {
return signatureByShaOne(token, timestamp, nonce, "", false);
}
/**
* 使用SHA-1计算签名公共方法
*
* @param token 令牌
* @param timestamp 时间粗
* @param nonce 随机字符串
* @param encrypt 密文
* @param encryptFlag 密文传入标识
* @return String 明文
* @throws AesException 异常信息
*/
private static String signatureByShaOne(String token, String timestamp, String nonce, String encrypt, boolean encryptFlag) throws AesException {
try {
String[] array;
int size;
if (BooleanUtils.isTrue(encryptFlag)) {
array = new String[]{token, timestamp, nonce, encrypt};
size = 4;
} else {
array = new String[]{token, timestamp, nonce};
size = 3;
}
StringBuilder sb = new StringBuilder();
// 字符串排序
Arrays.sort(array);
for (int i = 0; i < size; i++) {
sb.append(array[i]);
}
String str = sb.toString();
// SHA1签名生成
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(str.getBytes());
byte[] digest = md.digest();
StringBuilder hexStr = new StringBuilder();
String shaHex;
for (byte b : digest) {
shaHex = Integer.toHexString(b & 0xFF);
if (shaHex.length() < 2) {
hexStr.append(0);
}
hexStr.append(shaHex);
}
return hexStr.toString();
} catch (Exception e) {
e.printStackTrace();
throw new AesException(AesException.COMPUTE_SIGNATURE_ERROR);
}
}
}

View File

@ -0,0 +1,234 @@
package com.xinelu.common.utils.aes;
import org.apache.commons.codec.binary.Base64;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Random;
/**
* @Description 提供接收和推送给公众平台消息的加解密接口(UTF8编码的字符串).
* @Author WeChat
* @Date 2024-03-21 10:18:26
*/
public class WXBizMsgCrypt {
static Charset CHARSET = StandardCharsets.UTF_8;
Base64 base64 = new Base64();
byte[] aesKey;
String token;
String appId;
/**
* 构造函数
*
* @param token 公众平台上开发者设置的token
* @param encodingAesKey 公众平台上开发者设置的EncodingAESKey
* @param appId 公众平台appid
* @throws AesException 执行失败请查看该异常的错误码和具体的错误信息
*/
public WXBizMsgCrypt(String token, String encodingAesKey, String appId) throws AesException {
int length = 43;
if (encodingAesKey.length() != length) {
throw new AesException(AesException.ILLEGAL_AES_KEY);
}
this.token = token;
this.appId = appId;
aesKey = Base64.decodeBase64(encodingAesKey + "=");
}
/**
* 生成4个字节的网络字节序
*
* @param sourceNumber 数值
* @return 字节数组
*/
byte[] getNetworkBytesOrder(int sourceNumber) {
byte[] orderBytes = new byte[4];
orderBytes[3] = (byte) (sourceNumber & 0xFF);
orderBytes[2] = (byte) (sourceNumber >> 8 & 0xFF);
orderBytes[1] = (byte) (sourceNumber >> 16 & 0xFF);
orderBytes[0] = (byte) (sourceNumber >> 24 & 0xFF);
return orderBytes;
}
/**
* 还原4个字节的网络字节序
*
* @param orderBytes 字节数组
* @return 数值
*/
int recoverNetworkBytesOrder(byte[] orderBytes) {
int sourceNumber = 0;
for (int i = 0; i < 4; i++) {
sourceNumber <<= 8;
sourceNumber |= orderBytes[i] & 0xff;
}
return sourceNumber;
}
/**
* 随机生成16位字符串
*
* @return 随机字符串
*/
String getRandomStr() {
String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
Random random = new Random();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 16; i++) {
int number = random.nextInt(base.length());
sb.append(base.charAt(number));
}
return sb.toString();
}
/**
* 对明文进行加密.
*
* @param text 需要加密的明文
* @return 加密后base64编码的字符串
* @throws AesException aes加密失败
*/
String encrypt(String randomStr, String text) throws AesException {
ByteGroup byteCollector = new ByteGroup();
byte[] randomStrBytes = randomStr.getBytes(CHARSET);
byte[] textBytes = text.getBytes(CHARSET);
byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length);
byte[] appidBytes = appId.getBytes(CHARSET);
// randomStr + networkBytesOrder + text + appid
byteCollector.addBytes(randomStrBytes);
byteCollector.addBytes(networkBytesOrder);
byteCollector.addBytes(textBytes);
byteCollector.addBytes(appidBytes);
// ... + pad: 使用自定义的填充方式对明文进行补位填充
byte[] padBytes = PKCS7Encoder.encode(byteCollector.size());
byteCollector.addBytes(padBytes);
// 获得最终的字节流, 未加密
byte[] unencrypted = byteCollector.toBytes();
try {
// 设置加密模式为AES的CBC模式
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
SecretKeySpec keySpec = new SecretKeySpec(aesKey, "AES");
IvParameterSpec iv = new IvParameterSpec(aesKey, 0, 16);
cipher.init(Cipher.ENCRYPT_MODE, keySpec, iv);
// 加密
byte[] encrypted = cipher.doFinal(unencrypted);
// 使用BASE64对加密后的字符串进行编码
return base64.encodeToString(encrypted);
} catch (Exception e) {
e.printStackTrace();
throw new AesException(AesException.ENCRYPT_AES_ERROR);
}
}
/**
* 对密文进行解密.
*
* @param text 需要解密的密文
* @return 解密得到的明文
* @throws AesException aes解密失败
*/
String decrypt(String text) throws AesException {
byte[] original;
try {
// 设置解密模式为AES的CBC模式
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
SecretKeySpec keySpec = new SecretKeySpec(aesKey, "AES");
IvParameterSpec iv = new IvParameterSpec(Arrays.copyOfRange(aesKey, 0, 16));
cipher.init(Cipher.DECRYPT_MODE, keySpec, iv);
// 使用BASE64对密文进行解码
byte[] encrypted = Base64.decodeBase64(text);
// 解密
original = cipher.doFinal(encrypted);
} catch (Exception e) {
e.printStackTrace();
throw new AesException(AesException.DECRYPT_AES_ERROR);
}
String xmlContent, fromAppid;
try {
// 去除补位字符
byte[] bytes = PKCS7Encoder.decode(original);
// 分离16位随机字符串,网络字节序和AppId
byte[] networkOrder = Arrays.copyOfRange(bytes, 16, 20);
int xmlLength = recoverNetworkBytesOrder(networkOrder);
xmlContent = new String(Arrays.copyOfRange(bytes, 20, 20 + xmlLength), CHARSET);
fromAppid = new String(Arrays.copyOfRange(bytes, 20 + xmlLength, bytes.length),
CHARSET);
} catch (Exception e) {
e.printStackTrace();
throw new AesException(AesException.ILLEGAL_BUFFER);
}
// appid不相同的情况
if (!fromAppid.equals(appId)) {
throw new AesException(AesException.VALIDATE_APP_ID_ERROR);
}
return xmlContent;
}
/**
* @param replyMsg 公众平台待回复用户的消息xml格式的字符串
* @param timeStamp 时间戳可以自己生成也可以用URL参数的timestamp
* @param nonce 随机串可以自己生成也可以用URL参数的nonce
* @return 加密后的可以直接回复用户的密文包括msg_signature, timestamp, nonce, encrypt的xml格式的字符串
* @throws AesException 执行失败请查看该异常的错误码和具体的错误信息
* @Description 将公众平台回复用户的消息加密打包.
*/
public String encryptMsg(String replyMsg, String timeStamp, String nonce) throws AesException {
// 加密
String encrypt = encrypt(getRandomStr(), replyMsg);
// 生成安全签名
if ("".equals(timeStamp)) {
timeStamp = Long.toString(System.currentTimeMillis());
}
String signature = SHA1.getShaOne(token, timeStamp, nonce, encrypt);
// 生成发送的xml
return XMLParse.generate(encrypt, signature, timeStamp, nonce);
}
/**
* @param msgSignature 签名串对应URL参数的msg_signature
* @param timeStamp 时间戳对应URL参数的timestamp
* @param nonce 随机串对应URL参数的nonce
* @param postData 密文对应POST请求的数据
* @return 解密后的原文
* @throws AesException 执行失败请查看该异常的错误码和具体的错误信息
* @Description 检验消息的真实性并且获取解密后的明文.
*/
public String decryptMsg(String msgSignature, String timeStamp, String nonce, String postData)
throws AesException {
// 密钥公众账号的app secret
// 提取密文
Object[] encrypt = XMLParse.extract(postData);
// 验证安全签名
String signature = SHA1.getShaTwo(token, timeStamp, nonce);
// 和URL中的签名比较是否相等
if (!signature.equals(msgSignature)) {
throw new AesException(AesException.VALIDATE_SIGNATURE_ERROR);
}
// 解密
return decrypt(encrypt[1].toString());
}
/**
* 验证URL
*
* @param msgSignature 签名串对应URL参数的msg_signature
* @param timeStamp 时间戳对应URL参数的timestamp
* @param nonce 随机串对应URL参数的nonce
* @param echoStr 随机串对应URL参数的echostr
* @return 原始的随机串echostr
* @throws AesException 执行失败请查看该异常的错误码和具体的错误信息
*/
public String verifyUrl(String msgSignature, String timeStamp, String nonce, String echoStr) throws AesException {
String signature = SHA1.getShaTwo(token, timeStamp, nonce);
if (!signature.equals(msgSignature)) {
throw new AesException(AesException.VALIDATE_SIGNATURE_ERROR);
}
return echoStr;
}
}

View File

@ -0,0 +1,68 @@
package com.xinelu.common.utils.aes;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.StringReader;
/**
* @Description 提供提取消息格式中的密文及生成回复消息格式的接口.
* @Author WeChat
* @Date 2024-03-21 10:18:57
*/
class XMLParse {
/**
* 提取出xml数据包中的加密消息
*
* @param xmltext 待提取的xml字符串
* @return 提取出的加密消息字符串
* @throws AesException 异常信息
*/
public static Object[] extract(String xmltext) throws AesException {
Object[] result = new Object[3];
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
dbf.setXIncludeAware(false);
dbf.setExpandEntityReferences(false);
DocumentBuilder db = dbf.newDocumentBuilder();
StringReader sr = new StringReader(xmltext);
InputSource is = new InputSource(sr);
Document document = db.parse(is);
Element root = document.getDocumentElement();
NodeList nodelist1 = root.getElementsByTagName("Encrypt");
NodeList nodelist2 = root.getElementsByTagName("ToUserName");
result[0] = 0;
result[1] = nodelist1.item(0).getTextContent();
result[2] = nodelist2.item(0).getTextContent();
return result;
} catch (Exception e) {
e.printStackTrace();
throw new AesException(AesException.PARSE_XML_ERROR);
}
}
/**
* 生成xml消息
*
* @param encrypt 加密后的消息密文
* @param signature 安全签名
* @param timestamp 时间戳
* @param nonce 随机字符串
* @return 生成的xml字符串
*/
public static String generate(String encrypt, String signature, String timestamp, String nonce) {
String format = "<xml>\n" + "<Encrypt><![CDATA[%1$s]]></Encrypt>\n"
+ "<MsgSignature><![CDATA[%2$s]]></MsgSignature>\n"
+ "<TimeStamp>%3$s</TimeStamp>\n" + "<Nonce><![CDATA[%4$s]]></Nonce>\n" + "</xml>";
return String.format(format, encrypt, signature, timestamp, nonce);
}
}

View File

@ -2,6 +2,16 @@ package com.xinelu.common.utils.http;
import com.xinelu.common.constant.Constants;
import com.xinelu.common.utils.StringUtils;
import org.apache.http.Consts;
import org.apache.http.HttpEntity;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.HttpClientUtils;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -207,4 +217,40 @@ public class HttpUtils {
return true;
}
}
/**
* 发送json格式的POST类型的http请求
*
* @param url 请求地址
* @param param json格式的请求参数
* @return String 返回值信息
*/
public static String sendPostJson(String url, String param) {
String result = null;
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
try {
httpClient = HttpClients.createDefault();
// 字符串编码
StringEntity entity = new StringEntity(param, Consts.UTF_8);
// 设置content-type
entity.setContentType("application/json");
HttpPost httpPost = new HttpPost(url);
httpPost.setConfig(RequestConfig.custom().setSocketTimeout(10000).setConnectTimeout(10000).build());
// 防止被当成攻击添加的
httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/54.0.2840.87 Safari/537.36");
// 接收参数设置
httpPost.setHeader("Accept", "application/json");
httpPost.setEntity(entity);
response = httpClient.execute(httpPost);
HttpEntity httpEntity = response.getEntity();
result = EntityUtils.toString(httpEntity);
} catch (Exception e) {
log.warn("post请求发送失败请求路径[{}],请求参数:[{}],异常信息:[{}]", url, param, e);
} finally {
HttpClientUtils.closeQuietly(response);
HttpClientUtils.closeQuietly(httpClient);
}
return result;
}
}

View File

@ -4,6 +4,7 @@ import com.xinelu.framework.config.properties.PermitAllUrlProperties;
import com.xinelu.framework.security.filter.JwtAuthenticationTokenFilter;
import com.xinelu.framework.security.handle.AuthenticationEntryPointImpl;
import com.xinelu.framework.security.handle.LogoutSuccessHandlerImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
@ -64,6 +65,12 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Resource
private PermitAllUrlProperties permitAllUrl;
/**
* 请求拦截白名单
*/
@Value("${token.ant-matchers}")
private String antMatchers;
/**
* 解决 无法直接注入 AuthenticationManager
*
@ -111,6 +118,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// 静态资源可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
.antMatchers(antMatchers.split(",")).permitAll()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated()
.and()

View File

@ -167,7 +167,7 @@ public class GenUtils {
*
* @param replacementm 替换值
* @param searchList 替换列表
* @return
* @return 文本结果
*/
public static String replaceFirst(String replacementm, String[] searchList) {
String text = replacementm;

View File

@ -125,7 +125,7 @@ public class VelocityUtils {
* @return 模板列表
*/
public static List<String> getTemplateList(String tplCategory) {
List<String> templates = new ArrayList<String>();
List<String> templates = new ArrayList<>();
templates.add("vm/java/domain.java.vm");
templates.add("vm/java/mapper.java.vm");
templates.add("vm/java/service.java.vm");

View File

@ -13,15 +13,15 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.xinyilu.common.annotation.Log;
import com.xinyilu.common.core.controller.BaseController;
import com.xinyilu.common.core.domain.AjaxResult;
import com.xinyilu.common.enums.BusinessType;
import com.xinelu.common.annotation.Log;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.enums.BusinessType;
import ${packageName}.domain.${ClassName};
import ${packageName}.service.I${ClassName}Service;
import com.xinyilu.common.utils.poi.ExcelUtil;
import com.xinelu.common.utils.poi.ExcelUtil;
#if($table.crud || $table.sub)
import com.xinyilu.common.core.page.TableDataInfo;
import com.xinelu.common.core.page.TableDataInfo;
#elseif($table.tree)
#end

View File

@ -13,11 +13,11 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.xinyilu.common.annotation.Excel;
import com.xinelu.common.annotation.Excel;
#if($table.crud)
import com.xinyilu.common.core.domain.BaseEntity;
import com.xinelu.common.core.domain.BaseEntity;
#elseif($table.tree)
import com.xinyilu.common.core.domain.TreeEntity;
import com.xinelu.common.core.domain.TreeEntity;
#end
/**
@ -32,7 +32,7 @@ import com.xinyilu.common.core.domain.TreeEntity;
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "${functionName}对象", description = "${tableName}")
#if($table.crud)
#set($Entity="BaseDomain")
#set($Entity="BaseEntity")
#elseif($table.tree)
#set($Entity="TreeEntity")
#end

View File

@ -20,7 +20,7 @@ public interface ${ClassName}Mapper {
* @param ${pkColumn.javaField} ${functionName}主键
* @return ${functionName}
*/
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
/**
* 查询${functionName}列表

View File

@ -17,7 +17,7 @@ public interface I${ClassName}Service {
* @param ${pkColumn.javaField} ${functionName}主键
* @return ${functionName}
*/
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
/**
* 查询${functionName}列表

View File

@ -4,7 +4,7 @@ import java.time.LocalDateTime;
import java.util.List;
#foreach ($column in $columns)
#if($column.javaField == 'createTime' || $column.javaField == 'updateTime')
import com.xinyilu.common.utils.DateUtils;
import com.xinelu.common.utils.DateUtils;
#break
#end
#end
@ -13,7 +13,7 @@ import org.springframework.stereotype.Service;
#if($table.sub)
import java.util.ArrayList;
import com.xinyilu.common.utils.StringUtils;
import com.xinelu.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import ${packageName}.domain.${subClassName};
#end

View File

@ -3,7 +3,7 @@ package ${packageName}.domain;
#foreach ($import in $subImportList)
import ${import};
#end
import com.xinyilu.common.annotation.Excel;
import com.xinelu.common.annotation.Excel;
/**
* ${subTable.functionName}对象 ${subTableName}

View File

@ -110,7 +110,7 @@ public class QuestionInfoController extends BaseController {
* 科室问卷数量
*/
@GetMapping("/departmentQuestionCount")
public AjaxResult departmentQuestionCount(String departmentName) {
return questionInfoService.departmentQuestionCount(departmentName);
public AjaxResult departmentQuestionCount(String departmentName, String questionnaireStatus) {
return questionInfoService.departmentQuestionCount(departmentName, questionnaireStatus);
}
}

View File

@ -101,4 +101,15 @@ public class SpecialDiseaseNodeController extends BaseController {
}
return specialDiseaseNodeService.selectSpecialDisease(specialDiseaseRouteId);
}
/**
* 修改节点信息状态
*/
@PostMapping("/updateRouteCheckStatus")
public AjaxResult updateRouteCheckStatus(@RequestBody SpecialDiseaseNode specialDiseaseNode) {
if (Objects.isNull(specialDiseaseNode)) {
return AjaxResult.error("请选择需要修改的节点信息!");
}
return specialDiseaseNodeService.updateRouteCheckStatus(specialDiseaseNode);
}
}

View File

@ -52,8 +52,8 @@ public class SpecialDiseaseRouteController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:specialDiseaseRoute:add')")
@Log(title = "专病路径信息", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult add(@RequestBody SpecialDiseaseRoute specialDiseaseRoute) {
return toAjax(specialDiseaseRouteService.insertSpecialDiseaseRoute(specialDiseaseRoute));
public AjaxResult add(@RequestBody SpecialDiseaseRouteVO specialDiseaseRoute) {
return specialDiseaseRouteService.insertSpecialDiseaseRoute(specialDiseaseRoute);
}
/**
@ -62,8 +62,8 @@ public class SpecialDiseaseRouteController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:specialDiseaseRoute:edit')")
@Log(title = "专病路径信息", businessType = BusinessType.UPDATE)
@PutMapping("/edit")
public AjaxResult edit(@RequestBody SpecialDiseaseRoute specialDiseaseRoute) {
return toAjax(specialDiseaseRouteService.updateSpecialDiseaseRoute(specialDiseaseRoute));
public AjaxResult edit(@RequestBody SpecialDiseaseRouteVO specialDiseaseRoute) {
return specialDiseaseRouteService.updateSpecialDiseaseRoute(specialDiseaseRoute);
}
/**
@ -83,4 +83,12 @@ public class SpecialDiseaseRouteController extends BaseController {
public AjaxResult departmentRouteCount(String departmentName) {
return specialDiseaseRouteService.departmentRouteCount(departmentName);
}
/**
* 发布专病路径信息
*/
@PostMapping("/editReleaseStatus")
public AjaxResult editReleaseStatus(@RequestBody SpecialDiseaseRoute specialDiseaseRoute) {
return specialDiseaseRouteService.editReleaseStatus(specialDiseaseRoute);
}
}

View File

@ -0,0 +1,91 @@
package com.xinelu.manage.controller.specialdiseaseroutepackage;
import com.xinelu.common.annotation.Log;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.enums.BusinessType;
import com.xinelu.common.utils.poi.ExcelUtil;
import com.xinelu.manage.domain.specialdiseaseroutepackage.SpecialDiseaseRoutePackage;
import com.xinelu.manage.service.specialdiseaseroutepackage.ISpecialDiseaseRoutePackageService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 专病路径-服务包关系多对多关系Controller
*
* @author xinelu
* @date 2024-04-09
*/
@RestController
@RequestMapping("/system/routePackage")
public class SpecialDiseaseRoutePackageController extends BaseController {
@Resource
private ISpecialDiseaseRoutePackageService specialDiseaseRoutePackageService;
/**
* 查询专病路径-服务包关系多对多关系列表
*/
@PreAuthorize("@ss.hasPermi('system:routePackage:list')")
@GetMapping("/list")
public TableDataInfo list(SpecialDiseaseRoutePackage specialDiseaseRoutePackage) {
startPage();
List<SpecialDiseaseRoutePackage> list = specialDiseaseRoutePackageService.selectSpecialDiseaseRoutePackageList(specialDiseaseRoutePackage);
return getDataTable(list);
}
/**
* 导出专病路径-服务包关系多对多关系列表
*/
@PreAuthorize("@ss.hasPermi('system:routePackage:export')")
@Log(title = "专病路径-服务包关系(多对多关系)", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SpecialDiseaseRoutePackage specialDiseaseRoutePackage) {
List<SpecialDiseaseRoutePackage> list = specialDiseaseRoutePackageService.selectSpecialDiseaseRoutePackageList(specialDiseaseRoutePackage);
ExcelUtil<SpecialDiseaseRoutePackage> util = new ExcelUtil<>(SpecialDiseaseRoutePackage.class);
util.exportExcel(response, list, "专病路径-服务包关系(多对多关系)数据");
}
/**
* 获取专病路径-服务包关系多对多关系详细信息
*/
@PreAuthorize("@ss.hasPermi('system:routePackage:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(specialDiseaseRoutePackageService.selectSpecialDiseaseRoutePackageById(id));
}
/**
* 新增专病路径-服务包关系多对多关系
*/
@PreAuthorize("@ss.hasPermi('system:routePackage:add')")
@Log(title = "专病路径-服务包关系(多对多关系)", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SpecialDiseaseRoutePackage specialDiseaseRoutePackage) {
return toAjax(specialDiseaseRoutePackageService.insertSpecialDiseaseRoutePackage(specialDiseaseRoutePackage));
}
/**
* 修改专病路径-服务包关系多对多关系
*/
@PreAuthorize("@ss.hasPermi('system:routePackage:edit')")
@Log(title = "专病路径-服务包关系(多对多关系)", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SpecialDiseaseRoutePackage specialDiseaseRoutePackage) {
return toAjax(specialDiseaseRoutePackageService.updateSpecialDiseaseRoutePackage(specialDiseaseRoutePackage));
}
/**
* 删除专病路径-服务包关系多对多关系
*/
@PreAuthorize("@ss.hasPermi('system:routePackage:remove')")
@Log(title = "专病路径-服务包关系(多对多关系)", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(specialDiseaseRoutePackageService.deleteSpecialDiseaseRoutePackageByIds(ids));
}
}

View File

@ -0,0 +1,91 @@
package com.xinelu.manage.controller.subscribemessagerecord;
import com.xinelu.common.annotation.Log;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.enums.BusinessType;
import com.xinelu.common.utils.poi.ExcelUtil;
import com.xinelu.manage.domain.subscribemessagerecord.SubscribeMessageRecord;
import com.xinelu.manage.service.subscribemessagerecord.ISubscribeMessageRecordService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 微信小程序订阅消息记录Controller
*
* @author xinelu
* @date 2024-03-19
*/
@RestController
@RequestMapping("/manage/sendRecord")
public class SubscribeMessageRecordController extends BaseController {
@Resource
private ISubscribeMessageRecordService subscribeMessageRecordService;
/**
* 查询微信小程序订阅消息记录列表
*/
@PreAuthorize("@ss.hasPermi('manage:sendRecord:list')")
@GetMapping("/list")
public TableDataInfo list(SubscribeMessageRecord subscribeMessageRecord) {
startPage();
List<SubscribeMessageRecord> list = subscribeMessageRecordService.selectSubscribeMessageRecordList(subscribeMessageRecord);
return getDataTable(list);
}
/**
* 导出微信小程序订阅消息记录列表
*/
@PreAuthorize("@ss.hasPermi('manage:sendRecord:export')")
@Log(title = "微信小程序订阅消息记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SubscribeMessageRecord subscribeMessageRecord) {
List<SubscribeMessageRecord> list = subscribeMessageRecordService.selectSubscribeMessageRecordList(subscribeMessageRecord);
ExcelUtil<SubscribeMessageRecord> util = new ExcelUtil<>(SubscribeMessageRecord.class);
util.exportExcel(response, list, "微信小程序订阅消息记录数据");
}
/**
* 获取微信小程序订阅消息记录详细信息
*/
@PreAuthorize("@ss.hasPermi('manage:sendRecord:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(subscribeMessageRecordService.selectSubscribeMessageRecordById(id));
}
/**
* 新增微信小程序订阅消息记录
*/
@PreAuthorize("@ss.hasPermi('manage:sendRecord:add')")
@Log(title = "微信小程序订阅消息记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SubscribeMessageRecord subscribeMessageRecord) {
return toAjax(subscribeMessageRecordService.insertSubscribeMessageRecord(subscribeMessageRecord));
}
/**
* 修改微信小程序订阅消息记录
*/
@PreAuthorize("@ss.hasPermi('manage:sendRecord:edit')")
@Log(title = "微信小程序订阅消息记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SubscribeMessageRecord subscribeMessageRecord) {
return toAjax(subscribeMessageRecordService.updateSubscribeMessageRecord(subscribeMessageRecord));
}
/**
* 删除微信小程序订阅消息记录
*/
@PreAuthorize("@ss.hasPermi('manage:sendRecord:remove')")
@Log(title = "微信小程序订阅消息记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(subscribeMessageRecordService.deleteSubscribeMessageRecordByIds(ids));
}
}

View File

@ -0,0 +1,91 @@
package com.xinelu.manage.controller.subscribemessagesendrecord;
import com.xinelu.common.annotation.Log;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.enums.BusinessType;
import com.xinelu.common.utils.poi.ExcelUtil;
import com.xinelu.manage.domain.subscribemessagesendrecord.SubscribeMessageSendRecord;
import com.xinelu.manage.service.subscribemessagesendrecord.ISubscribeMessageSendRecordService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 微信小程序订阅消息发送结果记录Controller
*
* @author xinelu
* @date 2024-03-19
*/
@RestController
@RequestMapping("/manage/sendResult")
public class SubscribeMessageSendRecordController extends BaseController {
@Resource
private ISubscribeMessageSendRecordService subscribeMessageSendRecordService;
/**
* 查询微信小程序订阅消息发送结果记录列表
*/
@PreAuthorize("@ss.hasPermi('manage:sendResult:list')")
@GetMapping("/list")
public TableDataInfo list(SubscribeMessageSendRecord subscribeMessageSendRecord) {
startPage();
List<SubscribeMessageSendRecord> list = subscribeMessageSendRecordService.selectSubscribeMessageSendRecordList(subscribeMessageSendRecord);
return getDataTable(list);
}
/**
* 导出微信小程序订阅消息发送结果记录列表
*/
@PreAuthorize("@ss.hasPermi('manage:sendResult:export')")
@Log(title = "微信小程序订阅消息发送结果记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SubscribeMessageSendRecord subscribeMessageSendRecord) {
List<SubscribeMessageSendRecord> list = subscribeMessageSendRecordService.selectSubscribeMessageSendRecordList(subscribeMessageSendRecord);
ExcelUtil<SubscribeMessageSendRecord> util = new ExcelUtil<>(SubscribeMessageSendRecord.class);
util.exportExcel(response, list, "微信小程序订阅消息发送结果记录数据");
}
/**
* 获取微信小程序订阅消息发送结果记录详细信息
*/
@PreAuthorize("@ss.hasPermi('manage:sendResult:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(subscribeMessageSendRecordService.selectSubscribeMessageSendRecordById(id));
}
/**
* 新增微信小程序订阅消息发送结果记录
*/
@PreAuthorize("@ss.hasPermi('manage:sendResult:add')")
@Log(title = "微信小程序订阅消息发送结果记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SubscribeMessageSendRecord subscribeMessageSendRecord) {
return toAjax(subscribeMessageSendRecordService.insertSubscribeMessageSendRecord(subscribeMessageSendRecord));
}
/**
* 修改微信小程序订阅消息发送结果记录
*/
@PreAuthorize("@ss.hasPermi('manage:sendResult:edit')")
@Log(title = "微信小程序订阅消息发送结果记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SubscribeMessageSendRecord subscribeMessageSendRecord) {
return toAjax(subscribeMessageSendRecordService.updateSubscribeMessageSendRecord(subscribeMessageSendRecord));
}
/**
* 删除微信小程序订阅消息发送结果记录
*/
@PreAuthorize("@ss.hasPermi('manage:sendResult:remove')")
@Log(title = "微信小程序订阅消息发送结果记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(subscribeMessageSendRecordService.deleteSubscribeMessageSendRecordByIds(ids));
}
}

View File

@ -0,0 +1,94 @@
package com.xinelu.manage.domain.officialaccountsubscribeevent;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.time.LocalDateTime;
/**
* 微信公众号关注和取消事件信息对象 official_account_subscribe_event
*
* @author xinelu
* @date 2024-03-26
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "微信公众号关注和取消事件信息对象", description = "official_account_subscribe_event")
public class OfficialAccountSubscribeEvent extends BaseEntity {
private static final long serialVersionUID = 4235213866159646854L;
/**
* 主键id
*/
private Long id;
/**
* 微信公众号openid
*/
@ApiModelProperty(value = "微信公众号openid")
@Excel(name = "微信公众号openid")
private String openid;
/**
* 微信公众号id
*/
@ApiModelProperty(value = "微信公众号id")
@Excel(name = "微信公众号id")
private String officialAccountAppId;
/**
* 消息创建时间 yyyy-MM-dd HH:mm:ss
*/
@ApiModelProperty(value = "消息创建时间 yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "消息创建时间 yyyy-MM-dd HH:mm:ss", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime sendTime;
/**
* 消息类型是事件固定取值为event
*/
@ApiModelProperty(value = "消息类型是事件固定取值为event")
@Excel(name = "消息类型是事件固定取值为event")
private String msgType;
/**
* 事件类型订阅subscribe取消订阅unsubscribe
*/
@ApiModelProperty(value = "事件类型订阅subscribe取消订阅unsubscribe")
@Excel(name = "事件类型订阅subscribe取消订阅unsubscribe")
private String eventType;
/**
* 订阅状态关注FOCUS取消CANCEL
*/
@ApiModelProperty(value = "订阅状态关注FOCUS取消CANCEL")
@Excel(name = "订阅状态关注FOCUS取消CANCEL")
private String subscribeStatus;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("openid", getOpenid())
.append("officialAccountAppId", getOfficialAccountAppId())
.append("sendTime", getSendTime())
.append("msgType", getMsgType())
.append("eventType", getEventType())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,119 @@
package com.xinelu.manage.domain.officialaccounttemplateevent;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.time.LocalDateTime;
/**
* 微信公众号模板信息事件推送对象 official_account_template_event
*
* @author xinelu
* @date 2024-03-25
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "微信公众号模板信息事件推送对象", description = "official_account_template_event")
public class OfficialAccountTemplateEvent extends BaseEntity {
private static final long serialVersionUID = -8437491233815143821L;
/**
* 主键id
*/
private Long id;
/**
* 患者信息表id
*/
@ApiModelProperty(value = "患者信息表id")
@Excel(name = "患者信息表id")
private Long patientId;
/**
* 患者姓名
*/
@ApiModelProperty(value = "患者姓名")
@Excel(name = "患者姓名")
private String patientName;
/**
* 微信公众号openid
*/
@ApiModelProperty(value = "微信用户openid")
@Excel(name = "微信用户openid")
private String openid;
/**
* 微信公众号id
*/
@ApiModelProperty(value = "微信公众号id")
@Excel(name = "微信公众号id")
private String officialAccountAppId;
/**
* 发送时间事件创建时间yyyy-MM-dd HH:mm:ss
*/
@ApiModelProperty(value = "发送时间事件创建时间yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "发送时间事件创建时间yyyy-MM-dd HH:mm:ss", width = 30, dateFormat = "yyyy-MM-dd")
private LocalDateTime sendTime;
/**
* 消息类型是事件固定取值为event
*/
@ApiModelProperty(value = "消息类型是事件固定取值为event")
@Excel(name = "消息类型是事件固定取值为event")
private String msgType;
/**
* 事件为模板消息发送结束固定取值为TEMPLATESENDJOBFINISH
*/
@ApiModelProperty(value = "事件为模板消息发送结束固定取值为TEMPLATESENDJOBFINISH")
@Excel(name = "事件为模板消息发送结束固定取值为TEMPLATESENDJOBFINISH")
private String eventType;
/**
* 消息id
*/
@ApiModelProperty(value = "消息id")
@Excel(name = "消息id")
private String msgId;
/**
* 发送状态,成功success用户拒绝接收failed:user block发送失败非用户拒绝failed:system failed
*/
@ApiModelProperty(value = "发送状态,成功success用户拒绝接收failed:user block发送失败")
@Excel(name = "发送状态,成功success用户拒绝接收failed:user block发送失败", readConverterExp = "非=用户拒绝")
private String status;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("patientId", getPatientId())
.append("patientName", getPatientName())
.append("openid", getOpenid())
.append("officialAccountAppId", getOfficialAccountAppId())
.append("sendTime", getSendTime())
.append("msgType", getMsgType())
.append("eventType", getEventType())
.append("msgId", getMsgId())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -115,6 +115,13 @@ public class PatientInfo extends BaseEntity {
@Excel(name = "签约时间格式yyyy-MM-dd HH:mm:ss", width = 30, dateFormat = "yyyy-MM-dd")
private LocalDateTime signTime;
/**
* 开证医生预住院患者
*/
@ApiModelProperty(value = "开证医生")
@Excel(name = "开证医生", readConverterExp = "预住院患者")
private String certificateIssuingDoctor;
/**
* 就诊方式门诊OUTPATIENT_SERVICE住院BE_IN_HOSPITAL
*/
@ -142,6 +149,13 @@ public class PatientInfo extends BaseEntity {
@ApiModelProperty(value = "主要诊断")
private String mainDiagnosis;
/**
* 主治医生
*/
@ApiModelProperty(value = "主治医生")
@Excel(name = "主治医生")
private String attendingPhysician;
/**
* 所属医院id
*/
@ -194,6 +208,13 @@ public class PatientInfo extends BaseEntity {
@Excel(name = "所属病区名称")
private String wardName;
/**
* 住院号
*/
@ApiModelProperty(value = "住院号")
@Excel(name = "住院号")
private String admissionNumber;
/**
* 责任护士
*/
@ -229,6 +250,12 @@ public class PatientInfo extends BaseEntity {
*/
private Long patientPreHospitalizationId;
/**
* 病历内容
*/
@ApiModelProperty(value = "病历内容")
private String medicalRecordContent;
/**
* 预约治疗组取值以及枚举未知
*/
@ -260,14 +287,29 @@ public class PatientInfo extends BaseEntity {
@Excel(name = "门诊/住院号 ", readConverterExp = "门诊/住院号 ")
private String inHospitalNumber;
/**
* 门诊号门诊患者
*/
@ApiModelProperty(value = "门诊号")
@Excel(name = "门诊号", readConverterExp = "门=诊患者")
private String outpatientNumber;
/**
* 就诊时间格式yyyy-MM-dd HH:mm:ss
*/
@ApiModelProperty(value = "就诊时间格式yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "就诊时间格式yyyy-MM-dd HH:mm:ss", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "就诊时间格式yyyy-MM-dd HH:mm:ss", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime visitDate;
/**
* 就诊时间门诊患者时间格式yyyy-MM-dd
*/
@ApiModelProperty(value = "就诊时间")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "就诊时间", readConverterExp = "门=诊患者")
private LocalDate visitTime;
/**
* 出院方式出院患者
*/
@ -275,6 +317,24 @@ public class PatientInfo extends BaseEntity {
@Excel(name = "出院方式", readConverterExp = "出=院患者")
private String dischargeMethod;
/**
* 微信小程序openid微信小程序唯一标识
*/
@ApiModelProperty(value = "微信小程序openid微信小程序唯一标识")
private String openId;
/**
* 微信unionid微信小程序和微信公众号统一标识
*/
@ApiModelProperty(value = "微信unionid微信小程序和微信公众号统一标识 ")
private String unionId;
/**
* 微信公众号openid微信众号唯一标识
*/
@ApiModelProperty(value = "微信公众号openid微信众号唯一标识 ")
private String officialAccountOpenId;
/**
* 患者来源微信小程序WE_CHAT_APPLET微信公众号WE_CHAT_OFFICIAL_ACCOUNT管理端MANAGE_END
*/

View File

@ -97,7 +97,7 @@ public class SignPatientManageRouteNode extends BaseEntity {
/** 电话内容(富文本存放整个节点的信息,包含标签画像的名称以及其它,标签画像名称使用特殊符号进行标记) */
@ApiModelProperty(value = "电话内容")
@Excel(name = "电话内容", readConverterExp = "=文本存放整个节点的信息,包含标签画像的名称以及其它,标签画像名称使用特殊符号进行标记")
@Excel(name = "电话内容", readConverterExp = "文本存放整个节点的信息,包含标签画像的名称以及其它,标签画像名称使用特殊符号进行标记")
private String phoneNodeContent;
/** 电话重拨次数重拨一次REDIAL_ONCE重拨二次REDIAL_TWICE不重播NOT_REPLAY */

View File

@ -12,8 +12,8 @@ import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Date;
/**
* 专病路径-管理节点信息对象 special_disease_node
@ -307,7 +307,7 @@ public class SpecialDiseaseNode extends BaseEntity {
@ApiModelProperty(value = "节点审核时间")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "节点审核时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date routeCheckDate;
private LocalDateTime routeCheckDate;
/**
* 节点审核备注信息存储审核备注信息以及审核不通过原因等信息

View File

@ -0,0 +1,76 @@
package com.xinelu.manage.domain.specialdiseaseroutepackage;
import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 专病路径-服务包关系多对多关系对象 special_disease_route_package
*
* @author xinelu
* @date 2024-04-09
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "专病路径-服务包关系(多对多关系)对象", description = "special_disease_route_package")
public class SpecialDiseaseRoutePackage extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private Long id;
/**
* 专病路径表id
*/
@ApiModelProperty(value = "专病路径表id")
@Excel(name = "专病路径表id")
private Long routeId;
/**
* 服务包表id
*/
@ApiModelProperty(value = "服务包表id")
@Excel(name = "服务包表id")
private Long servicePackageId;
/**
* 路径名称
*/
@ApiModelProperty(value = "路径名称")
@Excel(name = "路径名称")
private String routeName;
/**
* 服务包名称
*/
@ApiModelProperty(value = "服务包名称")
@Excel(name = "服务包名称")
private String packageName;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("routeId", getRouteId())
.append("servicePackageId", getServicePackageId())
.append("routeName", getRouteName())
.append("packageName", getPackageName())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -12,7 +12,7 @@ import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
import java.time.LocalDateTime;
/**
* 微信小程序订阅消息记录对象 subscribe_message_record
@ -87,21 +87,21 @@ public class SubscribeMessageRecord extends BaseEntity {
*/
@ApiModelProperty(value = "用于订阅消息次数")
@Excel(name = "用于订阅消息次数")
private Long subscribeCount;
private Integer subscribeCount;
/**
* 订阅时间
*/
@ApiModelProperty(value = "订阅时间")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "订阅时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date subscribeTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "订阅时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime subscribeTime;
/**
* 订阅状态accept接受reject拒绝
*/
@ApiModelProperty(value = "订阅状态,accept接受reject:拒绝")
@Excel(name = "订阅状态,accept接受reject:拒绝")
@ApiModelProperty(value = "订阅状态,ACCEPT接受REJECT:拒绝")
@Excel(name = "订阅状态,ACCEPT接受REJECT:拒绝")
private String subscribeStatus;

View File

@ -0,0 +1,136 @@
package com.xinelu.manage.domain.subscribemessagesendrecord;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.time.LocalDateTime;
/**
* 微信小程序订阅消息发送结果记录对象 subscribe_message_send_record
*
* @author xinelu
* @date 2024-03-19
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "微信小程序订阅消息发送结果记录对象", description = "subscribe_message_send_record")
public class SubscribeMessageSendRecord extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private Long id;
/**
* 患者id
*/
@ApiModelProperty(value = "患者id")
@Excel(name = "患者id")
private Long patientId;
/**
* 签约患者管理任务节点表id
*/
@ApiModelProperty(value = "签约患者管理任务节点表id")
@Excel(name = "签约患者管理任务节点表id")
private Long manageRouteNodeId;
/**
* 微信unionid
*/
@ApiModelProperty(value = "微信unionid")
@Excel(name = "微信unionid")
private String unionid;
/**
* 微信openid
*/
@ApiModelProperty(value = "微信openid")
@Excel(name = "微信openid")
private String openid;
/**
* 微信小程序id
*/
@ApiModelProperty(value = "微信小程序id")
@Excel(name = "微信小程序id")
private String appletId;
/**
* 订阅消息发送时间
*/
@ApiModelProperty(value = "订阅消息发送时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "订阅消息发送时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime subscribeTime;
/**
* 消息模板id
*/
@ApiModelProperty(value = "消息模板id")
@Excel(name = "消息模板id")
private String templateId;
/**
* 消息id
*/
@ApiModelProperty(value = "消息id")
@Excel(name = "消息id")
private String msgId;
/**
* 订阅任务消息类型电话外呼PHONE_OUTBOUND问卷量表QUESTIONNAIRE_SCALE宣教文章PROPAGANDA_ARTICLE文字提醒TEXT_REMIND人工随访ARTIFICIAL_FOLLOW_UP
*/
@ApiModelProperty(value = "订阅任务消息类型电话外呼PHONE_OUTBOUND问卷量表QUESTIONNAIRE_SCALE宣教文章PROPAGANDA_ARTICLE文字提醒TEXT_REMIND人工随访ARTIFICIAL_FOLLOW_UP")
@Excel(name = "订阅任务消息类型电话外呼PHONE_OUTBOUND问卷量表QUESTIONNAIRE_SCALE宣教文章PROPAGANDA_ARTICLE文字提醒TEXT_REMIND人工随访ARTIFICIAL_FOLLOW_UP")
private String messageType;
/**
* 推送结果状态码0表示成功
*/
@ApiModelProperty(value = "推送结果状态码")
@Excel(name = "推送结果状态码", readConverterExp = "0=表示成功")
private Integer errorCode;
/**
* 推送结果状态码success成功
*/
@ApiModelProperty(value = "推送结果状态码success成功fail失败")
@Excel(name = "推送结果状态码success成功, fail失败")
private String errorStatus;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("patientId", getPatientId())
.append("manageRouteNodeId", getManageRouteNodeId())
.append("unionid", getUnionid())
.append("openid", getOpenid())
.append("appletId", getAppletId())
.append("subscribeTime", getSubscribeTime())
.append("templateId", getTemplateId())
.append("msgId", getMsgId())
.append("messageType", getMessageType())
.append("errorCode", getErrorCode())
.append("errorStatus", getErrorStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -44,8 +44,8 @@ public class ManualFollowUpDTO {
@ApiModelProperty(value = "所属病区id")
private Long wardId;
@ApiModelProperty(value = "患者类型在院患者IN_HOSPITAL_PATIENT门诊患者OUTPATIENT出院患者DISCHARGED_PATIENT")
private String patientType;
@ApiModelProperty(value = "适用范围在院IN_THE_HOSPITAL出院DISCHARGE门诊OUTPATIENT_SERVICE")
private String suitRange;
@ApiModelProperty(value = "就诊流水号")
private String visitSerialNumber;

View File

@ -0,0 +1,77 @@
package com.xinelu.manage.mapper.officialaccountsubscribeevent;
import com.xinelu.manage.domain.officialaccountsubscribeevent.OfficialAccountSubscribeEvent;
import java.util.List;
/**
* 微信公众号关注和取消事件信息Mapper接口
*
* @author xinelu
* @date 2024-03-26
*/
public interface OfficialAccountSubscribeEventMapper {
/**
* 查询微信公众号关注和取消事件信息
*
* @param id 微信公众号关注和取消事件信息主键
* @return 微信公众号关注和取消事件信息
*/
OfficialAccountSubscribeEvent selectOfficialAccountSubscribeEventById(Long id);
/**
* 查询微信公众号关注和取消事件信息列表
*
* @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
* @return 微信公众号关注和取消事件信息集合
*/
List<OfficialAccountSubscribeEvent> selectOfficialAccountSubscribeEventList(OfficialAccountSubscribeEvent officialAccountSubscribeEvent);
/**
* 新增微信公众号关注和取消事件信息
*
* @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
* @return 结果
*/
int insertOfficialAccountSubscribeEvent(OfficialAccountSubscribeEvent officialAccountSubscribeEvent);
/**
* 修改微信公众号关注和取消事件信息
*
* @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
* @return 结果
*/
int updateOfficialAccountSubscribeEvent(OfficialAccountSubscribeEvent officialAccountSubscribeEvent);
/**
* 删除微信公众号关注和取消事件信息
*
* @param id 微信公众号关注和取消事件信息主键
* @return 结果
*/
int deleteOfficialAccountSubscribeEventById(Long id);
/**
* 批量删除微信公众号关注和取消事件信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteOfficialAccountSubscribeEventByIds(Long[] ids);
/**
* 根据openid查询用户是否订阅公众号
*
* @param openId 公众号openID
* @return 结果
*/
int getSubscribeEventInfo(String openId);
/**
* 根据openid修改订阅信息
*
* @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
* @return 结果
*/
int updateSubscribeEventInfo(OfficialAccountSubscribeEvent officialAccountSubscribeEvent);
}

View File

@ -0,0 +1,61 @@
package com.xinelu.manage.mapper.officialaccounttemplateevent;
import com.xinelu.manage.domain.officialaccounttemplateevent.OfficialAccountTemplateEvent;
import java.util.List;
/**
* 微信公众号模板信息事件推送Mapper接口
*
* @author xinelu
* @date 2024-03-25
*/
public interface OfficialAccountTemplateEventMapper {
/**
* 查询微信公众号模板信息事件推送
*
* @param id 微信公众号模板信息事件推送主键
* @return 微信公众号模板信息事件推送
*/
OfficialAccountTemplateEvent selectOfficialAccountTemplateEventById(Long id);
/**
* 查询微信公众号模板信息事件推送列表
*
* @param officialAccountTemplateEvent 微信公众号模板信息事件推送
* @return 微信公众号模板信息事件推送集合
*/
List<OfficialAccountTemplateEvent> selectOfficialAccountTemplateEventList(OfficialAccountTemplateEvent officialAccountTemplateEvent);
/**
* 新增微信公众号模板信息事件推送
*
* @param officialAccountTemplateEvent 微信公众号模板信息事件推送
* @return 结果
*/
int insertOfficialAccountTemplateEvent(OfficialAccountTemplateEvent officialAccountTemplateEvent);
/**
* 修改微信公众号模板信息事件推送
*
* @param officialAccountTemplateEvent 微信公众号模板信息事件推送
* @return 结果
*/
int updateOfficialAccountTemplateEvent(OfficialAccountTemplateEvent officialAccountTemplateEvent);
/**
* 删除微信公众号模板信息事件推送
*
* @param id 微信公众号模板信息事件推送主键
* @return 结果
*/
int deleteOfficialAccountTemplateEventById(Long id);
/**
* 批量删除微信公众号模板信息事件推送
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteOfficialAccountTemplateEventByIds(Long[] ids);
}

View File

@ -19,7 +19,7 @@ public interface PatientInfoMapper {
* @param id 患者信息主键
* @return 患者信息
*/
public PatientInfo selectPatientInfoById(Long id);
PatientInfo selectPatientInfoById(Long id);
/**
* 查询患者信息
@ -27,7 +27,7 @@ public interface PatientInfoMapper {
* @param id 主键id
* @return 患者信息
*/
public PatientBaseInfoVo getPatientBaseInfo(Long id);
PatientBaseInfoVo getPatientBaseInfo(Long id);
/**
* 查询患者信息列表
@ -59,7 +59,7 @@ public interface PatientInfoMapper {
* @param id 患者信息主键
* @return 结果
*/
public int deletePatientInfoById(Long id);
int deletePatientInfoById(Long id);
/**
* 批量删除患者信息
@ -67,5 +67,13 @@ public interface PatientInfoMapper {
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deletePatientInfoByIds(Long[] ids);
int deletePatientInfoByIds(Long[] ids);
/**
* 根据openid查询被护理人信息
*
* @param openId 微信openId
* @return 被护理人基本信息
*/
PatientInfo getPatientInfoByOpenId(String openId);
}

View File

@ -2,10 +2,10 @@ package com.xinelu.manage.mapper.questioninfo;
import com.xinelu.manage.domain.questioninfo.QuestionInfo;
import com.xinelu.manage.vo.department.DepartmentVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 问卷基本信息Mapper接口
*
@ -65,8 +65,9 @@ public interface QuestionInfoMapper {
/**
* 科室路径数量
*
* @param departmentName 科室名称
* @param departmentName 科室名称
* @param questionnaireStatus 问卷状态
* @return DepartmentVO
*/
List<DepartmentVO> departmentQuestionByDepartmentName(String departmentName);
List<DepartmentVO> departmentQuestionByDepartmentName(@Param("departmentName") String departmentName, @Param("questionnaireStatus") String questionnaireStatus);
}

View File

@ -3,6 +3,7 @@ package com.xinelu.manage.mapper.specialdiseaseroute;
import com.xinelu.manage.domain.specialdiseaseroute.SpecialDiseaseRoute;
import com.xinelu.manage.vo.department.DepartmentVO;
import com.xinelu.manage.vo.specialdiseaseroute.SpecialDiseaseRouteVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -84,4 +85,13 @@ public interface SpecialDiseaseRouteMapper {
* @return 专病路径信息
*/
SpecialDiseaseRouteVO selectSpecialDiseaseRouteAndTriggerById(Long id);
/**
* 查询未审核节点状态
*
* @param routeId 路径信息
* @param routeCheckStatus 节点状态
* @return int
*/
int selectRouteCheckStatus(@Param("routeId") Long routeId, @Param("routeCheckStatus") String routeCheckStatus);
}

View File

@ -0,0 +1,73 @@
package com.xinelu.manage.mapper.specialdiseaseroutepackage;
import com.xinelu.manage.domain.specialdiseaseroutepackage.SpecialDiseaseRoutePackage;
import java.util.List;
/**
* 专病路径-服务包关系多对多关系Mapper接口
*
* @author xinelu
* @date 2024-04-09
*/
public interface SpecialDiseaseRoutePackageMapper {
/**
* 查询专病路径-服务包关系多对多关系
*
* @param id 专病路径-服务包关系多对多关系主键
* @return 专病路径-服务包关系多对多关系
*/
SpecialDiseaseRoutePackage selectSpecialDiseaseRoutePackageById(Long id);
/**
* 查询专病路径-服务包关系多对多关系列表
*
* @param specialDiseaseRoutePackage 专病路径-服务包关系多对多关系
* @return 专病路径-服务包关系多对多关系集合
*/
List<SpecialDiseaseRoutePackage> selectSpecialDiseaseRoutePackageList(SpecialDiseaseRoutePackage specialDiseaseRoutePackage);
/**
* 新增专病路径-服务包关系多对多关系
*
* @param specialDiseaseRoutePackage 专病路径-服务包关系多对多关系
* @return 结果
*/
int insertSpecialDiseaseRoutePackage(SpecialDiseaseRoutePackage specialDiseaseRoutePackage);
/**
* 修改专病路径-服务包关系多对多关系
*
* @param specialDiseaseRoutePackage 专病路径-服务包关系多对多关系
* @return 结果
*/
int updateSpecialDiseaseRoutePackage(SpecialDiseaseRoutePackage specialDiseaseRoutePackage);
/**
* 删除专病路径-服务包关系多对多关系
*
* @param id 专病路径-服务包关系多对多关系主键
* @return 结果
*/
int deleteSpecialDiseaseRoutePackageById(Long id);
/**
* 批量删除专病路径-服务包关系多对多关系
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteSpecialDiseaseRoutePackageByIds(Long[] ids);
int insertSpecialDiseaseRoutePackageList(List<SpecialDiseaseRoutePackage> specialDiseaseRoutePackageList);
/**
* 删除专病路径-服务包关系多对多关系
*
* @param routeId 专病路径-服务包关系多对多关系主键
* @return 结果
*/
int deleteSpecialDiseaseRoutePackageByRouteId(Long routeId);
}

View File

@ -0,0 +1,81 @@
package com.xinelu.manage.mapper.subscribemessagerecord;
import com.xinelu.manage.domain.subscribemessagerecord.SubscribeMessageRecord;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 微信小程序订阅消息记录Mapper接口
*
* @author xinelu
* @date 2024-03-19
*/
public interface SubscribeMessageRecordMapper {
/**
* 查询微信小程序订阅消息记录
*
* @param id 微信小程序订阅消息记录主键
* @return 微信小程序订阅消息记录
*/
SubscribeMessageRecord selectSubscribeMessageRecordById(Long id);
/**
* 查询微信小程序订阅消息记录列表
*
* @param subscribeMessageRecord 微信小程序订阅消息记录
* @return 微信小程序订阅消息记录集合
*/
List<SubscribeMessageRecord> selectSubscribeMessageRecordList(SubscribeMessageRecord subscribeMessageRecord);
/**
* 新增微信小程序订阅消息记录
*
* @param subscribeMessageRecord 微信小程序订阅消息记录
* @return 结果
*/
int insertSubscribeMessageRecord(SubscribeMessageRecord subscribeMessageRecord);
/**
* 修改微信小程序订阅消息记录
*
* @param subscribeMessageRecord 微信小程序订阅消息记录
* @return 结果
*/
int updateSubscribeMessageRecord(SubscribeMessageRecord subscribeMessageRecord);
/**
* 删除微信小程序订阅消息记录
*
* @param id 微信小程序订阅消息记录主键
* @return 结果
*/
int deleteSubscribeMessageRecordById(Long id);
/**
* 批量删除微信小程序订阅消息记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteSubscribeMessageRecordByIds(Long[] ids);
/**
* 批量新增微信小程序订阅消息记录
*
* @param subscribeMessageRecordList 新增微信小程序订阅消息记录
* @return int
**/
int insertSubscribeMessageRecordList(List<SubscribeMessageRecord> subscribeMessageRecordList);
/**
* 根据会员openid与templateId修改微信小程序订阅消息记录
*
* @param openId 微信openid
* @param templateId 模板id
* @param subscribeStatus 订阅状态
* @param patientId 患者id
* @return int
**/
int updateSubscribeMessageTemplateId(@Param("openId") String openId, @Param("templateId") String templateId, @Param("subscribeStatus") String subscribeStatus, @Param("patientId") Long patientId);
}

View File

@ -0,0 +1,69 @@
package com.xinelu.manage.mapper.subscribemessagesendrecord;
import com.xinelu.manage.domain.subscribemessagesendrecord.SubscribeMessageSendRecord;
import java.util.List;
/**
* 微信小程序订阅消息发送结果记录Mapper接口
*
* @author xinelu
* @date 2024-03-19
*/
public interface SubscribeMessageSendRecordMapper {
/**
* 查询微信小程序订阅消息发送结果记录
*
* @param id 微信小程序订阅消息发送结果记录主键
* @return 微信小程序订阅消息发送结果记录
*/
SubscribeMessageSendRecord selectSubscribeMessageSendRecordById(Long id);
/**
* 查询微信小程序订阅消息发送结果记录列表
*
* @param subscribeMessageSendRecord 微信小程序订阅消息发送结果记录
* @return 微信小程序订阅消息发送结果记录集合
*/
List<SubscribeMessageSendRecord> selectSubscribeMessageSendRecordList(SubscribeMessageSendRecord subscribeMessageSendRecord);
/**
* 新增微信小程序订阅消息发送结果记录
*
* @param subscribeMessageSendRecord 微信小程序订阅消息发送结果记录
* @return 结果
*/
int insertSubscribeMessageSendRecord(SubscribeMessageSendRecord subscribeMessageSendRecord);
/**
* 修改微信小程序订阅消息发送结果记录
*
* @param subscribeMessageSendRecord 微信小程序订阅消息发送结果记录
* @return 结果
*/
int updateSubscribeMessageSendRecord(SubscribeMessageSendRecord subscribeMessageSendRecord);
/**
* 删除微信小程序订阅消息发送结果记录
*
* @param id 微信小程序订阅消息发送结果记录主键
* @return 结果
*/
int deleteSubscribeMessageSendRecordById(Long id);
/**
* 批量删除微信小程序订阅消息发送结果记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteSubscribeMessageSendRecordByIds(Long[] ids);
/**
* 批量新增微信小程序订阅消息发送记录
*
* @param subscribeMessageSendRecordList 微信小程序订阅发送消息记录
* @return int
**/
int insertSubscribeMessageSendRecordList(List<SubscribeMessageSendRecord> subscribeMessageSendRecordList);
}

View File

@ -1,9 +1,7 @@
package com.xinelu.manage.service.agencycategory.impl;
import com.xinelu.common.utils.DateUtils;
import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.common.utils.StringUtils;
import com.xinelu.common.utils.codes.GenerateSystemCodeUtil;
import com.xinelu.manage.domain.agencycategory.AgencyCategory;
import com.xinelu.manage.mapper.agencycategory.AgencyCategoryMapper;
import com.xinelu.manage.service.agencycategory.IAgencyCategoryService;
@ -61,8 +59,9 @@ public class AgencyCategoryServiceImpl implements IAgencyCategoryService {
*/
@Override
public int insertAgencyCategory(AgencyCategory agencyCategory) {
if (Objects.isNull(agencyCategory.getCategoryLevel()) || agencyCategory.getCategoryLevel().equals(1)) {
agencyCategory.setParentCategoryId(null);
if (Objects.nonNull(agencyCategory.getParentCategoryId())) {
AgencyCategory parentAgencyCategory = agencyCategoryMapper.selectAgencyCategoryById(agencyCategory.getParentCategoryId());
agencyCategory.setCategoryLevel((parentAgencyCategory.getCategoryLevel() == null ? 0 : parentAgencyCategory.getCategoryLevel()) + 1);
}
agencyCategory.setCreateTime(LocalDateTime.now());
agencyCategory.setCreateBy(SecurityUtils.getUsername());

View File

@ -0,0 +1,61 @@
package com.xinelu.manage.service.officialaccountsubscribeevent;
import com.xinelu.manage.domain.officialaccountsubscribeevent.OfficialAccountSubscribeEvent;
import java.util.List;
/**
* 微信公众号关注和取消事件信息Service接口
*
* @author xinelu
* @date 2024-03-26
*/
public interface IOfficialAccountSubscribeEventService {
/**
* 查询微信公众号关注和取消事件信息
*
* @param id 微信公众号关注和取消事件信息主键
* @return 微信公众号关注和取消事件信息
*/
OfficialAccountSubscribeEvent selectOfficialAccountSubscribeEventById(Long id);
/**
* 查询微信公众号关注和取消事件信息列表
*
* @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
* @return 微信公众号关注和取消事件信息集合
*/
List<OfficialAccountSubscribeEvent> selectOfficialAccountSubscribeEventList(OfficialAccountSubscribeEvent officialAccountSubscribeEvent);
/**
* 新增微信公众号关注和取消事件信息
*
* @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
* @return 结果
*/
int insertOfficialAccountSubscribeEvent(OfficialAccountSubscribeEvent officialAccountSubscribeEvent);
/**
* 修改微信公众号关注和取消事件信息
*
* @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
* @return 结果
*/
int updateOfficialAccountSubscribeEvent(OfficialAccountSubscribeEvent officialAccountSubscribeEvent);
/**
* 批量删除微信公众号关注和取消事件信息
*
* @param ids 需要删除的微信公众号关注和取消事件信息主键集合
* @return 结果
*/
int deleteOfficialAccountSubscribeEventByIds(Long[] ids);
/**
* 删除微信公众号关注和取消事件信息信息
*
* @param id 微信公众号关注和取消事件信息主键
* @return 结果
*/
int deleteOfficialAccountSubscribeEventById(Long id);
}

View File

@ -0,0 +1,91 @@
package com.xinelu.manage.service.officialaccountsubscribeevent.impl;
import com.xinelu.manage.domain.officialaccountsubscribeevent.OfficialAccountSubscribeEvent;
import com.xinelu.manage.mapper.officialaccountsubscribeevent.OfficialAccountSubscribeEventMapper;
import com.xinelu.manage.service.officialaccountsubscribeevent.IOfficialAccountSubscribeEventService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
/**
* 微信公众号关注和取消事件信息Service业务层处理
*
* @author xinelu
* @date 2024-03-26
*/
@Service
public class OfficialAccountSubscribeEventServiceImpl implements IOfficialAccountSubscribeEventService {
@Resource
private OfficialAccountSubscribeEventMapper officialAccountSubscribeEventMapper;
/**
* 查询微信公众号关注和取消事件信息
*
* @param id 微信公众号关注和取消事件信息主键
* @return 微信公众号关注和取消事件信息
*/
@Override
public OfficialAccountSubscribeEvent selectOfficialAccountSubscribeEventById(Long id) {
return officialAccountSubscribeEventMapper.selectOfficialAccountSubscribeEventById(id);
}
/**
* 查询微信公众号关注和取消事件信息列表
*
* @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
* @return 微信公众号关注和取消事件信息
*/
@Override
public List<OfficialAccountSubscribeEvent> selectOfficialAccountSubscribeEventList(OfficialAccountSubscribeEvent officialAccountSubscribeEvent) {
return officialAccountSubscribeEventMapper.selectOfficialAccountSubscribeEventList(officialAccountSubscribeEvent);
}
/**
* 新增微信公众号关注和取消事件信息
*
* @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
* @return 结果
*/
@Override
public int insertOfficialAccountSubscribeEvent(OfficialAccountSubscribeEvent officialAccountSubscribeEvent) {
officialAccountSubscribeEvent.setCreateTime(LocalDateTime.now());
return officialAccountSubscribeEventMapper.insertOfficialAccountSubscribeEvent(officialAccountSubscribeEvent);
}
/**
* 修改微信公众号关注和取消事件信息
*
* @param officialAccountSubscribeEvent 微信公众号关注和取消事件信息
* @return 结果
*/
@Override
public int updateOfficialAccountSubscribeEvent(OfficialAccountSubscribeEvent officialAccountSubscribeEvent) {
officialAccountSubscribeEvent.setUpdateTime(LocalDateTime.now());
return officialAccountSubscribeEventMapper.updateOfficialAccountSubscribeEvent(officialAccountSubscribeEvent);
}
/**
* 批量删除微信公众号关注和取消事件信息
*
* @param ids 需要删除的微信公众号关注和取消事件信息主键
* @return 结果
*/
@Override
public int deleteOfficialAccountSubscribeEventByIds(Long[] ids) {
return officialAccountSubscribeEventMapper.deleteOfficialAccountSubscribeEventByIds(ids);
}
/**
* 删除微信公众号关注和取消事件信息信息
*
* @param id 微信公众号关注和取消事件信息主键
* @return 结果
*/
@Override
public int deleteOfficialAccountSubscribeEventById(Long id) {
return officialAccountSubscribeEventMapper.deleteOfficialAccountSubscribeEventById(id);
}
}

View File

@ -0,0 +1,61 @@
package com.xinelu.manage.service.officialaccounttemplateevent;
import com.xinelu.manage.domain.officialaccounttemplateevent.OfficialAccountTemplateEvent;
import java.util.List;
/**
* 微信公众号模板信息事件推送Service接口
*
* @author xinelu
* @date 2024-03-25
*/
public interface IOfficialAccountTemplateEventService {
/**
* 查询微信公众号模板信息事件推送
*
* @param id 微信公众号模板信息事件推送主键
* @return 微信公众号模板信息事件推送
*/
OfficialAccountTemplateEvent selectOfficialAccountTemplateEventById(Long id);
/**
* 查询微信公众号模板信息事件推送列表
*
* @param officialAccountTemplateEvent 微信公众号模板信息事件推送
* @return 微信公众号模板信息事件推送集合
*/
List<OfficialAccountTemplateEvent> selectOfficialAccountTemplateEventList(OfficialAccountTemplateEvent officialAccountTemplateEvent);
/**
* 新增微信公众号模板信息事件推送
*
* @param officialAccountTemplateEvent 微信公众号模板信息事件推送
* @return 结果
*/
int insertOfficialAccountTemplateEvent(OfficialAccountTemplateEvent officialAccountTemplateEvent);
/**
* 修改微信公众号模板信息事件推送
*
* @param officialAccountTemplateEvent 微信公众号模板信息事件推送
* @return 结果
*/
int updateOfficialAccountTemplateEvent(OfficialAccountTemplateEvent officialAccountTemplateEvent);
/**
* 批量删除微信公众号模板信息事件推送
*
* @param ids 需要删除的微信公众号模板信息事件推送主键集合
* @return 结果
*/
int deleteOfficialAccountTemplateEventByIds(Long[] ids);
/**
* 删除微信公众号模板信息事件推送信息
*
* @param id 微信公众号模板信息事件推送主键
* @return 结果
*/
int deleteOfficialAccountTemplateEventById(Long id);
}

View File

@ -0,0 +1,90 @@
package com.xinelu.manage.service.officialaccounttemplateevent.impl;
import com.xinelu.manage.domain.officialaccounttemplateevent.OfficialAccountTemplateEvent;
import com.xinelu.manage.mapper.officialaccounttemplateevent.OfficialAccountTemplateEventMapper;
import com.xinelu.manage.service.officialaccounttemplateevent.IOfficialAccountTemplateEventService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
/**
* 微信公众号模板信息事件推送Service业务层处理
*
* @author xinelu
* @date 2024-03-25
*/
@Service
public class OfficialAccountTemplateEventServiceImpl implements IOfficialAccountTemplateEventService {
@Resource
private OfficialAccountTemplateEventMapper officialAccountTemplateEventMapper;
/**
* 查询微信公众号模板信息事件推送
*
* @param id 微信公众号模板信息事件推送主键
* @return 微信公众号模板信息事件推送
*/
@Override
public OfficialAccountTemplateEvent selectOfficialAccountTemplateEventById(Long id) {
return officialAccountTemplateEventMapper.selectOfficialAccountTemplateEventById(id);
}
/**
* 查询微信公众号模板信息事件推送列表
*
* @param officialAccountTemplateEvent 微信公众号模板信息事件推送
* @return 微信公众号模板信息事件推送
*/
@Override
public List<OfficialAccountTemplateEvent> selectOfficialAccountTemplateEventList(OfficialAccountTemplateEvent officialAccountTemplateEvent) {
return officialAccountTemplateEventMapper.selectOfficialAccountTemplateEventList(officialAccountTemplateEvent);
}
/**
* 新增微信公众号模板信息事件推送
*
* @param officialAccountTemplateEvent 微信公众号模板信息事件推送
* @return 结果
*/
@Override
public int insertOfficialAccountTemplateEvent(OfficialAccountTemplateEvent officialAccountTemplateEvent) {
officialAccountTemplateEvent.setCreateTime(LocalDateTime.now());
return officialAccountTemplateEventMapper.insertOfficialAccountTemplateEvent(officialAccountTemplateEvent);
}
/**
* 修改微信公众号模板信息事件推送
*
* @param officialAccountTemplateEvent 微信公众号模板信息事件推送
* @return 结果
*/
@Override
public int updateOfficialAccountTemplateEvent(OfficialAccountTemplateEvent officialAccountTemplateEvent) {
officialAccountTemplateEvent.setUpdateTime(LocalDateTime.now());
return officialAccountTemplateEventMapper.updateOfficialAccountTemplateEvent(officialAccountTemplateEvent);
}
/**
* 批量删除微信公众号模板信息事件推送
*
* @param ids 需要删除的微信公众号模板信息事件推送主键
* @return 结果
*/
@Override
public int deleteOfficialAccountTemplateEventByIds(Long[] ids) {
return officialAccountTemplateEventMapper.deleteOfficialAccountTemplateEventByIds(ids);
}
/**
* 删除微信公众号模板信息事件推送信息
*
* @param id 微信公众号模板信息事件推送主键
* @return 结果
*/
@Override
public int deleteOfficialAccountTemplateEventById(Long id) {
return officialAccountTemplateEventMapper.deleteOfficialAccountTemplateEventById(id);
}
}

View File

@ -1,17 +1,22 @@
package com.xinelu.manage.service.patienttaskexecuterecord.impl;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.enums.TaskContentEnum;
import com.xinelu.common.utils.AgeUtil;
import com.xinelu.manage.domain.patienttaskexecuterecord.PatientTaskExecuteRecord;
import com.xinelu.manage.mapper.patientquestionsubmitresult.PatientQuestionSubmitResultMapper;
import com.xinelu.manage.mapper.patienttaskexecuterecord.PatientTaskExecuteRecordMapper;
import com.xinelu.manage.service.patienttaskexecuterecord.IPatientTaskExecuteRecordService;
import com.xinelu.manage.service.propagandainfo.IPropagandaInfoService;
import com.xinelu.manage.vo.patientquestionsubmitresult.PatientQuestionSubmitResultVO;
import com.xinelu.manage.vo.patienttaskexecuterecord.PatientTaskExecuteRecordVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
/**
* 患者管理任务执行记录Service业务层处理
@ -25,6 +30,8 @@ public class PatientTaskExecuteRecordServiceImpl implements IPatientTaskExecuteR
private PatientTaskExecuteRecordMapper patientTaskExecuteRecordMapper;
@Resource
private PatientQuestionSubmitResultMapper submitResultMapper;
@Resource
private IPropagandaInfoService iPropagandaInfoService;
/**
* 查询患者管理任务执行记录
@ -115,6 +122,29 @@ public class PatientTaskExecuteRecordServiceImpl implements IPatientTaskExecuteR
*/
@Override
public AjaxResult selectPatientQuestionSubmit(Long taskExecuteRecordId) {
return AjaxResult.success(submitResultMapper.selectResultByTaskExecuteRecordId(taskExecuteRecordId));
//判断任务类型
PatientTaskExecuteRecord patientTaskExecuteRecord = patientTaskExecuteRecordMapper.selectPatientTaskExecuteRecordById(taskExecuteRecordId);
if (Objects.isNull(patientTaskExecuteRecord) || StringUtils.isBlank(patientTaskExecuteRecord.getTaskContent())) {
return AjaxResult.success();
}
//如果是人工随访或问卷表
if (TaskContentEnum.ARTIFICIAL_FOLLOW_UP.getInfo().equals(patientTaskExecuteRecord.getTaskContent()) || TaskContentEnum.QUESTIONNAIRE_SCALE.getInfo().equals(patientTaskExecuteRecord.getTaskContent())) {
PatientQuestionSubmitResultVO patientQuestionSubmitResult = submitResultMapper.selectResultByTaskExecuteRecordId(taskExecuteRecordId);
patientQuestionSubmitResult.setTaskContent(patientTaskExecuteRecord.getTaskContent());
return AjaxResult.success(patientQuestionSubmitResult);
}
//如果是电话外呼
if (TaskContentEnum.PHONE_OUTBOUND.getInfo().equals(patientTaskExecuteRecord.getTaskContent())) {
return AjaxResult.success();
}
//如果是宣教文章
if (TaskContentEnum.PROPAGANDA_ARTICLE.getInfo().equals(patientTaskExecuteRecord.getTaskContent())) {
return AjaxResult.success();
}
if (TaskContentEnum.TEXT_REMIND.getInfo().equals(patientTaskExecuteRecord.getTaskContent())) {
return AjaxResult.success();
}
return AjaxResult.success();
}
}

View File

@ -75,5 +75,5 @@ public interface IQuestionInfoService {
* @param departmentName 科室名称
* @return AjaxResult
*/
AjaxResult departmentQuestionCount(String departmentName);
AjaxResult departmentQuestionCount(String departmentName, String questionnaireStatus);
}

View File

@ -181,7 +181,9 @@ public class QuestionInfoServiceImpl implements IQuestionInfoService {
saveQuestionSubject.setCreateTime(LocalDateTime.now());
saveQuestionSubject.setCreateBy(SecurityUtils.getUsername());
questionSubjects.add(saveQuestionSubject);
questionSubjectOptions.addAll(questionSubject.getQuestionSubjectOptionList());
if (CollectionUtils.isNotEmpty(questionSubject.getQuestionSubjectOptionList())) {
questionSubjectOptions.addAll(questionSubject.getQuestionSubjectOptionList());
}
}
int questionSubjectCount = questionSubjectMapper.insertQuestionSubjectList(questionSubjects);
if (questionSubjectCount <= 0) {
@ -288,12 +290,12 @@ public class QuestionInfoServiceImpl implements IQuestionInfoService {
* @return AjaxResult
*/
@Override
public AjaxResult departmentQuestionCount(String departmentName) {
public AjaxResult departmentQuestionCount(String departmentName, String questionnaireStatus) {
DepartmentVO departmentVO = new DepartmentVO();
List<DepartmentVO> department = new ArrayList<>();
departmentVO.setDepartmentName("全部");
departmentVO.setCountNum(0);
List<DepartmentVO> departmentVOS = questionInfoMapper.departmentQuestionByDepartmentName(departmentName);
List<DepartmentVO> departmentVOS = questionInfoMapper.departmentQuestionByDepartmentName(departmentName, questionnaireStatus);
if (CollectionUtils.isNotEmpty(departmentVOS)) {
Integer result = departmentVOS.stream().mapToInt(DepartmentVO::getCountNum).sum();
departmentVO.setCountNum(result);

View File

@ -208,11 +208,16 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
// 新增患者管理任务执行记录
insertPatientTaskExecuteRecord(dto, routeHandlePerson, time);
} else {
// 如果任务类型不是电话外呼(人工随访问卷量表)新增问卷提交结果表(题目选项表)更新节点任务表新增患者管理任务执行记录
// 如果任务类型不是电话外呼,更新节点任务表,新增患者管理任务执行记录,新增问卷提交结果表题目表选项表
// 更新节点任务表
updateSignPatientManageRouteNode(dto, routeHandlePerson, time);
// 新增患者管理任务执行记录
Long taskExecuteRecordId = insertPatientTaskExecuteRecord(dto, routeHandlePerson, time);
PatientQuestionSubmitResult patientQuestionSubmitResult = new PatientQuestionSubmitResult();
BeanUtils.copyBeanProp(patientQuestionSubmitResult, dto);
patientQuestionSubmitResult.setCreateBy(routeHandlePerson);
patientQuestionSubmitResult.setCreateTime(time);
patientQuestionSubmitResult.setTaskExecuteRecordId(taskExecuteRecordId);
// 新增患者问卷提交结果
if (patientQuestionSubmitResultMapper.insertPatientQuestionSubmitResult(patientQuestionSubmitResult) <= 0) {
throw new ServiceException("新增患者问卷提交结果失败");
@ -255,11 +260,6 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
if (patientQuestionOptionResultMapper.saveQuestionOptionList(saveQuestionSubjectOptions) <= 0) {
throw new ServiceException("新增患者问卷题目选项提交结果失败");
}
// 更新节点任务表
updateSignPatientManageRouteNode(dto, routeHandlePerson, time);
// 新增患者管理任务执行记录
insertPatientTaskExecuteRecord(dto, routeHandlePerson, time);
}
return AjaxResult.success();
}
@ -267,7 +267,7 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
/**
* 新增患者管理任务执行记录
*/
private void insertPatientTaskExecuteRecord(PatientQuestionSubmitResultDTO dto, String routeHandlePerson, LocalDateTime time) {
private Long insertPatientTaskExecuteRecord(PatientQuestionSubmitResultDTO dto, String routeHandlePerson, LocalDateTime time) {
PatientTaskExecuteRecord patientTaskExecuteRecord = new PatientTaskExecuteRecord();
BeanUtils.copyProperties(dto, patientTaskExecuteRecord);
patientTaskExecuteRecord.setTaskContent(dto.getTaskType());
@ -276,11 +276,12 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
patientTaskExecuteRecord.setExecuteType(TaskCreateTypeConstant.MANUAL_CREATE);
patientTaskExecuteRecord.setCreateBy(routeHandlePerson);
patientTaskExecuteRecord.setCreateTime(time);
if (patientTaskExecuteRecordMapper.insertPatientTaskExecuteRecord(patientTaskExecuteRecord) <= 0) {
if (patientTaskExecuteRecordMapper.insertPatientTaskExecuteRecord(patientTaskExecuteRecord) > 0) {
return patientTaskExecuteRecord.getId();
} else {
throw new ServiceException("新增患者管理任务记录失败");
}
}
/**
* 更新节点任务表
*/
@ -290,8 +291,8 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
signPatientManageRouteNode.setRouteHandleRemark(dto.getRouteHandleRemark());
signPatientManageRouteNode.setRouteHandleId(dto.getRouteHandleId());
signPatientManageRouteNode.setRouteHandlePerson(routeHandlePerson);
signPatientManageRouteNode.setCreateBy(routeHandlePerson);
signPatientManageRouteNode.setCreateTime(time);
signPatientManageRouteNode.setUpdateBy(routeHandlePerson);
signPatientManageRouteNode.setUpdateTime(time);
// 更新节点任务表
if (signPatientManageRouteNodeMapper.updateSignPatientManageRouteNode(signPatientManageRouteNode) <= 0) {
throw new ServiceException("更新节点任务表失败");

View File

@ -68,4 +68,12 @@ public interface ISpecialDiseaseNodeService {
* @return AjaxResult
*/
AjaxResult selectSpecialDisease(Long specialDiseaseRouteId);
/**
* 修改节点信息状态
*
* @param specialDiseaseNode 节点信息
* @return AjaxResult
*/
AjaxResult updateRouteCheckStatus(SpecialDiseaseNode specialDiseaseNode);
}

View File

@ -6,11 +6,10 @@ import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.common.utils.bean.BeanUtils;
import com.xinelu.manage.domain.specialdiseasenode.SpecialDiseaseNode;
import com.xinelu.manage.domain.specialdiseaseroute.SpecialDiseaseRoute;
import com.xinelu.manage.domain.specialdiseasetriggercondition.SpecialDiseaseTriggerCondition;
import com.xinelu.manage.mapper.specialdiseasenode.SpecialDiseaseNodeMapper;
import com.xinelu.manage.mapper.specialdiseaseroute.SpecialDiseaseRouteMapper;
import com.xinelu.manage.mapper.specialdiseasetriggercondition.SpecialDiseaseTriggerConditionMapper;
import com.xinelu.manage.service.specialdiseasenode.ISpecialDiseaseNodeService;
import com.xinelu.manage.vo.specialdiseasenode.SpecialDiseaseNodeVO;
import com.xinelu.manage.vo.specialdiseaseroute.SpecialDiseaseRouteVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -18,8 +17,8 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* 专病路径-管理节点信息Service业务层处理
@ -34,8 +33,6 @@ public class SpecialDiseaseNodeServiceImpl implements ISpecialDiseaseNodeService
private SpecialDiseaseNodeMapper specialDiseaseNodeMapper;
@Resource
private SpecialDiseaseRouteMapper specialDiseaseRouteMapper;
@Resource
private SpecialDiseaseTriggerConditionMapper triggerConditionMapper;
/**
@ -86,17 +83,6 @@ public class SpecialDiseaseNodeServiceImpl implements ISpecialDiseaseNodeService
if (insertNodeCount < 0) {
throw new ServiceException("新增专病路径管理节点信息失败");
}
List<SpecialDiseaseTriggerCondition> specialDiseaseTriggerConditions = new ArrayList<>();
for (SpecialDiseaseTriggerCondition triggerCondition : specialDiseaseNode.getTriggerConditionList()) {
triggerCondition.setRouteId(specialDiseaseRoute.getId());
triggerCondition.setCreateTime(LocalDateTime.now());
triggerCondition.setCreateBy(SecurityUtils.getUsername());
specialDiseaseTriggerConditions.add(triggerCondition);
}
int triggerConditionCount = triggerConditionMapper.insertTriggerConditionList(specialDiseaseTriggerConditions);
if (triggerConditionCount < 0) {
throw new ServiceException("新增专病路径管理节点信息失败");
}
return AjaxResult.success();
}
@ -113,18 +99,20 @@ public class SpecialDiseaseNodeServiceImpl implements ISpecialDiseaseNodeService
BeanUtils.copyBeanProp(specialDiseaseRoute, specialDiseaseNode);
specialDiseaseRoute.setUpdateTime(LocalDateTime.now());
specialDiseaseRoute.setUpdateBy(SecurityUtils.getUsername());
specialDiseaseRoute.setId(specialDiseaseNode.getSpecialDiseaseRouteId());
int updateRouteCount = specialDiseaseRouteMapper.updateSpecialDiseaseRoute(specialDiseaseRoute);
if (updateRouteCount < 0) {
log.info("修改专病路径失败");
throw new ServiceException("修改专病路径管理节点信息失败");
}
int deleteCount = specialDiseaseNodeMapper.deleteSpecialDiseaseNodeByRouteId(specialDiseaseNode.getId());
int deleteCount = specialDiseaseNodeMapper.deleteSpecialDiseaseNodeByRouteId(specialDiseaseRoute.getId());
if (deleteCount < 0) {
log.info("删除管理节点信息失败");
throw new ServiceException("修改专病路径管理节点信息失败");
}
for (SpecialDiseaseNode diseaseNode : specialDiseaseNode.getSpecialDiseaseNodeList()) {
for (SpecialDiseaseNodeVO diseaseNode : specialDiseaseNode.getSpecialDiseaseNodeList()) {
diseaseNode.setRouteId(specialDiseaseRoute.getId());
diseaseNode.setRouteName(specialDiseaseNode.getRouteName());
diseaseNode.setUpdateTime(LocalDateTime.now());
diseaseNode.setUpdateBy(SecurityUtils.getUsername());
}
@ -133,22 +121,6 @@ public class SpecialDiseaseNodeServiceImpl implements ISpecialDiseaseNodeService
log.info("新增管理节点信息失败");
throw new ServiceException("修改专病路径管理节点信息失败");
}
int deleteCondition = triggerConditionMapper.deleteSpecialDiseaseTriggerConditionByRouteId(specialDiseaseRoute.getId());
if (deleteCondition < 0) {
log.info("删除管理节点信息失败");
throw new ServiceException("修改专病路径管理节点信息失败");
}
List<SpecialDiseaseTriggerCondition> specialDiseaseTriggerConditions = new ArrayList<>();
for (SpecialDiseaseTriggerCondition triggerCondition : specialDiseaseNode.getTriggerConditionList()) {
triggerCondition.setRouteId(specialDiseaseRoute.getId());
triggerCondition.setCreateTime(LocalDateTime.now());
triggerCondition.setCreateBy(SecurityUtils.getUsername());
specialDiseaseTriggerConditions.add(triggerCondition);
}
int triggerConditionCount = triggerConditionMapper.insertTriggerConditionList(specialDiseaseTriggerConditions);
if (triggerConditionCount < 0) {
throw new ServiceException("修改专病路径管理节点信息失败");
}
return AjaxResult.success();
}
@ -184,4 +156,19 @@ public class SpecialDiseaseNodeServiceImpl implements ISpecialDiseaseNodeService
public AjaxResult selectSpecialDisease(Long specialDiseaseRouteId) {
return AjaxResult.success(specialDiseaseNodeMapper.selectSpecialDiseaseByRouteId(specialDiseaseRouteId));
}
/**
* 修改节点信息状态
*
* @param specialDiseaseNode 节点信息
* @return AjaxResult
*/
@Override
public AjaxResult updateRouteCheckStatus(SpecialDiseaseNode specialDiseaseNode) {
if (Objects.isNull(specialDiseaseNode) || Objects.isNull(specialDiseaseNode.getId())) {
return AjaxResult.error("请选择需要审核的信息!");
}
specialDiseaseNode.setRouteCheckDate(LocalDateTime.now());
return AjaxResult.success(specialDiseaseNodeMapper.updateSpecialDiseaseNode(specialDiseaseNode));
}
}

View File

@ -35,7 +35,7 @@ public interface ISpecialDiseaseRouteService {
* @param specialDiseaseRoute 专病路径信息
* @return 结果
*/
int insertSpecialDiseaseRoute(SpecialDiseaseRoute specialDiseaseRoute);
AjaxResult insertSpecialDiseaseRoute(SpecialDiseaseRouteVO specialDiseaseRoute);
/**
* 修改专病路径信息
@ -43,7 +43,7 @@ public interface ISpecialDiseaseRouteService {
* @param specialDiseaseRoute 专病路径信息
* @return 结果
*/
int updateSpecialDiseaseRoute(SpecialDiseaseRoute specialDiseaseRoute);
AjaxResult updateSpecialDiseaseRoute(SpecialDiseaseRouteVO specialDiseaseRoute);
/**
* 批量删除专病路径信息
@ -68,4 +68,12 @@ public interface ISpecialDiseaseRouteService {
* @return AjaxResult
*/
AjaxResult departmentRouteCount(String departmentName);
/**
* 专病路径发布
*
* @param specialDiseaseRoute 路径信息
* @return AjaxResult
*/
AjaxResult editReleaseStatus(SpecialDiseaseRoute specialDiseaseRoute);
}

View File

@ -2,17 +2,24 @@ package com.xinelu.manage.service.specialdiseaseroute.impl;
import com.xinelu.common.constant.Constants;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.enums.ReleaseStatusEnum;
import com.xinelu.common.enums.RouteCheckStatusEnum;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.common.utils.bean.BeanUtils;
import com.xinelu.common.utils.codes.GenerateSystemCodeUtil;
import com.xinelu.manage.domain.specialdiseaseroute.SpecialDiseaseRoute;
import com.xinelu.manage.domain.specialdiseaseroutepackage.SpecialDiseaseRoutePackage;
import com.xinelu.manage.mapper.specialdiseasenode.SpecialDiseaseNodeMapper;
import com.xinelu.manage.mapper.specialdiseaseroute.SpecialDiseaseRouteMapper;
import com.xinelu.manage.mapper.specialdiseaseroutepackage.SpecialDiseaseRoutePackageMapper;
import com.xinelu.manage.mapper.specialdiseasetriggercondition.SpecialDiseaseTriggerConditionMapper;
import com.xinelu.manage.service.specialdiseaseroute.ISpecialDiseaseRouteService;
import com.xinelu.manage.vo.department.DepartmentVO;
import com.xinelu.manage.vo.specialdiseaseroute.SpecialDiseaseRouteVO;
import com.xinelu.manage.vo.specialdiseaseroutepackage.SpecialDiseaseRoutePackageVO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -20,6 +27,7 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* 专病路径信息Service业务层处理
@ -37,6 +45,8 @@ public class SpecialDiseaseRouteServiceImpl implements ISpecialDiseaseRouteServi
private SpecialDiseaseTriggerConditionMapper triggerConditionMapper;
@Resource
private GenerateSystemCodeUtil generateSystemCodeUtil;
@Resource
private SpecialDiseaseRoutePackageMapper specialDiseaseRoutePackageMapper;
/**
@ -68,11 +78,31 @@ public class SpecialDiseaseRouteServiceImpl implements ISpecialDiseaseRouteServi
* @return 结果
*/
@Override
public int insertSpecialDiseaseRoute(SpecialDiseaseRoute specialDiseaseRoute) {
public AjaxResult insertSpecialDiseaseRoute(SpecialDiseaseRouteVO specialDiseaseRoute) {
specialDiseaseRoute.setCreateTime(LocalDateTime.now());
specialDiseaseRoute.setCreateBy(SecurityUtils.getUsername());
specialDiseaseRoute.setRouteCode(Constants.ROUTE_CODE + generateSystemCodeUtil.generateSystemCode(Constants.ROUTE_CODE));
return specialDiseaseRouteMapper.insertSpecialDiseaseRoute(specialDiseaseRoute);
int insertRouteCount = specialDiseaseRouteMapper.insertSpecialDiseaseRoute(specialDiseaseRoute);
if (insertRouteCount < 0) {
return AjaxResult.error("新增专病路径信息失败,请联系管理员!");
}
List<SpecialDiseaseRoutePackage> specialDiseaseRoutePackages = new ArrayList<>();
if (CollectionUtils.isNotEmpty(specialDiseaseRoute.getRoutePackageList())) {
for (SpecialDiseaseRoutePackage specialDiseaseRoutePackage : specialDiseaseRoute.getRoutePackageList()) {
SpecialDiseaseRoutePackage routePackage = new SpecialDiseaseRoutePackage();
specialDiseaseRoutePackage.setRouteId(specialDiseaseRoute.getId());
specialDiseaseRoutePackage.setRouteName(specialDiseaseRoute.getRouteName());
specialDiseaseRoutePackage.setCreateTime(LocalDateTime.now());
specialDiseaseRoutePackage.setCreateBy(SecurityUtils.getUsername());
BeanUtils.copyBeanProp(routePackage, specialDiseaseRoutePackage);
specialDiseaseRoutePackages.add(routePackage);
}
int insertRoutePackageCount = specialDiseaseRoutePackageMapper.insertSpecialDiseaseRoutePackageList(specialDiseaseRoutePackages);
if (insertRoutePackageCount < 0) {
return AjaxResult.error("新增专病路径信息失败,请联系管理员!");
}
}
return AjaxResult.success();
}
/**
@ -82,10 +112,34 @@ public class SpecialDiseaseRouteServiceImpl implements ISpecialDiseaseRouteServi
* @return 结果
*/
@Override
public int updateSpecialDiseaseRoute(SpecialDiseaseRoute specialDiseaseRoute) {
public AjaxResult updateSpecialDiseaseRoute(SpecialDiseaseRouteVO specialDiseaseRoute) {
int deleteRoutePackageCount = specialDiseaseRoutePackageMapper.deleteSpecialDiseaseRoutePackageByRouteId(specialDiseaseRoute.getId());
if (deleteRoutePackageCount < 0) {
return AjaxResult.error("修改专病路径信息失败,请联系管理员!");
}
specialDiseaseRoute.setUpdateTime(LocalDateTime.now());
specialDiseaseRoute.setUpdateBy(SecurityUtils.getUsername());
return specialDiseaseRouteMapper.updateSpecialDiseaseRoute(specialDiseaseRoute);
int updateRouteCount = specialDiseaseRouteMapper.updateSpecialDiseaseRoute(specialDiseaseRoute);
if (updateRouteCount < 0) {
return AjaxResult.error("修改专病路径信息失败,请联系管理员!");
}
List<SpecialDiseaseRoutePackage> specialDiseaseRoutePackages = new ArrayList<>();
if (CollectionUtils.isNotEmpty(specialDiseaseRoute.getRoutePackageList())) {
for (SpecialDiseaseRoutePackageVO specialDiseaseRoutePackage : specialDiseaseRoute.getRoutePackageList()) {
SpecialDiseaseRoutePackage routePackage = new SpecialDiseaseRoutePackage();
specialDiseaseRoutePackage.setRouteId(specialDiseaseRoute.getId());
specialDiseaseRoutePackage.setRouteName(specialDiseaseRoute.getRouteName());
specialDiseaseRoutePackage.setUpdateTime(LocalDateTime.now());
specialDiseaseRoutePackage.setUpdateBy(SecurityUtils.getUsername());
BeanUtils.copyBeanProp(routePackage, specialDiseaseRoutePackage);
specialDiseaseRoutePackages.add(routePackage);
}
int insertRoutePackageCount = specialDiseaseRoutePackageMapper.insertSpecialDiseaseRoutePackageList(specialDiseaseRoutePackages);
if (insertRoutePackageCount < 0) {
return AjaxResult.error("修改专病路径信息失败,请联系管理员!");
}
}
return AjaxResult.success();
}
/**
@ -110,15 +164,19 @@ public class SpecialDiseaseRouteServiceImpl implements ISpecialDiseaseRouteServi
public AjaxResult deleteSpecialDiseaseRouteById(Long id) {
int deleteRouteCount = specialDiseaseRouteMapper.deleteSpecialDiseaseRouteById(id);
if (deleteRouteCount < 0) {
throw new ServiceException("删除专病路径管理信息失败");
throw new ServiceException("删除专病路径管理信息失败,请联系管理员!");
}
int deleteNodeCount = specialDiseaseNodeMapper.deleteSpecialDiseaseNodeByRouteId(id);
if (deleteNodeCount < 0) {
throw new ServiceException("删除专病路径管理信息失败");
throw new ServiceException("删除专病路径管理信息失败,请联系管理员!");
}
int deleteTriggerConditionCount = triggerConditionMapper.deleteSpecialDiseaseTriggerConditionByRouteId(id);
if (deleteTriggerConditionCount < 0) {
throw new ServiceException("删除专病路径管理信息失败");
throw new ServiceException("删除专病路径管理信息失败,请联系管理员!");
}
int deleteRoutePackageCount = specialDiseaseRoutePackageMapper.deleteSpecialDiseaseRoutePackageByRouteId(id);
if (deleteRoutePackageCount < 0) {
return AjaxResult.error("删除专病路径管理信息失败,请联系管理员!");
}
return AjaxResult.success();
}
@ -144,4 +202,26 @@ public class SpecialDiseaseRouteServiceImpl implements ISpecialDiseaseRouteServi
}
return AjaxResult.success(department);
}
/**
* 专病路径发布
*
* @param specialDiseaseRoute 路径信息
* @return AjaxResult
*/
@Override
public AjaxResult editReleaseStatus(SpecialDiseaseRoute specialDiseaseRoute) {
if (Objects.isNull(specialDiseaseRoute) || StringUtils.isBlank(specialDiseaseRoute.getReleaseStatus())) {
return AjaxResult.error("请选择需要发布专病路径的信息!");
}
if (ReleaseStatusEnum.PUBLISHED.getInfo().equals(specialDiseaseRoute.getReleaseStatus())) {
int count = specialDiseaseRouteMapper.selectRouteCheckStatus(specialDiseaseRoute.getId(), RouteCheckStatusEnum.AGREE.getInfo());
if (count > 0) {
return AjaxResult.error("该路径存在未审核的节点,请全部审核后发布!");
}
}
specialDiseaseRoute.setUpdateTime(LocalDateTime.now());
specialDiseaseRoute.setUpdateBy(SecurityUtils.getUsername());
return AjaxResult.success(specialDiseaseRouteMapper.updateSpecialDiseaseRoute(specialDiseaseRoute));
}
}

View File

@ -0,0 +1,61 @@
package com.xinelu.manage.service.specialdiseaseroutepackage;
import com.xinelu.manage.domain.specialdiseaseroutepackage.SpecialDiseaseRoutePackage;
import java.util.List;
/**
* 专病路径-服务包关系多对多关系Service接口
*
* @author xinelu
* @date 2024-04-09
*/
public interface ISpecialDiseaseRoutePackageService {
/**
* 查询专病路径-服务包关系多对多关系
*
* @param id 专病路径-服务包关系多对多关系主键
* @return 专病路径-服务包关系多对多关系
*/
SpecialDiseaseRoutePackage selectSpecialDiseaseRoutePackageById(Long id);
/**
* 查询专病路径-服务包关系多对多关系列表
*
* @param specialDiseaseRoutePackage 专病路径-服务包关系多对多关系
* @return 专病路径-服务包关系多对多关系集合
*/
List<SpecialDiseaseRoutePackage> selectSpecialDiseaseRoutePackageList(SpecialDiseaseRoutePackage specialDiseaseRoutePackage);
/**
* 新增专病路径-服务包关系多对多关系
*
* @param specialDiseaseRoutePackage 专病路径-服务包关系多对多关系
* @return 结果
*/
int insertSpecialDiseaseRoutePackage(SpecialDiseaseRoutePackage specialDiseaseRoutePackage);
/**
* 修改专病路径-服务包关系多对多关系
*
* @param specialDiseaseRoutePackage 专病路径-服务包关系多对多关系
* @return 结果
*/
int updateSpecialDiseaseRoutePackage(SpecialDiseaseRoutePackage specialDiseaseRoutePackage);
/**
* 批量删除专病路径-服务包关系多对多关系
*
* @param ids 需要删除的专病路径-服务包关系多对多关系主键集合
* @return 结果
*/
int deleteSpecialDiseaseRoutePackageByIds(Long[] ids);
/**
* 删除专病路径-服务包关系多对多关系信息
*
* @param id 专病路径-服务包关系多对多关系主键
* @return 结果
*/
int deleteSpecialDiseaseRoutePackageById(Long id);
}

View File

@ -0,0 +1,90 @@
package com.xinelu.manage.service.specialdiseaseroutepackage.impl;
import com.xinelu.manage.domain.specialdiseaseroutepackage.SpecialDiseaseRoutePackage;
import com.xinelu.manage.mapper.specialdiseaseroutepackage.SpecialDiseaseRoutePackageMapper;
import com.xinelu.manage.service.specialdiseaseroutepackage.ISpecialDiseaseRoutePackageService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
/**
* 专病路径-服务包关系多对多关系Service业务层处理
*
* @author xinelu
* @date 2024-04-09
*/
@Service
public class SpecialDiseaseRoutePackageServiceImpl implements ISpecialDiseaseRoutePackageService {
@Resource
private SpecialDiseaseRoutePackageMapper specialDiseaseRoutePackageMapper;
/**
* 查询专病路径-服务包关系多对多关系
*
* @param id 专病路径-服务包关系多对多关系主键
* @return 专病路径-服务包关系多对多关系
*/
@Override
public SpecialDiseaseRoutePackage selectSpecialDiseaseRoutePackageById(Long id) {
return specialDiseaseRoutePackageMapper.selectSpecialDiseaseRoutePackageById(id);
}
/**
* 查询专病路径-服务包关系多对多关系列表
*
* @param specialDiseaseRoutePackage 专病路径-服务包关系多对多关系
* @return 专病路径-服务包关系多对多关系
*/
@Override
public List<SpecialDiseaseRoutePackage> selectSpecialDiseaseRoutePackageList(SpecialDiseaseRoutePackage specialDiseaseRoutePackage) {
return specialDiseaseRoutePackageMapper.selectSpecialDiseaseRoutePackageList(specialDiseaseRoutePackage);
}
/**
* 新增专病路径-服务包关系多对多关系
*
* @param specialDiseaseRoutePackage 专病路径-服务包关系多对多关系
* @return 结果
*/
@Override
public int insertSpecialDiseaseRoutePackage(SpecialDiseaseRoutePackage specialDiseaseRoutePackage) {
specialDiseaseRoutePackage.setCreateTime(LocalDateTime.now());
return specialDiseaseRoutePackageMapper.insertSpecialDiseaseRoutePackage(specialDiseaseRoutePackage);
}
/**
* 修改专病路径-服务包关系多对多关系
*
* @param specialDiseaseRoutePackage 专病路径-服务包关系多对多关系
* @return 结果
*/
@Override
public int updateSpecialDiseaseRoutePackage(SpecialDiseaseRoutePackage specialDiseaseRoutePackage) {
specialDiseaseRoutePackage.setUpdateTime(LocalDateTime.now());
return specialDiseaseRoutePackageMapper.updateSpecialDiseaseRoutePackage(specialDiseaseRoutePackage);
}
/**
* 批量删除专病路径-服务包关系多对多关系
*
* @param ids 需要删除的专病路径-服务包关系多对多关系主键
* @return 结果
*/
@Override
public int deleteSpecialDiseaseRoutePackageByIds(Long[] ids) {
return specialDiseaseRoutePackageMapper.deleteSpecialDiseaseRoutePackageByIds(ids);
}
/**
* 删除专病路径-服务包关系多对多关系信息
*
* @param id 专病路径-服务包关系多对多关系主键
* @return 结果
*/
@Override
public int deleteSpecialDiseaseRoutePackageById(Long id) {
return specialDiseaseRoutePackageMapper.deleteSpecialDiseaseRoutePackageById(id);
}
}

View File

@ -0,0 +1,61 @@
package com.xinelu.manage.service.subscribemessagerecord;
import com.xinelu.manage.domain.subscribemessagerecord.SubscribeMessageRecord;
import java.util.List;
/**
* 微信小程序订阅消息记录Service接口
*
* @author xinelu
* @date 2024-03-19
*/
public interface ISubscribeMessageRecordService {
/**
* 查询微信小程序订阅消息记录
*
* @param id 微信小程序订阅消息记录主键
* @return 微信小程序订阅消息记录
*/
SubscribeMessageRecord selectSubscribeMessageRecordById(Long id);
/**
* 查询微信小程序订阅消息记录列表
*
* @param subscribeMessageRecord 微信小程序订阅消息记录
* @return 微信小程序订阅消息记录集合
*/
List<SubscribeMessageRecord> selectSubscribeMessageRecordList(SubscribeMessageRecord subscribeMessageRecord);
/**
* 新增微信小程序订阅消息记录
*
* @param subscribeMessageRecord 微信小程序订阅消息记录
* @return 结果
*/
int insertSubscribeMessageRecord(SubscribeMessageRecord subscribeMessageRecord);
/**
* 修改微信小程序订阅消息记录
*
* @param subscribeMessageRecord 微信小程序订阅消息记录
* @return 结果
*/
int updateSubscribeMessageRecord(SubscribeMessageRecord subscribeMessageRecord);
/**
* 批量删除微信小程序订阅消息记录
*
* @param ids 需要删除的微信小程序订阅消息记录主键集合
* @return 结果
*/
int deleteSubscribeMessageRecordByIds(Long[] ids);
/**
* 删除微信小程序订阅消息记录信息
*
* @param id 微信小程序订阅消息记录主键
* @return 结果
*/
int deleteSubscribeMessageRecordById(Long id);
}

View File

@ -0,0 +1,90 @@
package com.xinelu.manage.service.subscribemessagerecord.impl;
import com.xinelu.manage.domain.subscribemessagerecord.SubscribeMessageRecord;
import com.xinelu.manage.mapper.subscribemessagerecord.SubscribeMessageRecordMapper;
import com.xinelu.manage.service.subscribemessagerecord.ISubscribeMessageRecordService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
/**
* 微信小程序订阅消息记录Service业务层处理
*
* @author xinelu
* @date 2024-03-19
*/
@Service
public class SubscribeMessageRecordServiceImpl implements ISubscribeMessageRecordService {
@Resource
private SubscribeMessageRecordMapper subscribeMessageRecordMapper;
/**
* 查询微信小程序订阅消息记录
*
* @param id 微信小程序订阅消息记录主键
* @return 微信小程序订阅消息记录
*/
@Override
public SubscribeMessageRecord selectSubscribeMessageRecordById(Long id) {
return subscribeMessageRecordMapper.selectSubscribeMessageRecordById(id);
}
/**
* 查询微信小程序订阅消息记录列表
*
* @param subscribeMessageRecord 微信小程序订阅消息记录
* @return 微信小程序订阅消息记录
*/
@Override
public List<SubscribeMessageRecord> selectSubscribeMessageRecordList(SubscribeMessageRecord subscribeMessageRecord) {
return subscribeMessageRecordMapper.selectSubscribeMessageRecordList(subscribeMessageRecord);
}
/**
* 新增微信小程序订阅消息记录
*
* @param subscribeMessageRecord 微信小程序订阅消息记录
* @return 结果
*/
@Override
public int insertSubscribeMessageRecord(SubscribeMessageRecord subscribeMessageRecord) {
subscribeMessageRecord.setCreateTime(LocalDateTime.now());
return subscribeMessageRecordMapper.insertSubscribeMessageRecord(subscribeMessageRecord);
}
/**
* 修改微信小程序订阅消息记录
*
* @param subscribeMessageRecord 微信小程序订阅消息记录
* @return 结果
*/
@Override
public int updateSubscribeMessageRecord(SubscribeMessageRecord subscribeMessageRecord) {
subscribeMessageRecord.setUpdateTime(LocalDateTime.now());
return subscribeMessageRecordMapper.updateSubscribeMessageRecord(subscribeMessageRecord);
}
/**
* 批量删除微信小程序订阅消息记录
*
* @param ids 需要删除的微信小程序订阅消息记录主键
* @return 结果
*/
@Override
public int deleteSubscribeMessageRecordByIds(Long[] ids) {
return subscribeMessageRecordMapper.deleteSubscribeMessageRecordByIds(ids);
}
/**
* 删除微信小程序订阅消息记录信息
*
* @param id 微信小程序订阅消息记录主键
* @return 结果
*/
@Override
public int deleteSubscribeMessageRecordById(Long id) {
return subscribeMessageRecordMapper.deleteSubscribeMessageRecordById(id);
}
}

View File

@ -0,0 +1,61 @@
package com.xinelu.manage.service.subscribemessagesendrecord;
import com.xinelu.manage.domain.subscribemessagesendrecord.SubscribeMessageSendRecord;
import java.util.List;
/**
* 微信小程序订阅消息发送结果记录Service接口
*
* @author xinelu
* @date 2024-03-19
*/
public interface ISubscribeMessageSendRecordService {
/**
* 查询微信小程序订阅消息发送结果记录
*
* @param id 微信小程序订阅消息发送结果记录主键
* @return 微信小程序订阅消息发送结果记录
*/
SubscribeMessageSendRecord selectSubscribeMessageSendRecordById(Long id);
/**
* 查询微信小程序订阅消息发送结果记录列表
*
* @param subscribeMessageSendRecord 微信小程序订阅消息发送结果记录
* @return 微信小程序订阅消息发送结果记录集合
*/
List<SubscribeMessageSendRecord> selectSubscribeMessageSendRecordList(SubscribeMessageSendRecord subscribeMessageSendRecord);
/**
* 新增微信小程序订阅消息发送结果记录
*
* @param subscribeMessageSendRecord 微信小程序订阅消息发送结果记录
* @return 结果
*/
int insertSubscribeMessageSendRecord(SubscribeMessageSendRecord subscribeMessageSendRecord);
/**
* 修改微信小程序订阅消息发送结果记录
*
* @param subscribeMessageSendRecord 微信小程序订阅消息发送结果记录
* @return 结果
*/
int updateSubscribeMessageSendRecord(SubscribeMessageSendRecord subscribeMessageSendRecord);
/**
* 批量删除微信小程序订阅消息发送结果记录
*
* @param ids 需要删除的微信小程序订阅消息发送结果记录主键集合
* @return 结果
*/
int deleteSubscribeMessageSendRecordByIds(Long[] ids);
/**
* 删除微信小程序订阅消息发送结果记录信息
*
* @param id 微信小程序订阅消息发送结果记录主键
* @return 结果
*/
int deleteSubscribeMessageSendRecordById(Long id);
}

View File

@ -0,0 +1,90 @@
package com.xinelu.manage.service.subscribemessagesendrecord.impl;
import com.xinelu.manage.domain.subscribemessagesendrecord.SubscribeMessageSendRecord;
import com.xinelu.manage.mapper.subscribemessagesendrecord.SubscribeMessageSendRecordMapper;
import com.xinelu.manage.service.subscribemessagesendrecord.ISubscribeMessageSendRecordService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
/**
* 微信小程序订阅消息发送结果记录Service业务层处理
*
* @author xinelu
* @date 2024-03-19
*/
@Service
public class SubscribeMessageSendRecordServiceImpl implements ISubscribeMessageSendRecordService {
@Resource
private SubscribeMessageSendRecordMapper subscribeMessageSendRecordMapper;
/**
* 查询微信小程序订阅消息发送结果记录
*
* @param id 微信小程序订阅消息发送结果记录主键
* @return 微信小程序订阅消息发送结果记录
*/
@Override
public SubscribeMessageSendRecord selectSubscribeMessageSendRecordById(Long id) {
return subscribeMessageSendRecordMapper.selectSubscribeMessageSendRecordById(id);
}
/**
* 查询微信小程序订阅消息发送结果记录列表
*
* @param subscribeMessageSendRecord 微信小程序订阅消息发送结果记录
* @return 微信小程序订阅消息发送结果记录
*/
@Override
public List<SubscribeMessageSendRecord> selectSubscribeMessageSendRecordList(SubscribeMessageSendRecord subscribeMessageSendRecord) {
return subscribeMessageSendRecordMapper.selectSubscribeMessageSendRecordList(subscribeMessageSendRecord);
}
/**
* 新增微信小程序订阅消息发送结果记录
*
* @param subscribeMessageSendRecord 微信小程序订阅消息发送结果记录
* @return 结果
*/
@Override
public int insertSubscribeMessageSendRecord(SubscribeMessageSendRecord subscribeMessageSendRecord) {
subscribeMessageSendRecord.setCreateTime(LocalDateTime.now());
return subscribeMessageSendRecordMapper.insertSubscribeMessageSendRecord(subscribeMessageSendRecord);
}
/**
* 修改微信小程序订阅消息发送结果记录
*
* @param subscribeMessageSendRecord 微信小程序订阅消息发送结果记录
* @return 结果
*/
@Override
public int updateSubscribeMessageSendRecord(SubscribeMessageSendRecord subscribeMessageSendRecord) {
subscribeMessageSendRecord.setUpdateTime(LocalDateTime.now());
return subscribeMessageSendRecordMapper.updateSubscribeMessageSendRecord(subscribeMessageSendRecord);
}
/**
* 批量删除微信小程序订阅消息发送结果记录
*
* @param ids 需要删除的微信小程序订阅消息发送结果记录主键
* @return 结果
*/
@Override
public int deleteSubscribeMessageSendRecordByIds(Long[] ids) {
return subscribeMessageSendRecordMapper.deleteSubscribeMessageSendRecordByIds(ids);
}
/**
* 删除微信小程序订阅消息发送结果记录信息
*
* @param id 微信小程序订阅消息发送结果记录主键
* @return 结果
*/
@Override
public int deleteSubscribeMessageSendRecordById(Long id) {
return subscribeMessageSendRecordMapper.deleteSubscribeMessageSendRecordById(id);
}
}

View File

@ -90,8 +90,8 @@ public class ManualFollowUpVO {
@ApiModelProperty(value = "主治医生姓名")
private String attendingPhysicianName;
@ApiModelProperty(value = "患者类型在院患者IN_HOSPITAL_PATIENT门诊患者OUTPATIENT出院患者DISCHARGED_PATIENT")
private String patientType;
@ApiModelProperty(value = "在院IN_THE_HOSPITAL出院DISCHARGE门诊OUTPATIENT_SERVICE")
private String suitRange;
@ApiModelProperty(value = "入院时间")
@JsonFormat(pattern = "yyyy-MM-dd")

View File

@ -1,6 +1,5 @@
package com.xinelu.manage.vo.patientquestionsubmitresult;
import com.xinelu.manage.vo.patientquestionsubjectresult.PatientQuestionSubjectResultVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -17,6 +16,12 @@ import java.util.List;
public class PatientQuestionSubmitResultVO {
private Long submitResulId;
/**
* 任务类型
*/
private String taskContent;
/**
* 问卷标题
*/

View File

@ -15,6 +15,9 @@ import lombok.EqualsAndHashCode;
@Data
public class SpecialDiseaseNodeVO extends SpecialDiseaseNode {
@ApiModelProperty(value = "专病路径表id")
private Long SpecialDiseaseNodeId;
private Long specialDiseaseNodeId;
private String taskTypeName;
private String taskSubdivisionName;
}

View File

@ -2,6 +2,7 @@ package com.xinelu.manage.vo.specialdiseaseroute;
import com.xinelu.manage.domain.specialdiseaseroute.SpecialDiseaseRoute;
import com.xinelu.manage.vo.specialdiseasenode.SpecialDiseaseNodeVO;
import com.xinelu.manage.vo.specialdiseaseroutepackage.SpecialDiseaseRoutePackageVO;
import com.xinelu.manage.vo.specialdiseasetriggercondition.TriggerConditionVO;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -42,4 +43,6 @@ public class SpecialDiseaseRouteVO extends SpecialDiseaseRoute {
* 触发条件信息
*/
List<TriggerConditionVO> triggerConditionList;
List<SpecialDiseaseRoutePackageVO> routePackageList;
}

View File

@ -0,0 +1,18 @@
package com.xinelu.manage.vo.specialdiseaseroutepackage;
import com.xinelu.manage.domain.specialdiseaseroutepackage.SpecialDiseaseRoutePackage;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 专病路径-服务包关系多对多关系对象 special_disease_route_package
*
* @author xinelu
* @date 2024-04-09
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class SpecialDiseaseRoutePackageVO extends SpecialDiseaseRoutePackage {
private Long specialDiseaseRoutePackageId;
}

View File

@ -0,0 +1,191 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xinelu.manage.mapper.officialaccountsubscribeevent.OfficialAccountSubscribeEventMapper">
<resultMap type="OfficialAccountSubscribeEvent" id="OfficialAccountSubscribeEventResult">
<result property="id" column="id"/>
<result property="openid" column="openid"/>
<result property="officialAccountAppId" column="official_account_app_id"/>
<result property="sendTime" column="send_time"/>
<result property="msgType" column="msg_type"/>
<result property="eventType" column="event_type"/>
<result property="subscribeStatus" column="subscribe_status"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectOfficialAccountSubscribeEventVo">
select id, openid, official_account_app_id, send_time, msg_type, event_type, subscribe_status, create_by, create_time, update_by, update_time from official_account_subscribe_event
</sql>
<select id="selectOfficialAccountSubscribeEventList" parameterType="OfficialAccountSubscribeEvent"
resultMap="OfficialAccountSubscribeEventResult">
<include refid="selectOfficialAccountSubscribeEventVo"/>
<where>
<if test="openid != null and openid != ''">
and openid = #{openid}
</if>
<if test="officialAccountAppId != null and officialAccountAppId != ''">
and official_account_app_id = #{officialAccountAppId}
</if>
<if test="sendTime != null ">
and send_time = #{sendTime}
</if>
<if test="msgType != null and msgType != ''">
and msg_type = #{msgType}
</if>
<if test="eventType != null and eventType != ''">
and event_type = #{eventType}
</if>
</where>
</select>
<select id="selectOfficialAccountSubscribeEventById" parameterType="Long"
resultMap="OfficialAccountSubscribeEventResult">
<include refid="selectOfficialAccountSubscribeEventVo"/>
where id = #{id}
</select>
<insert id="insertOfficialAccountSubscribeEvent" parameterType="OfficialAccountSubscribeEvent"
useGeneratedKeys="true"
keyProperty="id">
insert into official_account_subscribe_event
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="openid != null">openid,
</if>
<if test="officialAccountAppId != null">official_account_app_id,
</if>
<if test="sendTime != null">send_time,
</if>
<if test="msgType != null">msg_type,
</if>
<if test="eventType != null">event_type,
</if>
<if test="subscribeStatus != null">subscribe_status,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="openid != null">#{openid},
</if>
<if test="officialAccountAppId != null">#{officialAccountAppId},
</if>
<if test="sendTime != null">#{sendTime},
</if>
<if test="msgType != null">#{msgType},
</if>
<if test="eventType != null">#{eventType},
</if>
<if test="subscribeStatus != null">#{subscribeStatus},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
</trim>
</insert>
<update id="updateOfficialAccountSubscribeEvent" parameterType="OfficialAccountSubscribeEvent">
update official_account_subscribe_event
<trim prefix="SET" suffixOverrides=",">
<if test="openid != null">openid =
#{openid},
</if>
<if test="officialAccountAppId != null">official_account_app_id =
#{officialAccountAppId},
</if>
<if test="sendTime != null">send_time =
#{sendTime},
</if>
<if test="msgType != null">msg_type =
#{msgType},
</if>
<if test="eventType != null">event_type =
#{eventType},
</if>
<if test="subscribeStatus != null">subscribe_status =
#{subscribeStatus},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteOfficialAccountSubscribeEventById" parameterType="Long">
delete from official_account_subscribe_event where id = #{id}
</delete>
<delete id="deleteOfficialAccountSubscribeEventByIds" parameterType="String">
delete from official_account_subscribe_event where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getSubscribeEventInfo" resultType="int">
select count(1) from official_account_subscribe_event where openid = #{openid}
</select>
<update id="updateSubscribeEventInfo" parameterType="OfficialAccountSubscribeEvent">
update official_account_subscribe_event
<trim prefix="SET" suffixOverrides=",">
<if test="openid != null">openid =
#{openid},
</if>
<if test="officialAccountAppId != null">official_account_app_id =
#{officialAccountAppId},
</if>
<if test="sendTime != null">send_time =
#{sendTime},
</if>
<if test="msgType != null">msg_type =
#{msgType},
</if>
<if test="eventType != null">event_type =
#{eventType},
</if>
<if test="subscribeStatus != null">subscribe_status =
#{subscribeStatus},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
</trim>
where openid = #{openid}
</update>
</mapper>

View File

@ -0,0 +1,185 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xinelu.manage.mapper.officialaccounttemplateevent.OfficialAccountTemplateEventMapper">
<resultMap type="OfficialAccountTemplateEvent" id="OfficialAccountTemplateEventResult">
<result property="id" column="id"/>
<result property="patientId" column="patient_id"/>
<result property="patientName" column="patient_name"/>
<result property="openid" column="openid"/>
<result property="officialAccountAppId" column="official_account_app_id"/>
<result property="sendTime" column="send_time"/>
<result property="msgType" column="msg_type"/>
<result property="eventType" column="event_type"/>
<result property="msgId" column="msg_id"/>
<result property="status" column="status"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectOfficialAccountTemplateEventVo">
select id, patient_id, patient_name, openid, official_account_app_id, send_time, msg_type, event_type, msg_id, status, create_by, create_time, update_by, update_time from official_account_template_event
</sql>
<select id="selectOfficialAccountTemplateEventList" parameterType="OfficialAccountTemplateEvent"
resultMap="OfficialAccountTemplateEventResult">
<include refid="selectOfficialAccountTemplateEventVo"/>
<where>
<if test="patientId != null ">
and patient_id = #{patientId}
</if>
<if test="patientName != null and patientName != ''">
and patient_name like concat('%', #{patientName}, '%')
</if>
<if test="openid != null and openid != ''">
and openid = #{openid}
</if>
<if test="officialAccountAppId != null and officialAccountAppId != ''">
and official_account_app_id = #{officialAccountAppId}
</if>
<if test="sendTime != null ">
and send_time = #{sendTime}
</if>
<if test="msgType != null and msgType != ''">
and msg_type = #{msgType}
</if>
<if test="eventType != null and eventType != ''">
and event_type = #{eventType}
</if>
<if test="msgId != null and msgId != ''">
and msg_id = #{msgId}
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
</where>
</select>
<select id="selectOfficialAccountTemplateEventById" parameterType="Long"
resultMap="OfficialAccountTemplateEventResult">
<include refid="selectOfficialAccountTemplateEventVo"/>
where id = #{id}
</select>
<insert id="insertOfficialAccountTemplateEvent" parameterType="OfficialAccountTemplateEvent" useGeneratedKeys="true"
keyProperty="id">
insert into official_account_template_event
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="patientId != null">patient_id,
</if>
<if test="patientName != null">patient_name,
</if>
<if test="openid != null">openid,
</if>
<if test="officialAccountAppId != null">official_account_app_id,
</if>
<if test="sendTime != null">send_time,
</if>
<if test="msgType != null">msg_type,
</if>
<if test="eventType != null">event_type,
</if>
<if test="msgId != null">msg_id,
</if>
<if test="status != null">status,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="patientId != null">#{patientId},
</if>
<if test="patientName != null">#{patientName},
</if>
<if test="openid != null">#{openid},
</if>
<if test="officialAccountAppId != null">#{officialAccountAppId},
</if>
<if test="sendTime != null">#{sendTime},
</if>
<if test="msgType != null">#{msgType},
</if>
<if test="eventType != null">#{eventType},
</if>
<if test="msgId != null">#{msgId},
</if>
<if test="status != null">#{status},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
</trim>
</insert>
<update id="updateOfficialAccountTemplateEvent" parameterType="OfficialAccountTemplateEvent">
update official_account_template_event
<trim prefix="SET" suffixOverrides=",">
<if test="patientId != null">patient_id =
#{patientId},
</if>
<if test="patientName != null">patient_name =
#{patientName},
</if>
<if test="openid != null">openid =
#{openid},
</if>
<if test="officialAccountAppId != null">official_account_app_id =
#{officialAccountAppId},
</if>
<if test="sendTime != null">send_time =
#{sendTime},
</if>
<if test="msgType != null">msg_type =
#{msgType},
</if>
<if test="eventType != null">event_type =
#{eventType},
</if>
<if test="msgId != null">msg_id =
#{msgId},
</if>
<if test="status != null">status =
#{status},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteOfficialAccountTemplateEventById" parameterType="Long">
delete from official_account_template_event where id = #{id}
</delete>
<delete id="deleteOfficialAccountTemplateEventByIds" parameterType="String">
delete from official_account_template_event where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -523,4 +523,34 @@
#{id}
</foreach>
</update>
<select id="getPatientInfoByOpenId" parameterType="string" resultType="patientInfo">
SELECT
id,
community_code,
area_code,
patient_code,
patient_name,
card_no,
user_id,
unionid,
openid,
official_account_openid,
phone,
address,
urgent_contact_name,
urgent_contact_phone,
community_alias_name,
home_longitude,
home_latitude,
head_picture_url
FROM
patient_info
<where>
del_flag = 0
<if test="openId != null and openId != ''">
and openid = #{openId}
</if>
</where>
</select>
</mapper>

View File

@ -256,6 +256,9 @@
<if test="departmentName != null and departmentName != ''">
dt.department_name like concat('%',#{departmentName},'%')
</if>
<if test="questionnaireStatus != null and questionnaireStatus != ''">
qi.questionnaire_status =#{questionnaireStatus}
</if>
</where>
GROUP BY dt.id
</select>

View File

@ -115,9 +115,17 @@
pvr.surgical_name,
pi.attending_physician_id,
pi.attending_physician_name,
pi.patient_type,
IF(pi.visit_method = 'OUTPATIENT_SERVICE',NULL,pi.admission_time) AS 'admissionTime',
IF(pi.visit_method = 'OUTPATIENT_SERVICE',pi.visit_date,pi.discharge_time) AS 'visitOrDischargeTime',
IF(spmr.suit_range = 'IN_THE_HOSPITAL', pi.admission_time, NULL) AS 'admissionTime',
CASE
WHEN spmr.suit_range = 'OUTPATIENT_SERVICE' THEN pi.visit_date
WHEN spmr.suit_range = 'DISCHARGE' THEN pi.discharge_time
WHEN spmr.suit_range = 'OUTPATIENT_SERVICE_DISCHARGE' THEN COALESCE(pi.visit_date, pi.discharge_time)
END AS 'visitOrDischargeTime',
CASE
WHEN spmr.suit_range IN ('IN_THE_HOSPITAL', 'DISCHARGE', 'OUTPATIENT_SERVICE') THEN spmr.suit_range
WHEN spmr.suit_range = 'OUTPATIENT_SERVICE_DISCHARGE' AND pi.visit_date IS NOT NULL THEN 'OUTPATIENT_SERVICE'
WHEN spmr.suit_range = 'OUTPATIENT_SERVICE_DISCHARGE' AND pi.discharge_time IS NOT NULL THEN 'DISCHARGE'
END AS 'suitRange',
pter.execute_time AS 'executeTime',
spmr.id AS 'manageRouteId',
spmrn.id AS 'manageRouteNodeId',
@ -162,8 +170,17 @@
<if test="wardId != null">
AND pi.ward_id = #{wardId}
</if>
<if test="patientType != null and patientType != ''">
AND pi.patient_type = #{patientType}
<if test="suitRange != null and suitRange != ''">
<choose>
<!-- 当传入的是出院或门诊时,也匹配门诊+出院 -->
<when test="suitRange == 'DISCHARGE' or suitRange == 'OUTPATIENT_SERVICE'">
AND (spmr.suit_range = #{suitRange} OR spmr.suit_range = 'OUTPATIENT_SERVICE_DISCHARGE')
</when>
<!-- 其他情况直接匹配传入的值 -->
<otherwise>
AND spmr.suit_range = #{suitRange}
</otherwise>
</choose>
</if>
<if test="visitSerialNumber != null and visitSerialNumber != ''">
AND pi.visit_serial_number LIKE concat('%', #{visitSerialNumber}, '%')

View File

@ -18,10 +18,10 @@
<result property="suitRange" column="suit_range"/>
<result property="routeSort" column="route_sort"/>
<result property="routeRemark" column="route_remark"/>
<result property="totalNumber" column="totalNumber"/>
<result property="agreeNumber" column="agreeNumber"/>
<collection property="specialDiseaseNodeList" javaType="java.util.List"
resultMap="SpecialDiseaseNodeResult"/>
<collection property="triggerConditionList" javaType="java.util.List"
resultMap="SpecialDiseaseTriggerConditionResult"/>
resultMap="SpecialDiseaseNodeVOResult"/>
</resultMap>
<resultMap type="SpecialDiseaseNode" id="SpecialDiseaseNodeResult">
@ -66,23 +66,58 @@
<result property="routeCheckPerson" column="route_check_person"/>
<result property="routeCheckDate" column="route_check_date"/>
<result property="routeCheckRemark" column="route_check_remark"/>
<result property="nodeContent" column="node_content"/>
<result property="nodeContent" column="node_content"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<resultMap type="SpecialDiseaseTriggerCondition" id="SpecialDiseaseTriggerConditionResult">
<result property="id" column="triggerConditionId"/>
<resultMap type="com.xinelu.manage.vo.specialdiseasenode.SpecialDiseaseNodeVO" id="SpecialDiseaseNodeVOResult">
<result property="specialDiseaseNodeId" column="specialDiseaseNodeId"/>
<result property="routeId" column="route_id"/>
<result property="routeName" column="route_name"/>
<result property="triggerConditionCode" column="trigger_condition_code"/>
<result property="triggerConditionName" column="trigger_condition_name"/>
<result property="triggerConditionOperator" column="trigger_condition_operator"/>
<result property="triggerConditionValue" column="trigger_condition_value"/>
<result property="triggerConditionSort" column="trigger_condition_sort"/>
<result property="triggerConditionRemark" column="trigger_condition_remark"/>
<result property="routeNodeName" column="route_node_name"/>
<result property="routeNodeDay" column="route_node_day"/>
<result property="taskType" column="task_type"/>
<result property="taskSubdivision" column="task_subdivision"/>
<result property="taskType" column="taskSubdivisionName"/>
<result property="taskSubdivision" column="taskSubdivisionName"/>
<result property="taskStatus" column="task_status"/>
<result property="secondClassifyDescribe" column="second_classify_describe"/>
<result property="executionTime" column="execution_time"/>
<result property="templateId" column="template_id"/>
<result property="templateName" column="template_name"/>
<result property="templateType" column="template_type"/>
<result property="messagePushSign" column="message_push_sign"/>
<result property="messageTemplateId" column="message_template__id"/>
<result property="messageTemplateName" column="message_template_name"/>
<result property="messagePreview" column="message_preview"/>
<result property="messageNodeContent" column="message_node_content"/>
<result property="officialPushSign" column="official_push_sign"/>
<result property="officialTemplateId" column="official_template_id"/>
<result property="officialTemplateName" column="official_template_name"/>
<result property="officialRemindContent" column="official_remind_content"/>
<result property="officialNodeContent" column="official_node_content"/>
<result property="appletPushSign" column="applet_push_sign"/>
<result property="appletTemplateId" column="applet_template_id"/>
<result property="appletTemplateName" column="applet_template_name"/>
<result property="appletRemindContent" column="applet_remind_content"/>
<result property="appletPromptDescription" column="applet_prompt_description"/>
<result property="appletNodeContent" column="applet_node_content"/>
<result property="phonePushSign" column="phone_push_sign"/>
<result property="phoneTemplateId" column="phone_template_id"/>
<result property="phoneTemplateName" column="phone_template_name"/>
<result property="phoneMessageRemind" column="phone_message_remind"/>
<result property="phoneMessageTemplateId" column="phone_message_template_id"/>
<result property="phoneMessageTemplateName" column="phone_message_template_name"/>
<result property="phoneAgencyName" column="phone_agency_name"/>
<result property="phoneNodeContent" column="phone_node_content"/>
<result property="routeCheckStatus" column="route_check_status"/>
<result property="routeCheckPerson" column="route_check_person"/>
<result property="routeCheckDate" column="route_check_date"/>
<result property="routeCheckRemark" column="route_check_remark"/>
<result property="nodeContent" column="node_content"/>
</resultMap>
<sql id="selectSpecialDiseaseNodeVo">
@ -718,7 +753,7 @@
<select id="selectSpecialDiseaseByRouteId"
resultType="com.xinelu.manage.vo.specialdiseaseroute.SpecialDiseaseRouteVO"
resultMap="SpecialDiseaseRouteResult">
select sdr.id specialDiseaseRouteId,
select sdr.id specialDiseaseRouteId,
sdr.department_id,
sdr.department_name,
sdr.disease_type_id,
@ -729,13 +764,15 @@
sdr.route_classify,
sdr.release_status,
sdr.suit_range,
sdn.id specialDiseaseNodeId,
sdn.id as specialDiseaseNodeId,
sdn.route_id,
sdn.route_name,
sdn.route_node_name,
sdn.route_node_day,
sdn.task_type,
sdn.task_subdivision,
sdn.task_type taskTypeName,
sdn.task_subdivision taskSubdivisionName,
sdn.task_status,
sdn.second_classify_describe,
sdn.execution_time,
@ -771,24 +808,15 @@
sdn.route_check_date,
sdn.route_check_remark,
sdn.node_content,
sdtc.id triggerConditionId,
sdtc.route_id,
sdtc.route_name,
sdtc.trigger_condition_code,
sdtc.trigger_condition_name,
sdtc.trigger_condition_operator,
sdtc.trigger_condition_value,
sdtc.trigger_condition_sort,
sdtc.trigger_condition_remark
(select COUNT(1)
from special_disease_node
where route_id = specialDiseaseRouteId) totalNumber,
(select COUNT(1)
from special_disease_node
where route_id = specialDiseaseRouteId
and route_check_status = 'AGREE') agreeNumber
from special_disease_route sdr
left join special_disease_node sdn ON sdn.route_id = sdr.id
LEFT JOIN special_disease_trigger_condition sdtc ON sdtc.route_id = sdr.id
where sdr.id = #{specialDiseaseRouteId}
</select>
<delete id="deleteSpecialDiseaseNodeRouteId">
</delete>
</mapper>

View File

@ -42,6 +42,8 @@
<result property="routeRemark" column="route_remark"/>
<collection property="triggerConditionList" javaType="java.util.List"
resultMap="SpecialDiseaseTriggerConditionResult"/>
<collection property="routePackageList" javaType="java.util.List"
resultMap="SpecialDiseaseRoutePackageResult"/>
</resultMap>
<resultMap type="com.xinelu.manage.vo.specialdiseasetriggercondition.TriggerConditionVO"
id="SpecialDiseaseTriggerConditionResult">
@ -56,6 +58,14 @@
<result property="triggerConditionRemark" column="trigger_condition_remark"/>
</resultMap>
<resultMap type="com.xinelu.manage.vo.specialdiseaseroutepackage.SpecialDiseaseRoutePackageVO" id="SpecialDiseaseRoutePackageResult">
<result property="specialDiseaseRoutePackageId" column="id"/>
<result property="routeId" column="route_id"/>
<result property="servicePackageId" column="service_package_id"/>
<result property="routeName" column="route_name"/>
<result property="packageName" column="package_name"/>
</resultMap>
<sql id="selectSpecialDiseaseRouteVo">
select id,
department_id,
@ -373,6 +383,11 @@
sdtc.trigger_condition_value,
sdtc.trigger_condition_sort,
sdtc.trigger_condition_remark,
sdrp.id specialDiseaseRoutePackageId,
sdrp.route_id,
sdrp.service_package_id,
sdrp.route_name,
sdrp.package_name,
(select COUNT(1)
from special_disease_node
where route_id = specialDiseaseRouteId) totalNumber,
@ -383,6 +398,14 @@
from special_disease_route sdr
LEFT JOIN special_disease_node sdn ON sdn.route_id = sdr.id
LEFT JOIN special_disease_trigger_condition sdtc ON sdr.id = sdtc.route_id
LEFT JOIN special_disease_route_package sdrp ON sdr.id = sdrp.route_id
where sdr.id = #{id}
</select>
<select id="selectRouteCheckStatus" resultType="java.lang.Integer">
select COUNT(1)
from special_disease_node
where route_id = #{routeId}
and route_check_status != #{routeCheckStatus}
</select>
</mapper>

View File

@ -0,0 +1,168 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xinelu.manage.mapper.specialdiseaseroutepackage.SpecialDiseaseRoutePackageMapper">
<resultMap type="SpecialDiseaseRoutePackage" id="SpecialDiseaseRoutePackageResult">
<result property="id" column="id"/>
<result property="routeId" column="route_id"/>
<result property="servicePackageId" column="service_package_id"/>
<result property="routeName" column="route_name"/>
<result property="packageName" column="package_name"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectSpecialDiseaseRoutePackageVo">
select id,
route_id,
service_package_id,
route_name,
package_name,
create_by,
create_time,
update_by,
update_time
from special_disease_route_package
</sql>
<select id="selectSpecialDiseaseRoutePackageList" parameterType="SpecialDiseaseRoutePackage"
resultMap="SpecialDiseaseRoutePackageResult">
<include refid="selectSpecialDiseaseRoutePackageVo"/>
<where>
<if test="routeId != null ">
and route_id = #{routeId}
</if>
<if test="servicePackageId != null ">
and service_package_id = #{servicePackageId}
</if>
<if test="routeName != null and routeName != ''">
and route_name like concat('%', #{routeName}, '%')
</if>
<if test="packageName != null and packageName != ''">
and package_name like concat('%', #{packageName}, '%')
</if>
</where>
</select>
<select id="selectSpecialDiseaseRoutePackageById" parameterType="Long"
resultMap="SpecialDiseaseRoutePackageResult">
<include refid="selectSpecialDiseaseRoutePackageVo"/>
where id = #{id}
</select>
<insert id="insertSpecialDiseaseRoutePackage" parameterType="SpecialDiseaseRoutePackage" useGeneratedKeys="true"
keyProperty="id">
insert into special_disease_route_package
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="routeId != null">route_id,
</if>
<if test="servicePackageId != null">service_package_id,
</if>
<if test="routeName != null">route_name,
</if>
<if test="packageName != null">package_name,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="routeId != null">#{routeId},
</if>
<if test="servicePackageId != null">#{servicePackageId},
</if>
<if test="routeName != null">#{routeName},
</if>
<if test="packageName != null">#{packageName},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
</trim>
</insert>
<update id="updateSpecialDiseaseRoutePackage" parameterType="SpecialDiseaseRoutePackage">
update special_disease_route_package
<trim prefix="SET" suffixOverrides=",">
<if test="routeId != null">route_id =
#{routeId},
</if>
<if test="servicePackageId != null">service_package_id =
#{servicePackageId},
</if>
<if test="routeName != null">route_name =
#{routeName},
</if>
<if test="packageName != null">package_name =
#{packageName},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSpecialDiseaseRoutePackageById" parameterType="Long">
delete
from special_disease_route_package
where id = #{id}
</delete>
<delete id="deleteSpecialDiseaseRoutePackageByIds" parameterType="String">
delete from special_disease_route_package where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="insertSpecialDiseaseRoutePackageList">
insert into special_disease_route_package(
route_id,
service_package_id,
route_name,
package_name,
create_by,
create_time
) values
<foreach item="specialDiseaseRoutePackageList" index="index" collection="list" separator=",">
(
#{specialDiseaseRoutePackageList.routeId},
#{specialDiseaseRoutePackageList.servicePackageId},
#{specialDiseaseRoutePackageList.routeName},
#{specialDiseaseRoutePackageList.packageName},
#{specialDiseaseRoutePackageList.createBy},
#{specialDiseaseRoutePackageList.createTime}
)
</foreach>
</insert>
<delete id="deleteSpecialDiseaseRoutePackageByRouteId">
delete
from special_disease_route_package
where route_id = #{routeId}
</delete>
</mapper>

View File

@ -0,0 +1,237 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xinelu.manage.mapper.subscribemessagerecord.SubscribeMessageRecordMapper">
<resultMap type="SubscribeMessageRecord" id="SubscribeMessageRecordResult">
<result property="id" column="id"/>
<result property="patientId" column="patient_id"/>
<result property="manageRouteNodeId" column="manage_route_node_id"/>
<result property="unionid" column="unionid"/>
<result property="openid" column="openid"/>
<result property="appletId" column="applet_id"/>
<result property="templateId" column="template_id"/>
<result property="messageType" column="message_type"/>
<result property="subscribeCount" column="subscribe_count"/>
<result property="subscribeTime" column="subscribe_time"/>
<result property="subscribeStatus" column="subscribe_status"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectSubscribeMessageRecordVo">
select id, patient_id, manage_route_node_id, unionid, openid, applet_id, template_id, message_type, subscribe_count, subscribe_time, subscribe_status, create_by, create_time, update_by, update_time from subscribe_message_record
</sql>
<select id="selectSubscribeMessageRecordList" parameterType="SubscribeMessageRecord"
resultMap="SubscribeMessageRecordResult">
<include refid="selectSubscribeMessageRecordVo"/>
<where>
<if test="patientId != null ">
and patient_id = #{patientId}
</if>
<if test="manageRouteNodeId != null ">
and manage_route_node_id = #{manageRouteNodeId}
</if>
<if test="unionid != null and unionid != ''">
and unionid = #{unionid}
</if>
<if test="openid != null and openid != ''">
and openid = #{openid}
</if>
<if test="appletId != null and appletId != ''">
and applet_id = #{appletId}
</if>
<if test="templateId != null and templateId != ''">
and template_id = #{templateId}
</if>
<if test="messageType != null and messageType != ''">
and message_type = #{messageType}
</if>
<if test="subscribeCount != null ">
and subscribe_count = #{subscribeCount}
</if>
<if test="subscribeTime != null ">
and subscribe_time = #{subscribeTime}
</if>
<if test="subscribeStatus != null and subscribeStatus != ''">
and subscribe_status = #{subscribeStatus}
</if>
</where>
</select>
<select id="selectSubscribeMessageRecordById" parameterType="Long"
resultMap="SubscribeMessageRecordResult">
<include refid="selectSubscribeMessageRecordVo"/>
where id = #{id}
</select>
<insert id="insertSubscribeMessageRecord" parameterType="SubscribeMessageRecord" useGeneratedKeys="true"
keyProperty="id">
insert into subscribe_message_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="patientId != null">patient_id,
</if>
<if test="manageRouteNodeId != null">manage_route_node_id,
</if>
<if test="unionid != null">unionid,
</if>
<if test="openid != null">openid,
</if>
<if test="appletId != null">applet_id,
</if>
<if test="templateId != null">template_id,
</if>
<if test="messageType != null">message_type,
</if>
<if test="subscribeCount != null">subscribe_count,
</if>
<if test="subscribeTime != null">subscribe_time,
</if>
<if test="subscribeStatus != null">subscribe_status,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="patientId != null">#{patientId},
</if>
<if test="manageRouteNodeId != null">#{manageRouteNodeId},
</if>
<if test="unionid != null">#{unionid},
</if>
<if test="openid != null">#{openid},
</if>
<if test="appletId != null">#{appletId},
</if>
<if test="templateId != null">#{templateId},
</if>
<if test="messageType != null">#{messageType},
</if>
<if test="subscribeCount != null">#{subscribeCount},
</if>
<if test="subscribeTime != null">#{subscribeTime},
</if>
<if test="subscribeStatus != null">#{subscribeStatus},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
</trim>
</insert>
<update id="updateSubscribeMessageRecord" parameterType="SubscribeMessageRecord">
update subscribe_message_record
<trim prefix="SET" suffixOverrides=",">
<if test="patientId != null">patient_id =
#{patientId},
</if>
<if test="manageRouteNodeId != null">manage_route_node_id =
#{manageRouteNodeId},
</if>
<if test="unionid != null">unionid =
#{unionid},
</if>
<if test="openid != null">openid =
#{openid},
</if>
<if test="appletId != null">applet_id =
#{appletId},
</if>
<if test="templateId != null">template_id =
#{templateId},
</if>
<if test="messageType != null">message_type =
#{messageType},
</if>
<if test="subscribeCount != null">subscribe_count =
#{subscribeCount},
</if>
<if test="subscribeTime != null">subscribe_time =
#{subscribeTime},
</if>
<if test="subscribeStatus != null">subscribe_status =
#{subscribeStatus},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSubscribeMessageRecordById" parameterType="Long">
delete from subscribe_message_record where id = #{id}
</delete>
<delete id="deleteSubscribeMessageRecordByIds" parameterType="String">
delete from subscribe_message_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="insertSubscribeMessageRecordList" parameterType="java.util.List">
insert into subscribe_message_record(
patient_id,
unionid,
openid,
template_id,
message_type,
subscribe_count,
subscribe_time,
applet_id,
subscribe_status,
create_by,
create_time,
update_by,
update_time
) values
<foreach item="subscribeMessageRecordList" index="index" collection="list" separator=",">
(
#{subscribeMessageRecordList.patientId},
#{subscribeMessageRecordList.unionid},
#{subscribeMessageRecordList.openid},
#{subscribeMessageRecordList.templateId},
#{subscribeMessageRecordList.messageType},
#{subscribeMessageRecordList.subscribeCount},
#{subscribeMessageRecordList.subscribeTime},
#{subscribeMessageRecordList.appletId},
#{subscribeMessageRecordList.subscribeStatus},
#{subscribeMessageRecordList.createBy},
#{subscribeMessageRecordList.createTime},
#{subscribeMessageRecordList.updateBy},
#{subscribeMessageRecordList.updateTime}
)
</foreach>
</insert>
<update id="updateSubscribeMessageTemplateId">
update subscribe_message_record
set patient_id = #{patientId}, subscribe_status = #{subscribeStatus}, update_time = now()
where openid = #{openId} and template_id = #{templateId}
</update>
</mapper>

View File

@ -0,0 +1,234 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xinelu.manage.mapper.subscribemessagesendrecord.SubscribeMessageSendRecordMapper">
<resultMap type="SubscribeMessageSendRecord" id="SubscribeMessageSendRecordResult">
<result property="id" column="id"/>
<result property="patientId" column="patient_id"/>
<result property="manageRouteNodeId" column="manage_route_node_id"/>
<result property="unionid" column="unionid"/>
<result property="openid" column="openid"/>
<result property="appletId" column="applet_id"/>
<result property="subscribeTime" column="subscribe_time"/>
<result property="templateId" column="template_id"/>
<result property="msgId" column="msg_id"/>
<result property="messageType" column="message_type"/>
<result property="errorCode" column="error_code"/>
<result property="errorStatus" column="error_status"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectSubscribeMessageSendRecordVo">
select id, patient_id, manage_route_node_id, unionid, openid, applet_id, subscribe_time, template_id, msg_id, message_type, error_code, error_status, create_by, create_time, update_by, update_time from subscribe_message_send_record
</sql>
<select id="selectSubscribeMessageSendRecordList" parameterType="SubscribeMessageSendRecord"
resultMap="SubscribeMessageSendRecordResult">
<include refid="selectSubscribeMessageSendRecordVo"/>
<where>
<if test="patientId != null ">
and patient_id = #{patientId}
</if>
<if test="manageRouteNodeId != null ">
and manage_route_node_id = #{manageRouteNodeId}
</if>
<if test="unionid != null and unionid != ''">
and unionid = #{unionid}
</if>
<if test="openid != null and openid != ''">
and openid = #{openid}
</if>
<if test="appletId != null and appletId != ''">
and applet_id = #{appletId}
</if>
<if test="subscribeTime != null ">
and subscribe_time = #{subscribeTime}
</if>
<if test="templateId != null and templateId != ''">
and template_id = #{templateId}
</if>
<if test="msgId != null and msgId != ''">
and msg_id = #{msgId}
</if>
<if test="messageType != null and messageType != ''">
and message_type = #{messageType}
</if>
<if test="errorCode != null ">
and error_code = #{errorCode}
</if>
<if test="errorStatus != null and errorStatus != ''">
and error_status = #{errorStatus}
</if>
</where>
</select>
<select id="selectSubscribeMessageSendRecordById" parameterType="Long"
resultMap="SubscribeMessageSendRecordResult">
<include refid="selectSubscribeMessageSendRecordVo"/>
where id = #{id}
</select>
<insert id="insertSubscribeMessageSendRecord" parameterType="SubscribeMessageSendRecord" useGeneratedKeys="true"
keyProperty="id">
insert into subscribe_message_send_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="patientId != null">patient_id,
</if>
<if test="manageRouteNodeId != null">manage_route_node_id,
</if>
<if test="unionid != null">unionid,
</if>
<if test="openid != null">openid,
</if>
<if test="appletId != null">applet_id,
</if>
<if test="subscribeTime != null">subscribe_time,
</if>
<if test="templateId != null">template_id,
</if>
<if test="msgId != null">msg_id,
</if>
<if test="messageType != null">message_type,
</if>
<if test="errorCode != null">error_code,
</if>
<if test="errorStatus != null">error_status,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="patientId != null">#{patientId},
</if>
<if test="manageRouteNodeId != null">#{manageRouteNodeId},
</if>
<if test="unionid != null">#{unionid},
</if>
<if test="openid != null">#{openid},
</if>
<if test="appletId != null">#{appletId},
</if>
<if test="subscribeTime != null">#{subscribeTime},
</if>
<if test="templateId != null">#{templateId},
</if>
<if test="msgId != null">#{msgId},
</if>
<if test="messageType != null">#{messageType},
</if>
<if test="errorCode != null">#{errorCode},
</if>
<if test="errorStatus != null">#{errorStatus},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
</trim>
</insert>
<update id="updateSubscribeMessageSendRecord" parameterType="SubscribeMessageSendRecord">
update subscribe_message_send_record
<trim prefix="SET" suffixOverrides=",">
<if test="patientId != null">patient_id =
#{patientId},
</if>
<if test="manageRouteNodeId != null">manage_route_node_id =
#{manageRouteNodeId},
</if>
<if test="unionid != null">unionid =
#{unionid},
</if>
<if test="openid != null">openid =
#{openid},
</if>
<if test="appletId != null">applet_id =
#{appletId},
</if>
<if test="subscribeTime != null">subscribe_time =
#{subscribeTime},
</if>
<if test="templateId != null">template_id =
#{templateId},
</if>
<if test="msgId != null">msg_id =
#{msgId},
</if>
<if test="messageType != null">message_type =
#{messageType},
</if>
<if test="errorCode != null">error_code =
#{errorCode},
</if>
<if test="errorStatus != null">error_status =
#{errorStatus},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSubscribeMessageSendRecordById" parameterType="Long">
delete from subscribe_message_send_record where id = #{id}
</delete>
<delete id="deleteSubscribeMessageSendRecordByIds" parameterType="String">
delete from subscribe_message_send_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="insertSubscribeMessageSendRecordList" parameterType="java.util.List">
insert into subscribe_message_send_record(
openid,
applet_id,
subscribe_time,
template_id,
msg_id,
message_type,
error_code,
error_status,
create_time
) values
<foreach item="sendRecord" index="index" collection="list" separator=",">
(
#{sendRecord.openid},
#{sendRecord.appletId},
#{sendRecord.subscribeTime},
#{sendRecord.templateId},
#{sendRecord.msgId},
#{sendRecord.messageType},
#{sendRecord.errorCode},
#{sendRecord.errorStatus},
#{sendRecord.createTime}
)
</foreach>
</insert>
</mapper>

View File

@ -34,5 +34,10 @@
<groupId>com.xinelu</groupId>
<artifactId>postdischarge-manage</artifactId>
</dependency>
<!-- xml文件序列化和反序列化 -->
<dependency>
<groupId>org.simpleframework</groupId>
<artifactId>simple-xml</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -1,8 +1,13 @@
package com.xinelu.mobile.controller;
import com.xinelu.mobile.utils.WeChatAppletUtils;
import com.xinelu.mobile.utils.WeChatOfficialAccountUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @Description 测试controller
* @Author 纪寒
@ -12,5 +17,32 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/testMobile")
public class MobileTestController {
@Resource
private WeChatAppletUtils weChatAppletUtils;
@Resource
private WeChatOfficialAccountUtils weChatOfficialAccountUtils;
/**
* 测试获取微信小程序accessToken
*/
@GetMapping("/getAppletAcccessToken")
public String getAppletAccessToken() {
return weChatAppletUtils.getWeChatAppletAccessToken();
}
/**
* 测试获取微信公众号accessToken
*/
@GetMapping("/getOfficialAccountAccessToken")
public String getOfficialAccountAccessToken() {
return weChatOfficialAccountUtils.getWeChatOfficialAccountAccessToken();
}
/**
* 测试微信公众号模板消息发送
*/
@GetMapping("/sendOfficialAccountTemplate")
public void sendOfficialAccountTemplateMessage() {
weChatOfficialAccountUtils.sendOfficialAccountTemplateMessage();
}
}

View File

@ -0,0 +1,74 @@
package com.xinelu.mobile.controller.wechatappletcallback;
import com.xinelu.common.config.WeChatAppletChatConfig;
import com.xinelu.common.utils.aes.AesException;
import com.xinelu.common.utils.aes.WXBizMsgCrypt;
import com.xinelu.mobile.dto.wechatappletcallback.MessageSignDTO;
import com.xinelu.mobile.service.wechatappletcallback.WeChatAppletCallBackService;
import com.xinelu.mobile.utils.XmlUtil;
import com.xinelu.mobile.vo.wechatappletcallback.WeChatMessagePushVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Objects;
/**
* @Description 院后微信小程序事件回调控制器
* @Author 纪寒
* @Date 2024-03-21 10:20:32
* @Version 1.0
*/
@Slf4j
@RestController
@RequestMapping("/postDischarge/weChatAppletCallBack")
public class WeChatAppletCallBackController {
@Resource
private WeChatAppletChatConfig appletChatConfig;
@Resource
private WeChatAppletCallBackService weChatAppletCallBackService;
/**
* 微信小程序回调验证方法
*
* @param messageSignDTO 微信输入参数
* @return 解密后的字符串
* @throws AesException 异常信息
*/
@GetMapping
public String getWeChatAppletCallBack(MessageSignDTO messageSignDTO) throws AesException {
WXBizMsgCrypt wxCpt = new WXBizMsgCrypt(appletChatConfig.getToken(), appletChatConfig.getEncodingAesKey(), appletChatConfig.getAppletId());
String verifyMessage = wxCpt.verifyUrl(messageSignDTO.getSignature(), messageSignDTO.getTimestamp(), messageSignDTO.getNonce(), messageSignDTO.getEchostr());
log.info("院后微信小程序回调设置验证URL成功验证信息verifyMessage = [{}]", verifyMessage);
return verifyMessage;
}
/**
* 微信小程序消息推送事件回调POST处理
*
* @param signature 签名
* @param timestamp 时间戳
* @param nonce 随机字符串
* @param postData 消息体xml格式
*/
@PostMapping
public void handleWeChatAppletCallBack(@RequestParam("signature") String signature,
@RequestParam("timestamp") String timestamp,
@RequestParam("nonce") String nonce,
@RequestBody String postData) throws AesException {
WXBizMsgCrypt wxCpt = new WXBizMsgCrypt(appletChatConfig.getToken(), appletChatConfig.getEncodingAesKey(), appletChatConfig.getAppletId());
String decryptMsg = wxCpt.decryptMsg(signature, timestamp, nonce, postData);
WeChatMessagePushVO weChatMessagePushVO = (WeChatMessagePushVO) XmlUtil.fromXml(decryptMsg, WeChatMessagePushVO.class);
if (Objects.isNull(weChatMessagePushVO)) {
log.error("院后微信小程序xml数据转换失败请求信息为 [{}]", decryptMsg);
return;
}
if (StringUtils.isBlank(weChatMessagePushVO.getEvent()) || StringUtils.isBlank(weChatMessagePushVO.getMsgType())) {
return;
}
log.info("院后微信小程序消息推送回调执行,消息数据为: [{}]", weChatMessagePushVO);
weChatAppletCallBackService.handleWeChatAppletCallBack(weChatMessagePushVO);
}
}

View File

@ -0,0 +1,86 @@
package com.xinelu.mobile.controller.wechatofficialaccountcallback;
import com.xinelu.common.config.WeChatOfficialAccountConfig;
import com.xinelu.common.enums.OfficialAccountEventEnum;
import com.xinelu.common.utils.aes.AesException;
import com.xinelu.common.utils.aes.WXBizMsgCrypt;
import com.xinelu.mobile.dto.wechatappletcallback.MessageSignDTO;
import com.xinelu.mobile.service.wechatofficialaccountcallback.WeChatOfficialAccountCallbackService;
import com.xinelu.mobile.utils.XmlUtil;
import com.xinelu.mobile.vo.wechatofficialaccountcallback.WeChatOfficialAccountEventPushVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Objects;
/**
* @Description 院后微信公众号事件回调控制器
* @Author 纪寒
* @Date 2024-03-21 14:26:56
* @Version 1.0
*/
@Slf4j
@RestController
@RequestMapping("/postDischarge/officialAccountCallback")
public class WeChatOfficialAccountCallbackController {
@Resource
private WeChatOfficialAccountConfig weChatOfficialAccountConfig;
@Resource
private WeChatOfficialAccountCallbackService weChatOfficialAccountCallbackService;
/**
* 院后微信公众号回调验证方法
*
* @param messageSignDTO 微信输入参数
* @return 解密后的字符串
* @throws AesException 异常信息
*/
@GetMapping
public String getWeChatOfficialAccountCallBack(MessageSignDTO messageSignDTO) throws AesException {
//解密微信报文信息并验证微信公众号与服务器之间是否正常通信
WXBizMsgCrypt wxCpt = new WXBizMsgCrypt(weChatOfficialAccountConfig.getOfficialAccountToken(), weChatOfficialAccountConfig.getOfficialAccountEncodingAesKey(), weChatOfficialAccountConfig.getOfficialAccountAppId());
String verifyMessage = wxCpt.verifyUrl(messageSignDTO.getSignature(), messageSignDTO.getTimestamp(), messageSignDTO.getNonce(), messageSignDTO.getEchostr());
log.info("院后微信公众号回调设置验证URL成功验证信息verifyMessage = [{}]", verifyMessage);
return verifyMessage;
}
/**
* 院后微信公众号模板消息事件回调处理
*
* @param signature 签名
* @param timestamp 时间戳
* @param nonce 随机字符串
* @param postData 事件报文内容
* @throws AesException 异常信息
*/
@PostMapping
public void handleWeChatOfficialAccountCallBack(@RequestParam("signature") String signature,
@RequestParam("timestamp") String timestamp,
@RequestParam("nonce") String nonce,
@RequestBody String postData) throws AesException {
//解密微信报文信息并验证微信公众号与服务器之间是否正常通信
WXBizMsgCrypt wxCpt = new WXBizMsgCrypt(weChatOfficialAccountConfig.getOfficialAccountToken(), weChatOfficialAccountConfig.getOfficialAccountEncodingAesKey(), weChatOfficialAccountConfig.getOfficialAccountAppId());
String verifyMessage = wxCpt.verifyUrl(signature, timestamp, nonce, postData);
WeChatOfficialAccountEventPushVO eventPush = (WeChatOfficialAccountEventPushVO) XmlUtil.fromXml(verifyMessage, WeChatOfficialAccountEventPushVO.class);
if (Objects.isNull(eventPush)) {
log.info("院后微信公众号模板消息事件xml数据转换失败请求信息为 [{}]", verifyMessage);
return;
}
if (StringUtils.isBlank(eventPush.getToUserName()) || StringUtils.isBlank(eventPush.getEvent()) || StringUtils.isBlank(eventPush.getMsgType())) {
log.info("院后微信公众号模板消息事件解析事件数据为空!");
return;
}
//微信模板公众号消息事件
if (OfficialAccountEventEnum.TEMPLATESENDJOBFINISH.getInfo().equals(eventPush.getEvent())) {
weChatOfficialAccountCallbackService.handleOfficialAccountTemplateEvent(eventPush);
}
//微信公众号关注和取消事件
if (OfficialAccountEventEnum.SUBSCRIBE.getInfo().equals(eventPush.getEvent()) ||
OfficialAccountEventEnum.UNSUBSCRIBE.getInfo().equals(eventPush.getEvent())) {
weChatOfficialAccountCallbackService.handleOfficialAccountSubscribeEvent(eventPush);
}
}
}

View File

@ -0,0 +1,40 @@
package com.xinelu.mobile.dto.wechatappletcallback;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 消息验证实体类
* @Author 纪寒
* @Date 2024-03-21 10:09:01
* @Version 1.0
*/
@Data
public class MessageSignDTO implements Serializable {
private static final long serialVersionUID = 357274374767303359L;
/**
* 微信小程序签名
*/
private String signature;
/**
* 时间戳
*/
private String timestamp;
/**
* 随机字符串
*/
private String nonce;
/**
* 加密的字符串
*/
private String echostr;
/**
* 回调数据包xml格式
*/
private String postData;
}

View File

@ -1,4 +1,4 @@
package com.xinelu.mobile.mapper;
package com.xinelu.mobile.mapper.mobiletest;
/**
* @Description 测试 Mapper

View File

@ -0,0 +1,19 @@
package com.xinelu.mobile.service.wechatappletcallback;
import com.xinelu.mobile.vo.wechatappletcallback.WeChatMessagePushVO;
/**
* @Description 微信小程序事件回调业务层
* @Author 纪寒
* @Date 2024-03-15 15:45:50
* @Version 1.0
*/
public interface WeChatAppletCallBackService {
/**
* 微信小程序消息推送事件回调POST处理
*
* @param weChatMessagePushVO 请求参数
*/
void handleWeChatAppletCallBack(WeChatMessagePushVO weChatMessagePushVO);
}

View File

@ -0,0 +1,278 @@
package com.xinelu.mobile.service.wechatappletcallback.impl;
import com.xinelu.common.config.WeChatAppletChatConfig;
import com.xinelu.common.enums.SubscribeMessageTypeEnum;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.DateUtils;
import com.xinelu.manage.domain.patientinfo.PatientInfo;
import com.xinelu.manage.domain.subscribemessagerecord.SubscribeMessageRecord;
import com.xinelu.manage.domain.subscribemessagesendrecord.SubscribeMessageSendRecord;
import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper;
import com.xinelu.manage.mapper.subscribemessagerecord.SubscribeMessageRecordMapper;
import com.xinelu.manage.mapper.subscribemessagesendrecord.SubscribeMessageSendRecordMapper;
import com.xinelu.mobile.service.wechatappletcallback.WeChatAppletCallBackService;
import com.xinelu.mobile.vo.wechatappletcallback.WeChatMessagePushVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @Description 微信小程序事件回调业务层实现类
* @Author 纪寒
* @Date 2024-03-19 17:13:06
* @Version 1.0
*/
@Service
@Slf4j
public class WeChatAppletCallBackServiceImpl implements WeChatAppletCallBackService {
@Resource
private SubscribeMessageRecordMapper subscribeMessageRecordMapper;
@Resource
private WeChatAppletChatConfig appletChatConfig;
@Resource
private PatientInfoMapper patientInfoMapper;
@Resource
private SubscribeMessageSendRecordMapper subscribeMessageSendRecordMapper;
/**
* 微信消息推送变更事件标识
*/
private static final String SUBSCRIBE_MSG_CHANGE_EVENT = "subscribe_msg_change_event";
/**
* 微信消息推送订阅事件标识
*/
private static final String SUBSCRIBE_MSG_POPUP_EVENT = "subscribe_msg_popup_event";
/**
* 微信消息推送发送结果事件标识
*/
private static final String SUBSCRIBE_MSG__SENT_EVENT = "subscribe_msg_sent_event";
/**
* 微信小程序消息推送事件回调POST处理
*
* @param weChatMessagePushVO 请求参数
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void handleWeChatAppletCallBack(WeChatMessagePushVO weChatMessagePushVO) {
if (weChatMessagePushVO.getEvent().equals(SUBSCRIBE_MSG_POPUP_EVENT)) {
//处理用户订阅授权事件
this.handleSubscribeMsgPopupEvent(weChatMessagePushVO);
}
if (weChatMessagePushVO.getEvent().equals(SUBSCRIBE_MSG_CHANGE_EVENT)) {
//处理订阅消息变更事件
this.handleSubscribeMsgChangeEvent(weChatMessagePushVO);
}
if (weChatMessagePushVO.getEvent().equals(SUBSCRIBE_MSG__SENT_EVENT)) {
//处理订阅消息发送结果事件
this.handleSubscribeMsgSentEvent(weChatMessagePushVO);
}
}
/**
* 处理用户订阅授权事件
*
* @param weChatMessagePushVO 参数信息
*/
private void handleSubscribeMsgPopupEvent(WeChatMessagePushVO weChatMessagePushVO) {
//处理订阅消息授权事件
if (Objects.isNull(weChatMessagePushVO.getSubscribeMsgPopupEvent()) || CollectionUtils.isEmpty(weChatMessagePushVO.getSubscribeMsgPopupEvent().getSubscribeMsgPopupEventList())) {
return;
}
//查询用户信息表
PatientInfo patientInfo = patientInfoMapper.getPatientInfoByOpenId(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
//组装数据
List<SubscribeMessageRecord> subscribeMessageRecordList = createSubscribeMessageRecordList(patientInfo, weChatMessagePushVO, SUBSCRIBE_MSG_POPUP_EVENT);
if (CollectionUtils.isEmpty(subscribeMessageRecordList)) {
return;
}
//根据openid查询数据库原有的订阅消息记录
SubscribeMessageRecord subscribeMessageRecord = new SubscribeMessageRecord();
subscribeMessageRecord.setOpenid(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
List<SubscribeMessageRecord> existMessageRecordList = subscribeMessageRecordMapper.selectSubscribeMessageRecordList(subscribeMessageRecord);
List<SubscribeMessageRecord> subtractSubscribeList = new ArrayList<>(CollectionUtils.subtract(subscribeMessageRecordList, existMessageRecordList));
if (CollectionUtils.isNotEmpty(subtractSubscribeList)) {
//新增订阅记录信息
int insertCount = subscribeMessageRecordMapper.insertSubscribeMessageRecordList(subtractSubscribeList);
if (insertCount <= 0) {
log.error("微信订阅消息回调,新增用户订阅消息记录失败,记录信息为:[{}]", subtractSubscribeList);
throw new ServiceException("微信订阅消息回调,新增用户订阅消息记录失败!");
}
}
List<SubscribeMessageRecord> intersectionSubscribeList = new ArrayList<>(CollectionUtils.intersection(subscribeMessageRecordList, existMessageRecordList));
if (CollectionUtils.isNotEmpty(intersectionSubscribeList)) {
//修改订阅信息状态
for (SubscribeMessageRecord messageRecord : intersectionSubscribeList) {
Long patientId = null;
if (Objects.nonNull(patientInfo) && Objects.nonNull(patientInfo.getId())) {
patientId = patientInfo.getId();
}
String openId = StringUtils.isBlank(messageRecord.getOpenid()) ? "" : messageRecord.getOpenid();
String templateId = StringUtils.isBlank(messageRecord.getTemplateId()) ? "" : messageRecord.getTemplateId();
String subscribeStatus = StringUtils.isBlank(messageRecord.getSubscribeStatus()) ? "" : messageRecord.getSubscribeStatus();
subscribeMessageRecordMapper.updateSubscribeMessageTemplateId(openId, templateId, subscribeStatus, patientId);
}
}
}
/**
* 处理订阅消息变更事件
*
* @param weChatMessagePushVO 信息
*/
private void handleSubscribeMsgChangeEvent(WeChatMessagePushVO weChatMessagePushVO) {
if (Objects.isNull(weChatMessagePushVO.getSubscribeMsgChangeEvent()) || CollectionUtils.isEmpty(weChatMessagePushVO.getSubscribeMsgChangeEvent().getSubscribeMsgPopupEventList())) {
return;
}
//查询用户信息表
PatientInfo patientInfo = patientInfoMapper.getPatientInfoByOpenId(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
//组装数据
List<SubscribeMessageRecord> subscribeMessageRecordList = createSubscribeMessageRecordList(patientInfo, weChatMessagePushVO, SUBSCRIBE_MSG_CHANGE_EVENT);
if (CollectionUtils.isEmpty(subscribeMessageRecordList)) {
return;
}
//根据openid查询数据库原有的订阅消息记录
SubscribeMessageRecord subscribeMessageRecord = new SubscribeMessageRecord();
subscribeMessageRecord.setOpenid(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
List<SubscribeMessageRecord> existMessageRecordList = subscribeMessageRecordMapper.selectSubscribeMessageRecordList(subscribeMessageRecord);
List<SubscribeMessageRecord> intersectionSubscribeList = new ArrayList<>(CollectionUtils.intersection(subscribeMessageRecordList, existMessageRecordList));
if (CollectionUtils.isNotEmpty(intersectionSubscribeList)) {
//修改订阅信息状态
for (SubscribeMessageRecord messageRecord : intersectionSubscribeList) {
Long patientId = null;
if (Objects.nonNull(patientInfo) && Objects.nonNull(patientInfo.getId())) {
patientId = patientInfo.getId();
}
String openId = StringUtils.isBlank(messageRecord.getOpenid()) ? "" : messageRecord.getOpenid();
String templateId = StringUtils.isBlank(messageRecord.getTemplateId()) ? "" : messageRecord.getTemplateId();
String subscribeStatus = StringUtils.isBlank(messageRecord.getSubscribeStatus()) ? "" : messageRecord.getSubscribeStatus();
subscribeMessageRecordMapper.updateSubscribeMessageTemplateId(openId, templateId, subscribeStatus, patientId);
}
}
}
/**
* 处理订阅消息发送结果事件
*
* @param weChatMessagePushVO 信息
*/
private void handleSubscribeMsgSentEvent(WeChatMessagePushVO weChatMessagePushVO) {
if (Objects.isNull(weChatMessagePushVO.getSubscribeMsgSentEvent()) || CollectionUtils.isEmpty(weChatMessagePushVO.getSubscribeMsgSentEvent().getSubscribeMsgSentEventList())) {
return;
}
//组装数据
List<SubscribeMessageSendRecord> subscribeMessageSendRecordList = createSubscribeMessageSendRecordList(weChatMessagePushVO);
if (CollectionUtils.isNotEmpty(subscribeMessageSendRecordList)) {
int insertCount = subscribeMessageSendRecordMapper.insertSubscribeMessageSendRecordList(subscribeMessageSendRecordList);
if (insertCount <= 0) {
log.error("微信订阅消息回调,新增用户订阅消息发送记录失败,记录信息为:[{}]", subscribeMessageSendRecordList);
throw new ServiceException("微信订阅消息回调,新增用户订阅消息发送记录失败!");
}
}
}
/**
* 组装订阅消息数据
*
* @param patientInfo 会员用户信息
* @param weChatMessagePushVO 微信请求参数信息
* @param eventType 事件类型
* @return List<SubscribeMessageRecord>
*/
private List<SubscribeMessageRecord> createSubscribeMessageRecordList(PatientInfo patientInfo, WeChatMessagePushVO weChatMessagePushVO, String eventType) {
List<SubscribeMessageRecord> subscribeMessageRecordList = Lists.newArrayList();
if (SUBSCRIBE_MSG_POPUP_EVENT.equals(eventType)) {
subscribeMessageRecordList = weChatMessagePushVO.getSubscribeMsgPopupEvent().getSubscribeMsgPopupEventList().stream().filter(Objects::nonNull).map(item -> {
SubscribeMessageRecord subscribe = new SubscribeMessageRecord();
if (Objects.nonNull(patientInfo) && Objects.nonNull(patientInfo.getId())) {
subscribe.setPatientId(patientInfo.getId());
}
//此处模板通知需要根据实际情况进行修改
subscribe.setOpenid(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
subscribe.setAppletId(StringUtils.isBlank(weChatMessagePushVO.getToUserName()) ? "" : weChatMessagePushVO.getToUserName());
subscribe.setTemplateId(StringUtils.isBlank(item.getTemplateId()) ? "" : item.getTemplateId());
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getCouponReceiveTemplateId().equals(item.getTemplateId())) {
subscribe.setMessageType(SubscribeMessageTypeEnum.COUPON_RECEIVE_MESSAGE_PUSH.getInfo());
}
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getAppointOrderTemplateId().equals(item.getTemplateId())) {
subscribe.setMessageType(SubscribeMessageTypeEnum.APPOINT_ORDER_MESSAGE_PUSH.getInfo());
}
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getGoodsOrderTemplateId().equals(item.getTemplateId())) {
subscribe.setMessageType(SubscribeMessageTypeEnum.GOODS_ORDER_MESSAGE_PUSH.getInfo());
}
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getSignTemplateId().equals(item.getTemplateId())) {
subscribe.setMessageType(SubscribeMessageTypeEnum.SIGN_MESSAGE_PUSH.getInfo());
}
subscribe.setSubscribeCount(1);
subscribe.setSubscribeTime(StringUtils.isBlank(weChatMessagePushVO.getCreateTime()) ? null : DateUtils.timestampToLocalDateTime(Long.parseLong(weChatMessagePushVO.getCreateTime()) * 1000L));
subscribe.setCreateTime(LocalDateTime.now());
subscribe.setSubscribeStatus(StringUtils.isBlank(item.getSubscribeStatusString()) ? "" : item.getSubscribeStatusString());
return subscribe;
}).collect(Collectors.toList());
}
if (SUBSCRIBE_MSG_CHANGE_EVENT.equals(eventType)) {
subscribeMessageRecordList = weChatMessagePushVO.getSubscribeMsgChangeEvent().getSubscribeMsgPopupEventList().stream().filter(Objects::nonNull).map(item -> {
SubscribeMessageRecord subscribe = new SubscribeMessageRecord();
if (Objects.nonNull(patientInfo) && Objects.nonNull(patientInfo.getId())) {
subscribe.setPatientId(patientInfo.getId());
}
//此处模板通知需要根据实际情况进行修改
subscribe.setOpenid(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
subscribe.setAppletId(StringUtils.isBlank(weChatMessagePushVO.getToUserName()) ? "" : weChatMessagePushVO.getToUserName());
subscribe.setTemplateId(StringUtils.isBlank(item.getTemplateId()) ? "" : item.getTemplateId());
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getCouponReceiveTemplateId().equals(item.getTemplateId())) {
subscribe.setMessageType(SubscribeMessageTypeEnum.COUPON_RECEIVE_MESSAGE_PUSH.getInfo());
}
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getAppointOrderTemplateId().equals(item.getTemplateId())) {
subscribe.setMessageType(SubscribeMessageTypeEnum.APPOINT_ORDER_MESSAGE_PUSH.getInfo());
}
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getGoodsOrderTemplateId().equals(item.getTemplateId())) {
subscribe.setMessageType(SubscribeMessageTypeEnum.GOODS_ORDER_MESSAGE_PUSH.getInfo());
}
if (StringUtils.isNotBlank(item.getTemplateId()) && appletChatConfig.getSignTemplateId().equals(item.getTemplateId())) {
subscribe.setMessageType(SubscribeMessageTypeEnum.SIGN_MESSAGE_PUSH.getInfo());
}
subscribe.setSubscribeCount(1);
subscribe.setSubscribeTime(StringUtils.isBlank(weChatMessagePushVO.getCreateTime()) ? null : DateUtils.timestampToLocalDateTime(Long.parseLong(weChatMessagePushVO.getCreateTime()) * 1000L));
subscribe.setCreateTime(LocalDateTime.now());
subscribe.setSubscribeStatus(StringUtils.isBlank(item.getSubscribeStatusString()) ? "" : item.getSubscribeStatusString());
return subscribe;
}).collect(Collectors.toList());
}
return subscribeMessageRecordList;
}
/**
* 组装订阅消息发送结果数据
*
* @param weChatMessagePushVO 微信请求参数信息
* @return List<SubscribeMessageSendRecord>
*/
private List<SubscribeMessageSendRecord> createSubscribeMessageSendRecordList(WeChatMessagePushVO weChatMessagePushVO) {
return weChatMessagePushVO.getSubscribeMsgSentEvent().getSubscribeMsgSentEventList().stream().map(item -> {
SubscribeMessageSendRecord sendRecord = new SubscribeMessageSendRecord();
sendRecord.setOpenid(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
sendRecord.setAppletId(StringUtils.isBlank(weChatMessagePushVO.getToUserName()) ? "" : weChatMessagePushVO.getToUserName());
sendRecord.setTemplateId(StringUtils.isBlank(item.getTemplateId()) ? "" : item.getTemplateId());
sendRecord.setMessageType(StringUtils.isBlank(weChatMessagePushVO.getMsgType()) ? "" : weChatMessagePushVO.getMsgType());
sendRecord.setMsgId(StringUtils.isBlank(item.getMsgId()) ? "" : item.getMsgId());
sendRecord.setSubscribeTime(StringUtils.isBlank(weChatMessagePushVO.getCreateTime()) ? null : DateUtils.timestampToLocalDateTime(Long.parseLong(weChatMessagePushVO.getCreateTime()) * 1000L));
sendRecord.setCreateTime(LocalDateTime.now());
sendRecord.setErrorStatus(StringUtils.isBlank(item.getErrorStatus()) ? "" : item.getErrorStatus());
sendRecord.setErrorCode(StringUtils.isBlank(item.getErrorCode()) ? null : Integer.parseInt(item.getErrorCode()));
return sendRecord;
}).collect(Collectors.toList());
}
}

View File

@ -0,0 +1,25 @@
package com.xinelu.mobile.service.wechatofficialaccountcallback;
import com.xinelu.mobile.vo.wechatofficialaccountcallback.WeChatOfficialAccountEventPushVO;
/**
* @Description 院后微信公众号事件回调service
* @Author 纪寒
* @Date 2024-03-25 14:52:03
* @Version 1.0
*/
public interface WeChatOfficialAccountCallbackService {
/**
* 院后微信公众号模板消息事件回调处理
*
* @param eventPushVO 模板消息事件回调数据
*/
void handleOfficialAccountTemplateEvent(WeChatOfficialAccountEventPushVO eventPushVO);
/**
* 院后微信公众号取消和关注事件回调处理
*
* @param eventPushVO 公众号取消和关注事件回调数据
*/
void handleOfficialAccountSubscribeEvent(WeChatOfficialAccountEventPushVO eventPushVO);
}

View File

@ -0,0 +1,133 @@
package com.xinelu.mobile.service.wechatofficialaccountcallback.impl;
import com.xinelu.common.enums.OfficialAccountEventEnum;
import com.xinelu.common.enums.SubscribeStatusEnum;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.DateUtils;
import com.xinelu.manage.domain.officialaccountsubscribeevent.OfficialAccountSubscribeEvent;
import com.xinelu.manage.domain.officialaccounttemplateevent.OfficialAccountTemplateEvent;
import com.xinelu.manage.domain.patientinfo.PatientInfo;
import com.xinelu.manage.mapper.officialaccountsubscribeevent.OfficialAccountSubscribeEventMapper;
import com.xinelu.manage.mapper.officialaccounttemplateevent.OfficialAccountTemplateEventMapper;
import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper;
import com.xinelu.mobile.service.wechatofficialaccountcallback.WeChatOfficialAccountCallbackService;
import com.xinelu.mobile.vo.wechatofficialaccountcallback.WeChatOfficialAccountEventPushVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.Objects;
/**
* @Description 院后微信公众号事件回调service实现
* @Author 纪寒
* @Date 2024-03-25 14:55:53
* @Version 1.0
*/
@Service
@Slf4j
public class WeChatOfficialAccountCallbackServiceImpl implements WeChatOfficialAccountCallbackService {
@Resource
private PatientInfoMapper patientInfoMapper;
@Resource
private OfficialAccountTemplateEventMapper officialAccountTemplateEventMapper;
@Resource
private OfficialAccountSubscribeEventMapper officialAccountSubscribeEventMapper;
/**
* 院后微信公众号模板消息事件回调处理
*
* @param eventPushVO 模板消息事件回调数据
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void handleOfficialAccountTemplateEvent(WeChatOfficialAccountEventPushVO eventPushVO) {
//查询患者信息
PatientInfo patientInfo = patientInfoMapper.getPatientInfoByOpenId(eventPushVO.getFromUserName());
if (Objects.isNull(patientInfo)) {
log.info("当前患者信息不存在微信用户openid为{}", eventPushVO.getFromUserName());
return;
}
OfficialAccountTemplateEvent templateEvent = new OfficialAccountTemplateEvent();
templateEvent.setPatientId(Objects.isNull(patientInfo.getId()) ? null : patientInfo.getId());
templateEvent.setPatientName(StringUtils.isBlank(patientInfo.getPatientName()) ? "" : patientInfo.getPatientName());
templateEvent.setOpenid(eventPushVO.getFromUserName());
templateEvent.setOfficialAccountAppId(StringUtils.isBlank(eventPushVO.getToUserName()) ? "" : eventPushVO.getToUserName());
templateEvent.setSendTime(StringUtils.isBlank(eventPushVO.getCreateTime()) ? null : DateUtils.timestampToLocalDateTime(Long.parseLong(eventPushVO.getCreateTime()) * 1000L));
templateEvent.setMsgType(StringUtils.isBlank(eventPushVO.getMsgType()) ? "" : eventPushVO.getMsgType());
templateEvent.setEventType(StringUtils.isBlank(eventPushVO.getEvent()) ? "" : eventPushVO.getEvent());
templateEvent.setMsgId(StringUtils.isBlank(eventPushVO.getMsgId()) ? "" : eventPushVO.getMsgId());
templateEvent.setStatus(StringUtils.isBlank(eventPushVO.getStatus()) ? "" : eventPushVO.getStatus());
templateEvent.setCreateTime(LocalDateTime.now());
templateEvent.setCreateBy("xinyilu");
int insertTemplateEventCount = officialAccountTemplateEventMapper.insertOfficialAccountTemplateEvent(templateEvent);
if (insertTemplateEventCount < 0) {
log.error("院后微信公众号模板事件推送,新增模板事件消息信息失败,信息为:[{}]", templateEvent);
throw new ServiceException("院后微信公众号模板事件推送记录信息失败!");
}
log.info("院后微信公众号模板事件推送处理成功!");
}
/**
* 院后微信公众号取消和关注事件回调处理
*
* @param eventPushVO 公众号取消和关注事件回调数据
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void handleOfficialAccountSubscribeEvent(WeChatOfficialAccountEventPushVO eventPushVO) {
//关注公众号事件
if (OfficialAccountEventEnum.SUBSCRIBE.getInfo().equals(eventPushVO.getEvent())) {
handleSubscribeEventInfo(eventPushVO, SubscribeStatusEnum.accept.getValue());
}
//取消关注公众号事件
if (OfficialAccountEventEnum.UNSUBSCRIBE.getInfo().equals(eventPushVO.getEvent())) {
handleSubscribeEventInfo(eventPushVO, SubscribeStatusEnum.rejet.getValue());
}
}
/**
* 处理公众号订阅信息
*
* @param eventPushVO 公众号取消和关注事件回调数据
* @param subscribeStatus 订阅状态
*/
private void handleSubscribeEventInfo(WeChatOfficialAccountEventPushVO eventPushVO, String subscribeStatus) {
int subscribeEventCount = officialAccountSubscribeEventMapper.getSubscribeEventInfo(eventPushVO.getFromUserName());
if (subscribeEventCount == 0) {
//没有订阅过直接新增
OfficialAccountSubscribeEvent subscribeEvent = new OfficialAccountSubscribeEvent();
subscribeEvent.setOpenid(eventPushVO.getFromUserName());
subscribeEvent.setOfficialAccountAppId(StringUtils.isBlank(eventPushVO.getToUserName()) ? "" : eventPushVO.getToUserName());
subscribeEvent.setSendTime(StringUtils.isBlank(eventPushVO.getCreateTime()) ? null : DateUtils.timestampToLocalDateTime(Long.parseLong(eventPushVO.getCreateTime()) * 1000L));
subscribeEvent.setMsgType(StringUtils.isBlank(eventPushVO.getMsgType()) ? "" : eventPushVO.getMsgType());
subscribeEvent.setEventType(StringUtils.isBlank(eventPushVO.getEvent()) ? "" : eventPushVO.getEvent());
subscribeEvent.setSubscribeStatus(subscribeStatus);
subscribeEvent.setCreateTime(LocalDateTime.now());
subscribeEvent.setCreateBy("xinyilu");
int insertSubscribeEvent = officialAccountSubscribeEventMapper.insertOfficialAccountSubscribeEvent(subscribeEvent);
if (insertSubscribeEvent < 0) {
log.error("院后微信公众号关注和取消事件,新增信息失败,信息为:[{}]", subscribeEvent);
throw new ServiceException("新增院后微信公众号关注和取消事件信息失败!");
}
} else {
//订阅过修改
OfficialAccountSubscribeEvent subscribeEvent = new OfficialAccountSubscribeEvent();
subscribeEvent.setOpenid(eventPushVO.getFromUserName());
subscribeEvent.setSendTime(StringUtils.isBlank(eventPushVO.getCreateTime()) ? null : DateUtils.timestampToLocalDateTime(Long.parseLong(eventPushVO.getCreateTime()) * 1000L));
subscribeEvent.setEventType(StringUtils.isBlank(eventPushVO.getEvent()) ? "" : eventPushVO.getEvent());
subscribeEvent.setSubscribeStatus(subscribeStatus);
subscribeEvent.setUpdateTime(LocalDateTime.now());
subscribeEvent.setUpdateBy("xinyilu");
int updateSubscribeEvent = officialAccountSubscribeEventMapper.updateSubscribeEventInfo(subscribeEvent);
if (updateSubscribeEvent < 0) {
log.error("院后微信公众号关注和取消事件,修改信息失败,信息为:[{}]", subscribeEvent);
throw new ServiceException("修改院后微信公众号关注和取消事件信息失败!");
}
}
}
}

View File

@ -0,0 +1,71 @@
package com.xinelu.mobile.utils;
import com.alibaba.fastjson2.JSON;
import com.xinelu.common.config.WeChatAppletChatConfig;
import com.xinelu.common.constant.Constants;
import com.xinelu.common.entity.AccessToken;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.http.HttpUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
/**
* @Description 院后微信小程序公共方法工具类
* @Author 纪寒
* @Date 2024-03-21 13:41:08
* @Version 1.0
*/
@Component
public class WeChatAppletUtils {
@Resource
private RedisTemplate<String, Object> redisTemplate;
@Resource
private WeChatAppletChatConfig weChatAppletChatConfig;
/**
* 返回成功状态码
*/
private static final int SUCCESS_CODE = 0;
/**
* 获取微信小程序的accessToken值
*
* @return 小程序accessToken值
*/
public String getWeChatAppletAccessToken() {
String accessToken;
String accessTokenRedisKey = Constants.WE_CHAT_APPLET_ACCESS_TOKEN + "accessToken";
//从Redis中取出accessToken
Object object = redisTemplate.opsForValue().get(accessTokenRedisKey);
if (Objects.isNull(object)) {
//没有获取accessToken
String accessTokenUrl = Constants.WE_CHAT_ACCESS_TOKEN_URL + "&appid=" + weChatAppletChatConfig.getAppletId() + "&secret=" + weChatAppletChatConfig.getSecret();
//发送请求
String result = HttpUtils.sendGet(accessTokenUrl);
if (StringUtils.isBlank(result)) {
throw new ServiceException("获取微信小程序accessToken信息失败", 201);
}
AccessToken weAppletAccessToken = JSON.parseObject(result, AccessToken.class);
if (Objects.isNull(weAppletAccessToken)) {
throw new ServiceException("获取微信小程序accessToken信息失败");
}
if (Objects.nonNull(weAppletAccessToken.getErrcode()) && weAppletAccessToken.getErrcode() != SUCCESS_CODE) {
throw new ServiceException("获取微信小程序accessToken信息失败失败信息为" + weAppletAccessToken.getErrmsg(), 201);
}
if (StringUtils.isBlank(weAppletAccessToken.getAccessToken())) {
throw new ServiceException("微信小程序accessToken信息为空");
}
accessToken = weAppletAccessToken.getAccessToken();
//存入Redis中
redisTemplate.opsForValue().set(accessTokenRedisKey, accessToken, 3600, TimeUnit.SECONDS);
} else {
accessToken = (String) object;
}
return accessToken;
}
}

Some files were not shown because too many files have changed in this diff Show More