|
@ -200,6 +200,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
jsonObject1.put("statue","2");//1已填写,2未填写
|
|
|
jsonObject1.put("createtime","");
|
|
|
}
|
|
|
jsonObject1.put("typevalue","1");
|
|
|
result.add(jsonObject1);
|
|
|
|
|
|
JSONObject jsonObject2 = new JSONObject();
|
|
@ -214,6 +215,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
jsonObject2.put("statue","2");//1已填写,2未填写
|
|
|
jsonObject2.put("createtime","");
|
|
|
}
|
|
|
jsonObject2.put("typevalue","2,4");
|
|
|
result.add(jsonObject2);
|
|
|
|
|
|
return result;
|
|
@ -300,9 +302,12 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
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(result.get(0).get("amount") != null){
|
|
|
Double amount = new Double(result.get(0).get("amount").toString());
|
|
|
total = (result.get(0).get("amount") != null ? amount.intValue() : 0);
|
|
|
}
|
|
|
}
|
|
|
if(total != 1 || total != 3){
|
|
|
if(total != 1 && total !=3){
|
|
|
contentDoctor.put("deviceMsg","您未绑定血糖智能设备,请手动上传体征数据,绑定设备后系统将会自动将您的体征数据上报给医生");
|
|
|
}
|
|
|
|
|
@ -364,7 +369,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
|
|
|
FollowupContentESDO followupContentESDO = followUpService.esGetFollowupProjectData(followup_id,"3");
|
|
|
|
|
|
if(followupContentESDO != null){
|
|
|
if(followupContentESDO == null){
|
|
|
followUpService.esSaveFollowupProjectData(followup_id, "3", followupProjectData);
|
|
|
}else{
|
|
|
FollowupContentESDO newfollowupContentESDO = JSON.parseObject(followupProjectData, FollowupContentESDO.class);
|
|
@ -401,6 +406,8 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
contentPatient.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
|
|
|
contentPatient.put("needUpload","false");
|
|
|
contentPatient.put("type",2);
|
|
|
contentPatient.put("healthindexid",obj.getString("healthindexid"));
|
|
|
|
|
|
|
|
|
//患者发送Im消息
|
|
|
ImUtill.sendTopicIM(prescription.getPatient(), prescription.getPatientName(), prescription.getConsult(), "16", contentPatient.toString(), null);
|
|
@ -421,6 +428,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
contentPatient.put("tzMsg", "体征记录:无");
|
|
|
contentPatient.put("tzTime", "检测时间:");
|
|
|
contentPatient.put("tzAlert","温馨提示:居民近30天未上传血糖体征数据,已通知居民上传数据,请耐心等待");
|
|
|
contentPatient.put("patientAlert","温馨提示:您近30天未上传血糖体征数据,您可以");
|
|
|
contentPatient.put("needUpload","true");
|
|
|
contentPatient.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
|
|
|
contentPatient.put("type",2);
|
|
@ -466,7 +474,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
|
|
|
if(devicePatientHealthIndex != null){
|
|
|
org.json.JSONObject json = new org.json.JSONObject();
|
|
|
json.put("id", devicePatientHealthIndex.getId());
|
|
|
json.put("healthindexid", devicePatientHealthIndex.getId());
|
|
|
json.put("patient",devicePatientHealthIndex.getUser());
|
|
|
json.put("value1", devicePatientHealthIndex.getValue1());
|
|
|
json.put("value2", devicePatientHealthIndex.getValue2());
|
|
@ -501,9 +509,12 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
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(result.get(0).get("amount") != null){
|
|
|
Double amount = new Double(result.get(0).get("amount").toString());
|
|
|
total = (result.get(0).get("amount") != null ? amount.intValue() : 0);
|
|
|
}
|
|
|
}
|
|
|
if(total != 2 || total != 3){
|
|
|
if(total != 2 && total !=3 ){
|
|
|
contentDoctor.put("deviceMsg","您未绑定血压智能设备,请手动上传体征数据,绑定设备后系统将会自动将您的体征数据上报给医生");
|
|
|
}
|
|
|
|
|
@ -516,7 +527,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
|
|
|
FollowupContentESDO followupContentESDO = followUpService.esGetFollowupProjectData(followup_id,"2");
|
|
|
|
|
|
if(followupContentESDO != null){
|
|
|
if(followupContentESDO == null){
|
|
|
followUpService.esSaveFollowupProjectData(followup_id, "2", followupProjectData);
|
|
|
}else{
|
|
|
followupContentESDO.setBP_D(jsonObject.getString("value1"));
|
|
@ -544,6 +555,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
contentPatient.put("needUpload","false");
|
|
|
contentPatient.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
|
|
|
contentPatient.put("type",1);
|
|
|
contentPatient.put("healthindexid",jsonObject.get("healthindexid"));
|
|
|
|
|
|
//患者发送Im消息
|
|
|
ImUtill.sendTopicIM(prescription.getPatient(), prescription.getPatientName(), prescription.getConsult(), "16", contentPatient.toString(), null);
|
|
@ -565,6 +577,7 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
contentPatient.put("tzMsg", "体征记录:无");
|
|
|
contentPatient.put("tzTime", "检测时间:");
|
|
|
contentPatient.put("tzAlert","温馨提示:居民近30天未上传血压体征数据,已通知居民上传数据,请耐心等待");
|
|
|
contentPatient.put("patientAlert","温馨提示:您近30天未上传血压体征数据,您可以");
|
|
|
contentPatient.put("needUpload","true");
|
|
|
contentPatient.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
|
|
|
contentPatient.put("type",1);
|
|
@ -615,38 +628,54 @@ public class PrescriptionFollowupContentService extends BaseService {
|
|
|
}else if("2".equals(type)){
|
|
|
//2体征
|
|
|
Map<String, String> datamap2 = new HashMap<>();
|
|
|
|
|
|
List<PrescriptionFollowupContent> list2 = prescriptionFollowupContentDao.findByPrescriptionCodeAndFollowupProject(prescriptioncode,"2");
|
|
|
|
|
|
if(!list2.isEmpty()){
|
|
|
for (PrescriptionFollowupContent prescriptionFollowupContent: list2) {
|
|
|
datamap2.put(prescriptionFollowupContent.getFollowupKey(),prescriptionFollowupContent.getFollowupValue());
|
|
|
if(StringUtils.isNotBlank(prescriptionFollowupContent.getFollowupValue())){
|
|
|
datamap2.put(prescriptionFollowupContent.getFollowupKey(),prescriptionFollowupContent.getFollowupValue());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//近30天血压
|
|
|
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){
|
|
|
|
|
|
org.json.JSONObject jsonObject = jsonArray.getJSONObject(0);
|
|
|
datamap2.put("BP_D",jsonObject.getString("value1"));
|
|
|
datamap2.put("BP_U",jsonObject.getString("value2"));
|
|
|
}
|
|
|
followUpService.esSaveFollowupProjectData(followup_id, "2", JSON.toJSONString(datamap2));
|
|
|
|
|
|
//判断随访中是否已经有体征的相关数据
|
|
|
FollowupContentESDO followupContentESDO = followUpService.esGetFollowupProjectData(followup_id,"2");
|
|
|
if(followupContentESDO == null){
|
|
|
//如果没有,则自动获取近30天的血压
|
|
|
//近30天血压
|
|
|
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){
|
|
|
org.json.JSONObject jsonObject = jsonArray.getJSONObject(0);
|
|
|
datamap2.put("BP_D",jsonObject.getString("value1"));
|
|
|
datamap2.put("BP_U",jsonObject.getString("value2"));
|
|
|
}
|
|
|
}else{
|
|
|
datamap2.put("BP_D",followupContentESDO.getBP_D());
|
|
|
datamap2.put("BP_U",followupContentESDO.getBP_U());
|
|
|
}
|
|
|
//保存随访体征数据
|
|
|
if(!datamap2.isEmpty()){
|
|
|
followUpService.esSaveFollowupProjectData(followup_id, "2", JSON.toJSONString(datamap2));
|
|
|
}
|
|
|
|
|
|
Map<String, String> datamap3 = new HashMap<>();
|
|
|
List<PrescriptionFollowupContent> list3 = prescriptionFollowupContentDao.findByPrescriptionCodeAndFollowupProject(prescriptioncode,"4");
|
|
|
|
|
|
if(!list3.isEmpty()){
|
|
|
for (PrescriptionFollowupContent prescriptionFollowupContent: list3) {
|
|
|
datamap3.put(prescriptionFollowupContent.getFollowupKey(),prescriptionFollowupContent.getFollowupValue());
|
|
|
if(StringUtils.isNotBlank(prescriptionFollowupContent.getFollowupValue())){
|
|
|
datamap3.put(prescriptionFollowupContent.getFollowupKey(),prescriptionFollowupContent.getFollowupValue());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
followUpService.esSaveFollowupProjectData(followup_id, "4", JSON.toJSONString(datamap3));
|
|
|
|
|
|
|
|
|
//保证生活方式
|
|
|
if(!datamap3.isEmpty()){
|
|
|
followUpService.esSaveFollowupProjectData(followup_id, "4", JSON.toJSONString(datamap3));
|
|
|
}
|
|
|
}else{}
|
|
|
|
|
|
}
|