|
@ -1,5 +1,6 @@
|
|
|
package com.yihu.wlyy.service.specialist.rehabilitation;
|
|
package com.yihu.wlyy.service.specialist.rehabilitation;
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.message.Message;
|
|
import com.yihu.wlyy.entity.message.Message;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
@ -12,7 +13,10 @@ import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
|
|
|
import com.yihu.wlyy.service.BaseService;
|
|
import com.yihu.wlyy.service.BaseService;
|
|
|
import com.yihu.wlyy.service.specialist.SpecialistEvaluateSevice;
|
|
import com.yihu.wlyy.service.specialist.SpecialistEvaluateSevice;
|
|
|
import com.yihu.wlyy.task.PushMsgTask;
|
|
import com.yihu.wlyy.task.PushMsgTask;
|
|
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import com.yihu.wlyy.util.IdCardUtil;
|
|
import com.yihu.wlyy.util.IdCardUtil;
|
|
|
|
|
import com.yihu.wlyy.util.QrcodeUtil;
|
|
|
|
|
import com.yihu.wlyy.util.fastdfs.FastDFSUtil;
|
|
|
import com.yihu.wlyy.util.http.HttpResponse;
|
|
import com.yihu.wlyy.util.http.HttpResponse;
|
|
|
import com.yihu.wlyy.util.http.HttpUtils;
|
|
import com.yihu.wlyy.util.http.HttpUtils;
|
|
|
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
|
|
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
|
|
@ -27,7 +31,10 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.io.InputStream;
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@ -40,6 +47,14 @@ import java.util.Map;
|
|
|
public class RehabilitationManageService extends BaseService {
|
|
public class RehabilitationManageService extends BaseService {
|
|
|
@Value("${specialist.url}")
|
|
@Value("${specialist.url}")
|
|
|
private String specialistUrl;
|
|
private String specialistUrl;
|
|
|
|
|
@Value("${wechat.wechat_base_url}")
|
|
|
|
|
private String wechat_base_url;
|
|
|
|
|
@Value("${wechat.appId}")
|
|
|
|
|
private String appId;
|
|
|
|
|
@Value("${neiwang.enable}")
|
|
|
|
|
private Boolean isneiwang; //如果不是内网项目要转到到内网wlyy在上传
|
|
|
|
|
@Value("${fastDFS.fastdfs_file_url}")
|
|
|
|
|
private String fastdfs_file_url;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
@Autowired
|
|
@Autowired
|
|
@ -58,6 +73,10 @@ public class RehabilitationManageService extends BaseService {
|
|
|
private WeiXinOpenIdUtils weiXinOpenIdUtils;
|
|
private WeiXinOpenIdUtils weiXinOpenIdUtils;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private WeiXinAccessTokenUtils accessTokenUtils;
|
|
private WeiXinAccessTokenUtils accessTokenUtils;
|
|
|
|
|
@Autowired
|
|
|
|
|
protected HttpServletRequest request;
|
|
|
|
|
@Autowired
|
|
|
|
|
private com.yihu.wlyy.util.CommonUtil CommonUtil;
|
|
|
|
|
|
|
|
/************************************************************* start ************************************************************************/
|
|
/************************************************************* start ************************************************************************/
|
|
|
private String findRehabilitationPlanList = "/svr-specialist/findRehabilitationPlanList";//康复管理-康复计划列表
|
|
private String findRehabilitationPlanList = "/svr-specialist/findRehabilitationPlanList";//康复管理-康复计划列表
|
|
@ -75,10 +94,13 @@ public class RehabilitationManageService extends BaseService {
|
|
|
private String serviceDoctorList = "/svr-specialist/serviceDoctorList";//康复管理-医生端居民详情服务医生列表
|
|
private String serviceDoctorList = "/svr-specialist/serviceDoctorList";//康复管理-医生端居民详情服务医生列表
|
|
|
private String appCalendarPlanDetailList = "/svr-specialist/appCalendarPlanDetailList";//康复管理-app端、微信端计划的服务项目列表
|
|
private String appCalendarPlanDetailList = "/svr-specialist/appCalendarPlanDetailList";//康复管理-app端、微信端计划的服务项目列表
|
|
|
private String dailyJob = "/svr-specialist/dailyJob";//每日康复服务通知
|
|
private String dailyJob = "/svr-specialist/dailyJob";//每日康复服务通知
|
|
|
|
|
private String dailyJobReserve = "/svr-specialist/dailyJobReserve";//10天、7天、5天、当天康复服务预约复诊通知
|
|
|
private String saveRehabilitationOperateRecord ="/svr-specialist/saveRehabilitationOperateRecord";//新增operateRecodr
|
|
private String saveRehabilitationOperateRecord ="/svr-specialist/saveRehabilitationOperateRecord";//新增operateRecodr
|
|
|
private String updateNoteAndImageRehabilitationOperate ="/svr-specialist/updateNoteAndImageRehabilitationOperate";//康复计划完成时更新服务完成笔记和图片接口;
|
|
private String updateNoteAndImageRehabilitationOperate ="/svr-specialist/updateNoteAndImageRehabilitationOperate";//康复计划完成时更新服务完成笔记和图片接口;
|
|
|
private String updatePlanDetailStatusById = "/svr-specialist/updatePlanDetailStatusById";//康复管理-更新康复计划服务项目状态
|
|
private String updatePlanDetailStatusById = "/svr-specialist/updatePlanDetailStatusById";//康复管理-更新康复计划服务项目状态
|
|
|
private String planSchedule = "/svr-specialist/planSchedule";//康复管理-计划总进度
|
|
private String planSchedule = "/svr-specialist/planSchedule";//康复管理-计划总进度
|
|
|
|
|
private String planListByPatient = "/svr-specialist/planListByPatient";//康复管理-根据居民获取康复计划
|
|
|
|
|
private String patientCount = "/svr-specialist/patientCount";//康复管理-医生已计划数,已完成计划数(居民数)
|
|
|
/************************************************************* end ************************************************************************/
|
|
/************************************************************* end ************************************************************************/
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -139,17 +161,19 @@ public class RehabilitationManageService extends BaseService {
|
|
|
* @return
|
|
* @return
|
|
|
* @throws Exception
|
|
* @throws Exception
|
|
|
*/
|
|
*/
|
|
|
public JSONObject findRehabilitationPlanDetailList(String doctorCode,String patientCode) throws Exception{
|
|
|
|
|
|
|
public JSONArray findRehabilitationPlanDetailList(String doctorCode,String patientCode) throws Exception{
|
|
|
Map<String, Object> param = new HashedMap();
|
|
Map<String, Object> param = new HashedMap();
|
|
|
param.put("doctorCode", doctorCode);
|
|
param.put("doctorCode", doctorCode);
|
|
|
param.put("patientCode", patientCode);
|
|
param.put("patientCode", patientCode);
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + findRehabilitationPlanDetailList, param);
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + findRehabilitationPlanDetailList, param);
|
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
|
if(result.getInt("status")==200){
|
|
if(result.getInt("status")==200){
|
|
|
JSONObject jsonObject = result.getJSONObject("obj");
|
|
|
|
|
Patient p = patientDao.findByCode(patientCode);
|
|
|
|
|
jsonObject.put("patientPhoto",p.getPhoto());
|
|
|
|
|
return jsonObject;
|
|
|
|
|
|
|
JSONArray jsonArray = result.getJSONArray("obj");
|
|
|
|
|
for(int i=0;i<jsonArray.length();i++){
|
|
|
|
|
Patient p = patientDao.findByCode(patientCode);
|
|
|
|
|
jsonArray.getJSONObject(i).put("patientPhoto",p.getPhoto());
|
|
|
|
|
}
|
|
|
|
|
return jsonArray;
|
|
|
}
|
|
}
|
|
|
throw new Exception("请求微服务失败!");
|
|
throw new Exception("请求微服务失败!");
|
|
|
}
|
|
}
|
|
@ -214,9 +238,10 @@ public class RehabilitationManageService extends BaseService {
|
|
|
* @return
|
|
* @return
|
|
|
* @throws Exception
|
|
* @throws Exception
|
|
|
*/
|
|
*/
|
|
|
public JSONArray serviceItemList(String planDetailIds) throws Exception{
|
|
|
|
|
|
|
public JSONArray serviceItemList(String planDetailIds,String doctorCode) throws Exception{
|
|
|
Map<String, Object> param = new HashedMap();
|
|
Map<String, Object> param = new HashedMap();
|
|
|
param.put("planDetailIds", planDetailIds);
|
|
param.put("planDetailIds", planDetailIds);
|
|
|
|
|
param.put("doctorCode", doctorCode);
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + serviceItemList, param);
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + serviceItemList, param);
|
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
|
JSONArray jsonArray = null;
|
|
JSONArray jsonArray = null;
|
|
@ -244,9 +269,10 @@ public class RehabilitationManageService extends BaseService {
|
|
|
* @return
|
|
* @return
|
|
|
* @throws Exception
|
|
* @throws Exception
|
|
|
*/
|
|
*/
|
|
|
public JSONObject serviceItem(String planDetailId) throws Exception{
|
|
|
|
|
|
|
public JSONObject serviceItem(String planDetailId,String doctorCode) throws Exception{
|
|
|
Map<String, Object> param = new HashedMap();
|
|
Map<String, Object> param = new HashedMap();
|
|
|
param.put("planDetailId", planDetailId);
|
|
param.put("planDetailId", planDetailId);
|
|
|
|
|
param.put("doctorCode", doctorCode);
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + serviceItem, param);
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + serviceItem, param);
|
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
|
if(result.getInt("status")==200){
|
|
if(result.getInt("status")==200){
|
|
@ -315,7 +341,7 @@ public class RehabilitationManageService extends BaseService {
|
|
|
* @throws Exception
|
|
* @throws Exception
|
|
|
*/
|
|
*/
|
|
|
public JSONObject patientRehabilitationDetail(String patientCode) throws Exception{
|
|
public JSONObject patientRehabilitationDetail(String patientCode) throws Exception{
|
|
|
Map<String, Object> param = new HashedMap();
|
|
|
|
|
|
|
|
|
|
List<SignFamily> list = signFamilyDao.findByPatientAndExpensesStatusAndStatus(patientCode,"1",1);
|
|
List<SignFamily> list = signFamilyDao.findByPatientAndExpensesStatusAndStatus(patientCode,"1",1);
|
|
|
String healthDoctor = null;
|
|
String healthDoctor = null;
|
|
|
String healthDoctorName =null;
|
|
String healthDoctorName =null;
|
|
@ -325,6 +351,8 @@ public class RehabilitationManageService extends BaseService {
|
|
|
Integer age = null;
|
|
Integer age = null;
|
|
|
String sex = null;
|
|
String sex = null;
|
|
|
String signHospitalName = null;
|
|
String signHospitalName = null;
|
|
|
|
|
JSONObject json = null;
|
|
|
|
|
Patient patient = patientDao.findByCode(patientCode);
|
|
|
if(list.size()>0){
|
|
if(list.size()>0){
|
|
|
SignFamily signFamily = list.get(0);
|
|
SignFamily signFamily = list.get(0);
|
|
|
healthDoctor = signFamily.getDoctorHealth();
|
|
healthDoctor = signFamily.getDoctorHealth();
|
|
@ -332,37 +360,56 @@ public class RehabilitationManageService extends BaseService {
|
|
|
generalDoctor = signFamily.getDoctor();
|
|
generalDoctor = signFamily.getDoctor();
|
|
|
generalDoctorName = signFamily.getDoctorName();
|
|
generalDoctorName = signFamily.getDoctorName();
|
|
|
patientName = signFamily.getName();
|
|
patientName = signFamily.getName();
|
|
|
age = IdCardUtil.getAgeForIdcard(signFamily.getIdcard());
|
|
|
|
|
sex = IdCardUtil.getSexForIdcard_new(signFamily.getIdcard());
|
|
|
|
|
signHospitalName = signFamily.getHospitalName();
|
|
signHospitalName = signFamily.getHospitalName();
|
|
|
}
|
|
|
|
|
param.put("patientCode", patientCode);
|
|
|
|
|
param.put("healthDoctor", healthDoctor);
|
|
|
|
|
param.put("healthDoctorName", healthDoctorName);
|
|
|
|
|
param.put("generalDoctor", generalDoctor);
|
|
|
|
|
param.put("generalDoctorName", generalDoctorName);
|
|
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + patientRehabilitationDetail, param);
|
|
|
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
|
|
|
if(result.getInt("status")==200){
|
|
|
|
|
JSONObject json = result.getJSONObject("obj").getJSONObject("patientInfo");
|
|
|
|
|
json.put("patientName",patientName);
|
|
|
|
|
json.put("age",age);
|
|
|
|
|
json.put("sex",sex);
|
|
|
|
|
json.put("healthyCondition","康复期");
|
|
|
|
|
json.put("signHospitalName",signHospitalName);
|
|
|
|
|
json.put("photo",patientDao.findByCode(patientCode).getPhoto());
|
|
|
|
|
|
|
|
|
|
JSONArray jsonArray = result.getJSONObject("obj").getJSONArray("serviceDoctorList");
|
|
|
|
|
String doctorCode ="";
|
|
|
|
|
Doctor doctor = null;
|
|
|
|
|
for(int i=0;i<jsonArray.length();i++){
|
|
|
|
|
doctorCode = jsonArray.getJSONObject(i).get("doctorCode")+"";
|
|
|
|
|
doctor = doctorDao.findByCode(doctorCode);
|
|
|
|
|
jsonArray.getJSONObject(i).put("doctorPhoto",doctor!=null?doctor.getPhoto():"");
|
|
|
|
|
|
|
Map<String, Object> param = new HashedMap();
|
|
|
|
|
param.put("patientCode", patientCode);
|
|
|
|
|
param.put("healthDoctor", healthDoctor);
|
|
|
|
|
param.put("healthDoctorName", healthDoctorName);
|
|
|
|
|
param.put("generalDoctor", generalDoctor);
|
|
|
|
|
param.put("generalDoctorName", generalDoctorName);
|
|
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + patientRehabilitationDetail, param);
|
|
|
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
|
|
|
if(result.getInt("status")==200){
|
|
|
|
|
json = result.getJSONObject("obj").getJSONObject("patientInfo");
|
|
|
|
|
json.put("patientName",patientName);
|
|
|
|
|
String healthyConditionSql =" select label_name,label from wlyy_sign_patient_label_info where status=1 and patient='"+patientCode+"' and label_type=8";
|
|
|
|
|
List<Map<String,Object>> healthyConditionList = jdbcTemplate.queryForList(healthyConditionSql);
|
|
|
|
|
String healthyCondition = healthyConditionList.size()>0?healthyConditionList.get(0).get("label_name")+"":"";
|
|
|
|
|
String healthyConditionType = healthyConditionList.size()>0?healthyConditionList.get(0).get("label")+"":"";
|
|
|
|
|
json.put("healthyCondition",healthyCondition);
|
|
|
|
|
json.put("healthyConditionType",healthyConditionType);
|
|
|
|
|
json.put("signHospitalName",signHospitalName);
|
|
|
|
|
age = IdCardUtil.getAgeForIdcard(patient.getIdcard());
|
|
|
|
|
sex = IdCardUtil.getSexForIdcard_new(patient.getIdcard());
|
|
|
|
|
json.put("patientCode", patientCode);
|
|
|
|
|
json.put("patientName", patient.getName());
|
|
|
|
|
json.put("age",age);
|
|
|
|
|
json.put("sex",sex);
|
|
|
|
|
json.put("photo",patient.getPhoto());
|
|
|
|
|
json.put("mobile",patient.getMobile());
|
|
|
|
|
JSONArray jsonArray = result.getJSONObject("obj").getJSONArray("serviceDoctorList");
|
|
|
|
|
String doctorCode ="";
|
|
|
|
|
Doctor doctor = null;
|
|
|
|
|
for(int i=0;i<jsonArray.length();i++){
|
|
|
|
|
doctorCode = jsonArray.getJSONObject(i).get("doctorCode")+"";
|
|
|
|
|
doctor = doctorDao.findByCode(doctorCode);
|
|
|
|
|
jsonArray.getJSONObject(i).put("doctorPhoto",doctor!=null?doctor.getPhoto():"");
|
|
|
|
|
}
|
|
|
|
|
return result.getJSONObject("obj").put("patientInfo",json);
|
|
|
}
|
|
}
|
|
|
return result.getJSONObject("obj").put("patientInfo",json);
|
|
|
|
|
|
|
throw new Exception("请求微服务失败!");
|
|
|
|
|
}else{
|
|
|
|
|
json = new JSONObject();
|
|
|
}
|
|
}
|
|
|
throw new Exception("请求微服务失败!");
|
|
|
|
|
|
|
age = IdCardUtil.getAgeForIdcard(patient.getIdcard());
|
|
|
|
|
sex = IdCardUtil.getSexForIdcard_new(patient.getIdcard());
|
|
|
|
|
json.put("patientCode", patientCode);
|
|
|
|
|
json.put("patientName", patient.getName());
|
|
|
|
|
json.put("age",age);
|
|
|
|
|
json.put("sex",sex);
|
|
|
|
|
json.put("photo",patient.getPhoto());
|
|
|
|
|
json.put("mobile",patient.getMobile());
|
|
|
|
|
return new JSONObject().put("patientInfo",json) ;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -390,8 +437,47 @@ public class RehabilitationManageService extends BaseService {
|
|
|
|
|
|
|
|
public String createServiceQrCode(String planDetailId,String doctorCode) throws Exception{
|
|
public String createServiceQrCode(String planDetailId,String doctorCode) throws Exception{
|
|
|
Map<String, Object> param = new HashedMap();
|
|
Map<String, Object> param = new HashedMap();
|
|
|
|
|
String fileUrl = "";
|
|
|
|
|
String sql ="SELECT service_qr_code FROM wlyy_specialist.wlyy_rehabilitation_plan_detail where id='"+planDetailId+"'";
|
|
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
|
|
if(list!=null && list.size()>0){
|
|
|
|
|
fileUrl = String.valueOf(list.get(0).get("service_qr_code"));
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isEmpty(fileUrl) || "null".equals(fileUrl)){
|
|
|
|
|
//生成二维码图片
|
|
|
|
|
String contentJsonStr="https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appId+"&redirect_uri="+wechat_base_url+"/wx/html/kfgl/html/confirm-service.html"+"?paramStr="+planDetailId+","+doctorCode+"&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
|
|
|
|
|
InputStream ipt = QrcodeUtil.createQrcode(contentJsonStr, 300, "png");
|
|
|
|
|
if (isneiwang) {
|
|
|
|
|
// 圖片列表
|
|
|
|
|
List<String> tempPaths = new ArrayList<String>();
|
|
|
|
|
try {
|
|
|
|
|
ObjectNode imgNode = FastDFSUtil.upload(ipt, "png", "plan_service_qrcode" + System.currentTimeMillis());
|
|
|
|
|
com.alibaba.fastjson.JSONObject json = com.alibaba.fastjson.JSONObject.parseObject(imgNode.toString());
|
|
|
|
|
tempPaths.add(json.getString("fid"));
|
|
|
|
|
String urls = "";
|
|
|
|
|
for (String image : tempPaths) {
|
|
|
|
|
if (urls.length() == 0) {
|
|
|
|
|
urls = image;
|
|
|
|
|
} else {
|
|
|
|
|
urls += "," + image;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fileUrl = fastdfs_file_url + urls;
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
try {
|
|
|
|
|
fileUrl = fastdfs_file_url + CommonUtil.PrescriptionQRCodetoNeiWang(ipt);
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
System.out.println("服务码-----------1"+fileUrl);
|
|
|
param.put("planDetailId", planDetailId);
|
|
param.put("planDetailId", planDetailId);
|
|
|
param.put("doctorCode", doctorCode);
|
|
param.put("doctorCode", doctorCode);
|
|
|
|
|
param.put("imageUrl",fileUrl);
|
|
|
//specialistUrl= "http://localhost:10051";
|
|
//specialistUrl= "http://localhost:10051";
|
|
|
HttpResponse response = HttpUtils.doPost(specialistUrl + createServiceQrCode, param);
|
|
HttpResponse response = HttpUtils.doPost(specialistUrl + createServiceQrCode, param);
|
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
@ -440,7 +526,15 @@ public class RehabilitationManageService extends BaseService {
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + serviceDoctorList, param);
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + serviceDoctorList, param);
|
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
|
if(result.getInt("status")==200){
|
|
if(result.getInt("status")==200){
|
|
|
return result.getJSONArray("obj");
|
|
|
|
|
|
|
JSONArray jsonArray = result.getJSONArray("obj");
|
|
|
|
|
String doctorCode ="";
|
|
|
|
|
Doctor doctor = null;
|
|
|
|
|
for(int i=0;i<jsonArray.length();i++){
|
|
|
|
|
doctorCode = jsonArray.getJSONObject(i).get("doctorCode")+"";
|
|
|
|
|
doctor = doctorDao.findByCode(doctorCode);
|
|
|
|
|
jsonArray.getJSONObject(i).put("doctorPhoto",doctor!=null?doctor.getPhoto():"");
|
|
|
|
|
}
|
|
|
|
|
return jsonArray;
|
|
|
}
|
|
}
|
|
|
throw new Exception("请求微服务失败!");
|
|
throw new Exception("请求微服务失败!");
|
|
|
}
|
|
}
|
|
@ -482,6 +576,18 @@ public class RehabilitationManageService extends BaseService {
|
|
|
throw new Exception("请求微服务失败!");
|
|
throw new Exception("请求微服务失败!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public JSONArray dailyJobReserve(String startTime, String endTime) throws Exception{
|
|
|
|
|
Map<String, Object> param = new HashedMap();
|
|
|
|
|
param.put("startTime", startTime);
|
|
|
|
|
param.put("endTime", endTime);
|
|
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + dailyJobReserve, param);
|
|
|
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
|
|
|
if(result.getInt("status")==200){
|
|
|
|
|
return result.getJSONArray("obj");
|
|
|
|
|
}
|
|
|
|
|
throw new Exception("请求微服务失败!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
public JSONObject saveRehabilitationOperateRecord(String dataJson) throws Exception{
|
|
public JSONObject saveRehabilitationOperateRecord(String dataJson) throws Exception{
|
|
|
Map<String, Object> param = new HashedMap();
|
|
Map<String, Object> param = new HashedMap();
|
|
@ -509,32 +615,44 @@ public class RehabilitationManageService extends BaseService {
|
|
|
param.put("image", image);
|
|
param.put("image", image);
|
|
|
//specialistUrl= "http://localhost:10051";
|
|
//specialistUrl= "http://localhost:10051";
|
|
|
HttpResponse response = HttpUtils.doPost(specialistUrl + updateNoteAndImageRehabilitationOperate, param);
|
|
HttpResponse response = HttpUtils.doPost(specialistUrl + updateNoteAndImageRehabilitationOperate, param);
|
|
|
|
|
System.out.println("返回数据=======1===="+response);
|
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
|
if(result.getString("status").equals("200")){
|
|
|
|
|
JSONArray array = result.getJSONArray("detailModelList");
|
|
|
|
|
JSONObject object = array.getJSONObject(0);
|
|
|
|
|
|
|
System.out.println("返回数据=======2===="+result);
|
|
|
|
|
if(result.getInt("status") == 200){
|
|
|
|
|
JSONObject object = result.getJSONObject("obj");
|
|
|
|
|
//保存wlyy_message
|
|
|
|
|
String hospotal = object.getString("hospital");
|
|
|
|
|
String patient = object.getString("patient_code");
|
|
|
|
|
String doctor = object.getString("doctor_code");
|
|
|
|
|
Message message = new Message();
|
|
|
|
|
message.setType(21);
|
|
|
|
|
message.setSender(patient);
|
|
|
|
|
message.setReceiver(doctor);
|
|
|
|
|
message.setRelationCode(planDetailId);
|
|
|
|
|
specialistEvaluateSevice.sendMessage(message,hospotal,patient,null);
|
|
|
|
|
//发送微信模板消息
|
|
|
int evaluation = object.getInt("evaluation");
|
|
int evaluation = object.getInt("evaluation");
|
|
|
if (evaluation == 1){
|
|
if (evaluation == 1){
|
|
|
String serviceItemId = object.getString("serviceItemId");
|
|
|
|
|
String doctor = object.getString("doctorCode");
|
|
|
|
|
String patient = object.getString("patientCode");
|
|
|
|
|
|
|
String serviceItemId = object.getString("service_item_id");
|
|
|
String title = object.getString("title");
|
|
String title = object.getString("title");
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
|
|
Doctor doctor1 = doctorDao.findByCode(doctor);
|
|
|
String patientName = p.getName();
|
|
String patientName = p.getName();
|
|
|
String openId = p.getOpenid();
|
|
String openId = p.getOpenid();
|
|
|
WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey","fwxmpj");
|
|
|
|
|
|
|
WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_service","fwxmpj");
|
|
|
String first = templateConfig.getFirst();
|
|
String first = templateConfig.getFirst();
|
|
|
first = first.replace("key1",(patientName==null?"":patientName));
|
|
first = first.replace("key1",(patientName==null?"":patientName));
|
|
|
String keyword1 = templateConfig.getKeyword1();
|
|
String keyword1 = templateConfig.getKeyword1();
|
|
|
JSONObject json = new JSONObject();
|
|
JSONObject json = new JSONObject();
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
json.put("keyword1", keyword1);
|
|
|
|
|
json.put("keyword2", sdf.format(new Date()));
|
|
|
|
|
|
|
json.put("keyword1", title);
|
|
|
|
|
json.put("keyword2",doctor1.getName());
|
|
|
|
|
json.put("keyword3", sdf.format(new Date()));
|
|
|
json.put("toUser", p.getCode());
|
|
json.put("toUser", p.getCode());
|
|
|
json.put("represented",p.getCode());//被代理人
|
|
json.put("represented",p.getCode());//被代理人
|
|
|
json.put("remark", "");
|
|
json.put("remark", "");
|
|
|
json.put("doctor",doctor);
|
|
json.put("doctor",doctor);
|
|
|
json.put("serviceItemId", serviceItemId);
|
|
|
|
|
|
|
json.put("planIds", planDetailId);
|
|
|
first = first.replace("key2",title);
|
|
first = first.replace("key2",title);
|
|
|
json.put("first", first);
|
|
json.put("first", first);
|
|
|
if(StringUtils.isNotBlank(p.getOpenid())){
|
|
if(StringUtils.isNotBlank(p.getOpenid())){
|
|
@ -573,15 +691,18 @@ public class RehabilitationManageService extends BaseService {
|
|
|
String doctor = "";
|
|
String doctor = "";
|
|
|
String patient ="";
|
|
String patient ="";
|
|
|
Integer num = null;
|
|
Integer num = null;
|
|
|
|
|
String planDetailIds = null;
|
|
|
for(int i=0;i<jsonArray.length();i++){
|
|
for(int i=0;i<jsonArray.length();i++){
|
|
|
jsonObject = jsonArray.getJSONObject(i);
|
|
jsonObject = jsonArray.getJSONObject(i);
|
|
|
doctor = jsonObject.get("doctor")+"";//执行的医生(接收的医生)
|
|
doctor = jsonObject.get("doctor")+"";//执行的医生(接收的医生)
|
|
|
patient = jsonObject.get("patient")+"";//执行的居民
|
|
patient = jsonObject.get("patient")+"";//执行的居民
|
|
|
num = (Integer)jsonObject.get("num");//需要今日需要执行的项目数
|
|
num = (Integer)jsonObject.get("num");//需要今日需要执行的项目数
|
|
|
|
|
planDetailIds = jsonObject.get("planDetailIds")+"";
|
|
|
Message message1 = new Message();
|
|
Message message1 = new Message();
|
|
|
message1.setSender(null);
|
|
|
|
|
|
|
// message1.setSender(patient);
|
|
|
message1.setType(type);
|
|
message1.setType(type);
|
|
|
message1.setReceiver(doctor);
|
|
message1.setReceiver(doctor);
|
|
|
|
|
message1.setRelationCode(planDetailIds);
|
|
|
specialistEvaluateSevice.sendMessage(message1,null,patient,num);
|
|
specialistEvaluateSevice.sendMessage(message1,null,patient,num);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@ -624,8 +745,64 @@ public class RehabilitationManageService extends BaseService {
|
|
|
json.put("patientPhoto",p.getPhoto());
|
|
json.put("patientPhoto",p.getPhoto());
|
|
|
json.put("patientName",p.getName());
|
|
json.put("patientName",p.getName());
|
|
|
json.put("patientCode",p.getCode());
|
|
json.put("patientCode",p.getCode());
|
|
|
|
|
String healthyConditionSql =" select label_name,label from wlyy_sign_patient_label_info where status=1 and patient='"+p.getCode()+"' and label_type=8";
|
|
|
|
|
List<Map<String,Object>> healthyConditionList = jdbcTemplate.queryForList(healthyConditionSql);
|
|
|
|
|
String healthyCondition = healthyConditionList.size()>0?healthyConditionList.get(0).get("label_name")+"":"";
|
|
|
|
|
String healthyConditionType = healthyConditionList.size()>0?healthyConditionList.get(0).get("label")+"":"";
|
|
|
|
|
json.put("healthyCondition",healthyCondition);
|
|
|
|
|
json.put("healthyConditionType",healthyConditionType);
|
|
|
return json;
|
|
return json;
|
|
|
}
|
|
}
|
|
|
throw new Exception("请求微服务失败!");
|
|
throw new Exception("请求微服务失败!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public JSONArray planListByPatient(String patient) throws Exception {
|
|
|
|
|
Map<String, Object> param = new HashedMap();
|
|
|
|
|
param.put("patientCode", patient);
|
|
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + planListByPatient, param);
|
|
|
|
|
if(StringUtils.isNotBlank(response.getContent())) {
|
|
|
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
|
|
|
if(result.getInt("status")==200){
|
|
|
|
|
return result.getJSONArray("obj");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
throw new Exception("请求微服务失败!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public JSONObject patientCount(String doctorCode) throws Exception{
|
|
|
|
|
Map<String, Object> param = new HashedMap();
|
|
|
|
|
param.put("doctorCode", doctorCode);
|
|
|
|
|
HttpResponse response = HttpUtils.doGet(specialistUrl + patientCount, param);
|
|
|
|
|
JSONObject result = new JSONObject(response.getContent());
|
|
|
|
|
if(result.getInt("status")==200){
|
|
|
|
|
return result.getJSONObject("obj");
|
|
|
|
|
}
|
|
|
|
|
throw new Exception("请求微服务失败!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void dailyJobReserve(Integer num,Integer type) throws Exception{
|
|
|
|
|
Long time = num*24*60*60*1000L;
|
|
|
|
|
String startTime = DateUtil.dateToStrShort(new Date(new Date().getTime()+time))+" "+"00:00:00";
|
|
|
|
|
String endTime = DateUtil.dateToStrShort(new Date(new Date().getTime()+time))+" "+"23:59:59";
|
|
|
|
|
JSONArray jsonArray
|
|
|
|
|
= dailyJobReserve(startTime,endTime);
|
|
|
|
|
JSONObject jsonObject = null;
|
|
|
|
|
String doctor = "";
|
|
|
|
|
String patient ="";
|
|
|
|
|
String hospital ="";
|
|
|
|
|
String planDetailIds = null;
|
|
|
|
|
for(int i=0;i<jsonArray.length();i++){
|
|
|
|
|
jsonObject = jsonArray.getJSONObject(i);
|
|
|
|
|
doctor = jsonObject.get("doctor")+"";//执行的医生(接收的医生)
|
|
|
|
|
patient = jsonObject.get("patient")+"";//执行的居民
|
|
|
|
|
hospital = jsonObject.get("hospital")+"";//医院
|
|
|
|
|
planDetailIds = jsonObject.get("planDetailIds")+"";
|
|
|
|
|
Message message1 = new Message();
|
|
|
|
|
// message1.setSender(patient);
|
|
|
|
|
message1.setType(type);
|
|
|
|
|
message1.setReceiver(doctor);
|
|
|
|
|
message1.setRelationCode(planDetailIds);
|
|
|
|
|
specialistEvaluateSevice.sendMessage(message1,hospital,patient,num);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
}
|
|
}
|