|
@ -112,46 +112,94 @@ public class DoctorHealthGuidanceController extends WeixinBaseController {
|
|
|
}
|
|
|
}*/
|
|
|
// ====================修改代码========================
|
|
|
|
|
|
/**
|
|
|
* 添加患者健康指导
|
|
|
* 添加患者健康指导(modelCode不为空判断为使用模板)
|
|
|
* @param patient 患者标识
|
|
|
* @param content 指导内容
|
|
|
* @param modelCode 指导模板编码
|
|
|
* @param images 指导图片
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "add")
|
|
|
@ResponseBody
|
|
|
public String add(@RequestParam String patient,@RequestParam String content, @RequestParam(required = false) String images, @RequestParam(required = false) String voice) {
|
|
|
try {
|
|
|
PatientHealthGuidance guidance = new PatientHealthGuidance();
|
|
|
guidance.setContent(content);
|
|
|
guidance.setDoctor(getUID());
|
|
|
guidance.setPatient(patient);
|
|
|
Doctor doctor = doctorService.findDoctorByCode(getUID());
|
|
|
if (StringUtils.isNotEmpty(images)) {
|
|
|
images = CommonUtil.copyTempImage(images);
|
|
|
}
|
|
|
guidance.setImages(images);
|
|
|
public String add(@RequestParam String patient,
|
|
|
@RequestParam String content,
|
|
|
@RequestParam(required = false) String modelCode,
|
|
|
@RequestParam(required = false) String images,
|
|
|
@RequestParam(required = false) String voice) {
|
|
|
|
|
|
if (StringUtils.isNotEmpty(voice)) {
|
|
|
images = CommonUtil.copyTempVoice(voice);
|
|
|
if(modelCode==null) {
|
|
|
// 不使用模板指导,旧版手工指导
|
|
|
try {
|
|
|
PatientHealthGuidance guidance = new PatientHealthGuidance();
|
|
|
guidance.setContent(content);
|
|
|
guidance.setDoctor(getUID());
|
|
|
guidance.setPatient(patient);
|
|
|
Doctor doctor = doctorService.findDoctorByCode(getUID());
|
|
|
if (StringUtils.isNotEmpty(images)) {
|
|
|
images = CommonUtil.copyTempImage(images);
|
|
|
}
|
|
|
guidance.setImages(images);
|
|
|
|
|
|
if (StringUtils.isNotEmpty(voice)) {
|
|
|
images = CommonUtil.copyTempVoice(voice);
|
|
|
}
|
|
|
guidance.setVoice(voice);
|
|
|
|
|
|
// 保存
|
|
|
if (patientHealthGuidanceService.add(guidance, getAccessToken()) != null) {
|
|
|
Patient p = patientService.findByCode(patient);
|
|
|
consultService.sendMucMessageBySingnType(getUID(), doctor.getName(), patient, content, "1", p.getName());
|
|
|
BusinessLogs.info(BusinessLogs.BusinessType.guidance, patient, new JSONObject(guidance));
|
|
|
return success("保存成功!");
|
|
|
} else {
|
|
|
return error(-1, "保存失败!");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "保存失败!");
|
|
|
}
|
|
|
guidance.setVoice(voice);
|
|
|
}else{
|
|
|
// 使用模板发送指导
|
|
|
try{
|
|
|
/*// 1.查询单个模板详情
|
|
|
JSONObject modelDetail = doctorGuidanceTempService.listDetail(modelCode);
|
|
|
String name = modelDetail.get("modelName").toString();
|
|
|
String contain = modelDetail.get("content").toString();
|
|
|
String image = modelDetail.get("imagesUrl").toString();
|
|
|
content+=contain;
|
|
|
images+=image;*/
|
|
|
PatientHealthGuidance guidance = new PatientHealthGuidance();
|
|
|
guidance.setContent(content);
|
|
|
guidance.setDoctor(getUID());
|
|
|
guidance.setPatient(patient);
|
|
|
Doctor doctor = doctorService.findDoctorByCode(getUID());
|
|
|
if (StringUtils.isNotEmpty(images)) {
|
|
|
images = CommonUtil.copyTempImage(images);
|
|
|
}
|
|
|
guidance.setImages(images);
|
|
|
|
|
|
// 保存
|
|
|
if (patientHealthGuidanceService.add(guidance, getAccessToken()) != null) {
|
|
|
Patient p = patientService.findByCode(patient);
|
|
|
consultService.sendMucMessageBySingnType(getUID(),doctor.getName(),patient,content,"1",p.getName());
|
|
|
BusinessLogs.info(BusinessLogs.BusinessType.guidance, patient, new JSONObject(guidance));
|
|
|
// 发送成功记录模板发送次数
|
|
|
doctorGuidanceTempService.countSend("96961fb9d100424896e18c1d1dfde1eb");
|
|
|
if (StringUtils.isNotEmpty(voice)) {
|
|
|
images = CommonUtil.copyTempVoice(voice);
|
|
|
}
|
|
|
guidance.setVoice(voice);
|
|
|
|
|
|
return success("保存成功!");
|
|
|
} else {
|
|
|
// 保存
|
|
|
if (patientHealthGuidanceService.add(guidance, getAccessToken()) != null) {
|
|
|
Patient p = patientService.findByCode(patient);
|
|
|
consultService.sendMucMessageBySingnType(getUID(), doctor.getName(), patient, content, "1", p.getName());
|
|
|
BusinessLogs.info(BusinessLogs.BusinessType.guidance, patient, new JSONObject(guidance));
|
|
|
//发送成功记录模板发送次数
|
|
|
doctorGuidanceTempService.countSend(modelCode);
|
|
|
return success("保存成功!");
|
|
|
} else {
|
|
|
return error(-1, "保存失败!");
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
error(e);
|
|
|
return error(-1, "保存失败!");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "保存失败!");
|
|
|
}
|
|
|
}
|
|
|
// ============================================
|