1.修改预约新增字段:预约冲突原因
2.对应新增编辑发送预约待审核通知
2个文件已修改
493 ■■■■ 已修改文件
phi_platform_user/src/main/java/com/hx/phip/controller/appointment/AppointmentController.java 481 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/service/appointment/impl/AppointmentV2ServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/controller/appointment/AppointmentController.java
@@ -4,7 +4,6 @@
import com.alibaba.fastjson.JSONObject;
import com.hx.common.BaseController;
import com.hx.exception.TipsException;
import com.hx.guide.util.AppointmentListUtil;
import com.hx.guide.util.CommonQueryUtil;
import com.hx.mybatisTool.SqlSentence;
import com.hx.phiappt.common.OperatorConstants;
@@ -12,12 +11,10 @@
import com.hx.phiappt.common.UserStatusConstants;
import com.hx.phiappt.constants.tool.appointment.AppointmentTool;
import com.hx.phiappt.constants.tool.appointment.TransferUtil;
import com.hx.phiappt.constants.tool.appointment.autoMate.AppAutoMateV5Util;
import com.hx.phiappt.dao.mapper.*;
import com.hx.phiappt.model.*;
import com.hx.phiappt.util.AppointmentV2Util;
import com.hx.phiappt.vo.OperatorVo;
import com.hx.phiappt.vo.ProjectVo;
import com.hx.phip.service.EmployeeRoleService;
import com.hx.phip.service.EmployeeService;
import com.hx.phip.service.SystemParameterService;
@@ -26,10 +23,7 @@
import com.hx.resultTool.Result;
import com.hx.util.DateUtil;
import com.hx.util.StringUtils;
import com.hz.his.dto.appointment.AppointmentCrmAddDto;
import com.hz.his.dto.appointment.AppointmentV2Dto;
import com.platform.exception.PlatTipsException;
import com.platform.resultTool.PlatformCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.RequestBody;
@@ -59,239 +53,6 @@
    private EmployeeRoleService employeeRoleService;
    @Resource
    private EmployeeService employeeService;
    /** CRM预约(CRM的再升美学预约) */
    @RequestMapping("/crm/app")
    public Result crmApp(@RequestBody(required = false) AppointmentCrmAddDto dto) {
        if (dto == null) {
             throw new PlatTipsException(PlatformCode.ERROR_TIPS, "请求参数为空!");
        }
        if(dto.getHandleType() == null){
             throw new PlatTipsException(PlatformCode.ERROR_TIPS, "处理类型不能为空!");
        }
        Appointment appointment = null;
        //判断处理类型处理类型(1新增2编辑3取消)
        if(dto.getHandleType() == 2 || dto.getHandleType() == 3){
            if(StringUtils.isEmpty(dto.getAppointmentId())){
                throw new PlatTipsException(PlatformCode.ERROR_TIPS, "预约标识不能为空!");
            }
            appointment = commonService.selectOneByKey(AppointmentMapper.class, dto.getAppointmentId());
            if(appointment == null){
                throw new PlatTipsException(PlatformCode.ERROR_TIPS, "查询不到预约信息!");
            }
            //如果处理类型为取消,则直接调用取消逻辑然后返回
            if(dto.getHandleType() == 3){
                appointmentService.cancel(appointment, dto.getRemark(), Appointment.CANCEL_TYPE_CRM_USER, null);
                return Result.success();
            }
        }
        if(StringUtils.isEmpty(dto.getUserId())){
             throw new PlatTipsException(PlatformCode.ERROR_TIPS, "用户标识为空!");
        }
        if(StringUtils.isEmpty(dto.getShopId())){
             throw new PlatTipsException(PlatformCode.ERROR_TIPS, "门店标识为空!");
        }
        if(StringUtils.isEmpty(dto.getDoctorId())){
             throw new PlatTipsException(PlatformCode.ERROR_TIPS, "医生标识为空!");
        }
        if(StringUtils.isEmpty(dto.getStartTime())){
             throw new PlatTipsException(PlatformCode.ERROR_TIPS, "开始时间为空!");
        }
        User user = commonService.selectOneByKeyBlob(UserMapper.class, dto.getUserId());
        if (user == null) {
             throw new PlatTipsException(PlatformCode.ERROR_TIPS, "找不到用户信息!");
        }
        Shop shop = commonService.selectOneByKeyBlob(ShopMapper.class, dto.getShopId());
        if (shop == null) {
             throw new PlatTipsException(PlatformCode.ERROR_TIPS, "找不到门店信息!");
        }
        Employee employee = commonService.selectOneByKeyBlob(EmployeeMapper.class, dto.getDoctorId());
        if (employee == null) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "找不到医生信息!");
        }
        //目前写死一个项目
        SystemParameter sp = systemParameterService.selectOneByName(SystemParameter.KEY_CRM_APPOINTMENT_PROJECT_ID);
        if(sp == null || StringUtils.isEmpty(sp.getParamValue())){
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "还未配置项目信息!");
        }
        Project project = commonService.selectOneByKey(ProjectMapper.class, sp.getParamValue());
        if(project == null){
             throw new PlatTipsException(PlatformCode.ERROR_TIPS, "找不到项目信息!");
        }
        if(project == null || project.getIsDel() == BaseEntity.YES || project.getIsUp() == BaseEntity.NO)
        {
             throw new PlatTipsException(PlatformCode.ERROR_TIPS, "找不到项目或者项目下架!");
        }
        //组装json数组
        JSONArray arr = new JSONArray();
        JSONObject temp = new JSONObject();
        temp.put("id", project.getId());
        temp.put("num", 1);
        temp.put("isLifeBeauty", project.getIsLifeBeauty());
        temp.put("name", project.getName());
        temp.put("palsyDuration", project.getPalsyDuration());
        temp.put("isPalsy", project.getPalsyDuration() > 0 ? 1 : 0);
        temp.put("useDuration", project.getUseDuration());
        arr.add(temp);
        String [] projectIdsArr =  new String[arr.size()];
        String [] projectNamesArr = new String[arr.size()];
        Map<String, Integer> pNumMap = new HashMap<>();
        Map<String, Integer> pZlMap = new HashMap<>();
        String id = null;
        int num = 0;
        int zlTime = 0;
        List<AppointmentProject> apList = new ArrayList<>();
        LinkedHashMap<String, ProjectVo> pMap = new LinkedHashMap<>();
        for(int i = 0; i < arr.size(); i ++)
        {
            temp = arr.getJSONObject(i);
            id = temp.getString("id");
            num = temp.getIntValue("num");
            if(StringUtils.isEmpty(id) || num <= 0)
            {
                 throw new PlatTipsException(PlatformCode.ERROR_TIPS, "请选择正确项目和数量");
            }
            project = commonService.selectOneByKey(ProjectMapper.class, id);
            if(project == null || project.getIsDel() == BaseEntity.YES || project.getIsUp() == BaseEntity.NO)
            {
                 throw new PlatTipsException(PlatformCode.ERROR_TIPS, "找不到项目或者项目下架");
            }
//            //获取最大的术前准备时间
//            if(project.getReadyDuration() > sqTime){
//                sqTime = project.getReadyDuration();
//            }
            pNumMap.put(id, num);
            //判断治疗时间等于0,则默认5分钟
            pZlMap.put(id, project.getUseDuration() == null ? 0 : project.getUseDuration());
            pMap.put(id, new ProjectVo(project, num, dto.getShopId()));
            pMap.get(id).setZlTime(project.getUseDuration() / 60);
            projectIdsArr[i] = id;
            projectNamesArr[i] = project.getName();
            apList.add(new AppointmentProject(id, num));
            //治疗时间(分钟) = 项目使用时长(秒) / 60
            zlTime += project.getUseDuration() / 60;
        }
        SqlSentence sqlSentence = new SqlSentence();
        Map<String, Object> values = new HashMap<>();
        sqlSentence.setM(values);
        AppointmentInfo appointmentInfo = new AppointmentInfo();
        if(appointment == null){
            appointment = new Appointment();
        }
        appointment.setStatus(Appointment.STATUS_SUC);
        appointment.setSourceId(dto.getSourceId());
        appointment.setShopId(dto.getShopId());
        appointment.setDoctorId(dto.getDoctorId());
        appointment.setUserId(dto.getUserId());
        //项目信息
        appointment.setProjectJson(arr.toJSONString());
        appointment.setProjectIds(org.apache.commons.lang.StringUtils.join(projectIdsArr,","));
        appointment.setProjectNames(org.apache.commons.lang.StringUtils.join(projectNamesArr,","));
        //时间信息
        appointment.setStartTime(DateUtil.parseString_1(dto.getStartTime()));
        appointment.setEndTime(DateUtil.parseString_1(dto.getEndTime()));
        appointment.setDayStr(DateUtil.formatDate(appointment.getStartTime()));
        //周字符串
        Calendar ca = Calendar.getInstance();
        ca.setTime(appointment.getStartTime());
        int dayOfWeek = ca.get(Calendar.DAY_OF_WEEK);
        if(dayOfWeek == 1)
        {
            ca.add(Calendar.DAY_OF_YEAR, -6);
        }else{
            ca.add(Calendar.DAY_OF_YEAR, 2 - dayOfWeek);
        }
        appointment.setWeekStr(DateUtil.formatDate(ca.getTime()));
        appointment.setMonthStr(appointment.getDayStr().substring(0, 6));
        //所属顾问,使用用户所属顾问
        appointment.setCorpUserId(user.getHisCorpUserId());
        //创建人信息
        appointment.setCreateManId(user.getId());
        appointment.setCreateManName(user.getName());
        appointment.setCreateManType(Appointment.CREATE_MAN_TYPE_USER);
        //默认就诊类型:医美
        appointment.setVisitType("医美");
        //备注
        appointment.setRemark(dto.getRemark());
        //新增模式
        appointment.setAddMode(Appointment.ADD_MODE_CRM_CREATE);
        //
        appointment.setComDuration(0);
        appointment.setDocComDuration(0);
        appointment.setReadyDuration(0);
        appointment.setProDuration(0);
        appointment.setPalsyDuration(0);
        appointment.setTreatDuration(zlTime);
        appointment.setDoctorZlDuration(zlTime);
        //总时长 = 面诊 + 沟通 + 敷麻 + 术前 + 准备等待 + 治疗
        int duration = appointment.getDocComDuration() + appointment.getComDuration() + appointment.getPalsyDuration() + appointment.getReadyDuration() + appointment.getWaitDuration() + appointment.getTreatDuration();
        appointment.setDuration(duration);
        //获取出医生的治疗时间记录
        JSONArray zlTimeJson = AppAutoMateV5Util.handleDoctorZlTime(pMap, appointment.getStartTime());
        appointmentInfo.setZlTimeJson(zlTimeJson.toString());
        List<DoctorTime> doctorTimeList = AppointmentV2Util.getDoctorZlTime(zlTimeJson.toString(), appointment.getShopId(), appointment.getDoctorId(), appointment.getDayStr(), appointment.getMonthStr());
        //新增时
        if(StringUtils.isEmpty(appointment.getId())){
            //冗余用户信息
            appointmentInfo.setUserStatus(user.getUserStatus());
            appointmentInfo.setUserStatusCn(UserStatusConstants.getName(user.getUserStatus()));
            appointmentInfo.setUserInternetCorpUserId(user.getInternetCorpUserId());
            appointmentInfo.setUserInternetCorpUserName(CommonQueryUtil.getEmployeeName(user.getInternetCorpUserId(), commonService));
            appointmentInfo.setUserConsultantId(user.getHisCorpUserId());
            appointmentInfo.setUserConsultantName(CommonQueryUtil.getEmployeeName(user.getHisCorpUserId(), commonService));
            appointmentInfo.setUserShopId(user.getShopId());
            appointmentInfo.setUserShopName(CommonQueryUtil.getShopName(user.getShopId(), commonService));
            appointmentInfo.setUserLevel(user.getUserLevel());
            appointmentInfo.setMemberLevelId(user.getMemberLevelId());
            //根据用户角色信息,获取对应可使用预约类型,多个取第一个
            net.sf.json.JSONArray appTypeArr = AppointmentListUtil.userToAppType(dto.getUserId(), commonService);
            if(appTypeArr == null || appTypeArr.size() < 1){
                 throw new PlatTipsException(PlatformCode.ERROR_TIPS, "没有对应预约类型!");
            }
            appointment.setAppType(appTypeArr.getInt(0));
        }
        //添加预约
        if(dto.getHandleType() == 1){
            appointmentService.crmAdd(appointment, apList, doctorTimeList, null, appointmentInfo);
        }else if(dto.getHandleType() == 2){
            appointmentService.crmEdit(appointment, appointmentInfo, 0, doctorTimeList, apList, null, null);
        }
        JSONObject data = new JSONObject();
        data.put("appointmentId", appointment.getId());
        return Result.success(data);
    }
    /** 新增预约 */
    @RequestMapping("/add")
@@ -487,6 +248,8 @@
        }
        //周,取当前周一
        appointment.setWeekStr(DateUtil.formatDate(getWeekDate(st)));
        //预约冲突原因
        appointment.setConflictReason(dto.getConflictReason());
        //处理预约状态和是否转疗逻辑
        handleStatusAndIsSwitch(dto.getAddMode(), appointment, shop, employee, false, null);
@@ -793,6 +556,7 @@
        appointment.setProjectJson(dto.getProjectJson());
        appointment.setComRoomId(dto.getComRoomId());
        appointment.setTreatRoomId(dto.getTreatRoomId());
        appointment.setConflictReason(dto.getConflictReason());
        //如果预约已审核,则记录一下已审核修改
        if(appointment.getStatus() == Appointment.STATUS_SUC || appointment.getStatus() == Appointment.STATUS_FAIL) {
            appointment.setIsModify(BaseEntity.YES);
@@ -951,6 +715,9 @@
    //处理预约状态和是否转疗逻辑
    private void handleStatusAndIsSwitch(Integer addMode, Appointment appointment, Shop shop, Employee employee, boolean isEdit, Appointment oldInfo) {
        //默认状态:待审核
        appointment.setStatus(Appointment.STATUS_WAIT);
        //CRM预约的默认状态:预约成功
        if(addMode == Appointment.ADD_MODE_CRM_SELF){
            appointment.setStatus(Appointment.STATUS_SUC);
@@ -962,8 +729,6 @@
            return;
        }
        //默认状态:待审核
        appointment.setStatus(Appointment.STATUS_WAIT);
        //判断系统是否设置了自动审核成功
        SystemParameter systemParameter = systemParameterService.selectOneByName(SystemParameter.KEY_APP_AUTO_EXAMINE_SUC);
        if(systemParameter == null || !"1".equals(systemParameter.getParamValue())){
@@ -1095,4 +860,238 @@
    }
    //
//    /** CRM预约(CRM的再升美学预约) */
//    @RequestMapping("/crm/app")
//    public Result crmApp(@RequestBody(required = false) AppointmentCrmAddDto dto) {
//
//        if (dto == null) {
//             throw new PlatTipsException(PlatformCode.ERROR_TIPS, "请求参数为空!");
//        }
//
//        if(dto.getHandleType() == null){
//             throw new PlatTipsException(PlatformCode.ERROR_TIPS, "处理类型不能为空!");
//        }
//
//        Appointment appointment = null;
//        //判断处理类型处理类型(1新增2编辑3取消)
//        if(dto.getHandleType() == 2 || dto.getHandleType() == 3){
//            if(StringUtils.isEmpty(dto.getAppointmentId())){
//                throw new PlatTipsException(PlatformCode.ERROR_TIPS, "预约标识不能为空!");
//            }
//
//            appointment = commonService.selectOneByKey(AppointmentMapper.class, dto.getAppointmentId());
//            if(appointment == null){
//                throw new PlatTipsException(PlatformCode.ERROR_TIPS, "查询不到预约信息!");
//            }
//
//            //如果处理类型为取消,则直接调用取消逻辑然后返回
//            if(dto.getHandleType() == 3){
//                appointmentService.cancel(appointment, dto.getRemark(), Appointment.CANCEL_TYPE_CRM_USER, null);
//                return Result.success();
//            }
//        }
//
//        if(StringUtils.isEmpty(dto.getUserId())){
//             throw new PlatTipsException(PlatformCode.ERROR_TIPS, "用户标识为空!");
//        }
//
//        if(StringUtils.isEmpty(dto.getShopId())){
//             throw new PlatTipsException(PlatformCode.ERROR_TIPS, "门店标识为空!");
//        }
//
//        if(StringUtils.isEmpty(dto.getDoctorId())){
//             throw new PlatTipsException(PlatformCode.ERROR_TIPS, "医生标识为空!");
//        }
//
//        if(StringUtils.isEmpty(dto.getStartTime())){
//             throw new PlatTipsException(PlatformCode.ERROR_TIPS, "开始时间为空!");
//        }
//
//        User user = commonService.selectOneByKeyBlob(UserMapper.class, dto.getUserId());
//        if (user == null) {
//             throw new PlatTipsException(PlatformCode.ERROR_TIPS, "找不到用户信息!");
//        }
//
//        Shop shop = commonService.selectOneByKeyBlob(ShopMapper.class, dto.getShopId());
//        if (shop == null) {
//             throw new PlatTipsException(PlatformCode.ERROR_TIPS, "找不到门店信息!");
//        }
//
//        Employee employee = commonService.selectOneByKeyBlob(EmployeeMapper.class, dto.getDoctorId());
//        if (employee == null) {
//            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "找不到医生信息!");
//        }
//
//        //目前写死一个项目
//        SystemParameter sp = systemParameterService.selectOneByName(SystemParameter.KEY_CRM_APPOINTMENT_PROJECT_ID);
//        if(sp == null || StringUtils.isEmpty(sp.getParamValue())){
//            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "还未配置项目信息!");
//        }
//
//        Project project = commonService.selectOneByKey(ProjectMapper.class, sp.getParamValue());
//        if(project == null){
//             throw new PlatTipsException(PlatformCode.ERROR_TIPS, "找不到项目信息!");
//        }
//
//        if(project == null || project.getIsDel() == BaseEntity.YES || project.getIsUp() == BaseEntity.NO)
//        {
//             throw new PlatTipsException(PlatformCode.ERROR_TIPS, "找不到项目或者项目下架!");
//        }
//
//        //组装json数组
//        JSONArray arr = new JSONArray();
//        JSONObject temp = new JSONObject();
//        temp.put("id", project.getId());
//        temp.put("num", 1);
//        temp.put("isLifeBeauty", project.getIsLifeBeauty());
//        temp.put("name", project.getName());
//        temp.put("palsyDuration", project.getPalsyDuration());
//        temp.put("isPalsy", project.getPalsyDuration() > 0 ? 1 : 0);
//        temp.put("useDuration", project.getUseDuration());
//        arr.add(temp);
//
//        String [] projectIdsArr =  new String[arr.size()];
//        String [] projectNamesArr = new String[arr.size()];
//        Map<String, Integer> pNumMap = new HashMap<>();
//        Map<String, Integer> pZlMap = new HashMap<>();
//        String id = null;
//        int num = 0;
//        int zlTime = 0;
//
//
//        List<AppointmentProject> apList = new ArrayList<>();
//        LinkedHashMap<String, ProjectVo> pMap = new LinkedHashMap<>();
//        for(int i = 0; i < arr.size(); i ++)
//        {
//            temp = arr.getJSONObject(i);
//            id = temp.getString("id");
//            num = temp.getIntValue("num");
//            if(StringUtils.isEmpty(id) || num <= 0)
//            {
//                 throw new PlatTipsException(PlatformCode.ERROR_TIPS, "请选择正确项目和数量");
//            }
//            project = commonService.selectOneByKey(ProjectMapper.class, id);
//            if(project == null || project.getIsDel() == BaseEntity.YES || project.getIsUp() == BaseEntity.NO)
//            {
//                 throw new PlatTipsException(PlatformCode.ERROR_TIPS, "找不到项目或者项目下架");
//            }
////            //获取最大的术前准备时间
////            if(project.getReadyDuration() > sqTime){
////                sqTime = project.getReadyDuration();
////            }
//            pNumMap.put(id, num);
//            //判断治疗时间等于0,则默认5分钟
//            pZlMap.put(id, project.getUseDuration() == null ? 0 : project.getUseDuration());
//            pMap.put(id, new ProjectVo(project, num, dto.getShopId()));
//            pMap.get(id).setZlTime(project.getUseDuration() / 60);
//            projectIdsArr[i] = id;
//            projectNamesArr[i] = project.getName();
//            apList.add(new AppointmentProject(id, num));
//            //治疗时间(分钟) = 项目使用时长(秒) / 60
//            zlTime += project.getUseDuration() / 60;
//        }
//
//        SqlSentence sqlSentence = new SqlSentence();
//        Map<String, Object> values = new HashMap<>();
//        sqlSentence.setM(values);
//
//        AppointmentInfo appointmentInfo = new AppointmentInfo();
//        if(appointment == null){
//            appointment = new Appointment();
//        }
//        appointment.setStatus(Appointment.STATUS_SUC);
//        appointment.setSourceId(dto.getSourceId());
//        appointment.setShopId(dto.getShopId());
//        appointment.setDoctorId(dto.getDoctorId());
//        appointment.setUserId(dto.getUserId());
//        //项目信息
//        appointment.setProjectJson(arr.toJSONString());
//        appointment.setProjectIds(org.apache.commons.lang.StringUtils.join(projectIdsArr,","));
//        appointment.setProjectNames(org.apache.commons.lang.StringUtils.join(projectNamesArr,","));
//        //时间信息
//        appointment.setStartTime(DateUtil.parseString_1(dto.getStartTime()));
//        appointment.setEndTime(DateUtil.parseString_1(dto.getEndTime()));
//        appointment.setDayStr(DateUtil.formatDate(appointment.getStartTime()));
//        //周字符串
//        Calendar ca = Calendar.getInstance();
//        ca.setTime(appointment.getStartTime());
//        int dayOfWeek = ca.get(Calendar.DAY_OF_WEEK);
//        if(dayOfWeek == 1)
//        {
//            ca.add(Calendar.DAY_OF_YEAR, -6);
//        }else{
//            ca.add(Calendar.DAY_OF_YEAR, 2 - dayOfWeek);
//        }
//        appointment.setWeekStr(DateUtil.formatDate(ca.getTime()));
//        appointment.setMonthStr(appointment.getDayStr().substring(0, 6));
//        //所属顾问,使用用户所属顾问
//        appointment.setCorpUserId(user.getHisCorpUserId());
//        //创建人信息
//        appointment.setCreateManId(user.getId());
//        appointment.setCreateManName(user.getName());
//        appointment.setCreateManType(Appointment.CREATE_MAN_TYPE_USER);
//        //默认就诊类型:医美
//        appointment.setVisitType("医美");
//        //备注
//        appointment.setRemark(dto.getRemark());
//        //新增模式
//        appointment.setAddMode(Appointment.ADD_MODE_CRM_CREATE);
//
//        //
//        appointment.setComDuration(0);
//        appointment.setDocComDuration(0);
//        appointment.setReadyDuration(0);
//        appointment.setProDuration(0);
//        appointment.setPalsyDuration(0);
//        appointment.setTreatDuration(zlTime);
//        appointment.setDoctorZlDuration(zlTime);
//
//        //总时长 = 面诊 + 沟通 + 敷麻 + 术前 + 准备等待 + 治疗
//        int duration = appointment.getDocComDuration() + appointment.getComDuration() + appointment.getPalsyDuration() + appointment.getReadyDuration() + appointment.getWaitDuration() + appointment.getTreatDuration();
//        appointment.setDuration(duration);
//
//        //获取出医生的治疗时间记录
//        JSONArray zlTimeJson = AppAutoMateV5Util.handleDoctorZlTime(pMap, appointment.getStartTime());
//        appointmentInfo.setZlTimeJson(zlTimeJson.toString());
//        List<DoctorTime> doctorTimeList = AppointmentV2Util.getDoctorZlTime(zlTimeJson.toString(), appointment.getShopId(), appointment.getDoctorId(), appointment.getDayStr(), appointment.getMonthStr());
//
//
//        //新增时
//        if(StringUtils.isEmpty(appointment.getId())){
//
//            //冗余用户信息
//            appointmentInfo.setUserStatus(user.getUserStatus());
//            appointmentInfo.setUserStatusCn(UserStatusConstants.getName(user.getUserStatus()));
//            appointmentInfo.setUserInternetCorpUserId(user.getInternetCorpUserId());
//            appointmentInfo.setUserInternetCorpUserName(CommonQueryUtil.getEmployeeName(user.getInternetCorpUserId(), commonService));
//            appointmentInfo.setUserConsultantId(user.getHisCorpUserId());
//            appointmentInfo.setUserConsultantName(CommonQueryUtil.getEmployeeName(user.getHisCorpUserId(), commonService));
//            appointmentInfo.setUserShopId(user.getShopId());
//            appointmentInfo.setUserShopName(CommonQueryUtil.getShopName(user.getShopId(), commonService));
//            appointmentInfo.setUserLevel(user.getUserLevel());
//            appointmentInfo.setMemberLevelId(user.getMemberLevelId());
//
//            //根据用户角色信息,获取对应可使用预约类型,多个取第一个
//            net.sf.json.JSONArray appTypeArr = AppointmentListUtil.userToAppType(dto.getUserId(), commonService);
//            if(appTypeArr == null || appTypeArr.size() < 1){
//                 throw new PlatTipsException(PlatformCode.ERROR_TIPS, "没有对应预约类型!");
//            }
//            appointment.setAppType(appTypeArr.getInt(0));
//        }
//
//        //添加预约
//        if(dto.getHandleType() == 1){
//            appointmentService.crmAdd(appointment, apList, doctorTimeList, null, appointmentInfo);
//        }else if(dto.getHandleType() == 2){
//            appointmentService.crmEdit(appointment, appointmentInfo, 0, doctorTimeList, apList, null, null);
//        }
//
//
//        JSONObject data = new JSONObject();
//        data.put("appointmentId", appointment.getId());
//
//        return Result.success(data);
//    }
}
phi_platform_user/src/main/java/com/hx/phip/service/appointment/impl/AppointmentV2ServiceImpl.java
@@ -7,9 +7,10 @@
import com.hx.phiappt.constants.tool.appointment.AppointmentTool;
import com.hx.phiappt.constants.tool.appointment.GuideSyncAppItemUtil;
import com.hx.phiappt.dao.mapper.*;
import com.hx.phiappt.dao.mapper.custom.AppointmentV2Mapper;
import com.hx.phiappt.dao.mapper.AppointmentV2Mapper;
import com.hx.phiappt.model.*;
import com.hx.phiappt.util.AppointmentV2Util;
import com.hx.phiappt.util.system.config.AppointmentConfigUtil;
import com.hx.phiappt.vo.OperatorVo;
import com.hx.phip.service.appointment.AppointmentV2Service;
import com.hx.util.StringUtils;
@@ -459,6 +460,10 @@
            timerHandleItem.setType(TimerHandleItem.TYPE_APP_APPLY);
            timerHandleItem.setCreateTime(appointment.getStartTime());
            commonDao.insert(TimerHandleItemMapper.class, timerHandleItem);
            //处理是否发送预约审核通知
            AppointmentConfigUtil.handleAppointmentAuditNotice(commonDao, appointment);
        }else if(appointment.getStatus() == Appointment.STATUS_SUC){
            //预约成功
            timerHandleItem = new TimerHandleItem();
@@ -531,10 +536,15 @@
            timerHandleItem.setCreateTime(appointment.getStartTime());
            if (appointment.getStatus() == Appointment.STATUS_WAIT) {
                timerHandleItem.setType(TimerHandleItem.TYPE_APP_APPLY);
                //处理是否发送预约审核通知
                AppointmentConfigUtil.handleAppointmentAuditNotice(commonDao, appointment);
            } else if (appointment.getStatus() == Appointment.STATUS_SUC) {
                timerHandleItem.setType(TimerHandleItem.TYPE_APP_SUC);
            }
            commonDao.insert(TimerHandleItemMapper.class, timerHandleItem);
        }
    }