|
@ -300,8 +300,10 @@ 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) {
|
|
|
Double amount = new Double(result.get(0).get("amount").toString());
|
|
|
total = (result.get(0).get("amount") != null ? amount.intValue() : 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){
|
|
|
contentDoctor.put("deviceMsg","您未绑定血糖智能设备,请手动上传体征数据,绑定设备后系统将会自动将您的体征数据上报给医生");
|
|
@ -402,6 +404,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);
|
|
@ -467,7 +471,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());
|
|
@ -502,8 +506,10 @@ 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) {
|
|
|
Double amount = new Double(result.get(0).get("amount").toString());
|
|
|
total = (result.get(0).get("amount") != null ? amount.intValue() : 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){
|
|
|
contentDoctor.put("deviceMsg","您未绑定血压智能设备,请手动上传体征数据,绑定设备后系统将会自动将您的体征数据上报给医生");
|
|
@ -546,6 +552,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);
|
|
@ -617,38 +624,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{}
|
|
|
|
|
|
}
|