| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.hx.common.service.CommonService; |
| | | import com.hx.exception.TipsException; |
| | | import com.hx.guide.model.VisitOrder; |
| | | import com.hx.guide.util.corp.messages.SendMessageToolV2; |
| | | import com.hx.mybatisTool.SqlSentence; |
| | | import com.hx.phiappt.common.*; |
| | | import com.hx.phiappt.constants.enums.WarehouseTypeEnum; |
| | | import com.hx.phiappt.constants.tool.CouponTool; |
| | | import com.hx.phiappt.constants.tool.PerformanceInfoTool; |
| | | import com.hx.phiappt.constants.tool.UserInfoTool; |
| | | import com.hx.phiappt.constants.tool.UserStatusTool; |
| | | import com.hx.phiappt.constants.tool.*; |
| | | import com.hx.phiappt.constants.tool.appointment.AppointmentTool; |
| | | import com.hx.phiappt.constants.tool.employee.EmployeeTool; |
| | | import com.hx.phiappt.constants.tool.user.UserLabelTool; |
| | | import com.hx.phiappt.constants.tool.user.UserLevelTool; |
| | | import com.hx.phiappt.dao.mapper.ProjectTypeMapper; |
| | |
| | | import com.hx.phiappt.model.warehouse.ShopWarehouseChange; |
| | | import com.hx.phiappt.model.warehouse.ShopWarehouseItem; |
| | | import com.hx.phiappt.model.warehouse.ShopWarehouseType; |
| | | import com.hx.phip.common.wx.corp.WeiXinCorpMpUtil; |
| | | import com.hx.phip.common.wx.corp.WeiXinMpUtil; |
| | | import com.hx.phip.config.BotoxClubConfig; |
| | | import com.hx.phip.config.CustomParameter; |
| | | import com.hx.phip.config.QuestionInvestigateConfig; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.math.RoundingMode; |
| | | import java.text.MessageFormat; |
| | | import java.util.*; |
| | | |
| | | @Transactional |
| | |
| | | UserInfoTool.addUserUpdateLog(commonService, deductionSingle.getAppId(), user, shop.getId(), opEmployee.getId(), null, null, "调整用户科室关系数据", logArray, null, recordNo); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 作废划扣发通知给护士长 |
| | | * @param deductionSingleId 划扣编号 |
| | | */ |
| | | @Override |
| | | public void cancelDeductionSingleSentNotice(String deductionSingleId) { |
| | | try { |
| | | // 判断划扣单 |
| | | DeductionSingle deductionSingle = deductionSingleMapper.selectOneByKey(deductionSingleId); |
| | | if (deductionSingle == null) { |
| | | throw new TipsException("划扣数据不存在!"); |
| | | } |
| | | // 判断划扣项目 |
| | | DeductionProject deductionProject = this.getDeductionProjectBySingleId(deductionSingle.getId()); |
| | | if (deductionProject == null) { |
| | | throw new TipsException("划扣项目数据不存在!"); |
| | | } |
| | | // 判断划扣用户 |
| | | User user = commonService.selectOneByKey(UserMapper.class, deductionSingle.getUserId()); |
| | | if (user == null) { |
| | | throw new TipsException("划扣用户数据不存在!"); |
| | | } |
| | | // 判断是否有治疗单 |
| | | if (StringUtils.isEmpty(deductionSingle.getTreatSingleId())) { |
| | | logger.info("作废划扣发通知给护士长提示,不存在治疗通知单!"); |
| | | return; |
| | | } |
| | | // 获取治疗单 |
| | | TreatSingle treatSingle = commonService.selectOneByKey(TreatSingleMapper.class, deductionSingle.getTreatSingleId()); |
| | | if (treatSingle == null) { |
| | | throw new TipsException("划扣治疗单数据不存在!"); |
| | | } |
| | | // 判断到访单 |
| | | if (StringUtils.isEmpty(treatSingle.getVisitOrderId())) { |
| | | logger.info("作废划扣发通知给护士长提示,不存在到访单!"); |
| | | return; |
| | | } |
| | | // 获取到访单 |
| | | VisitOrder visitOrder = commonService.selectOneByKey(VisitOrderMapper.class, treatSingle.getVisitOrderId()); |
| | | if (visitOrder == null) { |
| | | logger.info("作废划扣发通知给护士长提示,不存在到访单!"); |
| | | return; |
| | | } |
| | | // 获取执行护士 |
| | | String nurseInfo = null; |
| | | DeductionJoin deductionName = this.getDeductionDoctorNameBySingleId(deductionSingleId, BaseEntity.NO); |
| | | if (deductionName != null && !StringUtils.isEmpty(deductionName.getEmployeeName())) { |
| | | nurseInfo = deductionName.getEmployeeName(); |
| | | } |
| | | // 获取小程序消息token |
| | | String mpToken = WeiXinMpUtil.getAccessToken(commonService, customParameter.getCorpMpAppId()); |
| | | String corpMpToken = WeiXinCorpMpUtil.getAccessToken(commonService, customParameter.getCorpMpAppId()); |
| | | if (StringUtils.isEmpty(mpToken)) { |
| | | throw new TipsException("获取小程序Token异常!"); |
| | | } |
| | | if (StringUtils.isEmpty(corpMpToken)) { |
| | | throw new TipsException("获取企业应用小程序Token异常!"); |
| | | } |
| | | // 消息内容 作废划扣通知 客户, 项目,执行护士: |
| | | String content; |
| | | if (!StringUtils.isEmpty(nurseInfo)) { |
| | | content = MessageFormat.format("作废划扣通知:{0},{1},{2}", user.getName(), deductionProject.getProjectName(), nurseInfo); |
| | | } else { |
| | | content = MessageFormat.format("作废划扣通知:{0},{1}", user.getName(), deductionProject.getProjectName()); |
| | | } |
| | | // 发送企业微信通知给分配治疗药房 |
| | | if (!StringUtils.isEmpty(deductionSingle.getShopId())) { |
| | | // 获取要发送的成员 |
| | | List<Employee> employees = EmployeeTool.getEmployeeByShopAndRoleList(commonService, deductionSingle.getShopId(), RoleType.UNIQUE_HEAD_NURSE); |
| | | if (employees != null && employees.size() > 0) { |
| | | //发送企业微信通知药房 |
| | | for (Employee employee : employees) { |
| | | // 企业服务消息提醒 |
| | | String sendDate = SendMessageToolV2.sendDataByTreatOrderNoticeMic(visitOrder, employee, mpToken, "1000050", content); |
| | | if (StringUtils.isEmpty(sendDate)) { |
| | | continue; |
| | | } |
| | | SendMessageTool.sendMessge(sendDate, corpMpToken); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | logger.error("作废划扣发通知给护士长出错:", e); |
| | | } |
| | | } |
| | | } |