|
@ -266,7 +266,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
* @param prescriptioncode
|
|
|
* @param followup_id
|
|
|
*/
|
|
|
public org.json.JSONArray importPatientBloodSugarToFollowup(String prescriptioncode, String followup_id,boolean sendIM) throws Exception {
|
|
|
public void importPatientBloodSugarToFollowup(String prescriptioncode, String followup_id,boolean sendIM) throws Exception {
|
|
|
Long followupId = Long.valueOf(followup_id);
|
|
|
|
|
|
Followup followup =followUpDao.findOne(followupId);
|
|
@ -277,9 +277,9 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
|
|
|
Prescription prescription = prescriptionDao.findByCode(prescriptioncode);
|
|
|
|
|
|
String patientCode = prescription.getParentCode();
|
|
|
String patientCode = prescription.getPatient();
|
|
|
|
|
|
String stardate = DateUtil.getNextMonth(new Date(),-30)+" 00:00:00";
|
|
|
String stardate = DateUtil.getNextMonth(new Date(),-1)+" 00:00:00";
|
|
|
String enddate = DateUtil.getStringDateShort()+" 23:59:59";
|
|
|
|
|
|
List<Object> list = healthIndexService.findIndexByPatient2(patientCode, 1, stardate, enddate, 0, 2);
|
|
@ -289,12 +289,11 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
|
|
|
org.json.JSONObject contentDoctor = new org.json.JSONObject();
|
|
|
org.json.JSONObject contentPatient = new org.json.JSONObject();
|
|
|
org.json.JSONArray resultJson = new org.json.JSONArray();
|
|
|
String imBloodSugarValue = "";
|
|
|
String imBloodSugarDate = "";
|
|
|
Date imBloodSugarDate = new Date();
|
|
|
|
|
|
int total = 0;
|
|
|
String sql = "select sum(category_code) amount deviceType FROM wlyy_patient_device WHERE user='"+prescription.getPatient()+"'";
|
|
|
String sql = "select sum(category_code) amount FROM wlyy_patient_device WHERE user='"+prescription.getPatient()+"'";
|
|
|
List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);
|
|
|
if (result != null && result.size() > 0) {
|
|
|
total = (result.get(0).get("amount") != null ? Integer.parseInt(result.get(0).get("amount").toString()) : 0);
|
|
@ -309,22 +308,52 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
|
|
|
JSONObject obj = (JSONObject)o;
|
|
|
|
|
|
imBloodSugarDate = obj.getString("recordDate");
|
|
|
imBloodSugarDate = obj.getDate("recordDate");
|
|
|
|
|
|
int index = Integer.valueOf(obj.getString("value2"));
|
|
|
String value1 = obj.getString("value1");
|
|
|
|
|
|
// 餐后
|
|
|
if (index % 2 == 0) {
|
|
|
if(StringUtils.isNotBlank(value1)){
|
|
|
followupProjectData = "{'BS_FPG':'"+obj.getString("value1")+"'}";
|
|
|
break;
|
|
|
}
|
|
|
} else { //餐前
|
|
|
followupProjectData = "{'NO_BS_FPG':'"+obj.getString("value1")+"'}";
|
|
|
//餐前
|
|
|
if(StringUtils.isNotBlank(obj.getString("value1"))){
|
|
|
followupProjectData = "{'BS_FPG':'"+obj.getString("value1")+"'}";
|
|
|
imBloodSugarValue = obj.getString("value1");
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(obj.getString("value3"))){
|
|
|
followupProjectData = "{'BS_FPG':'"+obj.getString("value3")+"'}";
|
|
|
imBloodSugarValue = obj.getString("value3");
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(obj.getString("value5"))){
|
|
|
followupProjectData = "{'BS_FPG':'"+obj.getString("value5")+"'}";
|
|
|
imBloodSugarValue = obj.getString("value5");
|
|
|
break;
|
|
|
}
|
|
|
//餐后
|
|
|
if(StringUtils.isNotBlank(obj.getString("value2"))){
|
|
|
followupProjectData = "{'NO_BS_FPG':'"+obj.getString("value2")+"'}";
|
|
|
imBloodSugarValue = obj.getString("value2");
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(obj.getString("value4"))){
|
|
|
followupProjectData = "{'NO_BS_FPG':'"+obj.getString("value4")+"'}";
|
|
|
imBloodSugarValue = obj.getString("value4");
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotBlank(obj.getString("value6"))){
|
|
|
followupProjectData = "{'NO_BS_FPG':'"+obj.getString("value6")+"'}";
|
|
|
imBloodSugarValue = obj.getString("value6");
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
//随机血糖
|
|
|
if(StringUtils.isNotBlank(obj.getString("value7"))){
|
|
|
followupProjectData = "{'RANDOM_BLOOD_SUGAR':'"+obj.getString("value7")+"'}";
|
|
|
imBloodSugarValue = obj.getString("value7");
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
followUpService.esSaveFollowupProjectData(followup_id, "3", followupProjectData);
|
|
@ -333,7 +362,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
if(sendIM){
|
|
|
//医生发送的消息
|
|
|
contentDoctor.put("text", "请提供您最近一次的血糖检测数值及检测时间");
|
|
|
contentDoctor.put("needupload",false);
|
|
|
contentDoctor.put("needUpload","false");
|
|
|
contentDoctor.put("type",2);
|
|
|
|
|
|
//医生发送Im消息
|
|
@ -341,9 +370,10 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
|
|
|
//患者发送的消息
|
|
|
contentPatient.put("title", "【本消息为系统提醒】:");
|
|
|
contentPatient.put("tzMsg", "体征记录:血糖"+imBloodSugarValue);
|
|
|
contentPatient.put("tzTime", "检测时间:"+imBloodSugarDate);
|
|
|
contentPatient.put("tzMsg", "体征记录:血糖 "+imBloodSugarValue+"mmol/L");
|
|
|
contentPatient.put("tzTime", "检测时间:"+DateUtil.dateToStr(imBloodSugarDate,"yyyy-MM-dd HH:mm:ss"));
|
|
|
contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以");
|
|
|
contentPatient.put("needUpload","false");
|
|
|
contentPatient.put("type",2);
|
|
|
|
|
|
//患者发送Im消息
|
|
@ -354,7 +384,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
if(sendIM){
|
|
|
//医生发送的消息
|
|
|
contentDoctor.put("text", "请提供您最近一次的血糖检测数值及检测时间");
|
|
|
contentDoctor.put("needupload",true);
|
|
|
contentDoctor.put("needUpload","true");
|
|
|
contentDoctor.put("type",2);
|
|
|
//医生发送Im消息
|
|
|
ImUtill.sendTopicIM(prescription.getDoctor(), prescription.getDoctorName(), prescription.getConsult(), "16", contentDoctor.toString(), null);
|
|
@ -364,6 +394,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
contentPatient.put("tzMsg", "体征记录:无");
|
|
|
contentPatient.put("tzTime", "检测时间:");
|
|
|
contentPatient.put("tzAlert","温馨提示:居民近30天未上传血糖体征数据,已通知居民上传数据,请耐心等待");
|
|
|
contentPatient.put("needUpload","true");
|
|
|
contentPatient.put("type",2);
|
|
|
|
|
|
//患者发送Im消息
|
|
@ -372,10 +403,6 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
throw new Exception("未找到30天内的血糖记录!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
resultJson.put(contentDoctor);
|
|
|
|
|
|
return resultJson;
|
|
|
|
|
|
}
|
|
|
|
|
@ -385,7 +412,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
* @param followup_id
|
|
|
* @param sendIM 是否发送IM消息
|
|
|
*/
|
|
|
public org.json.JSONArray importPatientBloodPressureToFollowup(String prescriptioncode, String followup_id,boolean sendIM) throws Exception {
|
|
|
public void importPatientBloodPressureToFollowup(String prescriptioncode, String followup_id,boolean sendIM) throws Exception {
|
|
|
|
|
|
Long followupId = Long.valueOf(followup_id);
|
|
|
|
|
@ -397,9 +424,9 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
|
|
|
Prescription prescription = prescriptionDao.findByCode(prescriptioncode);
|
|
|
|
|
|
String patientCode = prescription.getParentCode();
|
|
|
String patientCode = prescription.getPatient();
|
|
|
|
|
|
String stardate = DateUtil.getNextMonth(new Date(),-30)+" 00:00:00";
|
|
|
String stardate = DateUtil.getNextMonth(new Date(),-1)+" 00:00:00";
|
|
|
String enddate = DateUtil.getStringDateShort()+" 23:59:59";
|
|
|
org.json.JSONArray jsonArray = healthIndexService.findIndexByPatient(patientCode, 2, stardate, enddate, 0, 2);
|
|
|
|
|
@ -408,10 +435,8 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
org.json.JSONObject contentDoctor = new org.json.JSONObject();
|
|
|
org.json.JSONObject contentPatient = new org.json.JSONObject();
|
|
|
|
|
|
org.json.JSONArray resultJson = new org.json.JSONArray();
|
|
|
|
|
|
int total = 0;
|
|
|
String sql = "select sum(category_code) amount deviceType FROM wlyy_patient_device WHERE user='"+prescription.getPatient()+"'";
|
|
|
String sql = "select sum(category_code) amount FROM wlyy_patient_device WHERE user='"+prescription.getPatient()+"'";
|
|
|
List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);
|
|
|
if (result != null && result.size() > 0) {
|
|
|
total = (result.get(0).get("amount") != null ? Integer.parseInt(result.get(0).get("amount").toString()) : 0);
|
|
@ -424,14 +449,14 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
|
|
|
org.json.JSONObject jsonObject = jsonArray.getJSONObject(0);
|
|
|
|
|
|
followupProjectData = "{'BP_D':'"+jsonObject.getString("value1")+"'BP_U':'"+jsonObject.getString("value2")+"'}";
|
|
|
followupProjectData = "{'BP_D':'"+jsonObject.getString("value1")+"','BP_U':'"+jsonObject.getString("value2")+"'}";
|
|
|
followUpService.esSaveFollowupProjectData(followup_id, "2", followupProjectData);
|
|
|
|
|
|
//是否需要发送IM消息
|
|
|
if(sendIM){
|
|
|
//医生发送的消息
|
|
|
contentDoctor.put("text", "请提供您最近一次的血压检测数值及检测时间");
|
|
|
contentDoctor.put("needUpload",false);
|
|
|
contentDoctor.put("needUpload","false");
|
|
|
contentDoctor.put("type",1);
|
|
|
|
|
|
//医生发送Im消息
|
|
@ -442,6 +467,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
contentPatient.put("tzMsg", "体征记录:血压"+jsonObject.getString("value1")+"/"+jsonObject.getString("value2")+" mmHg");
|
|
|
contentPatient.put("tzTime", "检测时间:"+jsonObject.getString("date"));
|
|
|
contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以");
|
|
|
contentPatient.put("needUpload","false");
|
|
|
contentPatient.put("type",1);
|
|
|
|
|
|
//患者发送Im消息
|
|
@ -453,7 +479,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
|
|
|
//医生发送的消息
|
|
|
contentDoctor.put("text", "请提供您最近一次的血压检测数值及检测时间");
|
|
|
contentDoctor.put("needUpload",true);
|
|
|
contentDoctor.put("needUpload","true");
|
|
|
contentDoctor.put("type",1);
|
|
|
//医生发送Im消息
|
|
|
ImUtill.sendTopicIM(prescription.getDoctor(), prescription.getDoctorName(), prescription.getConsult(), "16", contentDoctor.toString(), null);
|
|
@ -463,6 +489,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
contentPatient.put("tzMsg", "体征记录:无");
|
|
|
contentPatient.put("tzTime", "检测时间:");
|
|
|
contentPatient.put("tzAlert","温馨提示:居民近30天未上传血压体征数据,已通知居民上传数据,请耐心等待");
|
|
|
contentPatient.put("needUpload","true");
|
|
|
contentPatient.put("type",1);
|
|
|
|
|
|
//患者发送Im消息
|
|
@ -471,11 +498,6 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
throw new Exception("未找到30天内的血压记录!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
resultJson.put(contentDoctor);
|
|
|
|
|
|
return resultJson;
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -525,7 +547,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
}
|
|
|
|
|
|
//近30天血压
|
|
|
String stardate = DateUtil.getNextMonth(new Date(),-30)+" 00:00:00";
|
|
|
String stardate = DateUtil.getNextMonth(new Date(),-1)+" 00:00:00";
|
|
|
String enddate = DateUtil.getStringDateShort()+" 23:59:59";
|
|
|
org.json.JSONArray jsonArray = healthIndexService.findIndexByPatient(patientCode, 2, stardate, enddate, 0, 2);
|
|
|
if(jsonArray.length() > 0){
|