提交 | 用户 | age
|
9710f8
|
1 |
package com.hx.phip.controller.treat; |
be3140
|
2 |
|
R |
3 |
import com.alibaba.fastjson.JSONObject; |
|
4 |
import com.github.pagehelper.util.StringUtil; |
|
5 |
import com.hx.common.BaseController; |
f59369
|
6 |
import com.hx.exception.TipsException; |
128220
|
7 |
import com.hx.guide.vo.treatOrder.TreatOrderReqVo; |
5acd7e
|
8 |
import com.hx.mybatis.aes.springbean.VariableAesKey; |
be3140
|
9 |
import com.hx.mybatisTool.SqlSentence; |
eb8351
|
10 |
import com.hx.phiappt.common.DeductionSingleConstants; |
e18c30
|
11 |
import com.hx.phiappt.common.RoleType; |
be3140
|
12 |
import com.hx.phiappt.common.TreatSingleConstants; |
ef962a
|
13 |
import com.hx.phiappt.constants.tool.exception.ExceptionTool; |
ad0ff1
|
14 |
import com.hx.phiappt.dao.mapper.*; |
2cfe2a
|
15 |
import com.hx.phiappt.model.*; |
b33cd3
|
16 |
import com.hx.phiappt.model.guide.VisitOrder; |
be3140
|
17 |
import com.hx.phiappt.model.treat.TreatProject; |
e18c30
|
18 |
import com.hx.phiappt.model.treat.TreatProjectDoctor; |
be3140
|
19 |
import com.hx.phiappt.model.treat.TreatSingle; |
2cfe2a
|
20 |
import com.hx.phiappt.model.treat.TreatSingleSign; |
8fd4fa
|
21 |
import com.hx.phip.config.CustomParameter; |
61ef7d
|
22 |
import com.hx.phip.service.AppointmentService; |
180320
|
23 |
import com.hx.phip.service.EmployeeService; |
be3140
|
24 |
import com.hx.phip.service.UserService; |
de721d
|
25 |
import com.hx.phip.service.treat.TreatSingleService; |
2cfe2a
|
26 |
import com.hx.phip.service.treat.TreatV3Service; |
be3140
|
27 |
import com.hx.phip.tool.SendSMSTool; |
c9c262
|
28 |
import com.hx.phip.util.api.CrmUtil; |
71332a
|
29 |
import com.hx.resultTool.Result; |
be3140
|
30 |
import com.hx.util.DateUtil; |
R |
31 |
import com.hx.util.StringUtils; |
ef962a
|
32 |
import com.hx.util.thread.ExecutorServiceTool; |
8fd4fa
|
33 |
import com.platform.constants.PlatformPattern; |
be3140
|
34 |
import com.platform.exception.PlatTipsException; |
R |
35 |
import com.platform.resultTool.PlatformCode; |
9710f8
|
36 |
import com.platform.resultTool.PlatformResult; |
d81c64
|
37 |
import org.slf4j.Logger; |
R |
38 |
import org.slf4j.LoggerFactory; |
2cfe2a
|
39 |
import org.springframework.web.bind.annotation.RequestBody; |
F |
40 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
41 |
import org.springframework.web.bind.annotation.RequestMethod; |
|
42 |
import org.springframework.web.bind.annotation.RestController; |
be3140
|
43 |
|
R |
44 |
import javax.annotation.Resource; |
e18c30
|
45 |
import java.util.ArrayList; |
be3140
|
46 |
import java.util.HashMap; |
R |
47 |
import java.util.List; |
|
48 |
import java.util.Map; |
|
49 |
|
|
50 |
/** |
|
51 |
* 治疗通知单控制器 |
|
52 |
* |
|
53 |
* @USER: zhouxiang |
|
54 |
* @DATE: 2021/12/03 |
|
55 |
*/ |
|
56 |
@RestController |
|
57 |
@RequestMapping("/treat") |
|
58 |
public class TreatController extends BaseController { |
d81c64
|
59 |
|
R |
60 |
private static Logger logger = LoggerFactory.getLogger(TreatController.class); |
be3140
|
61 |
|
R |
62 |
@Resource |
2cfe2a
|
63 |
private TreatV3Service treatV3Service; |
be3140
|
64 |
@Resource |
R |
65 |
private UserService userService; |
61ef7d
|
66 |
@Resource |
R |
67 |
private TreatSingleService treatSingleService; |
|
68 |
@Resource |
|
69 |
private AppointmentService appointmentService; |
e18c30
|
70 |
@Resource |
8fd4fa
|
71 |
private CustomParameter customParameter; |
180320
|
72 |
@Resource |
F |
73 |
private EmployeeService employeeService; |
37a7e2
|
74 |
|
be3140
|
75 |
/** |
R |
76 |
* 创建治疗通知单 |
|
77 |
*/ |
|
78 |
@RequestMapping(value = "/add", method = RequestMethod.POST) |
75d152
|
79 |
public PlatformResult create(@RequestBody TreatOrderReqVo reqVo) { |
128220
|
80 |
|
6df582
|
81 |
logger.info("新增治疗单参数:{}", JSONObject.toJSONString(reqVo) ); |
6ae01a
|
82 |
|
b7f4e6
|
83 |
//治疗通知单对象 |
2d22c6
|
84 |
TreatSingle treatSingle = reqVo.createTreatSingle(); |
2cfe2a
|
85 |
//治疗单签名 |
F |
86 |
List<TreatSingleSign> signList = reqVo.getSignList(); |
6ae01a
|
87 |
|
be3140
|
88 |
//校验参数 |
2cfe2a
|
89 |
checkTreatSingleParam(true, treatSingle, signList); |
128220
|
90 |
|
1c1cdf
|
91 |
//判断是否发送通知MIC分配治疗 |
F |
92 |
Integer isMicNotice = BaseEntity.NO; |
|
93 |
// if(reqVo.getIsMicNotice() != null && reqVo.getIsMicNotice() == BaseEntity.YES){ |
|
94 |
// isMicNotice = BaseEntity.YES; |
|
95 |
// } |
|
96 |
|
128220
|
97 |
//治疗单项目 |
F |
98 |
List<TreatProject> projectList = reqVo.getProjectList(); |
|
99 |
if (projectList == null || projectList.size() == 0) { |
|
100 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "治疗通知单的治疗项目不能为空"); |
|
101 |
} |
6ae01a
|
102 |
//检查项目参数 |
F |
103 |
checkProjectParam(projectList); |
bc99c7
|
104 |
|
2cfe2a
|
105 |
if(StringUtils.isEmpty(reqVo.getRoleId())){ |
F |
106 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "操作人角色标识为空"); |
|
107 |
} |
|
108 |
EmployeeRole employeeRole = employeeService.selectRoleInfoById(reqVo.getRoleId()); |
|
109 |
if(employeeRole == null){ |
|
110 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "查询不到操作人角色信息!"); |
|
111 |
} |
be3140
|
112 |
|
2d22c6
|
113 |
VisitOrder visitOrder = commonService.selectOneByKey(VisitOrderMapper.class, treatSingle.getVisitOrderId()); |
6ae01a
|
114 |
if(visitOrder == null){ |
F |
115 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "查询不到到访订单信息"); |
|
116 |
} |
891640
|
117 |
treatSingle.setUserId(visitOrder.getUserId()); |
1c1cdf
|
118 |
|
F |
119 |
|
|
120 |
treatV3Service.add(treatSingle, projectList, visitOrder, employeeRole, isMicNotice, signList); |
128220
|
121 |
|
ef962a
|
122 |
//开启多线程处理用户科室关系 |
F |
123 |
ExecutorServiceTool fixedThreadPool = new ExecutorServiceTool(1, 1); |
|
124 |
try { |
7e52f3
|
125 |
fixedThreadPool.getThreadPool().execute(() ->{ |
F |
126 |
//处理用户科室关系 |
|
127 |
treatV3Service.doctorRoomHandler(treatSingle.getId()); |
|
128 |
//处理治疗单项目模式数据 |
|
129 |
treatV3Service.handleModeData(projectList); |
|
130 |
}); |
ef962a
|
131 |
}catch (Exception e){ |
7e52f3
|
132 |
logger.error("新增治疗单-开启多线程处理失败:"+ ExceptionTool.getExceptionInfo(e)); |
ef962a
|
133 |
}finally { |
F |
134 |
fixedThreadPool.shutdown(); |
|
135 |
} |
128220
|
136 |
//返回id |
F |
137 |
JSONObject data = new JSONObject(); |
|
138 |
data.put("treatSingleId", treatSingle.getId()); |
|
139 |
|
|
140 |
return PlatformResult.success(data); |
|
141 |
} |
|
142 |
|
|
143 |
/** |
|
144 |
* 修改治疗通知单 |
|
145 |
*/ |
|
146 |
@RequestMapping(value = "/edit", method = RequestMethod.POST) |
|
147 |
public PlatformResult edit(@RequestBody(required = false) TreatOrderReqVo reqVo) { |
|
148 |
|
4a3027
|
149 |
logger.info("修改治疗单参数:{}", JSONObject.toJSONString(reqVo) ); |
F |
150 |
|
128220
|
151 |
//获取-判断治疗通知单信息 |
F |
152 |
if (reqVo == null) { |
|
153 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗单信息为空"); |
|
154 |
} |
|
155 |
|
|
156 |
//治疗通知单对象 |
2d22c6
|
157 |
TreatSingle treatSingle = reqVo.createTreatSingle(); |
2cfe2a
|
158 |
//治疗单签名 |
F |
159 |
List<TreatSingleSign> signList = reqVo.getSignList(); |
128220
|
160 |
//校验参数 |
2cfe2a
|
161 |
checkTreatSingleParam(false, treatSingle, signList); |
F |
162 |
|
2d22c6
|
163 |
|
F |
164 |
List<TreatProject> projectList = reqVo.getProjectList(); |
|
165 |
if (projectList == null || projectList.size() == 0) { |
|
166 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "治疗通知单的治疗项目不能为空"); |
|
167 |
} |
2cfe2a
|
168 |
checkProjectParam(projectList); |
128220
|
169 |
|
F |
170 |
TreatSingle updateTreat = commonService.selectOneByKey(TreatSingleMapper.class,treatSingle.getId()); |
|
171 |
if(updateTreat == null){ |
|
172 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "未找到"); |
|
173 |
} |
|
174 |
|
1c1cdf
|
175 |
// //判断是否发送通知MIC分配治疗(如果治疗单分配医生不为空,则不继续通知MIC) |
F |
176 |
// Integer isMicNotice = BaseEntity.NO; |
|
177 |
// if(reqVo.getIsMicNotice() != null && reqVo.getIsMicNotice() == BaseEntity.YES |
|
178 |
// && StringUtils.noNull(updateTreat.getaDoctorId())){ |
|
179 |
// isMicNotice = BaseEntity.YES; |
|
180 |
// } |
6608fc
|
181 |
|
F |
182 |
if(updateTreat.getStatus() == TreatSingleConstants.STATUS_CANCEL){ |
|
183 |
throwParamException("作废治疗通知单不可修改!"); |
|
184 |
} |
|
185 |
|
2cfe2a
|
186 |
if(StringUtils.isEmpty(reqVo.getRoleId())){ |
F |
187 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "操作人角色标识为空"); |
|
188 |
} |
|
189 |
EmployeeRole employeeRole = employeeService.selectRoleInfoById(reqVo.getRoleId()); |
|
190 |
if(employeeRole == null){ |
|
191 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "查询不到操作人角色信息!"); |
|
192 |
} |
6ae01a
|
193 |
|
6df582
|
194 |
VisitOrder visitOrder = commonService.selectOneByKey(VisitOrderMapper.class, updateTreat.getVisitOrderId()); |
6ae01a
|
195 |
if(visitOrder == null){ |
F |
196 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "查询不到到访订单信息"); |
128220
|
197 |
} |
F |
198 |
|
|
199 |
//修改 |
|
200 |
treatSingle.setTreatSingleNo(updateTreat.getTreatSingleNo()); |
|
201 |
treatSingle.setCommonId(updateTreat.getCommonId()); |
1c1cdf
|
202 |
treatSingle.setaNurseId(updateTreat.getaNurseId()); |
F |
203 |
treatSingle.setaDoctorId(updateTreat.getaDoctorId()); |
2cfe2a
|
204 |
treatV3Service.edit(treatSingle, projectList, visitOrder, employeeRole, updateTreat, signList); |
128220
|
205 |
|
F |
206 |
//当状态是 待确认 发送短信给客户确认 |
|
207 |
if(treatSingle.getStatus()==TreatSingleConstants.STATUS_WAIT_CONFIRM){ |
|
208 |
//修改治疗通知单发送给客户 |
6ae01a
|
209 |
editSendMsg(treatSingle.getId(), visitOrder.getUserId()); |
128220
|
210 |
} |
be3140
|
211 |
|
7e52f3
|
212 |
//开启多线程处理 |
F |
213 |
ExecutorServiceTool fixedThreadPool = new ExecutorServiceTool(1, 1); |
|
214 |
try { |
|
215 |
fixedThreadPool.getThreadPool().execute(() ->{ |
|
216 |
//处理治疗单项目模式数据 |
|
217 |
treatV3Service.handleModeData(projectList); |
|
218 |
}); |
|
219 |
}catch (Exception e){ |
|
220 |
logger.error("编辑治疗单-开启多线程处理失败:"+ ExceptionTool.getExceptionInfo(e)); |
|
221 |
}finally { |
|
222 |
fixedThreadPool.shutdown(); |
|
223 |
} |
|
224 |
|
be3140
|
225 |
//返回id |
128220
|
226 |
JSONObject data = new JSONObject(); |
F |
227 |
data.put("treatSingleId", treatSingle.getId()); |
|
228 |
return PlatformResult.success(data); |
6ae01a
|
229 |
} |
F |
230 |
|
eb8351
|
231 |
/** 作废 */ |
F |
232 |
@RequestMapping(value = "/invalid", method = RequestMethod.POST) |
|
233 |
public PlatformResult invalid(@RequestBody(required = false) TreatOrderReqVo reqVo) { |
|
234 |
|
|
235 |
//获取-判断治疗通知单信息 |
|
236 |
if (reqVo == null) { |
|
237 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗单信息为空"); |
|
238 |
} |
|
239 |
|
|
240 |
if (StringUtils.isEmpty(reqVo.getTreatSingleId())) { |
|
241 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗通知单标识为空"); |
|
242 |
} |
|
243 |
|
|
244 |
if(StringUtils.isEmpty(reqVo.getRoleId())){ |
|
245 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "操作人角色标识为空"); |
|
246 |
} |
|
247 |
|
|
248 |
|
|
249 |
//治疗通知单对象 |
|
250 |
TreatSingle treatSingle = commonService.selectOneByKey(TreatSingleMapper.class, reqVo.getTreatSingleId()); |
|
251 |
if(treatSingle == null){ |
|
252 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "查询不到治疗通知单信息!"); |
|
253 |
} |
|
254 |
|
|
255 |
//查询治疗通知单有划扣过(已执行),则不可作废 |
|
256 |
SqlSentence sqlSentence = new SqlSentence(); |
|
257 |
Map<String, Object> values = new HashMap<>(); |
|
258 |
sqlSentence.setM(values); |
|
259 |
values.put("treatSingleId", reqVo.getTreatSingleId()); |
|
260 |
values.put("commonId", treatSingle.getCommonId()); |
|
261 |
values.put("status", DeductionSingleConstants.STATUS_DONE_EXECUTE); |
|
262 |
sqlSentence.setSqlSentence(" isDel = 0 and status = #{m.status} and commonId = #{m.commonId} and treatSingleId = #{m.treatSingleId} "); |
|
263 |
int count = commonService.selectCount(com.hx.phiappt.dao.mapper.DeductionSingleMapper.class, sqlSentence); |
|
264 |
if(count > 0){ |
|
265 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗通知单有划扣记录,不可作废!如想作废请先作废关联划扣记录"); |
|
266 |
} |
|
267 |
|
|
268 |
EmployeeRole employeeRole = employeeService.selectRoleInfoById(reqVo.getRoleId()); |
|
269 |
if(employeeRole == null){ |
|
270 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "查询不到操作人角色信息!"); |
|
271 |
} |
|
272 |
|
|
273 |
VisitOrder visitOrder = commonService.selectOneByKey(VisitOrderMapper.class, treatSingle.getVisitOrderId()); |
|
274 |
if(visitOrder == null){ |
|
275 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "查询不到到访订单信息"); |
|
276 |
} |
|
277 |
|
|
278 |
treatV3Service.invalidTreat(treatSingle, visitOrder, employeeRole); |
|
279 |
|
|
280 |
return PlatformResult.success(); |
|
281 |
} |
71332a
|
282 |
|
F |
283 |
/** 更新治疗单签名 */ |
|
284 |
@RequestMapping(value ="/updateSign", method = RequestMethod.POST) |
|
285 |
public Result updateSign(@RequestBody(required = false) TreatOrderReqVo reqVo){ |
|
286 |
if(reqVo == null){ |
|
287 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "请求对象为空!"); |
|
288 |
} |
|
289 |
|
|
290 |
if(StringUtils.isEmpty(reqVo.getRoleId())){ |
|
291 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "操作人标识不能为空!"); |
|
292 |
} |
|
293 |
|
|
294 |
if(StringUtils.isEmpty(reqVo.getTreatSingleId())){ |
|
295 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "操作人标识不能为空!"); |
|
296 |
} |
|
297 |
|
|
298 |
if(reqVo.getSignList() == null || reqVo.getSignList().size() < 1){ |
|
299 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "签名信息不能为空!"); |
|
300 |
} |
|
301 |
|
|
302 |
|
|
303 |
EmployeeRole employeeRole = employeeService.selectRoleInfoById(reqVo.getRoleId()); |
|
304 |
if(employeeRole == null){ |
|
305 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "查询不到操作人角色信息!"); |
|
306 |
} |
|
307 |
|
|
308 |
TreatSingle treatSingle = treatSingleService.selectOneByKey(reqVo.getTreatSingleId()); |
|
309 |
if(treatSingle == null){ |
|
310 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "查询不到治疗通知单信息!"); |
|
311 |
} |
1930e1
|
312 |
//先获取旧的,因为统一校验方法会覆盖,校验完后再重新set值 |
F |
313 |
Integer isUserSign = treatSingle.getIsUserSign(); |
37022a
|
314 |
checkSignParam(reqVo.getSignList(), treatSingle); |
1930e1
|
315 |
treatSingle.setIsUserSign(isUserSign); |
71332a
|
316 |
|
F |
317 |
treatV3Service.updateSign(treatSingle, reqVo.getSignList(), employeeRole); |
|
318 |
|
|
319 |
return Result.success(); |
|
320 |
} |
be3140
|
321 |
|
R |
322 |
/** |
|
323 |
* 客户确认治疗通知单 |
|
324 |
*/ |
9710f8
|
325 |
@RequestMapping(value = "/confirmTreatNotice", method = RequestMethod.POST) |
R |
326 |
public PlatformResult confirmTreatNotice(@RequestBody String param) { |
|
327 |
if (StringUtils.isEmpty(param)) { |
b7f4e6
|
328 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "治疗单参数为空"); |
be3140
|
329 |
} |
c83f0f
|
330 |
|
9710f8
|
331 |
JSONObject jsonObject = JSONObject.parseObject(param); |
R |
332 |
if (!jsonObject.containsKey("treatSingleId")) { |
|
333 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗单id为空"); |
|
334 |
} |
c83f0f
|
335 |
|
61ef7d
|
336 |
TreatSingle treatSingle = treatSingleService.selectOneByKey(jsonObject.getString("treatSingleId")); |
9710f8
|
337 |
if (treatSingle == null) { |
c83f0f
|
338 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "找不到治疗通知单信息"); |
F |
339 |
} |
|
340 |
|
9710f8
|
341 |
if (treatSingle.getStatus() == TreatSingleConstants.STATUS_CONFIRM) { |
c83f0f
|
342 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗通知单已确认"); |
F |
343 |
} |
|
344 |
|
ed5590
|
345 |
Appointment appointment = appointmentService.selectOneByKeyBlob(treatSingle.getCommonId()); |
R |
346 |
if(appointment == null){ |
|
347 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "找不到预约单信息"); |
|
348 |
} |
|
349 |
|
|
350 |
|
|
351 |
treatSingleService.updateTreatStatus(treatSingle,appointment,commonService); |
61ef7d
|
352 |
|
9710f8
|
353 |
return PlatformResult.success(); |
be3140
|
354 |
} |
R |
355 |
|
|
356 |
/** |
|
357 |
* 查询治疗通知单详情信息 |
|
358 |
*/ |
|
359 |
@RequestMapping(value = "/info", method = RequestMethod.POST) |
9710f8
|
360 |
public PlatformResult getTreatList(@RequestBody String param) { |
be3140
|
361 |
//判断参数 |
9710f8
|
362 |
if (StringUtil.isEmpty(param)) { |
R |
363 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗通知单id不能为空"); |
|
364 |
} |
|
365 |
|
|
366 |
JSONObject jsonObject = JSONObject.parseObject(param); |
|
367 |
if (!jsonObject.containsKey("treatSingleId")) { |
b7f4e6
|
368 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗通知单id不能为空"); |
be3140
|
369 |
} |
9710f8
|
370 |
|
be3140
|
371 |
//查询治疗通知单 |
61ef7d
|
372 |
TreatSingle treatSingle = treatSingleService.selectOneByKey(jsonObject.getString("treatSingleId")); |
be3140
|
373 |
if (treatSingle == null) { |
9710f8
|
374 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗通知单id不能为空"); |
be3140
|
375 |
} |
R |
376 |
//查询预约信息 |
61ef7d
|
377 |
Appointment appointment = appointmentService.selectOneByKey( treatSingle.getCommonId()); |
be3140
|
378 |
if (appointment == null) { |
9710f8
|
379 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "找不到预约信息"); |
be3140
|
380 |
} |
R |
381 |
|
|
382 |
SqlSentence sqlSentence = new SqlSentence(); |
|
383 |
Map<String, Object> map = new HashMap<>(); |
|
384 |
sqlSentence.setM(map); |
|
385 |
|
|
386 |
//查询项目信息 |
|
387 |
map.put("singleId", treatSingle.getId()); |
d466ed
|
388 |
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"); |
be3140
|
389 |
List<Map<String, Object>> projectList = commonService.selectListMap(TreatProjectMapper.class, sqlSentence); |
R |
390 |
|
|
391 |
//人员信息 |
|
392 |
map.put("userId", appointment.getUserId()); |
5acd7e
|
393 |
map.put("key", VariableAesKey.AES_KEY); |
Z |
394 |
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 "); |
be3140
|
395 |
User user = commonService.selectOne(UserMapper.class, sqlSentence); |
R |
396 |
if (user == null) { |
b7f4e6
|
397 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "用户信息为空"); |
be3140
|
398 |
} |
e18c30
|
399 |
//医生信息 |
Z |
400 |
sqlSentence.setSqlSentence("select * from treat_project_doctor where isDel=0 and treatSingleId=#{m.singleId}"); |
|
401 |
List<TreatProjectDoctor> projectDoctors = commonService.selectList(TreatProjectDoctorMapper.class, sqlSentence); |
|
402 |
List<Map<String, Object>> maps=new ArrayList<>(); |
|
403 |
if(projectDoctors !=null && projectDoctors.size()>0){ |
3594e1
|
404 |
for(TreatProjectDoctor vo:projectDoctors){ |
Z |
405 |
Map<String,Object> employeeMap=new HashMap<>(); |
|
406 |
Employee employee=commonService.selectOneByKey(EmployeeMapper.class, vo.getCommonId()); |
|
407 |
employeeMap.put("projectId",vo.getTreatProjectId()); |
|
408 |
employeeMap.put("projectHisId",vo.getTreatProjectHisId()); |
|
409 |
employeeMap.put("employeeName",employee.getCnName()); |
|
410 |
employeeMap.put("employeeId",employee.getId()); |
|
411 |
maps.add(employeeMap); |
|
412 |
} |
e18c30
|
413 |
} |
be3140
|
414 |
|
R |
415 |
map.clear(); |
|
416 |
map.put("createTime", DateUtil.formatDate(treatSingle.getCreateTime(), "yyy.MM.dd HH:mm")); |
|
417 |
map.put("name", user.getName()); |
|
418 |
map.put("ciq", user.getCIQ()); |
|
419 |
map.put("tel", user.getTel()); |
|
420 |
map.put("shopName", treatSingle.getShopName()); |
|
421 |
map.put("employeeName", treatSingle.getOperatorName()); |
|
422 |
map.put("projectList", projectList); |
|
423 |
map.put("remarkInfo", treatSingle.getRemarkInfo()); |
4ea264
|
424 |
map.put("status",treatSingle.getStatus()); |
e18c30
|
425 |
map.put("employeeList",maps); |
71c38a
|
426 |
map.put("employeeType",appointment.getIsLifeBeauty() ==null||appointment.getIsLifeBeauty()==0? RoleType.UNIQUE_STR_DOCTOR:RoleType.UNIQUE_STR_NURSE); |
4ea264
|
427 |
|
9710f8
|
428 |
return PlatformResult.success(map); |
be3140
|
429 |
} |
R |
430 |
|
|
431 |
/** |
|
432 |
* 重新发送短信 |
9710f8
|
433 |
* |
R |
434 |
* @param param |
be3140
|
435 |
* @return |
R |
436 |
*/ |
|
437 |
@RequestMapping("/againSendMsg") |
9710f8
|
438 |
public PlatformResult sendMsg(@RequestBody String param) { |
R |
439 |
//校验参数 |
be3140
|
440 |
if (StringUtils.isEmpty(param)) { |
R |
441 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "请传治疗通知单参数"); |
|
442 |
} |
9710f8
|
443 |
//转成对象 |
be3140
|
444 |
JSONObject object = JSONObject.parseObject(param); |
9710f8
|
445 |
//判断参数 |
R |
446 |
if (!object.containsKey("treatSingleId")) { |
|
447 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "请传治疗通知单参数"); |
|
448 |
} |
|
449 |
//查询治疗通知单 |
b7f4e6
|
450 |
TreatSingle treatSingle = commonService.selectOneByKey(TreatSingleMapper.class, object.getString("treatSingleId")); |
9710f8
|
451 |
if (treatSingle == null) { |
R |
452 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "找不到治疗通知单信息"); |
|
453 |
} |
|
454 |
//判断状态 短信是否是已确认 未确认发送短信 |
|
455 |
if (treatSingle.getStatus() == TreatSingleConstants.STATUS_CONFIRM) { |
|
456 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗通知单已确认"); |
|
457 |
} |
be3140
|
458 |
|
ed5590
|
459 |
//查询预约信息 |
b33cd3
|
460 |
Appointment appointment = commonService.selectOneByKey(AppointmentMapper.class, treatSingle.getCommonId()); |
ed5590
|
461 |
if (appointment == null) { |
R |
462 |
throw new TipsException("找不到预约信息"); |
|
463 |
} |
|
464 |
|
|
465 |
//用户信息 |
b33cd3
|
466 |
User userInfo = commonService.selectOneByKey(UserMapper.class, appointment.getUserId()); |
ed5590
|
467 |
if (userInfo == null) { |
R |
468 |
throw new TipsException("找不到用户信息!"); |
|
469 |
} |
|
470 |
|
be3140
|
471 |
SqlSentence sqlSentence = new SqlSentence(); |
R |
472 |
Map<String, Object> values = new HashMap<>(); |
|
473 |
sqlSentence.setM(values); |
|
474 |
//通过预约id查询到预约信息获取用户手机号 |
|
475 |
values.put("commonId", object.getString("appId")); |
0d64a4
|
476 |
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 "); |
be3140
|
477 |
Map<String, Object> map = userService.selectOneMap(sqlSentence); |
c9c262
|
478 |
if(PlatformPattern.PROD.equals(customParameter.getPlatformPattern())){ |
Z |
479 |
map.put("treatSingleId",treatSingle.getId()); |
|
480 |
CrmUtil.sendCrmSMS(map,commonService,0); |
|
481 |
}else{ |
|
482 |
net.sf.json.JSONObject jsonObject = new net.sf.json.JSONObject(); |
|
483 |
//发送短信 |
|
484 |
jsonObject = SendSMSTool.msgSend("测试服假链接"+"https://wxaurl.cn/66666666", map.get("tel").toString(), "", 1); |
d81c64
|
485 |
|
37cf38
|
486 |
// logger.info("发送短信返回:"+jsonObject.toString()); |
d81c64
|
487 |
|
c9c262
|
488 |
if (jsonObject.getInt("code") != 0) { |
Z |
489 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "发送短信失败"); |
|
490 |
} |
be3140
|
491 |
} |
ed5590
|
492 |
|
R |
493 |
// VLatelyLog vLatelyLog = new VLatelyLog(TreatSingleConstants.STATUS_CONFIRM, "客户自己确认治疗通知单", "治疗通知单,客户已确认自己的治疗通知单", userInfo.getCIQ() + userInfo.getName(), null, |
|
494 |
// null, null, null, userInfo.getId()); |
|
495 |
// |
|
496 |
// commonService.insert(com.hx.guide.dao.mapper.VLatelyLogMapper.class,vLatelyLog); |
|
497 |
|
9710f8
|
498 |
|
R |
499 |
return PlatformResult.success(); |
|
500 |
|
be3140
|
501 |
} |
a1a890
|
502 |
|
66cafd
|
503 |
|
2cfe2a
|
504 |
//////////////////////////////////////////////////////////////////////////////////////////////// |
180320
|
505 |
|
4667b8
|
506 |
public void editSendMsg(String treatSingleId,String userId) { |
85a86c
|
507 |
|
Z |
508 |
//查询治疗通知单 |
|
509 |
TreatSingle treatSingle = commonService.selectOneByKey(TreatSingleMapper.class, treatSingleId); |
|
510 |
if (treatSingle == null) { |
|
511 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "找不到治疗通知单信息"); |
|
512 |
} |
fcdf38
|
513 |
// //判断状态 短信是否是已确认 未确认发送短信 |
Z |
514 |
// if (treatSingle.getStatus() == TreatSingleConstants.STATUS_CONFIRM) { |
|
515 |
// throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_TYPE, "治疗通知单已确认"); |
|
516 |
// } |
85a86c
|
517 |
|
ed5590
|
518 |
|
R |
519 |
//查询预约信息 |
0240a3
|
520 |
Appointment appointment = commonService.selectOneByKey(AppointmentMapper.class, treatSingle.getCommonId()); |
ed5590
|
521 |
if (appointment == null) { |
R |
522 |
throw new TipsException("找不到预约信息"); |
|
523 |
} |
|
524 |
|
|
525 |
//用户信息 |
0240a3
|
526 |
User userInfo = commonService.selectOneByKey(UserMapper.class, appointment.getUserId()); |
ed5590
|
527 |
if (userInfo == null) { |
R |
528 |
throw new TipsException("找不到用户信息!"); |
|
529 |
} |
|
530 |
|
|
531 |
|
85a86c
|
532 |
SqlSentence sqlSentence = new SqlSentence(); |
Z |
533 |
Map<String, Object> values = new HashMap<>(); |
|
534 |
sqlSentence.setM(values); |
|
535 |
//通过预约id查询到预约信息获取用户手机号 |
|
536 |
values.put("commonId", userId); |
fcdf38
|
537 |
sqlSentence.setSqlSentence("SELECT tel FROM `user` WHERE id = #{m.commonId} AND isDel = 0"); |
85a86c
|
538 |
Map<String, Object> map = userService.selectOneMap(sqlSentence); |
Z |
539 |
|
c9c262
|
540 |
if(PlatformPattern.PROD.equals(customParameter.getPlatformPattern())){ |
Z |
541 |
map.put("treatSingleId",treatSingle.getId()); |
|
542 |
CrmUtil.sendCrmSMS(map,commonService,1); |
|
543 |
}else{ |
|
544 |
net.sf.json.JSONObject jsonObject = new net.sf.json.JSONObject(); |
|
545 |
//发送短信 |
|
546 |
jsonObject = SendSMSTool.msgSend("测试服假链接"+"https://wxaurl.cn/66666666", map.get("tel").toString(), "", 1); |
85a86c
|
547 |
|
c9c262
|
548 |
// logger.info("发送短信返回:"+jsonObject.toString()); |
85a86c
|
549 |
|
c9c262
|
550 |
if (jsonObject.getInt("code") != 0) { |
Z |
551 |
throw new PlatTipsException(PlatformCode.ERROR_TIPS, "发送短信失败"); |
|
552 |
} |
85a86c
|
553 |
} |
ed5590
|
554 |
|
R |
555 |
|
|
556 |
// VLatelyLog vLatelyLog = new VLatelyLog(TreatSingleConstants.STATUS_CONFIRM, "修改治疗单时客户需确认治疗单", "修改治疗通知单,客户已确认自己的治疗通知单", userInfo.getCIQ() + userInfo.getName(), null, |
|
557 |
// null, null, null, userInfo.getId()); |
|
558 |
// |
|
559 |
// commonService.insert(com.hx.guide.dao.mapper.VLatelyLogMapper.class,vLatelyLog); |
|
560 |
|
85a86c
|
561 |
} |
Z |
562 |
|
a1a890
|
563 |
|
128220
|
564 |
/** 治疗通知单参数校验 */ |
2cfe2a
|
565 |
private void checkTreatSingleParam(boolean isAdd, TreatSingle treatSingle, List<TreatSingleSign> signList) { |
F |
566 |
|
|
567 |
//新增才校验的参数 |
|
568 |
if(isAdd){ |
|
569 |
if (StringUtils.isEmpty(treatSingle.getCommonId())) { |
|
570 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "预约id为空"); |
|
571 |
} |
|
572 |
|
|
573 |
if (StringUtils.isEmpty(treatSingle.getVisitOrderId())) { |
|
574 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "到访订单标识为空"); |
|
575 |
} |
|
576 |
} |
be3140
|
577 |
|
R |
578 |
if (StringUtils.isEmpty(treatSingle.getType())) { |
|
579 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "治疗通知单类型为空"); |
|
580 |
} |
|
581 |
|
|
582 |
if (treatSingle.getStatus() == null) { |
|
583 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "状态为空"); |
|
584 |
} |
bc99c7
|
585 |
if (StringUtils.isEmpty(treatSingle.getShopId())) { |
R |
586 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "所属门店标识为空"); |
|
587 |
} |
a1a890
|
588 |
|
bc99c7
|
589 |
if (StringUtils.isEmpty(treatSingle.getOperatorId())) { |
R |
590 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "下单操作人标识为空"); |
|
591 |
} |
|
592 |
|
|
593 |
if (StringUtils.isEmpty(treatSingle.getDeveloperShopId())) { |
|
594 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "开单人门店标识为空"); |
|
595 |
} |
|
596 |
|
|
597 |
if (StringUtils.isEmpty(treatSingle.getDeveloperId())) { |
|
598 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "开单人标识为空"); |
|
599 |
} |
128220
|
600 |
|
4da8cc
|
601 |
if (treatSingle.getOrderClassify() == null) { |
F |
602 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "订单分类不能为空!"); |
|
603 |
} |
2cfe2a
|
604 |
|
F |
605 |
//校验签名参数---------------------------------------------------------------------------------- |
|
606 |
if(signList != null && signList.size() > 0){ |
37022a
|
607 |
checkSignParam(signList, treatSingle); |
2cfe2a
|
608 |
} |
F |
609 |
|
|
610 |
//---------------------------------------------------------------------------------- |
be3140
|
611 |
} |
R |
612 |
|
71332a
|
613 |
/** 检测校验治疗单签名参数 */ |
37022a
|
614 |
private void checkSignParam(List<TreatSingleSign> signList, TreatSingle treatSingle){ |
F |
615 |
treatSingle.setIsUserSign(BaseEntity.NO); |
71332a
|
616 |
for(TreatSingleSign sign : signList){ |
399961
|
617 |
|
71332a
|
618 |
if(StringUtils.isEmpty(sign.getSignPerType())){ |
F |
619 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"签名人类型不能为空!"); |
|
620 |
} |
|
621 |
if(StringUtils.isEmpty(sign.getSignPerName())){ |
|
622 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"签名人名称不能为空!"); |
|
623 |
} |
|
624 |
//判断类型,更改对应值 |
|
625 |
if(TreatSingleSign.SIGN_PER_TYPE_USER.equals(sign.getSignPerType())){ |
|
626 |
sign.setSortNo(1); |
37022a
|
627 |
treatSingle.setIsUserSign(BaseEntity.YES); |
71332a
|
628 |
}else if(TreatSingleSign.SIGN_PER_TYPE_NURSE1.equals(sign.getSignPerType())){ |
F |
629 |
sign.setSortNo(2); |
399961
|
630 |
continue; //跳过不判断图片,可为空 |
71332a
|
631 |
}else if(TreatSingleSign.SIGN_PER_TYPE_NURSE2.equals(sign.getSignPerType())){ |
F |
632 |
sign.setSortNo(3); |
399961
|
633 |
continue; //跳过不判断图片,可为空 |
71332a
|
634 |
}else if(TreatSingleSign.SIGN_PER_TYPE_DOCTOR.equals(sign.getSignPerType())){ |
F |
635 |
sign.setSortNo(4); |
|
636 |
} |
399961
|
637 |
|
F |
638 |
if(StringUtils.isEmpty(sign.getSignImg())){ |
|
639 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"签名图片不能为空!"); |
|
640 |
} |
|
641 |
|
71332a
|
642 |
} |
F |
643 |
} |
|
644 |
|
128220
|
645 |
/** 治疗项目参数校验 */ |
2cfe2a
|
646 |
private void checkProjectParam(List<TreatProject> treatProjectList) { |
be3140
|
647 |
|
2cfe2a
|
648 |
for(TreatProject treatProject : treatProjectList){ |
a1a890
|
649 |
if (StringUtils.isEmpty(treatProject.getProjectNo())) { |
R |
650 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "项目编号不能为空"); |
|
651 |
} |
|
652 |
|
|
653 |
if (StringUtils.isEmpty(treatProject.getProjectName())) { |
|
654 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "项目名称不能为空"); |
|
655 |
} |
|
656 |
|
|
657 |
if (treatProject.getPrice() == null) { |
|
658 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "价格不能为空"); |
|
659 |
} |
|
660 |
|
|
661 |
if (treatProject.getNum() == null) { |
|
662 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "数量不能为空"); |
|
663 |
} |
|
664 |
|
|
665 |
if (treatProject.getUseDuration() == null) { |
|
666 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "治疗时长不能为空"); |
|
667 |
} |
|
668 |
|
|
669 |
if (StringUtils.isEmpty(treatProject.getProjectId())) { |
|
670 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "项目标识不能为空"); |
|
671 |
} |
|
672 |
|
bb9a8c
|
673 |
if (StringUtils.isEmpty(treatProject.getGoodsId())) { |
F |
674 |
throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "公用项目标识不能为空"); |
|
675 |
} |
|
676 |
|
a65992
|
677 |
// if (StringUtils.isEmpty(treatProject.getUserProjectItemId())) { |
F |
678 |
// throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "用户项目标识不能为空"); |
|
679 |
// } |
2cfe2a
|
680 |
} |
a1a890
|
681 |
} |
R |
682 |
|
|
683 |
|
2cfe2a
|
684 |
|
F |
685 |
|
be3140
|
686 |
} |