|
@ -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;
|
|
|
}
|
|
@ -248,7 +266,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
* @param prescriptioncode
|
|
|
* @param followup_id
|
|
|
*/
|
|
|
public void importPatientBloodSugarToFollowup(String prescriptioncode, String followup_id,boolean sendIM) throws Exception {
|
|
|
public org.json.JSONArray importPatientBloodSugarToFollowup(String prescriptioncode, String followup_id,boolean sendIM) throws Exception {
|
|
|
Long followupId = Long.valueOf(followup_id);
|
|
|
|
|
|
Followup followup =followUpDao.findOne(followupId);
|
|
@ -271,9 +289,20 @@ 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 = "";
|
|
|
|
|
|
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","您未绑定血糖智能设备,请手动上传体征数据,绑定设备后系统将会自动将您的体征数据上报给医生");
|
|
|
}
|
|
|
|
|
|
if(!list.isEmpty()){
|
|
|
|
|
|
for (Object o: list) {
|
|
@ -306,15 +335,6 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
contentDoctor.put("text", "请提供您最近一次的血糖检测数值及检测时间");
|
|
|
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);
|
|
@ -333,13 +353,29 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
//是否需要发送IM消息
|
|
|
if(sendIM){
|
|
|
//医生发送的消息
|
|
|
contentDoctor.put("text", "居民近30天未上传血糖体征数据,已通知居民上传数据,请耐心等待");
|
|
|
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("type",2);
|
|
|
|
|
|
//患者发送Im消息
|
|
|
ImUtill.sendTopicIM(prescription.getPatient(), prescription.getPatientName(), prescription.getConsult(), "16", contentPatient.toString(), null);
|
|
|
}else{
|
|
|
throw new Exception("未找到30天内的血糖记录!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
resultJson.put(contentDoctor);
|
|
|
|
|
|
return resultJson;
|
|
|
|
|
|
}
|
|
|
|
|
@ -349,7 +385,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
* @param followup_id
|
|
|
* @param sendIM 是否发送IM消息
|
|
|
*/
|
|
|
public void importPatientBloodPressureToFollowup(String prescriptioncode, String followup_id,boolean sendIM) throws Exception {
|
|
|
public org.json.JSONArray importPatientBloodPressureToFollowup(String prescriptioncode, String followup_id,boolean sendIM) throws Exception {
|
|
|
|
|
|
Long followupId = Long.valueOf(followup_id);
|
|
|
|
|
@ -372,6 +408,18 @@ 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()+"'";
|
|
|
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);
|
|
@ -386,16 +434,6 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
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);
|
|
|
|
|
@ -412,14 +450,31 @@ 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("type",1);
|
|
|
|
|
|
//患者发送Im消息
|
|
|
ImUtill.sendTopicIM(prescription.getPatient(), prescription.getPatientName(), prescription.getConsult(), "16", contentPatient.toString(), null);
|
|
|
}else{
|
|
|
throw new Exception("未找到30天内的血压记录!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
resultJson.put(contentDoctor);
|
|
|
|
|
|
return resultJson;
|
|
|
|
|
|
|
|
|
}
|
|
@ -486,7 +541,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());
|
|
|
}
|
|
|
}
|