Merge branch '0418_小程序开发' of http://182.92.166.109:3000/zhuangyuanke/PostDischargePatientManage into 0418_小程序开发
This commit is contained in:
commit
af9a5ed6a1
@ -116,6 +116,9 @@ public class LabelFieldInfoController extends BaseController {
|
||||
return toAjax(labelFieldInfoService.deleteLabelFieldInfoByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务类型分组
|
||||
*/
|
||||
@GetMapping("/taskTypeGrouping")
|
||||
public AjaxResult taskTypeGrouping() {
|
||||
return labelFieldInfoService.taskTypeGrouping();
|
||||
|
||||
@ -181,14 +181,25 @@ public class LabelFieldInfoServiceImpl implements ILabelFieldInfoService {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字段信息
|
||||
*
|
||||
* @return AjaxResult
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult taskTypeGrouping() {
|
||||
//查询任务类型
|
||||
List<TaskTypeDictVO> taskTypeDictList = taskTypeDictMapper.selectTaskTypeDicts();
|
||||
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);
|
||||
if (CollectionUtils.isEmpty(taskPartitionDicts)) {
|
||||
return AjaxResult.success(taskPartitionDicts);
|
||||
}
|
||||
//组装
|
||||
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());
|
||||
if (CollectionUtils.isNotEmpty(collect)) {
|
||||
|
||||
@ -127,14 +127,14 @@
|
||||
wt.template_sort,
|
||||
wt.template_remark,
|
||||
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
|
||||
left join wechat_template_suit_task wtst on wt.id = wtst.wechat_template_id
|
||||
left join department d on d.id = wt.department_id
|
||||
<where>
|
||||
<if test="hospitalAgencyId != null">
|
||||
and d.hospital_agency_id = #{hospitalAgencyId}
|
||||
</if>
|
||||
<if test="hospitalAgencyId != null">
|
||||
and d.hospital_agency_id = #{hospitalAgencyId}
|
||||
</if>
|
||||
<if test="departmentId != null ">
|
||||
and wt.department_id =
|
||||
#{departmentId}
|
||||
@ -158,7 +158,7 @@
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</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 id="selectWechatTemplateDtoById" resultMap="WechatTemplateVOResultMap">
|
||||
select wt.id,
|
||||
|
||||
@ -4,6 +4,7 @@ import com.xinelu.common.core.controller.BaseController;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.core.page.TableDataInfo;
|
||||
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.service.appletpersoncenter.AppletPersonCenterService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -88,6 +89,13 @@ public class AppletPersonCenterController extends BaseController {
|
||||
return appletPersonCenterService.appletLoginV1(loginCode);
|
||||
}
|
||||
|
||||
@ApiOperation("小程序端手机号与openid解绑")
|
||||
@PostMapping("/unbindOpenId")
|
||||
public AjaxResult unbindOpenId(@RequestBody UnbindRequestDTO unbindRequestDTO) {
|
||||
return appletPersonCenterService.unbindOpenId(unbindRequestDTO.getPhoneNum(), unbindRequestDTO.getOpenId());
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("小程序登录发送短信验证码")
|
||||
@GetMapping("/sendSms")
|
||||
public AjaxResult sendSms(String phoneNum) {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -70,4 +70,12 @@ public interface AppletPersonCenterService {
|
||||
* @return 验证短信验证码信息
|
||||
*/
|
||||
AjaxResult verifySmsCode(VerifySmsCodeDTO verifySmsCodeDTO);
|
||||
|
||||
/**
|
||||
* 小程序端手机号与openid解绑
|
||||
* @param phoneNum 手机号
|
||||
* @param openId openid
|
||||
* @return 解绑信息
|
||||
*/
|
||||
AjaxResult unbindOpenId(String phoneNum, String openId);
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.ValueOperations;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
@ -247,6 +248,7 @@ public class AppletPersonCenterServiceImpl implements AppletPersonCenterService
|
||||
* @return 验证短信验证码信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult verifySmsCode(VerifySmsCodeDTO verifySmsCodeDTO) {
|
||||
try {
|
||||
String openId = verifySmsCodeDTO.getOpenId();
|
||||
@ -254,33 +256,66 @@ public class AppletPersonCenterServiceImpl implements AppletPersonCenterService
|
||||
String cacheKey = Constants.SMS_CODE + verifySmsCodeDTO.getPhoneNum();
|
||||
ValueOperations<String, String> valueOperations = redisTemplate.opsForValue();
|
||||
String storedCode = valueOperations.get(cacheKey);
|
||||
|
||||
// 缓存的验证码不存在
|
||||
if (storedCode == null) {
|
||||
log.error("验证码已过期,手机号:{}", verifySmsCodeDTO.getPhoneNum());
|
||||
return AjaxResult.error("验证码已过期,请重新获取!");
|
||||
}
|
||||
|
||||
// 缓存的验证码与输入的验证码不匹配
|
||||
if (!storedCode.equals(smsCode)) {
|
||||
log.error("验证码验证失败,手机号:{},输入的验证码:{},获取的验证码:{}", verifySmsCodeDTO.getPhoneNum(), smsCode, storedCode);
|
||||
return AjaxResult.error("验证码错误,请重新输入!");
|
||||
}
|
||||
|
||||
// 根据手机号和姓名查询用户信息
|
||||
log.info("验证码验证成功,手机号:{},输入的验证码:{},获取的验证码:{}", verifySmsCodeDTO.getPhoneNum(), smsCode, storedCode);
|
||||
List<ResidentInfo> residentInfos = residentInfoMapper.getResidentInfoByPhoneAndName(verifySmsCodeDTO.getPhoneNum(), verifySmsCodeDTO.getPatientName());
|
||||
|
||||
// 用户信息不存在
|
||||
if (residentInfos == null || residentInfos.isEmpty()) {
|
||||
return AjaxResult.error("您的用户信息尚未录入系统,无法执行注册操作!");
|
||||
} else if (residentInfos.size() > 1) {
|
||||
// 存在姓名和手机号重复的情况
|
||||
return AjaxResult.error("您的信息存在重复记录,请联系管理员进行操作!");
|
||||
}
|
||||
// 更新用户的openid
|
||||
ResidentInfo residentInfo = residentInfos.get(0);
|
||||
residentInfo.setOpenId(openId);
|
||||
residentInfoMapper.updateResidentInfo(residentInfo);
|
||||
log.info("用户注册成功,姓名:{},手机号:{},openid:{}", verifySmsCodeDTO.getPatientName(), verifySmsCodeDTO.getPhoneNum(), openId);
|
||||
return AjaxResult.success("注册成功!", residentInfo);
|
||||
} catch (Exception e) {
|
||||
log.error("验证验证码时发生异常,手机号:{},异常信息:{}", verifySmsCodeDTO.getPhoneNum(), e.getMessage(), e);
|
||||
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("解绑失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -312,8 +312,9 @@ public class HomePageServiceImpl implements HomePageService {
|
||||
//查询问卷
|
||||
QuestionInfo questionInfo = questionInfoMapper.selectQuestionInfoById(signPatientManageRouteNode.getQuestionInfoId());
|
||||
// 查询题目表
|
||||
QuestionVO questionVO = new QuestionVO();
|
||||
if (Objects.nonNull(questionInfo)) {
|
||||
BeanUtils.copyBeanProp(messageContentVO.getQuestion(), questionInfo);
|
||||
BeanUtils.copyBeanProp(questionVO, questionInfo);
|
||||
List<QuestionSubjectVO> questionSubjects = questionSubjectMapper.selectQuestionSubjectBy(signPatientManageRouteNode.getQuestionInfoId());
|
||||
if (CollectionUtils.isNotEmpty(questionSubjects)) {
|
||||
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());
|
||||
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)));
|
||||
}
|
||||
//副文本塞值
|
||||
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.setNodeContent(signPatientManageRouteNode.getNodeContent());
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user