fwq
2023-12-01 3784924ed530f4103c26625081532a7abb71b1f7
Merge branch 'master-fwq点诊科室医生' into master-prod-new

# Conflicts:
# phi_platform_user/src/main/java/com/hx/phip/service/impl/UserServiceImpl.java
7个文件已添加
4个文件已修改
1092 ■■■■■ 已修改文件
phi_platform_common/src/main/java/com/hx/phip/config/ProcessUserRoomBean.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_common/src/main/java/com/hx/phip/dao/mapper/UserDiagnosisDoctorItemMapper.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_common/src/main/java/com/hx/phip/dao/mapper/UserDiagnosisDoctorMapper.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_common/src/main/resources/mapper/platform/UserDiagnosisDoctorItemMapper.xml 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_common/src/main/resources/mapper/platform/UserDiagnosisDoctorMapper.xml 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/controller/user/UserController.java 101 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/service/UserService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/service/deduction/impl/DeductionSingleServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/service/impl/UserServiceImpl.java 618 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/service/user/UserDoctorNewService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/service/user/impl/UserDoctorNewServiceImpl.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_common/src/main/java/com/hx/phip/config/ProcessUserRoomBean.java
New file
@@ -0,0 +1,42 @@
package com.hx.phip.config;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
/**
 * 用户点诊审核的bean
 */
@Data
@Component
@RefreshScope
public class ProcessUserRoomBean {
    /**营销助手-科室关系审核回调*/
    @Value("${process.notify.user.room.url}")
    private String url;
    /**营销助手审核主题-无科室关系创建科室关系*/
    @Value("${process.createRoom.title:创建科室关系申请}")
    private String oneTitle;
    /**营销助手审核-工作流编号*/
    @Value("${process.createRoom.code:1002}")
    private Integer oneCode;
    /**营销助手审核主题-点诊医生申请*/
    @Value("${process.diagnosisDoctor.title:点诊医生申请}")
    private String twoTitle;
    /**营销助手审核-工作流编号*/
    @Value("${process.diagnosisDoctor.code:1003}")
    private Integer twoCode;
    /**营销助手审核主题-科室医生申请(点诊不足)*/
    @Value("${process.diagnosisCreate.title:科室医生申请(点诊不足)}")
    private String threeTitle;
    /**营销助手审核-工作流编号*/
    @Value("${process.diagnosisCreate.code:1004}")
    private Integer threeCode;
}
phi_platform_common/src/main/java/com/hx/phip/dao/mapper/UserDiagnosisDoctorItemMapper.java
New file
@@ -0,0 +1,37 @@
package com.hx.phip.dao.mapper;
import java.util.List;
import java.util.Map;
import com.hx.mybatisTool.SqlSentence;
import com.hx.phiappt.model.user.UserDiagnosisDoctorItem;
public interface UserDiagnosisDoctorItemMapper {
    /**新增,返回主键*/
    int insert(UserDiagnosisDoctorItem userDiagnosisDoctorItem);
    /**新增,返回主键*/
    int insertById(UserDiagnosisDoctorItem userDiagnosisDoctorItem);
    /**查询条数*/
    int selectCount(SqlSentence sqlSentence);
    /**查询条数*/
    int selectCountSql(SqlSentence sqlSentence);
    /**查询列表,返回实体类的List*/
    List<UserDiagnosisDoctorItem> selectList(SqlSentence sqlSentence);
    /**查询列表,返回Map的List*/
    List<Map<String,Object>> selectListMap(SqlSentence sqlSentence);
    /**查询,返回单个实体*/
    UserDiagnosisDoctorItem selectOne(SqlSentence sqlSentence);
    /**查询,返回单个map*/
    Map<String,Object> selectOneMap(SqlSentence sqlSentence);
    /**查询,返回实体类没有大数据的*/
    UserDiagnosisDoctorItem selectOneByKey(Object object);
    /**查询,返回实体类有大数据的*/
    UserDiagnosisDoctorItem selectOneByKeyBlob(Object object);
    /**更新,返回更新数量*/
    int updateWhere(SqlSentence sqlSentence);
    /**更新,返回更新数量*/
    int updateAll(UserDiagnosisDoctorItem userDiagnosisDoctorItem);
    /**删除,返回删除数量*/
    int deleteWhere(SqlSentence sqlSentence);
    /**删除,返回删除数量*/
    int deleteById(Object object);
}
phi_platform_common/src/main/java/com/hx/phip/dao/mapper/UserDiagnosisDoctorMapper.java
New file
@@ -0,0 +1,37 @@
package com.hx.phip.dao.mapper;
import java.util.List;
import java.util.Map;
import com.hx.mybatisTool.SqlSentence;
import com.hx.phiappt.model.user.UserDiagnosisDoctor;
public interface UserDiagnosisDoctorMapper {
    /**新增,返回主键*/
    int insert(UserDiagnosisDoctor userDiagnosisDoctor);
    /**新增,返回主键*/
    int insertById(UserDiagnosisDoctor userDiagnosisDoctor);
    /**查询条数*/
    int selectCount(SqlSentence sqlSentence);
    /**查询条数*/
    int selectCountSql(SqlSentence sqlSentence);
    /**查询列表,返回实体类的List*/
    List<UserDiagnosisDoctor> selectList(SqlSentence sqlSentence);
    /**查询列表,返回Map的List*/
    List<Map<String,Object>> selectListMap(SqlSentence sqlSentence);
    /**查询,返回单个实体*/
    UserDiagnosisDoctor selectOne(SqlSentence sqlSentence);
    /**查询,返回单个map*/
    Map<String,Object> selectOneMap(SqlSentence sqlSentence);
    /**查询,返回实体类没有大数据的*/
    UserDiagnosisDoctor selectOneByKey(Object object);
    /**查询,返回实体类有大数据的*/
    UserDiagnosisDoctor selectOneByKeyBlob(Object object);
    /**更新,返回更新数量*/
    int updateWhere(SqlSentence sqlSentence);
    /**更新,返回更新数量*/
    int updateAll(UserDiagnosisDoctor userDiagnosisDoctor);
    /**删除,返回删除数量*/
    int deleteWhere(SqlSentence sqlSentence);
    /**删除,返回删除数量*/
    int deleteById(Object object);
}
phi_platform_common/src/main/resources/mapper/platform/UserDiagnosisDoctorItemMapper.xml
New file
@@ -0,0 +1,90 @@
<?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">
<!-- namespace:该mapper.xml映射文件的 唯一标识 -->
<mapper namespace="com.hx.phip.dao.mapper.UserDiagnosisDoctorItemMapper">
    <!-- 整个实体类修改,表字段=实体类字段-->
    <sql id="Update_Column_All">
        <trim prefixOverrides=",">
            ,temporaryId = #{temporaryId},doctorId = #{doctorId},doctorName = #{doctorName},roomId = #{roomId},roomName = #{roomName},oldDoctorId = #{oldDoctorId},oldDoctorName = #{oldDoctorName},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
        </trim>
    </sql>
    <!--  后续通过  namespace.id-->
    <!--parameterType:输入参数的类型
    resultType:查询返回结果值的类型  ,返回类型  -->
    <insert id="insert" parameterType="com.hx.phiappt.model.user.UserDiagnosisDoctorItem">
        <selectKey keyProperty="id" resultType="String" order="BEFORE">
               select replace(uuid(),'-','') from dual
        </selectKey>
        insert into user_diagnosis_doctor_item (id,temporaryId,doctorId,doctorName,roomId,roomName,oldDoctorId,oldDoctorName,isDel,createTime,editTime)  values (#{id},#{temporaryId},#{doctorId},#{doctorName},#{roomId},#{roomName},#{oldDoctorId},#{oldDoctorName},#{isDel},#{createTime},#{editTime})
    </insert>
    <insert id="insertById" parameterType="com.hx.phiappt.model.user.UserDiagnosisDoctorItem">
        insert into user_diagnosis_doctor_item (id,temporaryId,doctorId,doctorName,roomId,roomName,oldDoctorId,oldDoctorName,isDel,createTime,editTime)  values (#{id},#{temporaryId},#{doctorId},#{doctorName},#{roomId},#{roomName},#{oldDoctorId},#{oldDoctorName},#{isDel},#{createTime},#{editTime})
    </insert>
    <select id="selectList" resultType="com.hx.phiappt.model.user.UserDiagnosisDoctorItem" parameterType="com.hx.mybatisTool.SqlSentence" >
        ${sqlSentence}
    </select>
    <select id="selectListMap" resultType="java.util.Map" parameterType="com.hx.mybatisTool.SqlSentence" >
            ${sqlSentence}
    </select>
    <select id="selectOne" resultType="com.hx.phiappt.model.user.UserDiagnosisDoctorItem" parameterType="com.hx.mybatisTool.SqlSentence" >
        ${sqlSentence}
    </select>
    <select id="selectOneMap" resultType="java.util.Map" parameterType="com.hx.mybatisTool.SqlSentence" >
            ${sqlSentence}
    </select>
    <select id="selectCount" resultType="int" parameterType="com.hx.mybatisTool.SqlSentence" >
            select
                COUNT(*)
            from user_diagnosis_doctor_item
                WHERE ${sqlSentence}
    </select>
    <select id="selectCountSql" resultType="int" parameterType="com.hx.mybatisTool.SqlSentence" >
            ${sqlSentence}
     </select>
    <select id="selectOneByKey" resultType="com.hx.phiappt.model.user.UserDiagnosisDoctorItem" parameterType="java.lang.Object" >
        select
            id,temporaryId,doctorId,doctorName,roomId,roomName,oldDoctorId,oldDoctorName,isDel,createTime,editTime
        from user_diagnosis_doctor_item
        WHERE id = #{value}
    </select>
    <select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.user.UserDiagnosisDoctorItem" parameterType="java.lang.Object" >
        select
            id,temporaryId,doctorId,doctorName,roomId,roomName,oldDoctorId,oldDoctorName,isDel,createTime,editTime
        from user_diagnosis_doctor_item
        WHERE id = #{value}
    </select>
    <update id="updateWhere" parameterType="com.hx.mybatisTool.SqlSentence">
        update
            user_diagnosis_doctor_item
        SET ${sqlSentence}
    </update>
    <update id="updateAll" parameterType="com.hx.phiappt.model.user.UserDiagnosisDoctorItem">
        update user_diagnosis_doctor_item
            SET <include refid="Update_Column_All"/>
        WHERE id = #{id}
    </update>
    <delete id="deleteWhere"  parameterType="com.hx.mybatisTool.SqlSentence">
        delete from user_diagnosis_doctor_item WHERE ${sqlSentence}
    </delete>
    <delete id="deleteById"  parameterType="java.lang.Object">
        delete from user_diagnosis_doctor_item WHERE id = #{value}
    </delete>
</mapper>
phi_platform_common/src/main/resources/mapper/platform/UserDiagnosisDoctorMapper.xml
New file
@@ -0,0 +1,90 @@
<?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">
<!-- namespace:该mapper.xml映射文件的 唯一标识 -->
<mapper namespace="com.hx.phip.dao.mapper.UserDiagnosisDoctorMapper">
    <!-- 整个实体类修改,表字段=实体类字段-->
    <sql id="Update_Column_All">
        <trim prefixOverrides=",">
            ,approveStatus = #{approveStatus},approveId = #{approveId},type = #{type},monthStr = #{monthStr},dayStr = #{dayStr},opId = #{opId},opName = #{opName},opShopId = #{opShopId},opShopName = #{opShopName},opRoleId = #{opRoleId},opRoleName = #{opRoleName},opRoleTypeId = #{opRoleTypeId},opRoleStr = #{opRoleStr},operatorRemark = #{operatorRemark},userId = #{userId},userName = #{userName},userCiq = #{userCiq},userNo = #{userNo},userLevel = #{userLevel},userCorpId = #{userCorpId},userCorpName = #{userCorpName},userShopId = #{userShopId},userShopName = #{userShopName},isDel = #{isDel},createTime = #{createTime},editTime = #{editTime}
        </trim>
    </sql>
    <!--  后续通过  namespace.id-->
    <!--parameterType:输入参数的类型
    resultType:查询返回结果值的类型  ,返回类型  -->
    <insert id="insert" parameterType="com.hx.phiappt.model.user.UserDiagnosisDoctor">
        <selectKey keyProperty="id" resultType="String" order="BEFORE">
               select replace(uuid(),'-','') from dual
        </selectKey>
        insert into user_diagnosis_doctor (id,approveStatus,approveId,type,monthStr,dayStr,opId,opName,opShopId,opShopName,opRoleId,opRoleName,opRoleTypeId,opRoleStr,operatorRemark,userId,userName,userCiq,userNo,userLevel,userCorpId,userCorpName,userShopId,userShopName,isDel,createTime,editTime)  values (#{id},#{approveStatus},#{approveId},#{type},#{monthStr},#{dayStr},#{opId},#{opName},#{opShopId},#{opShopName},#{opRoleId},#{opRoleName},#{opRoleTypeId},#{opRoleStr},#{operatorRemark},#{userId},#{userName},#{userCiq},#{userNo},#{userLevel},#{userCorpId},#{userCorpName},#{userShopId},#{userShopName},#{isDel},#{createTime},#{editTime})
    </insert>
    <insert id="insertById" parameterType="com.hx.phiappt.model.user.UserDiagnosisDoctor">
        insert into user_diagnosis_doctor (id,approveStatus,approveId,type,monthStr,dayStr,opId,opName,opShopId,opShopName,opRoleId,opRoleName,opRoleTypeId,opRoleStr,operatorRemark,userId,userName,userCiq,userNo,userLevel,userCorpId,userCorpName,userShopId,userShopName,isDel,createTime,editTime)  values (#{id},#{approveStatus},#{approveId},#{type},#{monthStr},#{dayStr},#{opId},#{opName},#{opShopId},#{opShopName},#{opRoleId},#{opRoleName},#{opRoleTypeId},#{opRoleStr},#{operatorRemark},#{userId},#{userName},#{userCiq},#{userNo},#{userLevel},#{userCorpId},#{userCorpName},#{userShopId},#{userShopName},#{isDel},#{createTime},#{editTime})
    </insert>
    <select id="selectList" resultType="com.hx.phiappt.model.user.UserDiagnosisDoctor" parameterType="com.hx.mybatisTool.SqlSentence" >
        ${sqlSentence}
    </select>
    <select id="selectListMap" resultType="java.util.Map" parameterType="com.hx.mybatisTool.SqlSentence" >
            ${sqlSentence}
    </select>
    <select id="selectOne" resultType="com.hx.phiappt.model.user.UserDiagnosisDoctor" parameterType="com.hx.mybatisTool.SqlSentence" >
        ${sqlSentence}
    </select>
    <select id="selectOneMap" resultType="java.util.Map" parameterType="com.hx.mybatisTool.SqlSentence" >
            ${sqlSentence}
    </select>
    <select id="selectCount" resultType="int" parameterType="com.hx.mybatisTool.SqlSentence" >
            select
                COUNT(*)
            from user_diagnosis_doctor
                WHERE ${sqlSentence}
    </select>
    <select id="selectCountSql" resultType="int" parameterType="com.hx.mybatisTool.SqlSentence" >
            ${sqlSentence}
     </select>
    <select id="selectOneByKey" resultType="com.hx.phiappt.model.user.UserDiagnosisDoctor" parameterType="java.lang.Object" >
        select
            id,approveStatus,approveId,type,monthStr,dayStr,opId,opName,opShopId,opShopName,opRoleId,opRoleName,opRoleTypeId,opRoleStr,operatorRemark,userId,userName,userCiq,userNo,userLevel,userCorpId,userCorpName,userShopId,userShopName,isDel,createTime,editTime
        from user_diagnosis_doctor
        WHERE id = #{value}
    </select>
    <select id="selectOneByKeyBlob" resultType="com.hx.phiappt.model.user.UserDiagnosisDoctor" parameterType="java.lang.Object" >
        select
            id,approveStatus,approveId,type,monthStr,dayStr,opId,opName,opShopId,opShopName,opRoleId,opRoleName,opRoleTypeId,opRoleStr,operatorRemark,userId,userName,userCiq,userNo,userLevel,userCorpId,userCorpName,userShopId,userShopName,isDel,createTime,editTime
        from user_diagnosis_doctor
        WHERE id = #{value}
    </select>
    <update id="updateWhere" parameterType="com.hx.mybatisTool.SqlSentence">
        update
            user_diagnosis_doctor
        SET ${sqlSentence}
    </update>
    <update id="updateAll" parameterType="com.hx.phiappt.model.user.UserDiagnosisDoctor">
        update user_diagnosis_doctor
            SET <include refid="Update_Column_All"/>
        WHERE id = #{id}
    </update>
    <delete id="deleteWhere"  parameterType="com.hx.mybatisTool.SqlSentence">
        delete from user_diagnosis_doctor WHERE ${sqlSentence}
    </delete>
    <delete id="deleteById"  parameterType="java.lang.Object">
        delete from user_diagnosis_doctor WHERE id = #{value}
    </delete>
</mapper>
phi_platform_user/src/main/java/com/hx/phip/controller/user/UserController.java
@@ -10,6 +10,7 @@
import com.hx.phiappt.common.OriginChannelConstants;
import com.hx.phiappt.common.UserChannelType;
import com.hx.phiappt.constants.tool.UserInfoTool;
import com.hx.phiappt.constants.tool.exception.ExceptionTool;
import com.hx.phiappt.constants.tool.user.UserLabelTool;
import com.hx.phiappt.constants.tool.user.UserLevelTool;
import com.hx.phiappt.model.*;
@@ -25,6 +26,7 @@
import com.hx.phip.service.UserService;
import com.hx.phip.service.UserUnionHisService;
import com.hx.phip.service.user.UnifiedUserService;
import com.hx.phip.service.user.UserDoctorNewService;
import com.hx.phip.service.userLevel.UserLevelRuleService;
import com.hx.phip.tool.ApplyParameterTool;
import com.hx.phip.tool.SendSMSTool;
@@ -35,9 +37,15 @@
import com.hx.util.AesUtil;
import com.hx.util.HttpServletRequestUtil;
import com.hx.util.StringUtils;
import com.hz.his.dto.marketing.common.MarCommonReturnDto;
import com.hz.his.dto.marketing.common.MarketingResultDto;
import com.hz.his.dto.marketing.common.MarketingReturnDto;
import com.hz.his.dto.marketing.common.MarketingTotalDto;
import com.hz.his.dto.user.UserInviteeInfoDto;
import com.hz.his.dto.user.UserParamDto;
import com.hz.his.dto.user.room.UserDoctorRoomDto;
import com.hz.his.feign.service.dcp.SPhisUserTagInfoService;
import com.hz.his.feign.service.marketing.MCommonService;
import com.hz.his.feign.service.sync.SyncUserService;
import com.platform.constants.LoginConstant;
import com.platform.constants.PlatformPattern;
@@ -87,6 +95,10 @@
    private UserLevelRuleService userLevelRuleService;
    @Resource
    private SPhisUserTagInfoService sPhisUserTagInfoService;
    @Resource
    private MCommonService mCommonService;
    @Resource
    private UserDoctorNewService userDoctorNewService;
    /**
     * 获取用户列表
@@ -1367,34 +1379,83 @@
                userParamDto.setApiId(thirtApplication.getAppIdCode());
            }
        }
        if (StringUtils.isEmpty(userParamDto.getUserId())) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "请传用户id!");
        }
        // 用户信息
        User user = userService.selectOneByKey(userParamDto.getUserId());
        if (user == null) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "找不到用户!");
        }
        if (StringUtils.isEmpty(userParamDto.getDepartmentJson())) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "请传科室关系参数!");
        }
        if (StringUtils.isEmpty(userParamDto.getOpId())) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "请传操作人id!");
        }
        // 操作人信息
        Employee opEmployee = commonService.selectOneByKey(EmployeeMapper.class, userParamDto.getOpId());
        if (opEmployee == null) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "找不到操作人信息!");
        }
        // 修改科室信息 先屏蔽代码 划扣处理用户科室数据
        if (userParamDto.getIsEditFamiliesRoom() != null && BaseEntity.YES.equals(userParamDto.getIsEditFamiliesRoom())) {
            userService.updateFamiliesRoom(userParamDto, user, opEmployee);
            userService.updateFamiliesRoom(userParamDto, userParamDto.getUserId(), userParamDto.getOpId());
        }
        // 返回处理
        return Result.success();
    }
    /**
     * 转发审核
     */
    @RequestMapping(value = "/common/approve/create", method = RequestMethod.POST)
    public Result commonApproveCreate(@RequestBody MarketingTotalDto marketingTotalDto) {
        Result result =  mCommonService.commonApply(marketingTotalDto);
        if (!result.checkCode()){
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "添加审核失败["+result.getMsg()+"]");
        }
        return Result.success(result.getData());
    }
    /**
     * 用户科室点诊记录新增
     */
    @RequestMapping(value = "/room/doctor/diagnosis/create", method = RequestMethod.POST)
    public Result userFamiliesRoomCreate(@RequestBody UserDoctorRoomDto userDoctorRoomDto) {
        if (userDoctorRoomDto == null) {
            throw new PlatTipsException(PlatformCode.ERROR_BODY_DATA, "数据格式错误,参数为空!");
        }
        logger.info("新增用户科室点诊记录数据,参数:" + JSONObject.toJSON(userDoctorRoomDto));
        MarketingResultDto marketingResultDto = userService.diagnosisDoctorCreate(userDoctorRoomDto);
        //直接通过需要更新信息
        try {
            userDoctorNewService.userDiagnosisDoctor(marketingResultDto);
        }catch (Exception e){
            logger.error("更新点诊审核数据信息失败"+ ExceptionTool.getExceptionInfo(e));
        }
        return Result.success(marketingResultDto.getUniqueId());
    }
    /**
     * 审核回调修改用户点诊医生记录
     */
    @RequestMapping(value = "/room/doctor/diagnosis", method = RequestMethod.POST)
    public Result updateFamiliesRoom(HttpServletRequest request, @RequestBody(required = false) MarCommonReturnDto marCommonReturnDto) {
        if (marCommonReturnDto == null) {
            throw new PlatTipsException(PlatformCode.ERROR_BODY_DATA, "审核结果数据为空");
        }
        logger.info("审核回调用户点诊记录,参数:" + JSONObject.toJSON(marCommonReturnDto));
        UserParamDto userParamDto = new UserParamDto();
        ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY);
        if (thirtApplication == null) {
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "验签失败,请重新验签!");
        }
        if (StringUtils.isEmpty(thirtApplication.getAppIdCode())) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "AppIdCode不能为空!");
        }
        if (StringUtils.isEmpty(marCommonReturnDto.getData())){
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "数据格式错误,审核结果为空[01]!");
        }
        MarketingReturnDto marketingReturnDto = JSONObject.parseObject(marCommonReturnDto.getData(), MarketingReturnDto.class);
        if (marketingReturnDto == null){
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "数据格式错误,审核结果为空[02]!");
        }
        if (StringUtils.isEmpty(marketingReturnDto.getResult())){
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "数据格式错误,审核结果为空[03]!");
        }
        //请求平台
        userParamDto.setApiId(thirtApplication.getAppIdCode());
        //修改审核状态
        userService.updateUserDoctorTemporary(userParamDto,marketingReturnDto);
        return Result.success();
    }
    /**
     * 用户等级重新计算
     */
    @RequestMapping("/level/calc")
phi_platform_user/src/main/java/com/hx/phip/service/UserService.java
@@ -4,8 +4,12 @@
import com.hx.phiappt.model.Employee;
import com.hx.phiappt.model.User;
import com.hx.mybatisTool.SqlSentence;
import com.hx.phiappt.model.user.UserDiagnosisDoctor;
import com.hx.phip.entity.user.UserDto;
import com.hz.his.dto.marketing.common.MarketingResultDto;
import com.hz.his.dto.marketing.common.MarketingReturnDto;
import com.hz.his.dto.user.UserParamDto;
import com.hz.his.dto.user.room.UserDoctorRoomDto;
import com.hz.his.dto.user.usercompleteInfo.UserInfoCompleteDto;
import java.util.List;
@@ -61,10 +65,14 @@
    JSONObject userLevelProgress(User user);
    void updateFamiliesRoom(UserParamDto userParamDto, User user, Employee opEmployee);
    void updateFamiliesRoom(UserParamDto userParamDto,String userId,String employeeId);
    void userLevelCalc(UserParamDto userParamDto, User user, Employee employee);
    /**用户完善资料页信息**/
    void userCompleteInfoById(UserInfoCompleteDto userInfoCompleteDto,User user);
    /**新增点诊数据*/
    MarketingResultDto diagnosisDoctorCreate(UserDoctorRoomDto userDoctorRoomDto);
    /**用户点诊记录修改*/
    void updateUserDoctorTemporary(UserParamDto userParamDto,MarketingReturnDto marketingReturnDto);
}
phi_platform_user/src/main/java/com/hx/phip/service/deduction/impl/DeductionSingleServiceImpl.java
@@ -1221,8 +1221,8 @@
                }
            }
            // 处理用户科室数据
            this.updateUserFamiliesRoomInfo(deductionSingle, deductionProject, user, shop, opEmployee, deductionDto.getAppIdCode());
            // 处理用户科室数据 点诊医生上线后划扣不修改科室了
            // this.updateUserFamiliesRoomInfo(deductionSingle, deductionProject, user, shop, opEmployee, deductionDto.getAppIdCode());
            // 处理项目剩余可划扣次数并添加使用记录
            if (BaseEntity.YES.equals(type)) {
@@ -4597,6 +4597,7 @@
    /**
     * 处理用户科室信息
     * 点诊医生上线后划扣不修改科室了
     * @param deductionSingle 划扣方法
     * @param user 用户信息
     * @param shop 门店信息
phi_platform_user/src/main/java/com/hx/phip/service/impl/UserServiceImpl.java
@@ -1,5 +1,6 @@
package com.hx.phip.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hx.common.service.CommonService;
@@ -10,6 +11,7 @@
import com.hx.phiappt.common.UserStatusConstants;
import com.hx.phiappt.constants.tool.UserInfoTool;
import com.hx.phiappt.constants.tool.UserStatusTool;
import com.hx.phiappt.constants.tool.exception.ExceptionTool;
import com.hx.phiappt.constants.tool.user.UserAgeTool;
import com.hx.phiappt.constants.tool.user.UserLevelTool;
import com.hx.phiappt.constants.tool.user.UserRegisterRecordTool;
@@ -21,6 +23,8 @@
import com.hx.phiappt.model.*;
import com.hx.phiappt.model.channels.Channels;
import com.hx.phiappt.model.memberLevel.MemberLevel;
import com.hx.phiappt.model.user.UserDiagnosisDoctor;
import com.hx.phiappt.model.user.UserDiagnosisDoctorItem;
import com.hx.phiappt.model.user.UserWakeUpLog;
import com.hx.phiappt.model.userLevel.UserLevelRecord;
import com.hx.phiappt.model.userLevel.UserLevelRule;
@@ -29,19 +33,31 @@
import com.hx.phiappt.util.UserPretriageAdminMpTool;
import com.hx.phip.config.CustomParameter;
import com.hx.phip.config.GlobalExceptionHandler;
import com.hx.phip.config.ProcessUserRoomBean;
import com.hx.phip.dao.mapper.*;
import com.hx.phip.entity.user.UserDto;
import com.hx.phip.service.SystemParameterService;
import com.hx.phip.service.UserService;
import com.hx.phip.service.UserUnionHisService;
import com.hx.phip.service.user.UserDoctorNewService;
import com.hx.resultTool.Result;
import com.hx.util.DateUtil;
import com.hx.util.SimpleTool;
import com.hx.util.StringUtils;
import com.hx.util.mysql.aes.MysqlHexAesTool;
import com.hx.util.thread.ExecutorServiceTool;
import com.hz.his.dto.marketing.common.*;
import com.hz.his.dto.user.UserParamDto;
import com.hz.his.dto.user.room.UserDoctorRoomDto;
import com.hz.his.dto.user.room.UserDoctorRoomItemDto;
import com.hz.his.dto.user.usercompleteInfo.UserInfoCompleteDto;
import com.hz.his.feign.service.dcp.SUserTagInfoService;
import com.hz.his.feign.service.marketing.MCommonService;
import com.hz.his.feign.service.sync.SyncUserService;
import com.hz.sms.dto.ContentItemDto;
import com.hz.sms.dto.TemplateMessageDto;
import com.hz.sms.dto.TemplateMsgDto;
import com.hz.sms.feign.FCorpWXSendService;
import com.platform.exception.PlatTipsException;
import com.platform.resultTool.PlatformCode;
import org.slf4j.Logger;
@@ -79,7 +95,6 @@
    private UserAddressBookMapper userAddressBookMapper;
    @Resource
    private UserGeneralLabelMapper userGeneralLabelMapper;
    @Resource
    private UserInterestsMapper userInterestsMapper;
    @Resource
@@ -97,11 +112,21 @@
    @Resource
    private UserWakeUpLogMapper userWakeUpLogMapper;
    @Resource
    private FamiliesRoomMapper familiesRoomMapper;
    private SUserTagInfoService sUserTagInfoService;
    @Resource
    private UserDiagnosisDoctorMapper userDiagnosisDoctorMapper;
    @Resource
    private UserFamiliesRoomMapper userFamiliesRoomMapper;
    @Resource
    private SUserTagInfoService sUserTagInfoService;
    private FamiliesRoomMapper familiesRoomMapper;
    @Resource
    private UserDiagnosisDoctorItemMapper userDiagnosisDoctorItemMapper;
    @Resource
    private FCorpWXSendService fCorpWXSendService;
    @Resource
    private ProcessUserRoomBean processUserRoomBean;
    @Resource
    private MCommonService mCommonService;
    /**查询列表*/
@@ -2792,11 +2817,30 @@
    /**
     * 修改用户科室关系信息
     * @param userParamDto 参数
     * @param user 用户信息
     * @param opEmployee 操作人
     * @param userId 用户信息
     * @param employeeId 操作人
     */
    @Override
    public void updateFamiliesRoom(UserParamDto userParamDto, User user, Employee opEmployee) {
    public void updateFamiliesRoom(UserParamDto userParamDto,String userId,String employeeId) {
        if (StringUtils.isEmpty(userParamDto.getUserId())) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "请传用户id!");
        }
        // 用户信息
        User user = userMapper.selectOneByKey(userParamDto.getUserId());
        if (user == null) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "找不到用户!");
        }
        if (StringUtils.isEmpty(userParamDto.getDepartmentJson())) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "请传科室关系参数!");
        }
        if (StringUtils.isEmpty(userParamDto.getOpId())) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "请传操作人id!");
        }
        // 操作人信息
        Employee opEmployee = commonService.selectOneByKey(EmployeeMapper.class, userParamDto.getOpId());
        if (opEmployee == null) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "找不到操作人信息!");
        }
        // 科室数据
        List<UserFamiliesRoom> userFamiliesRoomList;
        try {
@@ -3186,6 +3230,568 @@
    }
    /**
     * 新增点诊记录
     */
    @Override
    public MarketingResultDto diagnosisDoctorCreate(UserDoctorRoomDto userDoctorRoomDto) {
        if (StringUtils.isEmpty(userDoctorRoomDto.getUserId())) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "用户标识为空!");
        }
        if (userDoctorRoomDto.getType() == null) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "类型为空!");
        }
        User user = userMapper.selectOneByKey(userDoctorRoomDto.getUserId());
        if (user == null) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "用户标识错误,获取用户信息失败!");
        }
        if (StringUtils.isEmpty(userDoctorRoomDto.getOpId(), userDoctorRoomDto.getOpName())) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "操作人为空!");
        }
        List<UserDoctorRoomItemDto> roomList = userDoctorRoomDto.getRoomList();
        if (roomList == null || roomList.size() < 1) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "点诊数据为空!");
        }
        for (UserDoctorRoomItemDto userDoctorRoomItemDto : roomList) {
            if (StringUtils.isEmpty(userDoctorRoomItemDto.getDoctorId())) {
                throw new PlatTipsException(PlatformCode.ERROR_TIPS, "医生数据为空!");
            }
            if (StringUtils.isEmpty(userDoctorRoomItemDto.getFamiliesRoomId())) {
                throw new PlatTipsException(PlatformCode.ERROR_TIPS, "科室数据为空!");
            }
            Employee employee = employeeMapper.selectOneByKey(userDoctorRoomItemDto.getDoctorId());
            if (employee == null) {
                throw new PlatTipsException(PlatformCode.ERROR_TIPS, "医生标识错误,找不到医生信息!");
            }
            if (StringUtils.isEmpty(userDoctorRoomItemDto.getDoctorName())) {
                userDoctorRoomItemDto.setDoctorName(employee.getCnName());
            }
            FamiliesRoom familiesRoom = familiesRoomMapper.selectOneByKey(userDoctorRoomItemDto.getFamiliesRoomId());
            if (familiesRoom == null) {
                throw new PlatTipsException(PlatformCode.ERROR_TIPS, "科室标识错误,找不到科室信息!");
            }
            if (StringUtils.isEmpty(userDoctorRoomItemDto.getFamiliesRoomName())) {
                userDoctorRoomItemDto.setFamiliesRoomName(familiesRoom.getFamiliesRoomName());
            }
        }
        if (userDoctorRoomDto.getStartTime() == null) {
            userDoctorRoomDto.setStartTime(DateUtil.parseString(DateUtil.dayToStart(new Date()), "yyyy-MM-dd HH:mm:ss"));
        }
        if (userDoctorRoomDto.getEndTime() == null) {
            userDoctorRoomDto.setEndTime(DateUtil.parseString(DateUtil.dayToEnd(new Date()), "yyyy-MM-dd HH:mm:ss"));
        }
        UserDiagnosisDoctor userDiagnosisDoctor = new UserDiagnosisDoctor();
        userDiagnosisDoctor.setApproveStatus(0);
        userDiagnosisDoctor.setType(userDoctorRoomDto.getType());
        userDiagnosisDoctor.setStartTime(userDoctorRoomDto.getStartTime());
        userDiagnosisDoctor.setEndTime(userDoctorRoomDto.getEndTime());
        userDiagnosisDoctor.setReasonType(userDoctorRoomDto.getReasonType());
        userDiagnosisDoctor.setOpId(userDoctorRoomDto.getOpId());
        userDiagnosisDoctor.setOpName(userDoctorRoomDto.getOpName());
        userDiagnosisDoctor.setOpShopId(userDoctorRoomDto.getOpShopId());
        userDiagnosisDoctor.setOpShopName(userDoctorRoomDto.getOpShopName());
        userDiagnosisDoctor.setOpRoleId(userDoctorRoomDto.getOpRoleId());
        userDiagnosisDoctor.setOpRoleName(userDoctorRoomDto.getOpRoleName());
        userDiagnosisDoctor.setOpRoleTypeId(userDoctorRoomDto.getOpRoleTypeId());
        userDiagnosisDoctor.setOpRoleStr(userDoctorRoomDto.getOpRoleStr());
        userDiagnosisDoctor.setOperatorRemark(userDoctorRoomDto.getOperatorRemark());
        userDiagnosisDoctor.setUserId(user.getId());
        userDiagnosisDoctor.setUserName(user.getName());
        userDiagnosisDoctor.setUserCiq(user.getCIQ());
        userDiagnosisDoctor.setUserNo(user.getMemberNO());
        userDiagnosisDoctor.setUserLevel(user.getUserLevel());
        if (StringUtils.noNull(user.getHisCorpUserId())) {
            userDiagnosisDoctor.setUserCorpId(user.getHisCorpUserId());
            Employee coreUser = employeeMapper.selectOneByKey(user.getHisCorpUserId());
            if (coreUser != null) {
                userDiagnosisDoctor.setUserCorpName(coreUser.getCnName());
            }
        }
        if (StringUtils.noNull(user.getShopId())) {
            userDiagnosisDoctor.setUserShopId(user.getShopId());
            Shop shop = shopMapper.selectOneByKey(user.getShopId());
            if (shop != null) {
                userDiagnosisDoctor.setUserShopName(shop.getName());
            }
        }
        if (StringUtils.isEmpty(userDiagnosisDoctor.getReasonType())) {
            userDiagnosisDoctor.setReasonType("无");
        }
        if (userDiagnosisDoctorMapper.insert(userDiagnosisDoctor) != 1) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "新增失败!");
        }
        SqlSentence sqlSentence = new SqlSentence();
        Map<String, Object> values = new HashMap<>();
        values.put("isDel", BaseEntity.NO);
        values.put("userId", userDoctorRoomDto.getUserId());
        sqlSentence.sqlSentence(" SELECT * from user_families_room WHERE isDel = 0 AND userId = #{m.userId} ORDER BY createTime DESC", values);
        List<UserFamiliesRoom> oldList = commonService.selectList(UserFamiliesRoomMapper.class, sqlSentence);
        UserDiagnosisDoctorItem userDiagnosisDoctorItem;
        for (UserDoctorRoomItemDto userDoctorRoomItemDto : roomList) {
            userDiagnosisDoctorItem = new UserDiagnosisDoctorItem();
            userDiagnosisDoctorItem.setTemporaryId(userDiagnosisDoctor.getId());
            userDiagnosisDoctorItem.setDoctorId(userDoctorRoomItemDto.getDoctorId());
            userDiagnosisDoctorItem.setDoctorName(userDoctorRoomItemDto.getDoctorName());
            userDiagnosisDoctorItem.setRoomId(userDoctorRoomItemDto.getFamiliesRoomId());
            userDiagnosisDoctorItem.setRoomName(userDoctorRoomItemDto.getFamiliesRoomName());
            //旧的
            List<UserFamiliesRoom> rooms = oldList.stream().filter(a
                    -> (StringUtils.noNull(a.getFamiliesRoomId()) && a.getFamiliesRoomId().equals(userDoctorRoomItemDto.getFamiliesRoomId()))
                    ||(StringUtils.noNull(a.getFamiliesRoomName()) && a.getFamiliesRoomName().equals(userDoctorRoomItemDto.getFamiliesRoomName())))
                    .collect(Collectors.toList());
            if (rooms.size() > 0){
                userDoctorRoomItemDto.setOldDoctorId(rooms.get(0).getDoctorId());
                userDoctorRoomItemDto.setOldDoctorName(rooms.get(0).getDoctorName());
            }
            userDiagnosisDoctorItem.setOldDoctorId(userDoctorRoomItemDto.getOldDoctorId());
            userDiagnosisDoctorItem.setOldDoctorName(userDoctorRoomItemDto.getOldDoctorName());
            if (userDiagnosisDoctorItemMapper.insert(userDiagnosisDoctorItem) != 1) {
                throw new PlatTipsException(PlatformCode.ERROR_TIPS, "新增子项失败!");
            }
        }
        //请求营销助手
        Result result = approveNewAdd(userDiagnosisDoctor.getId(), userDoctorRoomDto);
        if (!result.checkCode()) {
            logger.error("创建审核失败,入参{},返回{}", JSON.toJSONString(userDoctorRoomDto), JSON.toJSONString(result));
            throw new TipsException("创建营销助手审核失败" + result.getMsg());
        }
        MarketingResultDto marketingResultDto = result.getObject(result.getData(), MarketingResultDto.class);
        if (marketingResultDto == null) {
            throw new TipsException("申请审核返回信息为空!");
        }
        marketingResultDto.setUniqueId(userDiagnosisDoctor.getId());
        return marketingResultDto;
    }
    /**
     * 创建营销助手申请
     */
    private Result approveNewAdd(String uniqueId, UserDoctorRoomDto userDoctorRoomDto) {
        //请求营销助手
        //---审核信息组拼
        MarketingTotalDto marketingTotalDto = new MarketingTotalDto();
        marketingTotalDto.setOperatorId(userDoctorRoomDto.getOpId());
        marketingTotalDto.setOpName(userDoctorRoomDto.getOpName());
        marketingTotalDto.setShopId(userDoctorRoomDto.getOpShopId());
        marketingTotalDto.setShopName(userDoctorRoomDto.getOpShopName());
        marketingTotalDto.setRoleId(userDoctorRoomDto.getOpRoleTypeId());
        marketingTotalDto.setRoleUniqueStr(userDoctorRoomDto.getOpRoleStr());
        marketingTotalDto.setUserId(userDoctorRoomDto.getUserId());
        marketingTotalDto.setRemark(userDoctorRoomDto.getOperatorRemark());
        //标识
        marketingTotalDto.setUniqueId(uniqueId);
        //旧医生
        StringBuilder oldDoctorStr = new StringBuilder();
        //新医生
        StringBuilder doctorStr = new StringBuilder();
        for (UserDoctorRoomItemDto userDoctorRoomItemDto : userDoctorRoomDto.getRoomList()) {
            if (doctorStr.length() > 0) {
                doctorStr.append(",");
            }
            doctorStr.append(userDoctorRoomItemDto.getFamiliesRoomName()).append(":").append(userDoctorRoomItemDto.getDoctorName());
            if (oldDoctorStr.length() > 0) {
                oldDoctorStr.append(",");
            }
            oldDoctorStr.append(userDoctorRoomItemDto.getFamiliesRoomName()).append(":").append(userDoctorRoomItemDto.getOldDoctorName());
        }
        //点诊
        if (UserDiagnosisDoctor.TYPE_DIAGNOSIS.equals(userDoctorRoomDto.getType())) {
            //---审核信息组拼开始
            marketingTotalDto.setTitle(processUserRoomBean.getTwoTitle());
            marketingTotalDto.setType(processUserRoomBean.getTwoCode());
            marketingTotalDto.setCallbackUrl(processUserRoomBean.getUrl());
            MarketingContentDto marketingContentDto = new MarketingContentDto();
            List<MarketingMsgItemDto> contentList = new ArrayList<>();
            MarketingMsgItemDto marketingMsgItemDto = new MarketingMsgItemDto();
            marketingMsgItemDto.setKey("当前科室医生");
            marketingMsgItemDto.setValue(oldDoctorStr.toString());
            contentList.add(marketingMsgItemDto);
            marketingMsgItemDto = new MarketingMsgItemDto();
            marketingMsgItemDto.setKey("点诊科室医生");
            marketingMsgItemDto.setValue(doctorStr.toString());
            contentList.add(marketingMsgItemDto);
            if (StringUtils.noNull(userDoctorRoomDto.getOperatorRemark())) {
                marketingMsgItemDto = new MarketingMsgItemDto();
                marketingMsgItemDto.setKey("点诊备注");
                marketingMsgItemDto.setValue(userDoctorRoomDto.getOperatorRemark());
                contentList.add(marketingMsgItemDto);
            }
            marketingMsgItemDto = new MarketingMsgItemDto();
            marketingMsgItemDto.setKey("点诊原因");
            marketingMsgItemDto.setValue(userDoctorRoomDto.getReasonType());
            contentList.add(marketingMsgItemDto);
            marketingMsgItemDto = new MarketingMsgItemDto();
            marketingMsgItemDto.setKey("点诊时间");
            String timeStr = DateUtil.formatDate(userDoctorRoomDto.getStartTime(), "yyyy-MM-dd HH:mm:ss")
                    + "~" + DateUtil.formatDate(userDoctorRoomDto.getEndTime(), "yyyy-MM-dd HH:mm:ss");
            marketingMsgItemDto.setValue(timeStr);
            contentList.add(marketingMsgItemDto);
            marketingContentDto.setContentList(contentList);
            marketingTotalDto.setMarketingContentDto(marketingContentDto);
            //---审核信息组拼结束
            //---企业微信信息组拼
            MarketingMsgDto marketingMsgDto = new MarketingMsgDto();
            marketingMsgDto.setEmphasisFirstItem(true);
            List<MarketingMsgItemDto> contentItemList = new ArrayList<>();
            marketingMsgItemDto = new MarketingMsgItemDto();
            marketingMsgItemDto.setKey("审核主题");
            marketingMsgItemDto.setValue(processUserRoomBean.getTwoTitle());
            contentItemList.add(marketingMsgItemDto);
            marketingMsgItemDto = new MarketingMsgItemDto();
            marketingMsgItemDto.setKey("当前科室医生");
            marketingMsgItemDto.setValue(oldDoctorStr.toString());
            contentItemList.add(marketingMsgItemDto);
            marketingMsgItemDto = new MarketingMsgItemDto();
            marketingMsgItemDto.setKey("点诊科室医生");
            marketingMsgItemDto.setValue(doctorStr.toString());
            contentItemList.add(marketingMsgItemDto);
            if (StringUtils.noNull(userDoctorRoomDto.getOperatorRemark())) {
                marketingMsgItemDto = new MarketingMsgItemDto();
                marketingMsgItemDto.setKey("点诊备注");
                marketingMsgItemDto.setValue(userDoctorRoomDto.getOperatorRemark());
                contentItemList.add(marketingMsgItemDto);
            }
            marketingMsgItemDto = new MarketingMsgItemDto();
            marketingMsgItemDto.setKey("点诊原因");
            marketingMsgItemDto.setValue(userDoctorRoomDto.getReasonType());
            contentItemList.add(marketingMsgItemDto);
            marketingMsgDto.setContentItem(contentItemList);
            marketingTotalDto.setMarketingMsgDto(marketingMsgDto);
            //---企业微信信息组拼结束
        } else if (UserDiagnosisDoctor.TYPE_NONE.equals(userDoctorRoomDto.getType())) {
            //创建科室医生
            //---审核信息组拼开始
            marketingTotalDto.setTitle(processUserRoomBean.getOneTitle());
            marketingTotalDto.setType(processUserRoomBean.getOneCode());
            marketingTotalDto.setCallbackUrl(processUserRoomBean.getUrl());
            MarketingContentDto marketingContentDto = new MarketingContentDto();
            List<MarketingMsgItemDto> contentList = new ArrayList<>();
            MarketingMsgItemDto marketingMsgItemDto = new MarketingMsgItemDto();
            marketingMsgItemDto.setKey("原科室医生");
            marketingMsgItemDto.setValue("无");
            contentList.add(marketingMsgItemDto);
            marketingMsgItemDto = new MarketingMsgItemDto();
            marketingMsgItemDto.setKey("新科室医生");
            marketingMsgItemDto.setValue(doctorStr.toString());
            contentList.add(marketingMsgItemDto);
            marketingContentDto.setContentList(contentList);
            marketingTotalDto.setMarketingContentDto(marketingContentDto);
            //---审核信息组拼结束
            //---企业微信信息组拼
            MarketingMsgDto marketingMsgDto = new MarketingMsgDto();
            marketingMsgDto.setEmphasisFirstItem(true);
            List<MarketingMsgItemDto> contentItem = new ArrayList<>();
            marketingMsgItemDto = new MarketingMsgItemDto();
            marketingMsgItemDto.setKey("审核主题");
            marketingMsgItemDto.setValue(processUserRoomBean.getOneTitle());
            contentItem.add(marketingMsgItemDto);
            marketingMsgItemDto = new MarketingMsgItemDto();
            marketingMsgItemDto.setKey("原科室医生");
            marketingMsgItemDto.setValue("无");
            contentItem.add(marketingMsgItemDto);
            marketingMsgItemDto = new MarketingMsgItemDto();
            marketingMsgItemDto.setKey("新科室医生");
            marketingMsgItemDto.setValue(doctorStr.toString());
            contentItem.add(marketingMsgItemDto);
            marketingMsgDto.setContentItem(contentItem);
            marketingTotalDto.setMarketingMsgDto(marketingMsgDto);
            //---企业微信信息组拼结束
        } else if (UserDiagnosisDoctor.TYPE_DIAGNOSIS_CREATE.equals(userDoctorRoomDto.getType())) {
            //点诊不足创建科室医生
            //---审核信息组拼开始
            marketingTotalDto.setTitle(processUserRoomBean.getThreeTitle());
            marketingTotalDto.setType(processUserRoomBean.getThreeCode());
            marketingTotalDto.setCallbackUrl(processUserRoomBean.getUrl());
            MarketingContentDto marketingContentDto = new MarketingContentDto();
            List<MarketingMsgItemDto> contentList = new ArrayList<>();
            MarketingMsgItemDto marketingMsgItemDto = new MarketingMsgItemDto();
            marketingMsgItemDto.setKey("原科室医生");
            marketingMsgItemDto.setValue(oldDoctorStr.toString());
            contentList.add(marketingMsgItemDto);
            marketingMsgItemDto = new MarketingMsgItemDto();
            marketingMsgItemDto.setKey("修改科室医生");
            marketingMsgItemDto.setValue(doctorStr.toString());
            contentList.add(marketingMsgItemDto);
            marketingContentDto.setContentList(contentList);
            marketingTotalDto.setMarketingContentDto(marketingContentDto);
            //---审核信息组拼结束
            //---企业微信信息组拼
            MarketingMsgDto marketingMsgDto = new MarketingMsgDto();
            marketingMsgDto.setEmphasisFirstItem(true);
            List<MarketingMsgItemDto> contentItem = new ArrayList<>();
            marketingMsgItemDto = new MarketingMsgItemDto();
            marketingMsgItemDto.setKey("审核主题");
            marketingMsgItemDto.setValue(processUserRoomBean.getThreeTitle());
            contentItem.add(marketingMsgItemDto);
            marketingMsgItemDto = new MarketingMsgItemDto();
            marketingMsgItemDto.setKey("原科室医生");
            marketingMsgItemDto.setValue(oldDoctorStr.toString());
            contentItem.add(marketingMsgItemDto);
            marketingMsgItemDto = new MarketingMsgItemDto();
            marketingMsgItemDto.setKey("修改科室医生");
            marketingMsgItemDto.setValue(doctorStr.toString());
            contentItem.add(marketingMsgItemDto);
            marketingMsgDto.setContentItem(contentItem);
            marketingTotalDto.setMarketingMsgDto(marketingMsgDto);
            //---企业微信信息组拼结束
        }
        logger.info("科室医生关系请求审核参数{}", JSON.toJSONString(marketingTotalDto));
        return mCommonService.commonApply(marketingTotalDto);
    }
    /**
     * 用户点诊记录回调修改
     */
    @Override
    public void updateUserDoctorTemporary(UserParamDto userParamDto, MarketingReturnDto marketingReturnDto) {
        SqlSentence sqlSentence = new SqlSentence();
        Map<String, Object> sqlMap = new HashMap<>();
        sqlMap.put("id", marketingReturnDto.getUniqueId());
        if (marketingReturnDto.getResult().equals(MarketingReturnDto.AGREE)) {
            sqlMap.put("approveStatus", 1);
        } else if (marketingReturnDto.getResult().equals(MarketingReturnDto.REJECT)) {
            sqlMap.put("approveStatus", 2);
        }
        sqlMap.put("approveId",marketingReturnDto.getApplyId());
        sqlSentence.sqlSentence(" approveStatus = #{m.approveStatus},approveId = #{m.approveId} " +
                "  WHERE id = #{m.id} AND approveStatus = 0 ", sqlMap);
        if (userDiagnosisDoctorMapper.updateWhere(sqlSentence) != 1) {
            logger.error("点诊记录回调,修改审核状态失败:" + JSON.toJSONString(marketingReturnDto));
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "修改审核状态失败");
        }
        UserDiagnosisDoctor userDiagnosisDoctor = userDiagnosisDoctorMapper.selectOneByKey(marketingReturnDto.getUniqueId());
        if (userDiagnosisDoctor == null) {
            logger.error("点诊记录回调,查询记录信息失败:" + JSON.toJSONString(marketingReturnDto));
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "获取记录信息失败!");
        }
        //如果通过,修改科室关系
        if (!marketingReturnDto.getResult().equals(MarketingReturnDto.AGREE)) {
            return;
        }
        //消息通知
        List<TemplateMessageDto> msgList = new ArrayList<>();
        //原科室关系
        sqlMap.put("userId", userDiagnosisDoctor.getUserId());
        sqlSentence.sqlSentence("SELECT * FROM user_families_room WHERE userId = #{m.userId}", sqlMap);
        List<UserFamiliesRoom> userFamiliesRoomList = userFamiliesRoomMapper.selectList(sqlSentence);
        Map<String, UserFamiliesRoom> map = new HashMap<>();
        for (UserFamiliesRoom userFamiliesRoom : userFamiliesRoomList) {
            map.put(userFamiliesRoom.getFamiliesRoomId(), userFamiliesRoom);
        }
        //要修改的科室信息
        sqlMap.put("temporaryId", userDiagnosisDoctor.getId());
        sqlSentence.sqlSentence("SELECT * FROM user_diagnosis_doctor_item WHERE temporaryId = #{m.temporaryId}", sqlMap);
        List<UserDiagnosisDoctorItem> diagnosisDoctorItemList = userDiagnosisDoctorItemMapper.selectList(sqlSentence);
        //点诊的通知
        if (userDiagnosisDoctor.getType().equals(UserDiagnosisDoctor.TYPE_DIAGNOSIS)) {
            for (UserDiagnosisDoctorItem userDiagnosisDoctorItem : diagnosisDoctorItemList) {
                //通知数据
                UserFamiliesRoom userFamiliesRoom = map.get(userDiagnosisDoctorItem.getRoomId());
                if (userFamiliesRoom != null) {
                    Employee employee = employeeMapper.selectOneByKey(userDiagnosisDoctorItem.getOldDoctorId());
                    if (employee != null) {
                        addMsg(userDiagnosisDoctor.getUserName(),userDiagnosisDoctor.getUserCiq()
                                ,userDiagnosisDoctor.getUserLevel(),customParameter.getCorpAppId()
                                , customParameter.getCorpMpAppId(), msgList, employee.getUserId()
                                , "点诊医生通知", "开治疗单申请点诊医生"
                                , userFamiliesRoom.getFamiliesRoomName() + ":" + userFamiliesRoom.getDoctorName()
                                , userDiagnosisDoctorItem.getRoomName() + ":" + userDiagnosisDoctorItem.getDoctorName()
                                , 1,userDiagnosisDoctor.getOpName(),userDiagnosisDoctor.getReasonType());
                    }
                }
            }
        }
        //如果是需要修改科室的类型
        if (userDiagnosisDoctor.getType().equals(UserDiagnosisDoctor.TYPE_NONE)
                || userDiagnosisDoctor.getType().equals(UserDiagnosisDoctor.TYPE_DIAGNOSIS_CREATE)) {
            userParamDto.setUserId(userDiagnosisDoctor.getUserId());
            userParamDto.setOpId(userDiagnosisDoctor.getOpId());
            userParamDto.setIsEditFamiliesRoom(1);
            List<UserFamiliesRoom> selectList = new ArrayList<>();
            UserFamiliesRoom selectRoom = null;
            for (UserDiagnosisDoctorItem userDiagnosisDoctorItem : diagnosisDoctorItemList) {
                selectRoom = new UserFamiliesRoom();
                selectRoom.setDoctorId(userDiagnosisDoctorItem.getDoctorId());
                selectRoom.setDoctorName(userDiagnosisDoctorItem.getDoctorName());
                selectRoom.setFamiliesRoomId(userDiagnosisDoctorItem.getRoomId());
                selectRoom.setFamiliesRoomName(userDiagnosisDoctorItem.getRoomName());
                selectList.add(selectRoom);
                //通知数据
                UserFamiliesRoom userFamiliesRoom = map.get(userDiagnosisDoctorItem.getRoomId());
                if (userFamiliesRoom != null) {
                    Employee employee = employeeMapper.selectOneByKey(userDiagnosisDoctorItem.getOldDoctorId());
                    if (employee != null) {
                        addMsg(userDiagnosisDoctor.getUserName(),userDiagnosisDoctor.getUserCiq()
                                ,userDiagnosisDoctor.getUserLevel(),customParameter.getCorpAppId()
                                , customParameter.getCorpMpAppId(), msgList
                                , employee.getUserId(), "科室医生变更通知", "开治疗单变更科室医生"
                                , userFamiliesRoom.getFamiliesRoomName() + ":" + userFamiliesRoom.getDoctorName()
                                , userDiagnosisDoctorItem.getRoomName() + ":" + userDiagnosisDoctorItem.getDoctorName()
                                , 0,userDiagnosisDoctor.getOpName(),userDiagnosisDoctor.getOperatorRemark());
                    }
                }
            }
            userParamDto.setDepartmentJson(JSON.toJSONString(selectList));
            //请求修改
            updateFamiliesRoom(userParamDto, userParamDto.getUserId(), userParamDto.getOpId());
        }
        //发送企业消息
        if (msgList.size() > 0) {
            //开启线程
            ExecutorServiceTool fixedThreadPool = new ExecutorServiceTool(2, 10);
            try {
                for (TemplateMessageDto templateMessageDto : msgList) {
                    fixedThreadPool.getThreadPool().execute(() -> {
                        Result result = fCorpWXSendService.sendNoticeSms(templateMessageDto);
                        logger.info("点诊回调发送通知消息发送返回:" + JSON.toJSONString(result));
                    });
                }
            } catch (Exception e) {
                logger.error("点诊回调发送通知消息发送,错误" + ExceptionTool.getExceptionInfo(e));
            } finally {
                fixedThreadPool.shutdown();
            }
        }
    }
    /**
     * 修改科室医生HIS助手通知消息添加
     * @param userName 客户名称
     * @param ciq 客户ciq
     * @param userLevel 客户等级
     * @param corpId 企业
     * @param appId 小程序
     * @param touSer 发送人
     * @param title 标题
     * @param description 描述
     * @param oldDoctor 旧医生
     * @param newDoctor 医生
     * @param isDiagnosis 是否点诊
     * @param opMan 操作人
     * @param opReason  操作原因/备注
     * @param msgList 发送消息实体集合返回用
     */
    private void addMsg(String userName,String ciq,String userLevel,String corpId, String appId
            , List<TemplateMessageDto> msgList, String touSer, String title, String description
            , String oldDoctor, String newDoctor, Integer isDiagnosis,String opMan,String opReason) {
        TemplateMessageDto templateMessageDto = new TemplateMessageDto();
        templateMessageDto.setCorpId(corpId);
        templateMessageDto.setAppId(appId);
        templateMessageDto.setTouSer(touSer);
        templateMessageDto.setSendModel(TemplateMessageDto.SEND_TYPE_IMMEDIATELY);
        //子信息
        TemplateMsgDto templateMsgDto = new TemplateMsgDto();
        templateMsgDto.setAppId(appId);
        templateMsgDto.setTitle(title);
        templateMsgDto.setDescription(description);
        List<ContentItemDto> contentItemList = new ArrayList<>();
        ContentItemDto contentItemDto = new ContentItemDto();
        contentItemDto.setKey("客户名称(CIQ)");
        if (!StringUtils.isEmpty(ciq)){
            contentItemDto.setValue(userName+"("+ciq+")");
        }else {
            contentItemDto.setValue(userName+"()");
        }
        contentItemList.add(contentItemDto);
        contentItemDto = new ContentItemDto();
        contentItemDto.setKey("客户等级");
        contentItemDto.setValue(userLevel);
        contentItemList.add(contentItemDto);
        contentItemDto = new ContentItemDto();
        contentItemDto.setKey("原科室医生");
        contentItemDto.setValue(oldDoctor);
        contentItemList.add(contentItemDto);
        if (isDiagnosis != null && isDiagnosis.equals(BaseEntity.YES)) {
            contentItemDto = new ContentItemDto();
            contentItemDto.setKey("点诊的医生");
            contentItemDto.setValue(newDoctor);
            contentItemList.add(contentItemDto);
            contentItemDto = new ContentItemDto();
            contentItemDto.setKey("申请原因");
            contentItemDto.setValue(opReason);
            contentItemList.add(contentItemDto);
        } else {
            contentItemDto = new ContentItemDto();
            contentItemDto.setKey("修改的医生");
            contentItemDto.setValue(newDoctor);
            contentItemList.add(contentItemDto);
            contentItemDto = new ContentItemDto();
            contentItemDto.setKey("申请备注");
            contentItemDto.setValue(opReason);
            contentItemList.add(contentItemDto);
        }
        contentItemDto = new ContentItemDto();
        contentItemDto.setKey("操作人");
        contentItemDto.setValue(opMan);
        contentItemList.add(contentItemDto);
        contentItemDto = new ContentItemDto();
        contentItemDto.setKey("操作时间");
        contentItemDto.setValue(DateUtil.formatDate(new Date(), "yyyy-MM-dd HH:mm:dd"));
        contentItemList.add(contentItemDto);
        templateMsgDto.setContentItem(contentItemList);
        templateMessageDto.setMinIProgramNotice(templateMsgDto);
        msgList.add(templateMessageDto);
    }
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /** 用户信息完善 处理标签信息**/
phi_platform_user/src/main/java/com/hx/phip/service/user/UserDoctorNewService.java
New file
@@ -0,0 +1,11 @@
package com.hx.phip.service.user;
import com.hz.his.dto.marketing.common.MarketingResultDto;
/**
 * 用户点诊医生
 */
public interface UserDoctorNewService {
    /**点诊修改审核信息*/
    void userDiagnosisDoctor(MarketingResultDto marketingResultDto);
}
phi_platform_user/src/main/java/com/hx/phip/service/user/impl/UserDoctorNewServiceImpl.java
New file
@@ -0,0 +1,51 @@
package com.hx.phip.service.user.impl;
import com.alibaba.fastjson.JSON;
import com.hx.phiappt.common.OriginChannelConstants;
import com.hx.phiappt.model.BaseEntity;
import com.hx.phip.service.UserService;
import com.hx.phip.service.user.UserDoctorNewService;
import com.hz.his.dto.marketing.common.MarketingResultDto;
import com.hz.his.dto.marketing.common.MarketingReturnDto;
import com.hz.his.dto.user.UserParamDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
 * 用户点诊医生
 */
@Service
public class UserDoctorNewServiceImpl implements UserDoctorNewService {
    private static Logger logger = LoggerFactory.getLogger(UserDoctorNewServiceImpl.class.getName());
    @Resource
    private UserService userService;
    /**
     * 点诊修改审核信息
     */
    @Override
    @Transactional(propagation = Propagation.REQUIRES_NEW,rollbackFor = Exception.class)
    public void userDiagnosisDoctor(MarketingResultDto dto) {
        logger.info("点诊修改审核数据"+JSON.toJSONString(dto));
        if (dto.getIsPass() != null && dto.getIsPass().equals(BaseEntity.YES)) {
            MarketingReturnDto marketingReturnDto = new MarketingReturnDto();
            marketingReturnDto.setResult(MarketingReturnDto.AGREE);
            marketingReturnDto.setUniqueId(dto.getUniqueId());
            marketingReturnDto.setApplyId(dto.getApplyId());
            //直接通过默认给营销助手平台
            UserParamDto userParamDto = new UserParamDto();
            userParamDto.setApiId(OriginChannelConstants.ORIGIN_CHANNEL_MA);
            logger.info("点诊修改审核数据,修改科室平台参数{},营销助手返回参数{}",JSON.toJSONString(userParamDto),JSON.toJSONString(marketingReturnDto));
            userService.updateUserDoctorTemporary(userParamDto,marketingReturnDto);
        }
    }
}