|
@ -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;
|
|
|
// =======================
|
|
|
/**
|
|
|
* 获取某个健康指导
|
|
|
*
|
|
@ -57,19 +58,60 @@ public class DoctorHealthGuidanceController extends WeixinBaseController {
|
|
|
*/
|
|
|
@RequestMapping(value = "/id")
|
|
|
@ResponseBody
|
|
|
public String getHealthGuidance(Long id){
|
|
|
public String getHealthGuidance(@RequestParam String id){
|
|
|
Long idl = Long.parseLong(id);
|
|
|
try{
|
|
|
if(id == null || id < 1){
|
|
|
if(idl == null || idl < 1){
|
|
|
return error(-1,"参数错误");
|
|
|
}
|
|
|
|
|
|
JSONObject guidance = patientHealthGuidanceService.findById(id);
|
|
|
JSONObject guidance = patientHealthGuidanceService.findById(idl);
|
|
|
return write(200,"查询成功","data",guidance);
|
|
|
}catch (Exception e){
|
|
|
return error(-1,"查询失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*/**
|
|
|
* 添加患者健康指导
|
|
|
* @param patient 患者标识
|
|
|
* @param content 指导内容
|
|
|
* @return
|
|
|
*/
|
|
|
/*@RequestMapping(value = "add")
|
|
|
@ResponseBody
|
|
|
public String add(String patient, 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));
|
|
|
return success("保存成功!");
|
|
|
} else {
|
|
|
return error(-1, "保存失败!");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|
|
|
return error(-1, "保存失败!");
|
|
|
}
|
|
|
}*/
|
|
|
// ====================修改代码========================
|
|
|
/**
|
|
|
* 添加患者健康指导
|
|
|
* @param patient 患者标识
|
|
@ -78,7 +120,7 @@ public class DoctorHealthGuidanceController extends WeixinBaseController {
|
|
|
*/
|
|
|
@RequestMapping(value = "add")
|
|
|
@ResponseBody
|
|
|
public String add(String patient, String content, @RequestParam(required = false) String images, @RequestParam(required = false) String voice) {
|
|
|
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);
|
|
@ -100,6 +142,9 @@ public class DoctorHealthGuidanceController extends WeixinBaseController {
|
|
|
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, "保存失败!");
|
|
@ -109,25 +154,34 @@ public class DoctorHealthGuidanceController extends WeixinBaseController {
|
|
|
return error(-1, "保存失败!");
|
|
|
}
|
|
|
}
|
|
|
// ============================================
|
|
|
|
|
|
/**
|
|
|
* 查询患者的健康指导
|
|
|
* @param patient 患者标识
|
|
|
* @param begin 开始时间
|
|
|
* @param end 结束时间
|
|
|
* @param begin 开始时间
|
|
|
* @param end 结束时间
|
|
|
* @param id 指导编码
|
|
|
* @param pagesize 展示页数
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "list")
|
|
|
@ResponseBody
|
|
|
public String list(@RequestParam(required = false) String patient, @RequestParam(required = false) String begin, @RequestParam(required = false) String end, long id, int pagesize) {
|
|
|
public String list(@RequestParam(required = false) String patient,
|
|
|
@RequestParam(required = false) String begin,
|
|
|
@RequestParam(required = false) String end,
|
|
|
@RequestParam String id,
|
|
|
@RequestParam String pagesize) {
|
|
|
try {
|
|
|
Long idl = Long.parseLong(id);
|
|
|
int page = Integer.parseInt(pagesize);
|
|
|
if (StringUtils.isNotEmpty(begin)) {
|
|
|
begin = begin + " 00:00:00";
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(end)) {
|
|
|
end = end + " 23:59:59";
|
|
|
}
|
|
|
JSONArray array = patientHealthGuidanceService.findPatientGuidanceByDoctor(getUID(), patient, begin, end, id, pagesize);
|
|
|
JSONArray array = patientHealthGuidanceService.findPatientGuidanceByDoctor(getUID(), patient, begin, end, idl, page);
|
|
|
return write(200, "查询成功!", "list", array);
|
|
|
} catch (Exception e) {
|
|
|
error(e);
|