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

This commit is contained in:
haown 2024-07-09 18:02:45 +08:00
commit af9a5ed6a1
8 changed files with 99 additions and 12 deletions

View File

@ -116,6 +116,9 @@ public class LabelFieldInfoController extends BaseController {
return toAjax(labelFieldInfoService.deleteLabelFieldInfoByIds(ids)); return toAjax(labelFieldInfoService.deleteLabelFieldInfoByIds(ids));
} }
/**
* 任务类型分组
*/
@GetMapping("/taskTypeGrouping") @GetMapping("/taskTypeGrouping")
public AjaxResult taskTypeGrouping() { public AjaxResult taskTypeGrouping() {
return labelFieldInfoService.taskTypeGrouping(); return labelFieldInfoService.taskTypeGrouping();

View File

@ -181,14 +181,25 @@ public class LabelFieldInfoServiceImpl implements ILabelFieldInfoService {
return 1; return 1;
} }
/**
* 查询字段信息
*
* @return AjaxResult
*/
@Override @Override
public AjaxResult taskTypeGrouping() { public AjaxResult taskTypeGrouping() {
//查询任务类型
List<TaskTypeDictVO> taskTypeDictList = taskTypeDictMapper.selectTaskTypeDicts(); List<TaskTypeDictVO> taskTypeDictList = taskTypeDictMapper.selectTaskTypeDicts();
List<Long> ids = taskTypeDictList.stream().filter(Objects::nonNull).map(TaskTypeDictVO::getTaskTypeId).filter(Objects::nonNull).collect(Collectors.toList()); List<Long> ids = taskTypeDictList.stream().filter(Objects::nonNull).map(TaskTypeDictVO::getTaskTypeId).filter(Objects::nonNull).collect(Collectors.toList());
//查询细分类型
if (CollectionUtils.isEmpty(taskTypeDictList)) {
return AjaxResult.success(taskTypeDictList);
}
List<TaskPartitionDict> taskPartitionDicts = taskPartitionDictMapper.selectTaskPartitionList(ids); List<TaskPartitionDict> taskPartitionDicts = taskPartitionDictMapper.selectTaskPartitionList(ids);
if (CollectionUtils.isEmpty(taskPartitionDicts)) { if (CollectionUtils.isEmpty(taskPartitionDicts)) {
return AjaxResult.success(taskPartitionDicts); return AjaxResult.success(taskPartitionDicts);
} }
//组装
for (TaskTypeDictVO taskTypeDictVO : taskTypeDictList) { for (TaskTypeDictVO taskTypeDictVO : taskTypeDictList) {
List<TaskPartitionDict> collect = taskPartitionDicts.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getTaskTypeId()) && taskTypeDictVO.getTaskTypeId().equals(item.getTaskTypeId())).collect(Collectors.toList()); List<TaskPartitionDict> collect = taskPartitionDicts.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getTaskTypeId()) && taskTypeDictVO.getTaskTypeId().equals(item.getTaskTypeId())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) { if (CollectionUtils.isNotEmpty(collect)) {

View File

@ -127,14 +127,14 @@
wt.template_sort, wt.template_sort,
wt.template_remark, wt.template_remark,
wtst.id AS taskId, wtst.id AS taskId,
GROUP_CONCAT(wtst.suit_task_type_name SEPARATOR ',') as suitTaskTypeName GROUP_CONCAT(wtst.suit_task_type_name SEPARATOR ',') as suitTaskTypeName
from wechat_template wt from wechat_template wt
left join wechat_template_suit_task wtst on wt.id = wtst.wechat_template_id left join wechat_template_suit_task wtst on wt.id = wtst.wechat_template_id
left join department d on d.id = wt.department_id left join department d on d.id = wt.department_id
<where> <where>
<if test="hospitalAgencyId != null"> <if test="hospitalAgencyId != null">
and d.hospital_agency_id = #{hospitalAgencyId} and d.hospital_agency_id = #{hospitalAgencyId}
</if> </if>
<if test="departmentId != null "> <if test="departmentId != null ">
and wt.department_id = and wt.department_id =
#{departmentId} #{departmentId}
@ -158,7 +158,7 @@
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}
</where> </where>
group by wt.id order by wt.create_time DESC,wtst.create_time DESC group by wt.id,wtst.id order by wt.create_time DESC,wtst.create_time DESC
</select> </select>
<select id="selectWechatTemplateDtoById" resultMap="WechatTemplateVOResultMap"> <select id="selectWechatTemplateDtoById" resultMap="WechatTemplateVOResultMap">
select wt.id, select wt.id,

View File

@ -4,6 +4,7 @@ import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.page.TableDataInfo; import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.mobile.dto.appletpersoncenter.HealthRecordDTO; import com.xinelu.mobile.dto.appletpersoncenter.HealthRecordDTO;
import com.xinelu.mobile.dto.appletpersoncenter.UnbindRequestDTO;
import com.xinelu.mobile.dto.verifysmscode.VerifySmsCodeDTO; import com.xinelu.mobile.dto.verifysmscode.VerifySmsCodeDTO;
import com.xinelu.mobile.service.appletpersoncenter.AppletPersonCenterService; import com.xinelu.mobile.service.appletpersoncenter.AppletPersonCenterService;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -88,6 +89,13 @@ public class AppletPersonCenterController extends BaseController {
return appletPersonCenterService.appletLoginV1(loginCode); return appletPersonCenterService.appletLoginV1(loginCode);
} }
@ApiOperation("小程序端手机号与openid解绑")
@PostMapping("/unbindOpenId")
public AjaxResult unbindOpenId(@RequestBody UnbindRequestDTO unbindRequestDTO) {
return appletPersonCenterService.unbindOpenId(unbindRequestDTO.getPhoneNum(), unbindRequestDTO.getOpenId());
}
@ApiOperation("小程序登录发送短信验证码") @ApiOperation("小程序登录发送短信验证码")
@GetMapping("/sendSms") @GetMapping("/sendSms")
public AjaxResult sendSms(String phoneNum) { public AjaxResult sendSms(String phoneNum) {

View File

@ -0,0 +1,20 @@
package com.xinelu.mobile.dto.appletpersoncenter;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @program: PostDischargePatientManage
* @description: 小程序解绑请求参数
* @author: yxl
* @create: 2024-07-09 15:12
**/
@Data
public class UnbindRequestDTO {
@ApiModelProperty(value = "手机号")
private String phoneNum;
@ApiModelProperty(value = "微信小程序openid")
private String openId;
}

View File

@ -70,4 +70,12 @@ public interface AppletPersonCenterService {
* @return 验证短信验证码信息 * @return 验证短信验证码信息
*/ */
AjaxResult verifySmsCode(VerifySmsCodeDTO verifySmsCodeDTO); AjaxResult verifySmsCode(VerifySmsCodeDTO verifySmsCodeDTO);
/**
* 小程序端手机号与openid解绑
* @param phoneNum 手机号
* @param openId openid
* @return 解绑信息
*/
AjaxResult unbindOpenId(String phoneNum, String openId);
} }

View File

@ -25,6 +25,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations; import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -247,6 +248,7 @@ public class AppletPersonCenterServiceImpl implements AppletPersonCenterService
* @return 验证短信验证码信息 * @return 验证短信验证码信息
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult verifySmsCode(VerifySmsCodeDTO verifySmsCodeDTO) { public AjaxResult verifySmsCode(VerifySmsCodeDTO verifySmsCodeDTO) {
try { try {
String openId = verifySmsCodeDTO.getOpenId(); String openId = verifySmsCodeDTO.getOpenId();
@ -254,33 +256,66 @@ public class AppletPersonCenterServiceImpl implements AppletPersonCenterService
String cacheKey = Constants.SMS_CODE + verifySmsCodeDTO.getPhoneNum(); String cacheKey = Constants.SMS_CODE + verifySmsCodeDTO.getPhoneNum();
ValueOperations<String, String> valueOperations = redisTemplate.opsForValue(); ValueOperations<String, String> valueOperations = redisTemplate.opsForValue();
String storedCode = valueOperations.get(cacheKey); String storedCode = valueOperations.get(cacheKey);
// 缓存的验证码不存在
if (storedCode == null) { if (storedCode == null) {
log.error("验证码已过期,手机号:{}", verifySmsCodeDTO.getPhoneNum()); log.error("验证码已过期,手机号:{}", verifySmsCodeDTO.getPhoneNum());
return AjaxResult.error("验证码已过期,请重新获取!"); return AjaxResult.error("验证码已过期,请重新获取!");
} }
// 缓存的验证码与输入的验证码不匹配
if (!storedCode.equals(smsCode)) { if (!storedCode.equals(smsCode)) {
log.error("验证码验证失败,手机号:{},输入的验证码:{},获取的验证码:{}", verifySmsCodeDTO.getPhoneNum(), smsCode, storedCode); log.error("验证码验证失败,手机号:{},输入的验证码:{},获取的验证码:{}", verifySmsCodeDTO.getPhoneNum(), smsCode, storedCode);
return AjaxResult.error("验证码错误,请重新输入!"); return AjaxResult.error("验证码错误,请重新输入!");
} }
// 根据手机号和姓名查询用户信息
log.info("验证码验证成功,手机号:{},输入的验证码:{},获取的验证码:{}", verifySmsCodeDTO.getPhoneNum(), smsCode, storedCode); log.info("验证码验证成功,手机号:{},输入的验证码:{},获取的验证码:{}", verifySmsCodeDTO.getPhoneNum(), smsCode, storedCode);
List<ResidentInfo> residentInfos = residentInfoMapper.getResidentInfoByPhoneAndName(verifySmsCodeDTO.getPhoneNum(), verifySmsCodeDTO.getPatientName()); List<ResidentInfo> residentInfos = residentInfoMapper.getResidentInfoByPhoneAndName(verifySmsCodeDTO.getPhoneNum(), verifySmsCodeDTO.getPatientName());
// 用户信息不存在
if (residentInfos == null || residentInfos.isEmpty()) { if (residentInfos == null || residentInfos.isEmpty()) {
return AjaxResult.error("您的用户信息尚未录入系统,无法执行注册操作!"); return AjaxResult.error("您的用户信息尚未录入系统,无法执行注册操作!");
} else if (residentInfos.size() > 1) { } else if (residentInfos.size() > 1) {
// 存在姓名和手机号重复的情况 // 存在姓名和手机号重复的情况
return AjaxResult.error("您的信息存在重复记录,请联系管理员进行操作!"); return AjaxResult.error("您的信息存在重复记录,请联系管理员进行操作!");
} }
// 更新用户的openid
ResidentInfo residentInfo = residentInfos.get(0); ResidentInfo residentInfo = residentInfos.get(0);
residentInfo.setOpenId(openId); residentInfo.setOpenId(openId);
residentInfoMapper.updateResidentInfo(residentInfo); residentInfoMapper.updateResidentInfo(residentInfo);
log.info("用户注册成功,姓名:{},手机号:{}openid{}", verifySmsCodeDTO.getPatientName(), verifySmsCodeDTO.getPhoneNum(), openId);
return AjaxResult.success("注册成功!", residentInfo); return AjaxResult.success("注册成功!", residentInfo);
} catch (Exception e) { } catch (Exception e) {
log.error("验证验证码时发生异常,手机号:{},异常信息:{}", verifySmsCodeDTO.getPhoneNum(), e.getMessage(), e); log.error("验证验证码时发生异常,手机号:{},异常信息:{}", verifySmsCodeDTO.getPhoneNum(), e.getMessage(), e);
return AjaxResult.error("短信验证码验证失败!"); return AjaxResult.error("短信验证码验证失败!");
} }
} }
/**
* 小程序端手机号与openid解绑
*
* @param phoneNum 手机号
* @param openId openid
* @return 解绑信息
*/
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult unbindOpenId(String phoneNum, String openId) {
try {
// 根据phoneNum和openid查询用户信息
ResidentInfo residentInfo = residentInfoMapper.getResidentInfoByPhoneAndOpenId(phoneNum, openId);
// 未查询到用户信息
if (ObjectUtils.isEmpty(residentInfo)) {
log.info("未查询到用户信息,手机号:{}openId{}", phoneNum, openId);
return AjaxResult.error("未查询到用户信息,无法解绑!");
}
// 清空openid字段更新用户信息
residentInfo.setOpenId(null);
residentInfoMapper.updateResidentInfo(residentInfo);
log.info("解绑成功,手机号:{}openId{}", phoneNum, openId);
return AjaxResult.success("解绑成功!");
} catch (Exception e) {
log.error("解绑openId时发生异常手机号{}openId{},异常信息:{}", phoneNum, openId, e.getMessage(), e);
return AjaxResult.error("解绑失败!");
}
}
} }

View File

@ -312,8 +312,9 @@ public class HomePageServiceImpl implements HomePageService {
//查询问卷 //查询问卷
QuestionInfo questionInfo = questionInfoMapper.selectQuestionInfoById(signPatientManageRouteNode.getQuestionInfoId()); QuestionInfo questionInfo = questionInfoMapper.selectQuestionInfoById(signPatientManageRouteNode.getQuestionInfoId());
// 查询题目表 // 查询题目表
QuestionVO questionVO = new QuestionVO();
if (Objects.nonNull(questionInfo)) { if (Objects.nonNull(questionInfo)) {
BeanUtils.copyBeanProp(messageContentVO.getQuestion(), questionInfo); BeanUtils.copyBeanProp(questionVO, questionInfo);
List<QuestionSubjectVO> questionSubjects = questionSubjectMapper.selectQuestionSubjectBy(signPatientManageRouteNode.getQuestionInfoId()); List<QuestionSubjectVO> questionSubjects = questionSubjectMapper.selectQuestionSubjectBy(signPatientManageRouteNode.getQuestionInfoId());
if (CollectionUtils.isNotEmpty(questionSubjects)) { if (CollectionUtils.isNotEmpty(questionSubjects)) {
List<Long> questionSubjectIds = questionSubjects.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getId())).map(QuestionSubject::getId).collect(Collectors.toList()); List<Long> questionSubjectIds = questionSubjects.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getId())).map(QuestionSubject::getId).collect(Collectors.toList());
@ -323,7 +324,8 @@ public class HomePageServiceImpl implements HomePageService {
List<QuestionSubjectOptionVO> collect = questionSubjectOptions.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getQuestionnaireSubjectId()) && questionSubject.getId().equals(item.getQuestionnaireSubjectId())).collect(Collectors.toList()); List<QuestionSubjectOptionVO> collect = questionSubjectOptions.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getQuestionnaireSubjectId()) && questionSubject.getId().equals(item.getQuestionnaireSubjectId())).collect(Collectors.toList());
questionSubject.setQuestionSubjectOptionList(collect); questionSubject.setQuestionSubjectOptionList(collect);
} }
messageContentVO.getQuestion().setQuestionSubjectList(questionSubjects); questionVO.setQuestionSubjectList(questionSubjects);
messageContentVO.setQuestion(questionVO);
} }
} }
} }
@ -335,7 +337,7 @@ public class HomePageServiceImpl implements HomePageService {
messageContentVO.setPropagandaContent(JSONObject.parseObject(JSONObject.toJSONString(propagandaMaterialsVo))); messageContentVO.setPropagandaContent(JSONObject.parseObject(JSONObject.toJSONString(propagandaMaterialsVo)));
} }
//副文本塞值 //副文本塞值
if (!TaskContentEnum.PROPAGANDA_ARTICLE.getInfo().equals(signPatientManageRouteNode.getTaskType()) || !TaskContentEnum.QUESTIONNAIRE_SCALE.getInfo().equals(signPatientManageRouteNode.getTaskType()) || !TaskContentEnum.ARTIFICIAL_FOLLOW_UP.getInfo().equals(signPatientManageRouteNode.getTaskType())) { if (!TaskContentEnum.PROPAGANDA_ARTICLE.getInfo().equals(signPatientManageRouteNode.getTaskType()) && !TaskContentEnum.QUESTIONNAIRE_SCALE.getInfo().equals(signPatientManageRouteNode.getTaskType()) && !TaskContentEnum.ARTIFICIAL_FOLLOW_UP.getInfo().equals(signPatientManageRouteNode.getTaskType())) {
messageContentVO.setTaskType(TaskContentEnum.TEXT_REMIND.getInfo()); messageContentVO.setTaskType(TaskContentEnum.TEXT_REMIND.getInfo());
messageContentVO.setNodeContent(signPatientManageRouteNode.getNodeContent()); messageContentVO.setNodeContent(signPatientManageRouteNode.getNodeContent());
} }