|
@ -2,13 +2,15 @@ package com.yihu.wlyy.web.doctor.health;
|
|
|
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
import com.yihu.wlyy.entity.patient.PatientHealthGuidance;
|
|
|
import com.yihu.wlyy.logs.BusinessLogs;
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
|
import com.yihu.wlyy.service.app.consult.ConsultService;
|
|
|
import com.yihu.wlyy.service.app.sign.FamilyContractService;
|
|
|
import com.yihu.wlyy.service.app.health.PatientHealthGuidanceService;
|
|
|
import com.yihu.wlyy.service.common.account.DoctorService;
|
|
|
import com.yihu.wlyy.service.common.account.PatientService;
|
|
|
import com.yihu.wlyy.service.template.DoctorGuidanceTempService;
|
|
|
import com.yihu.wlyy.util.CommonUtil;
|
|
|
import com.yihu.wlyy.web.WeixinBaseController;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
@ -23,11 +25,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import com.yihu.wlyy.entity.patient.PatientHealthGuidance;
|
|
|
import com.yihu.wlyy.service.app.health.PatientHealthGuidanceService;
|
|
|
import com.yihu.wlyy.util.CommonUtil;
|
|
|
import com.yihu.wlyy.web.WeixinBaseController;
|
|
|
|
|
|
/**
|
|
|
* 医生端:健康指导控制类
|
|
|
* @author George
|
|
@ -49,6 +46,10 @@ public class DoctorHealthGuidanceController extends WeixinBaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private ConsultService consultService;
|
|
|
//======================
|
|
|
@Autowired
|
|
|
DoctorGuidanceTempService doctorGuidanceTempService;
|
|
|
// =======================
|
|
|
/**
|
|
|
* 获取某个健康指导
|
|
|
*
|
|
@ -76,7 +77,7 @@ public class DoctorHealthGuidanceController extends WeixinBaseController {
|
|
|
* @param content 指导内容
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "add")
|
|
|
/*@RequestMapping(value = "add")
|
|
|
@ResponseBody
|
|
|
public String add(String patient, String content, @RequestParam(required = false) String images, @RequestParam(required = false) String voice) {
|
|
|
try {
|
|
@ -108,7 +109,45 @@ public class DoctorHealthGuidanceController extends WeixinBaseController {
|
|
|
error(e);
|
|
|
return error(-1, "保存失败!");
|
|
|
}
|
|
|
}*/
|
|
|
// ====================修改代码========================
|
|
|
@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);
|
|
|
|
|
|
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));
|
|
|
// 发送成功记录模板发送次数
|
|
|
doctorGuidanceTempService.countSend("96961fb9d100424896e18c1d1dfde1eb");
|
|
|
|
|
|
return success("保存成功!");
|
|
|
} else {
|
|
|
return error(-1, "保存失败!");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "保存失败!");
|
|
|
}
|
|
|
}
|
|
|
// ============================================
|
|
|
|
|
|
/**
|
|
|
* 查询患者的健康指导
|