package com.hx.phip.controller.treat;
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.github.pagehelper.util.StringUtil;
|
import com.hx.common.BaseController;
|
import com.hx.exception.TipsException;
|
import com.hx.guide.dao.mapper.VisitOrderMapper;
|
import com.hx.guide.model.VisitOrder;
|
import com.hx.guide.vo.treatOrder.TreatOrderReqVo;
|
import com.hx.mybatis.aes.springbean.VariableAesKey;
|
import com.hx.mybatisTool.SqlSentence;
|
import com.hx.phiappt.common.DeductionSingleConstants;
|
import com.hx.phiappt.common.RoleType;
|
import com.hx.phiappt.common.TreatSingleConstants;
|
import com.hx.phiappt.dao.mapper.*;
|
import com.hx.phiappt.model.*;
|
import com.hx.phiappt.model.treat.TreatProject;
|
import com.hx.phiappt.model.treat.TreatProjectDoctor;
|
import com.hx.phiappt.model.treat.TreatSingle;
|
import com.hx.phiappt.model.treat.TreatSingleSign;
|
import com.hx.phip.config.CustomParameter;
|
import com.hx.phip.dao.mapper.TreatProjectMapper;
|
import com.hx.phip.service.AppointmentService;
|
import com.hx.phip.service.EmployeeService;
|
import com.hx.phip.service.UserService;
|
import com.hx.phip.service.treat.TreatSingleService;
|
import com.hx.phip.service.treat.TreatV3Service;
|
import com.hx.phip.tool.SendSMSTool;
|
import com.hx.phip.util.api.CrmUtil;
|
import com.hx.resultTool.Result;
|
import com.hx.util.DateUtil;
|
import com.hx.util.StringUtils;
|
import com.platform.constants.PlatformPattern;
|
import com.platform.exception.PlatTipsException;
|
import com.platform.resultTool.PlatformCode;
|
import com.platform.resultTool.PlatformResult;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.annotation.Resource;
|
import java.util.ArrayList;
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* 治疗通知单控制器
|
*
|
* @USER: zhouxiang
|
* @DATE: 2021/12/03
|
*/
|
@RestController
|
@RequestMapping("/treat")
|
public class TreatController extends BaseController {
|
|
private static Logger logger = LoggerFactory.getLogger(TreatController.class);
|
|
@Resource
|
private TreatV3Service treatV3Service;
|
@Resource
|
private UserService userService;
|
@Resource
|
private TreatSingleService treatSingleService;
|
@Resource
|
private AppointmentService appointmentService;
|
@Resource
|
private CustomParameter customParameter;
|
@Resource
|
private EmployeeService employeeService;
|
|
/**
|
* 创建治疗通知单
|
*/
|
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
public PlatformResult create(@RequestBody(required = false) TreatOrderReqVo reqVo) {
|
|
//获取-判断治疗通知单信息
|
if (reqVo == null) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗单信息为空");
|
}
|
logger.info("新增治疗单参数:{}", JSONObject.toJSONString(reqVo) );
|
|
//治疗通知单对象
|
TreatSingle treatSingle = reqVo.createTreatSingle();
|
//治疗单签名
|
List<TreatSingleSign> signList = reqVo.getSignList();
|
|
//校验参数
|
checkTreatSingleParam(true, treatSingle, signList);
|
|
//判断是否发送通知MIC分配治疗
|
Integer isMicNotice = BaseEntity.NO;
|
// if(reqVo.getIsMicNotice() != null && reqVo.getIsMicNotice() == BaseEntity.YES){
|
// isMicNotice = BaseEntity.YES;
|
// }
|
|
//治疗单项目
|
List<TreatProject> projectList = reqVo.getProjectList();
|
if (projectList == null || projectList.size() == 0) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "治疗通知单的治疗项目不能为空");
|
}
|
//检查项目参数
|
checkProjectParam(projectList);
|
|
if(StringUtils.isEmpty(reqVo.getRoleId())){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "操作人角色标识为空");
|
}
|
EmployeeRole employeeRole = employeeService.selectRoleInfoById(reqVo.getRoleId());
|
if(employeeRole == null){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "查询不到操作人角色信息!");
|
}
|
|
VisitOrder visitOrder = commonService.selectOneByKey(VisitOrderMapper.class, treatSingle.getVisitOrderId());
|
if(visitOrder == null){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "查询不到到访订单信息");
|
}
|
treatSingle.setUserId(visitOrder.getUserId());
|
|
|
|
|
treatV3Service.add(treatSingle, projectList, visitOrder, employeeRole, isMicNotice, signList);
|
|
//返回id
|
JSONObject data = new JSONObject();
|
data.put("treatSingleId", treatSingle.getId());
|
|
return PlatformResult.success(data);
|
}
|
|
/**
|
* 修改治疗通知单
|
*/
|
@RequestMapping(value = "/edit", method = RequestMethod.POST)
|
public PlatformResult edit(@RequestBody(required = false) TreatOrderReqVo reqVo) {
|
|
//获取-判断治疗通知单信息
|
if (reqVo == null) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗单信息为空");
|
}
|
|
//治疗通知单对象
|
TreatSingle treatSingle = reqVo.createTreatSingle();
|
//治疗单签名
|
List<TreatSingleSign> signList = reqVo.getSignList();
|
//校验参数
|
checkTreatSingleParam(false, treatSingle, signList);
|
|
|
List<TreatProject> projectList = reqVo.getProjectList();
|
if (projectList == null || projectList.size() == 0) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "治疗通知单的治疗项目不能为空");
|
}
|
checkProjectParam(projectList);
|
|
TreatSingle updateTreat = commonService.selectOneByKey(TreatSingleMapper.class,treatSingle.getId());
|
if(updateTreat == null){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "未找到");
|
}
|
|
// //判断是否发送通知MIC分配治疗(如果治疗单分配医生不为空,则不继续通知MIC)
|
// Integer isMicNotice = BaseEntity.NO;
|
// if(reqVo.getIsMicNotice() != null && reqVo.getIsMicNotice() == BaseEntity.YES
|
// && StringUtils.noNull(updateTreat.getaDoctorId())){
|
// isMicNotice = BaseEntity.YES;
|
// }
|
|
if(updateTreat.getStatus() == TreatSingleConstants.STATUS_CANCEL){
|
throwParamException("作废治疗通知单不可修改!");
|
}
|
|
if(StringUtils.isEmpty(reqVo.getRoleId())){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "操作人角色标识为空");
|
}
|
EmployeeRole employeeRole = employeeService.selectRoleInfoById(reqVo.getRoleId());
|
if(employeeRole == null){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "查询不到操作人角色信息!");
|
}
|
|
VisitOrder visitOrder = commonService.selectOneByKey(VisitOrderMapper.class, updateTreat.getVisitOrderId());
|
if(visitOrder == null){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "查询不到到访订单信息");
|
}
|
|
//修改
|
treatSingle.setTreatSingleNo(updateTreat.getTreatSingleNo());
|
treatSingle.setCommonId(updateTreat.getCommonId());
|
treatSingle.setaNurseId(updateTreat.getaNurseId());
|
treatSingle.setaDoctorId(updateTreat.getaDoctorId());
|
treatV3Service.edit(treatSingle, projectList, visitOrder, employeeRole, updateTreat, signList);
|
|
//当状态是 待确认 发送短信给客户确认
|
if(treatSingle.getStatus()==TreatSingleConstants.STATUS_WAIT_CONFIRM){
|
//修改治疗通知单发送给客户
|
editSendMsg(treatSingle.getId(), visitOrder.getUserId());
|
}
|
|
//返回id
|
JSONObject data = new JSONObject();
|
data.put("treatSingleId", treatSingle.getId());
|
return PlatformResult.success(data);
|
}
|
|
/** 作废 */
|
@RequestMapping(value = "/invalid", method = RequestMethod.POST)
|
public PlatformResult invalid(@RequestBody(required = false) TreatOrderReqVo reqVo) {
|
|
//获取-判断治疗通知单信息
|
if (reqVo == null) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗单信息为空");
|
}
|
|
if (StringUtils.isEmpty(reqVo.getTreatSingleId())) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗通知单标识为空");
|
}
|
|
if(StringUtils.isEmpty(reqVo.getRoleId())){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "操作人角色标识为空");
|
}
|
|
|
//治疗通知单对象
|
TreatSingle treatSingle = commonService.selectOneByKey(TreatSingleMapper.class, reqVo.getTreatSingleId());
|
if(treatSingle == null){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "查询不到治疗通知单信息!");
|
}
|
|
//查询治疗通知单有划扣过(已执行),则不可作废
|
SqlSentence sqlSentence = new SqlSentence();
|
Map<String, Object> values = new HashMap<>();
|
sqlSentence.setM(values);
|
values.put("treatSingleId", reqVo.getTreatSingleId());
|
values.put("commonId", treatSingle.getCommonId());
|
values.put("status", DeductionSingleConstants.STATUS_DONE_EXECUTE);
|
sqlSentence.setSqlSentence(" isDel = 0 and status = #{m.status} and commonId = #{m.commonId} and treatSingleId = #{m.treatSingleId} ");
|
int count = commonService.selectCount(com.hx.phiappt.dao.mapper.DeductionSingleMapper.class, sqlSentence);
|
if(count > 0){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗通知单有划扣记录,不可作废!如想作废请先作废关联划扣记录");
|
}
|
|
EmployeeRole employeeRole = employeeService.selectRoleInfoById(reqVo.getRoleId());
|
if(employeeRole == null){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "查询不到操作人角色信息!");
|
}
|
|
VisitOrder visitOrder = commonService.selectOneByKey(VisitOrderMapper.class, treatSingle.getVisitOrderId());
|
if(visitOrder == null){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "查询不到到访订单信息");
|
}
|
|
treatV3Service.invalidTreat(treatSingle, visitOrder, employeeRole);
|
|
return PlatformResult.success();
|
}
|
|
/** 更新治疗单签名 */
|
@RequestMapping(value ="/updateSign", method = RequestMethod.POST)
|
public Result updateSign(@RequestBody(required = false) TreatOrderReqVo reqVo){
|
if(reqVo == null){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "请求对象为空!");
|
}
|
|
if(StringUtils.isEmpty(reqVo.getRoleId())){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "操作人标识不能为空!");
|
}
|
|
if(StringUtils.isEmpty(reqVo.getTreatSingleId())){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "操作人标识不能为空!");
|
}
|
|
if(reqVo.getSignList() == null || reqVo.getSignList().size() < 1){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "签名信息不能为空!");
|
}
|
|
|
EmployeeRole employeeRole = employeeService.selectRoleInfoById(reqVo.getRoleId());
|
if(employeeRole == null){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "查询不到操作人角色信息!");
|
}
|
|
TreatSingle treatSingle = treatSingleService.selectOneByKey(reqVo.getTreatSingleId());
|
if(treatSingle == null){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "查询不到治疗通知单信息!");
|
}
|
|
checkSignParam(reqVo.getSignList(), treatSingle);
|
|
treatV3Service.updateSign(treatSingle, reqVo.getSignList(), employeeRole);
|
|
return Result.success();
|
}
|
|
/**
|
* 客户确认治疗通知单
|
*/
|
@RequestMapping(value = "/confirmTreatNotice", method = RequestMethod.POST)
|
public PlatformResult confirmTreatNotice(@RequestBody String param) {
|
if (StringUtils.isEmpty(param)) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "治疗单参数为空");
|
}
|
|
JSONObject jsonObject = JSONObject.parseObject(param);
|
if (!jsonObject.containsKey("treatSingleId")) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗单id为空");
|
}
|
|
TreatSingle treatSingle = treatSingleService.selectOneByKey(jsonObject.getString("treatSingleId"));
|
if (treatSingle == null) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "找不到治疗通知单信息");
|
}
|
|
if (treatSingle.getStatus() == TreatSingleConstants.STATUS_CONFIRM) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗通知单已确认");
|
}
|
|
Appointment appointment = appointmentService.selectOneByKeyBlob(treatSingle.getCommonId());
|
if(appointment == null){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "找不到预约单信息");
|
}
|
|
|
treatSingleService.updateTreatStatus(treatSingle,appointment,commonService);
|
|
return PlatformResult.success();
|
}
|
|
/**
|
* 查询治疗通知单详情信息
|
*/
|
@RequestMapping(value = "/info", method = RequestMethod.POST)
|
public PlatformResult getTreatList(@RequestBody String param) {
|
//判断参数
|
if (StringUtil.isEmpty(param)) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗通知单id不能为空");
|
}
|
|
JSONObject jsonObject = JSONObject.parseObject(param);
|
if (!jsonObject.containsKey("treatSingleId")) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗通知单id不能为空");
|
}
|
|
//查询治疗通知单
|
TreatSingle treatSingle = treatSingleService.selectOneByKey(jsonObject.getString("treatSingleId"));
|
if (treatSingle == null) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗通知单id不能为空");
|
}
|
//查询预约信息
|
Appointment appointment = appointmentService.selectOneByKey( treatSingle.getCommonId());
|
if (appointment == null) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "找不到预约信息");
|
}
|
|
SqlSentence sqlSentence = new SqlSentence();
|
Map<String, Object> map = new HashMap<>();
|
sqlSentence.setM(map);
|
|
//查询项目信息
|
map.put("singleId", treatSingle.getId());
|
sqlSentence.setSqlSentence("SELECT p.positionData, p.projectNo as projectId,p.hisId as projectNo, p.projectName, p.num FROM treat_project p LEFT JOIN treat_single s ON p.treatSingleId = s.id where p.treatSingleId = #{m.singleId} and s.isDel=0 and p.isDel=0");
|
List<Map<String, Object>> projectList = commonService.selectListMap(TreatProjectMapper.class, sqlSentence);
|
|
//人员信息
|
map.put("userId", appointment.getUserId());
|
map.put("key", VariableAesKey.AES_KEY);
|
sqlSentence.setSqlSentence("select insert(CONVERT(AES_DECRYPT(UNHEX(tel), #{m.key}) , CHAR), 4, 4, '****') as tel,id,name,CIQ from user where id=#{m.userId} and isDel=0 ");
|
User user = commonService.selectOne(UserMapper.class, sqlSentence);
|
if (user == null) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "用户信息为空");
|
}
|
//医生信息
|
sqlSentence.setSqlSentence("select * from treat_project_doctor where isDel=0 and treatSingleId=#{m.singleId}");
|
List<TreatProjectDoctor> projectDoctors = commonService.selectList(TreatProjectDoctorMapper.class, sqlSentence);
|
List<Map<String, Object>> maps=new ArrayList<>();
|
if(projectDoctors !=null && projectDoctors.size()>0){
|
for(TreatProjectDoctor vo:projectDoctors){
|
Map<String,Object> employeeMap=new HashMap<>();
|
Employee employee=commonService.selectOneByKey(EmployeeMapper.class, vo.getCommonId());
|
employeeMap.put("projectId",vo.getTreatProjectId());
|
employeeMap.put("projectHisId",vo.getTreatProjectHisId());
|
employeeMap.put("employeeName",employee.getCnName());
|
employeeMap.put("employeeId",employee.getId());
|
maps.add(employeeMap);
|
}
|
}
|
|
map.clear();
|
map.put("createTime", DateUtil.formatDate(treatSingle.getCreateTime(), "yyy.MM.dd HH:mm"));
|
map.put("name", user.getName());
|
map.put("ciq", user.getCIQ());
|
map.put("tel", user.getTel());
|
map.put("shopName", treatSingle.getShopName());
|
map.put("employeeName", treatSingle.getOperatorName());
|
map.put("projectList", projectList);
|
map.put("remarkInfo", treatSingle.getRemarkInfo());
|
map.put("status",treatSingle.getStatus());
|
map.put("employeeList",maps);
|
map.put("employeeType",appointment.getIsLifeBeauty() ==null||appointment.getIsLifeBeauty()==0? RoleType.UNIQUE_STR_DOCTOR:RoleType.UNIQUE_STR_NURSE);
|
|
return PlatformResult.success(map);
|
}
|
|
/**
|
* 重新发送短信
|
*
|
* @param param
|
* @return
|
*/
|
@RequestMapping("/againSendMsg")
|
public PlatformResult sendMsg(@RequestBody String param) {
|
//校验参数
|
if (StringUtils.isEmpty(param)) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "请传治疗通知单参数");
|
}
|
//转成对象
|
JSONObject object = JSONObject.parseObject(param);
|
//判断参数
|
if (!object.containsKey("treatSingleId")) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "请传治疗通知单参数");
|
}
|
//查询治疗通知单
|
TreatSingle treatSingle = commonService.selectOneByKey(TreatSingleMapper.class, object.getString("treatSingleId"));
|
if (treatSingle == null) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "找不到治疗通知单信息");
|
}
|
//判断状态 短信是否是已确认 未确认发送短信
|
if (treatSingle.getStatus() == TreatSingleConstants.STATUS_CONFIRM) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗通知单已确认");
|
}
|
|
//查询预约信息
|
Appointment appointment = commonService.selectOneByKey(com.hx.guide.dao.mapper.AppointmentMapper.class, treatSingle.getCommonId());
|
if (appointment == null) {
|
throw new TipsException("找不到预约信息");
|
}
|
|
//用户信息
|
User userInfo = commonService.selectOneByKey(com.hx.guide.dao.mapper.UserMapper.class, appointment.getUserId());
|
if (userInfo == null) {
|
throw new TipsException("找不到用户信息!");
|
}
|
|
SqlSentence sqlSentence = new SqlSentence();
|
Map<String, Object> values = new HashMap<>();
|
sqlSentence.setM(values);
|
//通过预约id查询到预约信息获取用户手机号
|
values.put("commonId", object.getString("appId"));
|
sqlSentence.setSqlSentence("select u.tel from appointment a left join user u on u.id=a.userId where a.id =#{m.commonId} and u.isDel=0 and a.isDel=0 ");
|
Map<String, Object> map = userService.selectOneMap(sqlSentence);
|
if(PlatformPattern.PROD.equals(customParameter.getPlatformPattern())){
|
map.put("treatSingleId",treatSingle.getId());
|
CrmUtil.sendCrmSMS(map,commonService,0);
|
}else{
|
net.sf.json.JSONObject jsonObject = new net.sf.json.JSONObject();
|
//发送短信
|
jsonObject = SendSMSTool.msgSend("测试服假链接"+"https://wxaurl.cn/66666666", map.get("tel").toString(), "", 1);
|
|
// logger.info("发送短信返回:"+jsonObject.toString());
|
|
if (jsonObject.getInt("code") != 0) {
|
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "发送短信失败");
|
}
|
}
|
|
// VLatelyLog vLatelyLog = new VLatelyLog(TreatSingleConstants.STATUS_CONFIRM, "客户自己确认治疗通知单", "治疗通知单,客户已确认自己的治疗通知单", userInfo.getCIQ() + userInfo.getName(), null,
|
// null, null, null, userInfo.getId());
|
//
|
// commonService.insert(com.hx.guide.dao.mapper.VLatelyLogMapper.class,vLatelyLog);
|
|
|
return PlatformResult.success();
|
|
}
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
|
public void editSendMsg(String treatSingleId,String userId) {
|
|
//查询治疗通知单
|
TreatSingle treatSingle = commonService.selectOneByKey(TreatSingleMapper.class, treatSingleId);
|
if (treatSingle == null) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "找不到治疗通知单信息");
|
}
|
// //判断状态 短信是否是已确认 未确认发送短信
|
// if (treatSingle.getStatus() == TreatSingleConstants.STATUS_CONFIRM) {
|
// throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗通知单已确认");
|
// }
|
|
|
//查询预约信息
|
Appointment appointment = commonService.selectOneByKey(AppointmentMapper.class, treatSingle.getCommonId());
|
if (appointment == null) {
|
throw new TipsException("找不到预约信息");
|
}
|
|
//用户信息
|
User userInfo = commonService.selectOneByKey(UserMapper.class, appointment.getUserId());
|
if (userInfo == null) {
|
throw new TipsException("找不到用户信息!");
|
}
|
|
|
SqlSentence sqlSentence = new SqlSentence();
|
Map<String, Object> values = new HashMap<>();
|
sqlSentence.setM(values);
|
//通过预约id查询到预约信息获取用户手机号
|
values.put("commonId", userId);
|
sqlSentence.setSqlSentence("SELECT tel FROM `user` WHERE id = #{m.commonId} AND isDel = 0");
|
Map<String, Object> map = userService.selectOneMap(sqlSentence);
|
|
if(PlatformPattern.PROD.equals(customParameter.getPlatformPattern())){
|
map.put("treatSingleId",treatSingle.getId());
|
CrmUtil.sendCrmSMS(map,commonService,1);
|
}else{
|
net.sf.json.JSONObject jsonObject = new net.sf.json.JSONObject();
|
//发送短信
|
jsonObject = SendSMSTool.msgSend("测试服假链接"+"https://wxaurl.cn/66666666", map.get("tel").toString(), "", 1);
|
|
// logger.info("发送短信返回:"+jsonObject.toString());
|
|
if (jsonObject.getInt("code") != 0) {
|
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "发送短信失败");
|
}
|
}
|
|
|
// VLatelyLog vLatelyLog = new VLatelyLog(TreatSingleConstants.STATUS_CONFIRM, "修改治疗单时客户需确认治疗单", "修改治疗通知单,客户已确认自己的治疗通知单", userInfo.getCIQ() + userInfo.getName(), null,
|
// null, null, null, userInfo.getId());
|
//
|
// commonService.insert(com.hx.guide.dao.mapper.VLatelyLogMapper.class,vLatelyLog);
|
|
}
|
|
|
/** 治疗通知单参数校验 */
|
private void checkTreatSingleParam(boolean isAdd, TreatSingle treatSingle, List<TreatSingleSign> signList) {
|
|
//新增才校验的参数
|
if(isAdd){
|
if (StringUtils.isEmpty(treatSingle.getCommonId())) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "预约id为空");
|
}
|
|
if (StringUtils.isEmpty(treatSingle.getVisitOrderId())) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "到访订单标识为空");
|
}
|
}
|
|
if (StringUtils.isEmpty(treatSingle.getType())) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "治疗通知单类型为空");
|
}
|
|
if (treatSingle.getStatus() == null) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "状态为空");
|
}
|
if (StringUtils.isEmpty(treatSingle.getShopId())) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "所属门店标识为空");
|
}
|
|
if (StringUtils.isEmpty(treatSingle.getOperatorId())) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "下单操作人标识为空");
|
}
|
|
if (StringUtils.isEmpty(treatSingle.getDeveloperShopId())) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "开单人门店标识为空");
|
}
|
|
if (StringUtils.isEmpty(treatSingle.getDeveloperId())) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "开单人标识为空");
|
}
|
|
if (treatSingle.getOrderClassify() == null) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "订单分类不能为空!");
|
}
|
|
//校验签名参数----------------------------------------------------------------------------------
|
if(signList != null && signList.size() > 0){
|
checkSignParam(signList, treatSingle);
|
}
|
|
//----------------------------------------------------------------------------------
|
}
|
|
/** 检测校验治疗单签名参数 */
|
private void checkSignParam(List<TreatSingleSign> signList, TreatSingle treatSingle){
|
treatSingle.setIsUserSign(BaseEntity.NO);
|
for(TreatSingleSign sign : signList){
|
if(StringUtils.isEmpty(sign.getSignImg())){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"签名图片不能为空!");
|
}
|
if(StringUtils.isEmpty(sign.getSignPerType())){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"签名人类型不能为空!");
|
}
|
if(StringUtils.isEmpty(sign.getSignPerName())){
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"签名人名称不能为空!");
|
}
|
|
//判断类型,更改对应值
|
if(TreatSingleSign.SIGN_PER_TYPE_USER.equals(sign.getSignPerType())){
|
sign.setSortNo(1);
|
treatSingle.setIsUserSign(BaseEntity.YES);
|
}else if(TreatSingleSign.SIGN_PER_TYPE_NURSE1.equals(sign.getSignPerType())){
|
sign.setSortNo(2);
|
}else if(TreatSingleSign.SIGN_PER_TYPE_NURSE2.equals(sign.getSignPerType())){
|
sign.setSortNo(3);
|
}else if(TreatSingleSign.SIGN_PER_TYPE_DOCTOR.equals(sign.getSignPerType())){
|
sign.setSortNo(4);
|
}
|
}
|
}
|
|
/** 治疗项目参数校验 */
|
private void checkProjectParam(List<TreatProject> treatProjectList) {
|
|
for(TreatProject treatProject : treatProjectList){
|
if (StringUtils.isEmpty(treatProject.getProjectNo())) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "项目编号不能为空");
|
}
|
|
if (StringUtils.isEmpty(treatProject.getProjectName())) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "项目名称不能为空");
|
}
|
|
if (treatProject.getPrice() == null) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "价格不能为空");
|
}
|
|
if (treatProject.getNum() == null) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "数量不能为空");
|
}
|
|
if (treatProject.getUseDuration() == null) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "治疗时长不能为空");
|
}
|
|
if (StringUtils.isEmpty(treatProject.getProjectId())) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "项目标识不能为空");
|
}
|
|
if (StringUtils.isEmpty(treatProject.getGoodsId())) {
|
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "公用项目标识不能为空");
|
}
|
|
// if (StringUtils.isEmpty(treatProject.getUserProjectItemId())) {
|
// throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "用户项目标识不能为空");
|
// }
|
}
|
}
|
|
|
|
|
}
|