fwq
2024-02-20 f5dbf32a6c9755e21da1278055a311b14c493276
日志优化
1个文件已修改
99 ■■■■ 已修改文件
phi_platform_user/src/main/java/com/hx/phip/service/treat/impl/TreatV3ServiceImpl.java 99 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/service/treat/impl/TreatV3ServiceImpl.java
@@ -494,55 +494,56 @@
                    continue;
                }
                UserFamiliesRoom mapData = dataMap.get(treatProjectDoctor.getDepartmentId());
                if (mapData == null){
                    logger.info("当前科室关系不存在,新增数据:"+JSON.toJSONString(treatProjectDoctor));
                    //没有科室关系,创建科室关系
                    FamiliesRoom familiesRoom = familiesRoomMapper.selectOneByKey(treatProjectDoctor.getDepartmentId());
                    //找不到科室信息不处理
                    if (familiesRoom == null){
                        logger.info("新增治疗单处理科室关系,查询科室失败:"+treatProjectDoctor.getDepartmentId());
                        continue;
                    }
                    //不是皮肤科和注射科不处理
                    if (!"注射科".equals(familiesRoom.getFamiliesRoomName()) && !"皮肤科".equals(familiesRoom.getFamiliesRoomName())){
                        logger.info("新增治疗单处理科室关系,不处理注射科和皮肤科以外的:"+familiesRoom.getFamiliesRoomName());
                        continue;
                    }
                    UserFamiliesRoom userFamiliesRoom = new UserFamiliesRoom();
                    userFamiliesRoom.setUserId(treatSingle.getUserId());
                    userFamiliesRoom.setFamiliesRoomId(treatProjectDoctor.getDepartmentId());
                    userFamiliesRoom.setFamiliesRoomName(familiesRoom.getFamiliesRoomName());
                    userFamiliesRoom.setDoctorId(treatProjectDoctor.getCommonId());
                    Employee employee = employeeMapper.selectOneByKey(treatProjectDoctor.getCommonId());
                    if (employee != null){
                        userFamiliesRoom.setDoctorName(employee.getCnName());
                    }
                    userFamiliesRoom.setIsDefault(0);
                    if (userFamiliesRoomMapper.insert(userFamiliesRoom) != 1){
                        throw new TipsException("新增失败1!"+ JSON.toJSONString(userFamiliesRoom));
                    }
                    //新增修改记录
                    UserBeChangeLog userBeChangeLog = new UserBeChangeLog();
                    userBeChangeLog.setUserId(user.getId());
                    userBeChangeLog.setUserName(user.getName());
                    userBeChangeLog.setUserLevel(user.getUserLevel());
                    userBeChangeLog.setUserType(user.getUserType());
                    userBeChangeLog.setUserStatus(user.getUserStatus());
                    userBeChangeLog.setHisCorpUserId(user.getHisCorpUserId());
                    userBeChangeLog.setBelongShopId(user.getShopId());
                    userBeChangeLog.setMemberNO(user.getMemberNO());
                    userBeChangeLog.setCIQ(user.getCIQ());
                    userBeChangeLog.setChangeType(UserBeChangeLog.CHANGE_TYPE_ROOM_DOCTOR);
                    userBeChangeLog.setCommonId(treatProjectDoctor.getCommonId());
                    if (employee != null){
                        userBeChangeLog.setCommonValue(employee.getCnName());
                    }
                    userBeChangeLog.setRoomId(treatProjectDoctor.getDepartmentId());
                    userBeChangeLog.setRoomName(familiesRoom.getFamiliesRoomName());
                    userBeChangeLog.setRemark("治疗单:"+treatSingle.getTreatSingleNo());
                    if (userBeChangeLogMapper.insert(userBeChangeLog) != 1){
                        throw new TipsException("新增失败2!"+ JSON.toJSONString(userBeChangeLog));
                    }
                if (mapData != null){
                    logger.info("新增治疗单处理科室关系,已存在科室关系,跳过处理:"+mapData.getFamiliesRoomName());
                    continue;
                }
                logger.info("新增治疗单处理科室关系,治疗单医生数据:"+JSON.toJSONString(treatProjectDoctor));
                FamiliesRoom familiesRoom = familiesRoomMapper.selectOneByKey(treatProjectDoctor.getDepartmentId());
                //找不到科室信息不处理
                if (familiesRoom == null){
                    logger.info("新增治疗单处理科室关系,查询科室失败,跳过处理:"+treatProjectDoctor.getDepartmentId());
                    continue;
                }
                //不是皮肤科和注射科不处理
                if (!"注射科".equals(familiesRoom.getFamiliesRoomName()) && !"皮肤科".equals(familiesRoom.getFamiliesRoomName())){
                    logger.info("新增治疗单处理科室关系,非注射科和皮肤科,跳过处理:"+familiesRoom.getFamiliesRoomName());
                    continue;
                }
                UserFamiliesRoom userFamiliesRoom = new UserFamiliesRoom();
                userFamiliesRoom.setUserId(treatSingle.getUserId());
                userFamiliesRoom.setFamiliesRoomId(treatProjectDoctor.getDepartmentId());
                userFamiliesRoom.setFamiliesRoomName(familiesRoom.getFamiliesRoomName());
                userFamiliesRoom.setDoctorId(treatProjectDoctor.getCommonId());
                Employee employee = employeeMapper.selectOneByKey(treatProjectDoctor.getCommonId());
                if (employee != null){
                    userFamiliesRoom.setDoctorName(employee.getCnName());
                }
                userFamiliesRoom.setIsDefault(0);
                if (userFamiliesRoomMapper.insert(userFamiliesRoom) != 1){
                    throw new TipsException("新增失败1!"+ JSON.toJSONString(userFamiliesRoom));
                }
                //新增修改记录
                UserBeChangeLog userBeChangeLog = new UserBeChangeLog();
                userBeChangeLog.setUserId(user.getId());
                userBeChangeLog.setUserName(user.getName());
                userBeChangeLog.setUserLevel(user.getUserLevel());
                userBeChangeLog.setUserType(user.getUserType());
                userBeChangeLog.setUserStatus(user.getUserStatus());
                userBeChangeLog.setHisCorpUserId(user.getHisCorpUserId());
                userBeChangeLog.setBelongShopId(user.getShopId());
                userBeChangeLog.setMemberNO(user.getMemberNO());
                userBeChangeLog.setCIQ(user.getCIQ());
                userBeChangeLog.setChangeType(UserBeChangeLog.CHANGE_TYPE_ROOM_DOCTOR);
                userBeChangeLog.setCommonId(treatProjectDoctor.getCommonId());
                if (employee != null){
                    userBeChangeLog.setCommonValue(employee.getCnName());
                }
                userBeChangeLog.setRoomId(treatProjectDoctor.getDepartmentId());
                userBeChangeLog.setRoomName(familiesRoom.getFamiliesRoomName());
                userBeChangeLog.setRemark("治疗单:"+treatSingle.getTreatSingleNo());
                if (userBeChangeLogMapper.insert(userBeChangeLog) != 1){
                    throw new TipsException("新增失败2!"+ JSON.toJSONString(userBeChangeLog));
                }
            }
        }