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