Merge branch '0418_小程序开发' of http://182.92.166.109:3000/zhuangyuanke/PostDischargePatientManage into 0418_小程序开发

This commit is contained in:
haown 2024-07-08 10:22:44 +08:00
commit 64e904fc44
26 changed files with 221 additions and 146 deletions

View File

@ -11,18 +11,12 @@ import com.xinelu.manage.dto.labelfieldcontent.LabelFieldContentAddDTO;
import com.xinelu.manage.service.labelfieldcontent.ILabelFieldContentService;
import com.xinelu.manage.vo.labelfieldcontent.LabelField;
import com.xinelu.manage.vo.labelfieldcontent.LabelFieldAndPartitionDict;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 标签字段内容信息Controller
@ -102,8 +96,8 @@ public class LabelFieldContentController extends BaseController {
* 分组信息
*/
@GetMapping("/groupingContent")
public AjaxResult groupingContent() {
return labelFieldContentService.groupingContent();
public AjaxResult groupingContent(Long patientId) {
return labelFieldContentService.groupingContent(patientId);
}
/**

View File

@ -7,12 +7,12 @@ 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;
import java.util.Objects;
/**
* 微信小程序订阅消息记录对象 subscribe_message_record
@ -23,7 +23,6 @@ import java.time.LocalDateTime;
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "微信小程序订阅消息记录对象", description = "subscribe_message_record")
public class SubscribeMessageRecord extends BaseEntity {
private static final long serialVersionUID = 1L;
@ -105,6 +104,24 @@ public class SubscribeMessageRecord extends BaseEntity {
private String subscribeStatus;
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SubscribeMessageRecord that = (SubscribeMessageRecord) o;
return Objects.equals(openid, that.openid) && Objects.equals(templateId, that.templateId);
}
@Override
public int hashCode() {
return Objects.hash(openid, templateId);
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -1,8 +1,12 @@
package com.xinelu.manage.dto.manualfollowup;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinelu.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate;
@ -14,7 +18,11 @@ import java.time.LocalDate;
* @date : 2024/4/2 10:36
*/
@Data
public class ManualFollowUpDTO {
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class ManualFollowUpDTO extends BaseEntity {
private static final long serialVersionUID = 1L;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "随访开始时间")
@ -44,42 +52,12 @@ public class ManualFollowUpDTO {
@ApiModelProperty(value = "所属病区id")
private Long wardId;
@ApiModelProperty(value = "适用范围在院IN_THE_HOSPITAL出院DISCHARGE门诊OUTPATIENT_SERVICE")
private String suitRange;
@ApiModelProperty(value = "就诊方式门诊OUTPATIENT_SERVICE住院BE_IN_HOSPITAL")
private String visitMethod;
@ApiModelProperty(value = "就诊流水号")
private String visitSerialNumber;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "入院开始时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate admissionStartTime;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "入院结束时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate admissionEndTime;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "门诊(门诊患者)开始时间")
private LocalDate clinicalStartTime;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "门诊(门诊患者)结束时间")
private LocalDate clinicalEndTime;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "出院时间(出院患者)开始时间")
private LocalDate dischargeStartTime;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "出院时间(出院患者)结束时间")
private LocalDate dischargeEndTime;
@ApiModelProperty(value = "主要诊断")
private String mainDiagnosis;
@ -92,5 +70,8 @@ public class ManualFollowUpDTO {
@ApiModelProperty(value = "节点任务执行状态已执行EXECUTED未执行UNEXECUTED")
private String nodeExecuteStatus;
@ApiModelProperty(value = "任务名称")
private String manageRouteName;
}

View File

@ -116,4 +116,13 @@ public interface LabelFieldContentMapper {
* @return int
*/
int updateContentRemarkLabelFieldContentList(List<GroupingValue> labelFieldContentList);
/**
* 查询画像sn
*
* @param taskPartitionDictIds 细分id
* @param patientId 患者id
* @return LabelFieldContent
*/
List<LabelFieldContent> selectLabelFieldContentPortraitSn(@Param("taskPartitionDictIds") List<Long> taskPartitionDictIds, @Param("patientId") Long patientId);
}

View File

@ -1,6 +1,7 @@
package com.xinelu.manage.mapper.patientinfo;
import com.xinelu.manage.domain.patientinfo.PatientInfo;
import com.xinelu.manage.domain.residentinfo.ResidentInfo;
import com.xinelu.manage.dto.patientinfo.PatientInfoDto;
import com.xinelu.manage.vo.patientinfo.PatientBaseInfoVo;
import java.util.List;
@ -82,5 +83,5 @@ public interface PatientInfoMapper {
* @param openId 微信openId
* @return 被护理人基本信息
*/
PatientInfo getPatientInfoByOpenId(String openId);
ResidentInfo getPatientInfoByOpenId(String openId);
}

View File

@ -93,6 +93,13 @@ public interface SignPatientManageRouteNodeMapper {
*/
List<PatientTaskVo> selectPatientTaskList(PatientTaskDto patientTaskDto);
/**
* 查询个人任务消息
*
* @param residentId 用户id
* @param nodeExecuteStatus 状态
* @return SignPatientManageRouteNode
*/
List<SignPatientManageRouteNode> selectManageRouteByResidentId(@Param("residentId") Long residentId, @Param("nodeExecuteStatus") String nodeExecuteStatus);
String selectNodeContent(Long manageRouteNodeId);

View File

@ -72,7 +72,7 @@ public interface ILabelFieldContentService {
*
* @return LabelFieldInfo
*/
AjaxResult groupingContent();
AjaxResult groupingContent(Long patientId);
/**
* 画像查询

View File

@ -171,7 +171,7 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService {
* @return LabelFieldInfo
*/
@Override
public AjaxResult groupingContent() {
public AjaxResult groupingContent(Long patientId) {
//创建全部选项 TaskPartitionDictId =0为全部
List<LabelFieldInfo> labelFieldInfoList = new ArrayList<>();
LabelFieldInfo labelFieldInfo = new LabelFieldInfo();
@ -181,12 +181,20 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService {
//任务细分表数据
List<LabelFieldInfo> labelFieldInfos = labelFieldInfoMapper.taskPartitionDictIdList();
if (CollectionUtils.isNotEmpty(labelFieldInfos)) {
List<Long> collect = labelFieldInfos.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getTaskPartitionDictId())).map(LabelFieldInfo::getTaskPartitionDictId).distinct().collect(Collectors.toList());
List<LabelFieldContent> labelFieldContents = labelFieldContentMapper.selectLabelFieldContentPortraitSn(collect,patientId);
if (CollectionUtils.isNotEmpty(labelFieldContents)) {
for (LabelFieldInfo fieldInfo : labelFieldInfos) {
List<String> collect1 = labelFieldContents.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getFieldId()) && fieldInfo.getTaskPartitionDictId().equals(item.getFieldId())).map(LabelFieldContent::getPortraitSn).distinct().collect(Collectors.toList());
fieldInfo.setFieldSort(collect1.size());
}
}
labelFieldInfoList.addAll(labelFieldInfos);
}
//未分组选项 TaskPartitionDictId =null 为未分组
LabelFieldInfo labelFieldInfoTow = new LabelFieldInfo();
labelFieldInfoTow.setTaskPartitionDictName("未分组");
labelFieldInfoList.add(labelFieldInfoTow);
LabelFieldInfo labelFieldInfoTwo = new LabelFieldInfo();
labelFieldInfoTwo.setTaskPartitionDictName("未分组");
labelFieldInfoList.add(labelFieldInfoTwo);
return AjaxResult.success(labelFieldInfoList);
}

View File

@ -71,6 +71,9 @@ public class LabelFieldInfoServiceImpl implements ILabelFieldInfoService {
*/
@Override
public List<LabelFieldTreeVO> labelFieldList(Long taskPartitionDictId, String fieldType) {
if (Objects.isNull(taskPartitionDictId)) {
return new ArrayList<>();
}
int i = 1;
//查询细分
List<LabelFieldVO> labelFieldList = labelFieldInfoMapper.selectLabelFieldList(taskPartitionDictId, fieldType);

View File

@ -1,6 +1,7 @@
package com.xinelu.manage.service.signpatientmanageroute.impl;
import com.alibaba.fastjson2.JSONObject;
import com.xinelu.common.annotation.DataScope;
import com.xinelu.common.constant.TaskContentConstants;
import com.xinelu.common.constant.TaskCreateTypeConstant;
import com.xinelu.common.constant.TemplateTypeConstants;
@ -276,6 +277,7 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
* @return ManualFollowUpVO 人工随访代办VO
*/
@Override
@DataScope(agencyAlias = "pi", deptAlias = "pi")
public List<ManualFollowUpVO> selectManualFollowUpList(ManualFollowUpDTO manualFollowUpDTO) {
return signPatientManageRouteMapper.selectManualFollowUpList(manualFollowUpDTO);
}

View File

@ -36,6 +36,9 @@ public class ManualFollowUpVO {
@ApiModelProperty(value = "管理路径节点名称出院后AFTER_DISCHARGE入院后AFTER_ADMISSION就诊后AFTER_CONSULTATION就诊/出院后AFTER_VISIT_DISCHARGE术前PREOPERATIVE术后POSTOPERATIVE")
private String routeNodeName;
@ApiModelProperty(value = "管理路径节点时间,时间单位为:天")
private Integer routeNodeDay;
@ApiModelProperty(value = "患者就诊记录基本信息表id")
private Long visitRecordId;
@ -90,16 +93,20 @@ public class ManualFollowUpVO {
@ApiModelProperty(value = "主治医生姓名")
private String attendingPhysicianName;
@ApiModelProperty(value = "在院IN_THE_HOSPITAL出院DISCHARGE门诊OUTPATIENT_SERVICE")
private String suitRange;
@ApiModelProperty(value = "就诊方式门诊OUTPATIENT_SERVICE住院BE_IN_HOSPITAL")
private String visitMethod;
@ApiModelProperty(value = "入院时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime admissionTime;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "门诊/出院时间")
private LocalDateTime visitOrDischargeTime;
@ApiModelProperty(value = "门诊时间")
private LocalDateTime visitTime;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "出院时间")
private LocalDateTime dischargeTime;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "随访时间")

View File

@ -72,6 +72,10 @@ public class PatientTaskExecuteRecordVO extends PatientTaskExecuteRecord {
@ApiModelProperty(value = "就诊方式门诊OUTPATIENT_SERVICE住院BE_IN_HOSPITAL")
private String visitMethod;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "就诊时间(门诊患者)")
private LocalDateTime visitDate;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate startDate;
@ -117,6 +121,4 @@ public class PatientTaskExecuteRecordVO extends PatientTaskExecuteRecord {
@ApiModelProperty(value = "任务处理信息")
private String routeHandleRemark;
}

View File

@ -431,4 +431,24 @@
where id = #{labelFieldContentList.labelFieldContentId}
</foreach>
</update>
<select id="selectLabelFieldContentPortraitSn"
resultType="com.xinelu.manage.domain.labelfieldcontent.LabelFieldContent">
select
lfi.task_partition_dict_id fieldId,
lfc.portrait_sn
from label_field_content lfc
LEFT JOIN label_field_info lfi ON lfc.field_id = lfi.id
<where>
<if test="taskPartitionDictIds != null and taskPartitionDictIds.size() > 0">
lfi.task_partition_dict_id in
<foreach item="taskPartitionDictIds" collection="taskPartitionDictIds" open="(" separator="," close=")">
#{taskPartitionDictIds}
</foreach>
</if>
<if test="patientId != null">
AND patient_id = #{patientId}
</if>
</where>
</select>
</mapper>

View File

@ -579,32 +579,26 @@
</foreach>
</update>
<select id="getPatientInfoByOpenId" parameterType="string" resultType="patientInfo">
<select id="getPatientInfoByOpenId" parameterType="string" resultType="ResidentInfo">
SELECT
id,
community_code,
area_code,
patient_code,
patient_name,
patient_name,
patient_phone,
family_member_phone,
birth_date,
card_no,
user_id,
unionid,
openid,
official_account_openid,
phone,
sex,
address,
urgent_contact_name,
urgent_contact_phone,
community_alias_name,
home_longitude,
home_latitude,
head_picture_url
open_id,
union_id,
official_account_openid,
avatar_picture_url
FROM
patient_info
resident_info
<where>
del_flag = 0
<if test="openId != null and openId != ''">
and openid = #{openId}
and open_id = #{openId}
</if>
</where>
</select>

View File

@ -103,6 +103,7 @@
pter.execute_type,
pi.patient_type,
pi.visit_method,
pi.visit_date,
pi.hospital_agency_name,
pi.campus_agency_name,
pi.department_name,

View File

@ -312,23 +312,17 @@
pvr.surgical_name,
pi.attending_physician_id,
pi.attending_physician_name,
IF(spmr.suit_range = 'IN_THE_HOSPITAL' OR spmr.suit_range = 'DISCHARGE', 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',
pi.visit_date AS 'visitTime',
pi.admission_time,
pi.discharge_time AS 'dischargeTime',
pi.visit_method,
pter.id AS 'taskExecuteRecordId',
pter.execute_time AS 'executeTime',
spmr.id AS 'manageRouteId',
spmrn.id AS 'manageRouteNodeId',
spmrn.manage_route_name AS 'manageRouteName',
spmrn.route_node_name AS 'routeNodeName',
spmrn.route_node_day,
spmrn.task_type,
CASE
WHEN spmrn.task_type = 'PHONE_OUTBOUND' THEN spmrn.phone_template_name
@ -372,39 +366,12 @@
<if test="wardId != null">
AND pi.ward_id = #{wardId}
</if>
<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 test="visitMethod != null and visitMethod != ''">
AND pi.visit_method = #{visitMethod}
</if>
<if test="visitSerialNumber != null and visitSerialNumber != ''">
AND pi.visit_serial_number LIKE concat('%', #{visitSerialNumber}, '%')
</if>
<if test="clinicalStartTime != null">
AND pi.visit_date >= #{clinicalStartTime}
</if>
<if test="clinicalEndTime != null">
AND pi.visit_date &lt;= #{clinicalEndTime}
</if>
<if test="dischargeStartTime != null">
AND pi.discharge_time >= #{dischargeStartTime}
</if>
<if test="dischargeEndTime != null">
AND pi.discharge_time &lt;= #{dischargeEndTime}
</if>
<if test="admissionStartTime != null">
AND pi.admission_time >= #{admissionStartTime}
</if>
<if test="admissionEndTime != null">
AND pi.admission_time &lt;= #{admissionEndTime}
</if>
<if test="mainDiagnosis != null and mainDiagnosis != ''">
AND pi.main_diagnosis LIKE concat('%', #{mainDiagnosis}, '%')
</if>
@ -423,6 +390,11 @@
<if test="followEndTime != null ">
AND pter.execute_time &lt;= #{followEndTime}
</if>
<if test="manageRouteName != null and manageRouteName != ''">
AND spmrn.manage_route_name like concat('%', #{manageRouteName}, '%')
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where>
order by spmr.create_time DESC
</select>

View File

@ -210,13 +210,23 @@
<select id="selectTaskPartitionList"
resultType="com.xinelu.manage.domain.taskpartitiondict.TaskPartitionDict">
select * from task_partition_dict
select
tpd.id,
tpd.task_type_id,
tpd.task_type_name,
tpd.task_partition_name,
tpd.task_partition_code,
tpd.second_classify_describe,
tpd.execution_time,
tpd.task_partition_sort,
(SELECT count(1) from label_field_info where task_partition_dict_id = tpd.id) taskPartitionRemark
from task_partition_dict tpd
<where>
task_type_id in
<foreach item="ids" collection="list" open="(" separator="," close=")">
#{ids}
</foreach>
</where>
order by task_partition_sort
order by tpd.task_partition_sort
</select>
</mapper>

View File

@ -92,6 +92,9 @@ public class HomePageController extends BaseController {
return homePageService.subscriptionMessage(id);
}
/**
* 消息通知列表
*/
@GetMapping("/messageNotification")
public AjaxResult selectSignPatientManageRouteNode(Long residentId) {
return homePageService.selectSignPatientManageRouteNode(residentId);

View File

@ -57,4 +57,12 @@ public interface HomePageMapper {
* @return PatientVO
*/
List<PatientVO> selectSignPatientManageRouteNode(@Param("patientId") List<Long> patientId);
/**
* 修改执行状态
*
* @param signPatientManageRouteNodeIds
* @return int
*/
int updateNodeExecuteStatusByIds(@Param("signPatientManageRouteNodeIds") List<Long> signPatientManageRouteNodeIds);
}

View File

@ -76,6 +76,12 @@ public interface HomePageService {
*/
AjaxResult subscriptionMessage(Long id);
/**
* 消息通知列表
*
* @param residentId 用户id
* @return AjaxResult
*/
AjaxResult selectSignPatientManageRouteNode(Long residentId);
AjaxResult selectNodeContent(Long manageRouteNodeId);

View File

@ -227,7 +227,7 @@ public class HomePageServiceImpl implements HomePageService {
*/
@Override
public List<PatientTaskExecuteRecord> selectPatientTaskExecuteRecord(Long residentId) {
return homePageMapper.selectTaskExecuteRecordByResidentId(residentId, NodeExecuteStatusEnum.EXECUTED.getInfo());
return homePageMapper.selectTaskExecuteRecordByResidentId(residentId, null);
}
/**
@ -264,6 +264,12 @@ public class HomePageServiceImpl implements HomePageService {
return AjaxResult.success(signPatientManageRouteNodeMapper.selectSignPatientManageRouteNodeById(id));
}
/**
* 消息通知列表
*
* @param residentId 用户id
* @return AjaxResult
*/
@Override
public AjaxResult selectSignPatientManageRouteNode(Long residentId) {
List<SignPatientManageRouteNode> signPatientManageRouteNodes = signPatientManageRouteNodeMapper.selectManageRouteByResidentId(residentId, NodeExecuteStatusEnum.EXECUTED.getInfo());

View File

@ -4,7 +4,7 @@ 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.residentinfo.ResidentInfo;
import com.xinelu.manage.domain.subscribemessagerecord.SubscribeMessageRecord;
import com.xinelu.manage.domain.subscribemessagesendrecord.SubscribeMessageSendRecord;
import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper;
@ -92,9 +92,9 @@ public class WeChatAppletCallBackServiceImpl implements WeChatAppletCallBackServ
return;
}
//查询用户信息表
PatientInfo patientInfo = patientInfoMapper.getPatientInfoByOpenId(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
ResidentInfo residentInfo = patientInfoMapper.getPatientInfoByOpenId(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
//组装数据
List<SubscribeMessageRecord> subscribeMessageRecordList = createSubscribeMessageRecordList(patientInfo, weChatMessagePushVO, SUBSCRIBE_MSG_POPUP_EVENT);
List<SubscribeMessageRecord> subscribeMessageRecordList = createSubscribeMessageRecordList(residentInfo, weChatMessagePushVO, SUBSCRIBE_MSG_POPUP_EVENT);
if (CollectionUtils.isEmpty(subscribeMessageRecordList)) {
return;
}
@ -116,9 +116,9 @@ public class WeChatAppletCallBackServiceImpl implements WeChatAppletCallBackServ
//修改订阅信息状态
for (SubscribeMessageRecord messageRecord : intersectionSubscribeList) {
Long patientId = null;
if (Objects.nonNull(patientInfo) && Objects.nonNull(patientInfo.getId())) {
patientId = patientInfo.getId();
}
// if (Objects.nonNull(residentInfo) && Objects.nonNull(residentInfo.getId())) {
// patientId = residentInfo.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();
@ -137,9 +137,9 @@ public class WeChatAppletCallBackServiceImpl implements WeChatAppletCallBackServ
return;
}
//查询用户信息表
PatientInfo patientInfo = patientInfoMapper.getPatientInfoByOpenId(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
ResidentInfo residentInfo = patientInfoMapper.getPatientInfoByOpenId(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
//组装数据
List<SubscribeMessageRecord> subscribeMessageRecordList = createSubscribeMessageRecordList(patientInfo, weChatMessagePushVO, SUBSCRIBE_MSG_CHANGE_EVENT);
List<SubscribeMessageRecord> subscribeMessageRecordList = createSubscribeMessageRecordList(residentInfo, weChatMessagePushVO, SUBSCRIBE_MSG_CHANGE_EVENT);
if (CollectionUtils.isEmpty(subscribeMessageRecordList)) {
return;
}
@ -152,9 +152,9 @@ public class WeChatAppletCallBackServiceImpl implements WeChatAppletCallBackServ
//修改订阅信息状态
for (SubscribeMessageRecord messageRecord : intersectionSubscribeList) {
Long patientId = null;
if (Objects.nonNull(patientInfo) && Objects.nonNull(patientInfo.getId())) {
patientId = patientInfo.getId();
}
// if (Objects.nonNull(residentInfo) && Objects.nonNull(residentInfo.getId())) {
// patientId = residentInfo.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();
@ -186,19 +186,19 @@ public class WeChatAppletCallBackServiceImpl implements WeChatAppletCallBackServ
/**
* 组装订阅消息数据
*
* @param patientInfo 会员用户信息
* @param residentInfo 会员用户信息
* @param weChatMessagePushVO 微信请求参数信息
* @param eventType 事件类型
* @return List<SubscribeMessageRecord>
*/
private List<SubscribeMessageRecord> createSubscribeMessageRecordList(PatientInfo patientInfo, WeChatMessagePushVO weChatMessagePushVO, String eventType) {
private List<SubscribeMessageRecord> createSubscribeMessageRecordList(ResidentInfo residentInfo, 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());
}
// if (Objects.nonNull(residentInfo) && Objects.nonNull(residentInfo.getId())) {
// subscribe.setPatientId(residentInfo.getId());
// }
//此处模板通知需要根据实际情况进行修改
subscribe.setOpenid(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
subscribe.setAppletId(StringUtils.isBlank(weChatMessagePushVO.getToUserName()) ? "" : weChatMessagePushVO.getToUserName());
@ -216,9 +216,9 @@ public class WeChatAppletCallBackServiceImpl implements WeChatAppletCallBackServ
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());
}
// if (Objects.nonNull(residentInfo) && Objects.nonNull(residentInfo.getId())) {
// subscribe.setPatientId(residentInfo.getId());
// }
//此处模板通知需要根据实际情况进行修改
subscribe.setOpenid(StringUtils.isBlank(weChatMessagePushVO.getFromUserName()) ? "" : weChatMessagePushVO.getFromUserName());
subscribe.setAppletId(StringUtils.isBlank(weChatMessagePushVO.getToUserName()) ? "" : weChatMessagePushVO.getToUserName());

View File

@ -6,7 +6,7 @@ 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.domain.residentinfo.ResidentInfo;
import com.xinelu.manage.mapper.officialaccountsubscribeevent.OfficialAccountSubscribeEventMapper;
import com.xinelu.manage.mapper.officialaccounttemplateevent.OfficialAccountTemplateEventMapper;
import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper;
@ -47,7 +47,7 @@ public class WeChatOfficialAccountCallbackServiceImpl implements WeChatOfficialA
@Override
public void handleOfficialAccountTemplateEvent(WeChatOfficialAccountEventPushVO eventPushVO) {
//查询患者信息
PatientInfo patientInfo = patientInfoMapper.getPatientInfoByOpenId(eventPushVO.getFromUserName());
ResidentInfo patientInfo = patientInfoMapper.getPatientInfoByOpenId(eventPushVO.getFromUserName());
if (Objects.isNull(patientInfo)) {
log.info("当前患者信息不存在微信用户openid为{}", eventPushVO.getFromUserName());
return;

View File

@ -190,7 +190,7 @@ public class WeChatOfficialAccountUtils {
/**
* 微信小程序模板消息发送
*/
public void sendAppletTemplateMessage(PatientVO patientVO) {
public Integer sendAppletTemplateMessage(PatientVO patientVO) {
//微信模版组装
String thing5 = "每日阅读有助于了解当前情况哦";
String thing1 = "新入院注意事项指导、术前须知";
@ -208,6 +208,7 @@ public class WeChatOfficialAccountUtils {
Map<String, Object> paramsMap = new LinkedHashMap<>();
paramsMap.put("touser", patientVO.getOpenId());
paramsMap.put("template_id", weChatAppletChatConfig.getHealthyPropagandaId());
paramsMap.put("miniprogram_state", "developer");//todo
paramsMap.put("page", "pages/homepage/homepage");
Map<String, Object> dataMap = new LinkedHashMap<>();
dataMap.put("thing5", new MessageValueEntity(thing5));
@ -252,5 +253,6 @@ public class WeChatOfficialAccountUtils {
break;
}
}
return errCode.getErrcode();
}
}

View File

@ -137,4 +137,15 @@
and pi.del_flag = 0
</where>
</select>
<update id="updateNodeExecuteStatusByIds">
update sign_patient_manage_route_node
set node_execute_status = 'EXECUTED'
where
id in
<foreach item="signPatientManageRouteNodeIds" collection="signPatientManageRouteNodeIds" open="(" separator=","
close=")">
#{signPatientManageRouteNodeIds}
</foreach>
</update>
</mapper>

View File

@ -49,43 +49,54 @@ public class subscribeTaskServiceImpl implements SubscribeTaskService {
continue;
}
//判断路径节点组装数据
if (signPatientManageRouteNode.getRouteNodeName().equals(RouteNodeNameEnum.AFTER_DISCHARGE.getName()) || signPatientManageRouteNode.getRouteNodeName().equals(RouteNodeNameEnum.AFTER_VISIT_DISCHARGE.getName())) {
if (signPatientManageRouteNode.getRouteNodeName().equals(RouteNodeNameEnum.AFTER_DISCHARGE.getInfo()) || signPatientManageRouteNode.getRouteNodeName().equals(RouteNodeNameEnum.AFTER_VISIT_DISCHARGE.getInfo())) {
PatientVO patientVO = patient.stream().filter(Objects::nonNull).filter(item -> signPatientManageRouteNode.getPatientId().equals(item.getPatientId())).findFirst().orElse(new PatientVO());
if (patientVO.getPatientType().equals(PatientTypeEnum.DISCHARGED_PATIENT.getInfo())) {
LocalDate localDate = patientVO.getDischargeTime().plusDays(signPatientManageRouteNode.getRouteNodeDay());
boolean before = localDate.isEqual(LocalDate.now());
if (before) {
signPatientManageRouteNode.setOpenId(patientVO.getOpenId());
signPatientManageRouteNode.setRouteNodeName(RouteNodeNameEnum.AFTER_DISCHARGE.getName());
patientVOS.add(signPatientManageRouteNode);
}
}
}
if (signPatientManageRouteNode.getRouteNodeName().equals(RouteNodeNameEnum.AFTER_ADMISSION.getName())) {
if (signPatientManageRouteNode.getRouteNodeName().equals(RouteNodeNameEnum.AFTER_ADMISSION.getInfo())) {
PatientVO patientVO = patient.stream().filter(Objects::nonNull).filter(item -> signPatientManageRouteNode.getPatientId().equals(item.getPatientId())).findFirst().orElse(new PatientVO());
if (patientVO.getPatientType().equals(PatientTypeEnum.IN_HOSPITAL_PATIENT.getInfo())) {
LocalDate localDate = patientVO.getAdmissionTime().plusDays(signPatientManageRouteNode.getRouteNodeDay());
boolean before = localDate.isEqual(LocalDate.now());
if (before) {
signPatientManageRouteNode.setOpenId(patientVO.getOpenId());
signPatientManageRouteNode.setRouteNodeName(RouteNodeNameEnum.AFTER_ADMISSION.getName());
patientVOS.add(signPatientManageRouteNode);
}
}
}
if (signPatientManageRouteNode.getRouteNodeName().equals(RouteNodeNameEnum.AFTER_CONSULTATION.getName()) || signPatientManageRouteNode.getRouteNodeName().equals(RouteNodeNameEnum.AFTER_VISIT_DISCHARGE.getName())) {
if (signPatientManageRouteNode.getRouteNodeName().equals(RouteNodeNameEnum.AFTER_CONSULTATION.getInfo()) || signPatientManageRouteNode.getRouteNodeName().equals(RouteNodeNameEnum.AFTER_VISIT_DISCHARGE.getInfo())) {
PatientVO patientVO = patient.stream().filter(Objects::nonNull).filter(item -> signPatientManageRouteNode.getPatientId().equals(item.getPatientId())).findFirst().orElse(new PatientVO());
if (patientVO.getPatientType().equals(PatientTypeEnum.OUTPATIENT.getInfo()) && patientVO.getAdmissionTime() == null) {
LocalDate localDate = patientVO.getVisitDate().plusDays(signPatientManageRouteNode.getRouteNodeDay());
boolean before = localDate.isEqual(LocalDate.now());
if (before) {
signPatientManageRouteNode.setOpenId(patientVO.getOpenId());
signPatientManageRouteNode.setRouteNodeName(RouteNodeNameEnum.AFTER_CONSULTATION.getName());
patientVOS.add(signPatientManageRouteNode);
}
}
}
}
List<Long> signPatientManageRouteNodeIds = new ArrayList<>();
//发送
for (PatientVO patientVO : patientVOS) {
weChatOfficialAccountUtils.sendAppletTemplateMessage(patientVO);
Integer integer = weChatOfficialAccountUtils.sendAppletTemplateMessage(patientVO);
if (integer == 0) {
signPatientManageRouteNodeIds.add(patientVO.getSignPatientManageRouteNodeId());
}
//更改执行状态
if (CollectionUtils.isNotEmpty(signPatientManageRouteNodeIds)) {
homePageMapper.updateNodeExecuteStatusByIds(signPatientManageRouteNodeIds);
}
}
}
}