|
@ -91,6 +91,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
JSONArray objects = JSON.parseArray(followupProjectData);
|
|
|
|
|
|
if(objects!= null & objects.size() >0){
|
|
|
boolean isSendTZSHMsg = false;//是否已发送过体征和生活方式消息
|
|
|
for (int i = 0; i < objects.size(); i++) {
|
|
|
List<PrescriptionFollowupContent> savedatas = new ArrayList<>();
|
|
|
JSONObject jsonObject = objects.getJSONObject(i);
|
|
@ -107,6 +108,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
prescriptionFollowupContent.setFollowupKey(key);
|
|
|
prescriptionFollowupContent.setFollowupValue(value);
|
|
|
prescriptionFollowupContent.setPatientCode(patientCode);
|
|
|
prescriptionFollowupContent.setCreateTime(new Date());
|
|
|
savedatas.add(prescriptionFollowupContent);
|
|
|
});
|
|
|
}
|
|
@ -120,12 +122,19 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
content.put("title", "【本消息为系统提醒】:");
|
|
|
if("1".equals(followupProject)){
|
|
|
content.put("text", "居民已填写《身份异常症状问卷》");
|
|
|
content.put("msgType", 1);
|
|
|
}else{
|
|
|
if(isSendTZSHMsg){//判断是否已发送过,避免重复发送
|
|
|
continue;
|
|
|
}
|
|
|
content.put("text", "居民已填写《体征及生活方式调查问卷》");
|
|
|
isSendTZSHMsg = true;
|
|
|
content.put("msgType", 2);
|
|
|
}
|
|
|
content.put("sysMsg","填写完成并提交后,医生将可以查看您的问卷内容");
|
|
|
Prescription p = prescriptionDao.findByCode(prescriptioncode);
|
|
|
ImUtill.sendTopicIM(p.getDoctor(), p.getDoctorName(), p.getConsult(), "17", content.toString(), null);
|
|
|
// System.out.println(content.toString());
|
|
|
ImUtill.sendTopicIM(p.getPatient(), p.getPatientName(), p.getConsult(), "17", content.toString(), null);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@ -149,7 +158,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
for (PrescriptionFollowupContent prescriptionFollowupContent: list) {
|
|
|
|
|
|
if("1".equals(prescriptionFollowupContent.getFollowupProject())){
|
|
|
if(prescriptionFollowupContent1 != null){
|
|
|
if(prescriptionFollowupContent1 == null){
|
|
|
prescriptionFollowupContent1 = prescriptionFollowupContent;
|
|
|
}else{
|
|
|
continue;
|
|
@ -157,7 +166,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
}
|
|
|
|
|
|
if("2".equals(prescriptionFollowupContent.getFollowupProject())){
|
|
|
if(prescriptionFollowupContent2 != null){
|
|
|
if(prescriptionFollowupContent2 == null){
|
|
|
prescriptionFollowupContent2 = prescriptionFollowupContent;
|
|
|
}else{
|
|
|
continue;
|
|
@ -165,7 +174,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
}
|
|
|
|
|
|
if("4".equals(prescriptionFollowupContent.getFollowupProject())){
|
|
|
if(prescriptionFollowupContent2 != null){
|
|
|
if(prescriptionFollowupContent2 == null){
|
|
|
prescriptionFollowupContent2 = prescriptionFollowupContent;
|
|
|
}else{
|
|
|
continue;
|
|
@ -174,24 +183,33 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
}
|
|
|
|
|
|
JSONArray result = new JSONArray();
|
|
|
|
|
|
JSONObject jsonObject1 = new JSONObject();
|
|
|
if(prescriptionFollowupContent1 != null){
|
|
|
JSONObject jsonObject1 = new JSONObject();
|
|
|
jsonObject1.put("type","1");
|
|
|
jsonObject1.put("name","身份异常症状问卷");
|
|
|
jsonObject1.put("statue","1");//1已填写,2未填写
|
|
|
jsonObject1.put("createtime",prescriptionFollowupContent1.getCreateTime());
|
|
|
result.add(jsonObject1);
|
|
|
jsonObject1.put("createtime",DateUtil.dateToStrLong(prescriptionFollowupContent1.getCreateTime()));
|
|
|
}else{
|
|
|
jsonObject1.put("type","1");
|
|
|
jsonObject1.put("name","身份异常症状问卷");
|
|
|
jsonObject1.put("statue","2");//1已填写,2未填写
|
|
|
jsonObject1.put("createtime","");
|
|
|
}
|
|
|
result.add(jsonObject1);
|
|
|
|
|
|
JSONObject jsonObject2 = new JSONObject();
|
|
|
if(prescriptionFollowupContent2 != null){
|
|
|
JSONObject jsonObject2 = new JSONObject();
|
|
|
jsonObject2.put("type","2");
|
|
|
jsonObject2.put("name","体征及生活方式调查问卷");
|
|
|
jsonObject2.put("statue","1");//1已填写,2未填写
|
|
|
jsonObject2.put("createtime",prescriptionFollowupContent1.getCreateTime());
|
|
|
result.add(jsonObject2);
|
|
|
jsonObject2.put("createtime",DateUtil.dateToStrLong(prescriptionFollowupContent2.getCreateTime()));
|
|
|
}else{
|
|
|
jsonObject2.put("type","2");
|
|
|
jsonObject2.put("name","体征及生活方式调查问卷");
|
|
|
jsonObject2.put("statue","2");//1已填写,2未填写
|
|
|
jsonObject2.put("createtime","");
|
|
|
}
|
|
|
result.add(jsonObject2);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
@ -259,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);
|
|
@ -272,7 +290,17 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
org.json.JSONObject contentDoctor = new org.json.JSONObject();
|
|
|
org.json.JSONObject contentPatient = new org.json.JSONObject();
|
|
|
String imBloodSugarValue = "";
|
|
|
String imBloodSugarDate = "";
|
|
|
Date imBloodSugarDate = new Date();
|
|
|
|
|
|
int total = 0;
|
|
|
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);
|
|
|
}
|
|
|
if(total != 1 || total != 3){
|
|
|
contentDoctor.put("deviceMsg","您未绑定血糖智能设备,请手动上传体征数据,绑定设备后系统将会自动将您的体征数据上报给医生");
|
|
|
}
|
|
|
|
|
|
if(!list.isEmpty()){
|
|
|
|
|
@ -280,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);
|
|
@ -304,26 +362,18 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
if(sendIM){
|
|
|
//医生发送的消息
|
|
|
contentDoctor.put("text", "请提供您最近一次的血糖检测数值及检测时间");
|
|
|
contentDoctor.put("needupload",false);
|
|
|
contentDoctor.put("needUpload","false");
|
|
|
contentDoctor.put("type",2);
|
|
|
int total = 0;
|
|
|
String sql = "select sum(category_code) amount deviceType 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);
|
|
|
}
|
|
|
if(total != 1 || total != 3){
|
|
|
contentDoctor.put("deviceMsg","您未绑定血糖智能设备,请手动上传体征数据,绑定设备后系统将会自动将您的体征数据上报给医生");
|
|
|
}
|
|
|
|
|
|
//医生发送Im消息
|
|
|
ImUtill.sendTopicIM(prescription.getDoctor(), prescription.getDoctorName(), prescription.getConsult(), "16", contentDoctor.toString(), null);
|
|
|
|
|
|
//患者发送的消息
|
|
|
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消息
|
|
@ -333,9 +383,22 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
//是否需要发送IM消息
|
|
|
if(sendIM){
|
|
|
//医生发送的消息
|
|
|
contentDoctor.put("text", "居民近30天未上传血糖体征数据,已通知居民上传数据,请耐心等待");
|
|
|
contentDoctor.put("needupload",true);
|
|
|
contentDoctor.put("text", "请提供您最近一次的血糖检测数值及检测时间");
|
|
|
contentDoctor.put("needUpload","true");
|
|
|
contentDoctor.put("type",2);
|
|
|
//医生发送Im消息
|
|
|
ImUtill.sendTopicIM(prescription.getDoctor(), prescription.getDoctorName(), prescription.getConsult(), "16", contentDoctor.toString(), null);
|
|
|
|
|
|
//患者发送的消息
|
|
|
contentPatient.put("title", "【本消息为系统提醒】:");
|
|
|
contentPatient.put("tzMsg", "体征记录:无");
|
|
|
contentPatient.put("tzTime", "检测时间:");
|
|
|
contentPatient.put("tzAlert","温馨提示:居民近30天未上传血糖体征数据,已通知居民上传数据,请耐心等待");
|
|
|
contentPatient.put("needUpload","true");
|
|
|
contentPatient.put("type",2);
|
|
|
|
|
|
//患者发送Im消息
|
|
|
ImUtill.sendTopicIM(prescription.getPatient(), prescription.getPatientName(), prescription.getConsult(), "16", contentPatient.toString(), null);
|
|
|
}else{
|
|
|
throw new Exception("未找到30天内的血糖记录!");
|
|
|
}
|
|
@ -361,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);
|
|
|
|
|
@ -372,30 +435,30 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
org.json.JSONObject contentDoctor = new org.json.JSONObject();
|
|
|
org.json.JSONObject contentPatient = new org.json.JSONObject();
|
|
|
|
|
|
int total = 0;
|
|
|
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);
|
|
|
}
|
|
|
if(total != 2 || total != 3){
|
|
|
contentDoctor.put("deviceMsg","您未绑定血压智能设备,请手动上传体征数据,绑定设备后系统将会自动将您的体征数据上报给医生");
|
|
|
}
|
|
|
|
|
|
if(jsonArray.length() > 0){
|
|
|
|
|
|
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);
|
|
|
|
|
|
int total = 0;
|
|
|
String sql = "select sum(category_code) amount deviceType 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);
|
|
|
}
|
|
|
if(total != 2 || total != 3){
|
|
|
contentDoctor.put("deviceMsg","您未绑定血压智能设备,请手动上传体征数据,绑定设备后系统将会自动将您的体征数据上报给医生");
|
|
|
}
|
|
|
|
|
|
//医生发送Im消息
|
|
|
ImUtill.sendTopicIM(prescription.getDoctor(), prescription.getDoctorName(), prescription.getConsult(), "16", contentDoctor.toString(), null);
|
|
|
|
|
@ -404,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消息
|
|
@ -412,15 +476,28 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
}else{
|
|
|
//是否需要发送IM消息
|
|
|
if(sendIM){
|
|
|
|
|
|
//医生发送的消息
|
|
|
contentDoctor.put("text", "居民近30天未上传血压体征数据,已通知居民上传数据,请耐心等待");
|
|
|
contentDoctor.put("needupload",true);
|
|
|
contentDoctor.put("text", "请提供您最近一次的血压检测数值及检测时间");
|
|
|
contentDoctor.put("needUpload","true");
|
|
|
contentDoctor.put("type",1);
|
|
|
//医生发送Im消息
|
|
|
ImUtill.sendTopicIM(prescription.getDoctor(), prescription.getDoctorName(), prescription.getConsult(), "16", contentDoctor.toString(), null);
|
|
|
|
|
|
//患者发送Im消息
|
|
|
contentPatient.put("title", "【本消息为系统提醒】:");
|
|
|
contentPatient.put("tzMsg", "体征记录:无");
|
|
|
contentPatient.put("tzTime", "检测时间:");
|
|
|
contentPatient.put("tzAlert","温馨提示:居民近30天未上传血压体征数据,已通知居民上传数据,请耐心等待");
|
|
|
contentPatient.put("needUpload","true");
|
|
|
contentPatient.put("type",1);
|
|
|
|
|
|
//患者发送Im消息
|
|
|
ImUtill.sendTopicIM(prescription.getPatient(), prescription.getPatientName(), prescription.getConsult(), "16", contentPatient.toString(), null);
|
|
|
}else{
|
|
|
throw new Exception("未找到30天内的血压记录!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@ -470,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){
|
|
@ -486,7 +563,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
List<PrescriptionFollowupContent> list3 = prescriptionFollowupContentDao.findByPrescriptionCodeAndFollowupProject(prescriptioncode,"4");
|
|
|
|
|
|
if(!list3.isEmpty()){
|
|
|
for (PrescriptionFollowupContent prescriptionFollowupContent: list2) {
|
|
|
for (PrescriptionFollowupContent prescriptionFollowupContent: list3) {
|
|
|
datamap3.put(prescriptionFollowupContent.getFollowupKey(),prescriptionFollowupContent.getFollowupValue());
|
|
|
}
|
|
|
}
|