|
@ -1027,6 +1027,185 @@ public class ZysoftService {
|
|
result.put("type",data_type);
|
|
result.put("type",data_type);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}catch (JSONException ex){
|
|
|
|
ex.printStackTrace();
|
|
|
|
error = ex.getMessage();
|
|
|
|
errMsg = ex.getMessage();
|
|
|
|
status = "0";
|
|
|
|
}catch (Exception e){
|
|
|
|
e.printStackTrace();
|
|
|
|
error = e.getMessage();
|
|
|
|
status = "0";
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 根据身份证号查询服务记录指标
|
|
|
|
* @param idcard
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public com.alibaba.fastjson.JSONArray getstatictagbyidcard(String idcard,String start_time,String end_time) {
|
|
|
|
String error = null;
|
|
|
|
String status = "1";
|
|
|
|
String errMsg = null;
|
|
|
|
com.alibaba.fastjson.JSONArray result = new JSONArray();
|
|
|
|
|
|
|
|
try{
|
|
|
|
String name = "";//居民姓名
|
|
|
|
String datatype = "";//1血糖,2血压
|
|
|
|
Long total = new Long("0");
|
|
|
|
String sql = "";//待执行的SQL语句
|
|
|
|
Map<String, Object> totalCountMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isBlank(idcard)){
|
|
|
|
throw new Exception("身份证号不允许为空");
|
|
|
|
}
|
|
|
|
|
|
|
|
if(StringUtils.isBlank(start_time) || StringUtils.isBlank(end_time)){
|
|
|
|
throw new Exception("开始时间和结束时间不能为空");
|
|
|
|
}
|
|
|
|
|
|
|
|
Patient patient = patientDao.findByIdcard(idcard);
|
|
|
|
System.out.println(patient.getCode());
|
|
|
|
if(StringUtils.isNotBlank(patient.getCode())){
|
|
|
|
name = patient.getName();
|
|
|
|
|
|
|
|
}else{
|
|
|
|
throw new Exception(idcard+"-该身份证号找不到居民");
|
|
|
|
}
|
|
|
|
|
|
|
|
//1咨询量
|
|
|
|
com.alibaba.fastjson.JSONObject obj1 = new com.alibaba.fastjson.JSONObject();
|
|
|
|
sql = "select count(1) AS totalCount from wlyy_consult where patient ='"+patient.getCode()+"' and czrq BETWEEN '"+start_time+"' and '"+end_time+"'";
|
|
|
|
totalCountMap = jdbcTemplate.queryForMap(sql);
|
|
|
|
if (totalCountMap.get("totalCount") == null) {
|
|
|
|
totalCountMap.put("totalCount", 0);
|
|
|
|
}
|
|
|
|
total = (Long)totalCountMap.get("totalCount");
|
|
|
|
obj1.put("dataType","1");
|
|
|
|
obj1.put("total",String.valueOf(total));
|
|
|
|
obj1.put("type","0");
|
|
|
|
obj1.put("name",name);
|
|
|
|
obj1.put("idcard",patient.getIdcard());
|
|
|
|
result.add(obj1);
|
|
|
|
|
|
|
|
|
|
|
|
//2健康教育量
|
|
|
|
com.alibaba.fastjson.JSONObject obj2 = new com.alibaba.fastjson.JSONObject();
|
|
|
|
//查询总数sql
|
|
|
|
String countSql = "SELECT COUNT(*) AS count FROM " + esType + " where patientCode= '" + patient.getCode() + "' and userType = 1";
|
|
|
|
Long totalES = elasticsearchUtil.excuteForLong(countSql,esIndex, esType);
|
|
|
|
JSONArray re = new JSONArray();
|
|
|
|
obj2.put("dataType","2");
|
|
|
|
obj2.put("total",totalES);
|
|
|
|
obj2.put("type","0");
|
|
|
|
obj2.put("name",name);
|
|
|
|
obj2.put("idcard",patient.getIdcard());
|
|
|
|
result.add(obj2);
|
|
|
|
|
|
|
|
//3代预约量
|
|
|
|
com.alibaba.fastjson.JSONObject obj3 = new com.alibaba.fastjson.JSONObject();
|
|
|
|
sql = "select count(1) AS totalCount from wlyy_patient_reservation where patient='"+patient.getCode()+"' and doctor is not null and czrq BETWEEN '"+start_time+"' and '"+end_time+"'";
|
|
|
|
|
|
|
|
totalCountMap = jdbcTemplate.queryForMap(sql);
|
|
|
|
if (totalCountMap.get("totalCount") == null) {
|
|
|
|
totalCountMap.put("totalCount", 0);
|
|
|
|
}
|
|
|
|
total = (Long)totalCountMap.get("totalCount");
|
|
|
|
obj3.put("dataType","3");
|
|
|
|
obj3.put("total",String.valueOf(total));
|
|
|
|
obj3.put("type","0");
|
|
|
|
obj3.put("name",name);
|
|
|
|
obj3.put("idcard",patient.getIdcard());
|
|
|
|
result.add(obj3);
|
|
|
|
|
|
|
|
//4长处方续方量
|
|
|
|
com.alibaba.fastjson.JSONObject obj4 = new com.alibaba.fastjson.JSONObject();
|
|
|
|
sql = "select count(1) AS totalCount from wlyy_prescription where patient ='"+patient.getCode()+"' and create_time BETWEEN '"+start_time+"' and '"+end_time+"'";
|
|
|
|
|
|
|
|
totalCountMap = jdbcTemplate.queryForMap(sql);
|
|
|
|
if (totalCountMap.get("totalCount") == null) {
|
|
|
|
totalCountMap.put("totalCount", 0);
|
|
|
|
}
|
|
|
|
total = (Long)totalCountMap.get("totalCount");
|
|
|
|
obj4.put("dataType","4");
|
|
|
|
obj4.put("total",String.valueOf(total));
|
|
|
|
obj4.put("type","0");
|
|
|
|
obj4.put("name",name);
|
|
|
|
obj4.put("idcard",patient.getIdcard());
|
|
|
|
result.add(obj4);
|
|
|
|
|
|
|
|
//5体征测量总数
|
|
|
|
//血糖
|
|
|
|
com.alibaba.fastjson.JSONObject obj51 = new com.alibaba.fastjson.JSONObject();
|
|
|
|
sql = "select count(1) AS totalCount from device.wlyy_patient_health_index where `user` ='"+patient.getCode()+"' and type=1 and record_date BETWEEN '"+start_time+"' and '"+end_time+"'";
|
|
|
|
|
|
|
|
totalCountMap = jdbcTemplate.queryForMap(sql);
|
|
|
|
if (totalCountMap.get("totalCount") == null) {
|
|
|
|
totalCountMap.put("totalCount", 0);
|
|
|
|
}
|
|
|
|
total = (Long)totalCountMap.get("totalCount");
|
|
|
|
obj51.put("dataType","5");
|
|
|
|
obj51.put("total",String.valueOf(total));
|
|
|
|
obj51.put("type","1");//血糖
|
|
|
|
obj51.put("name",name);
|
|
|
|
obj51.put("idcard",patient.getIdcard());
|
|
|
|
result.add(obj51);
|
|
|
|
|
|
|
|
//血压
|
|
|
|
com.alibaba.fastjson.JSONObject obj52 = new com.alibaba.fastjson.JSONObject();
|
|
|
|
sql = "select count(1) AS totalCount from device.wlyy_patient_health_index where `user` ='"+patient.getCode()+"' and type=2 and record_date BETWEEN '"+start_time+"' and '"+end_time+"'";
|
|
|
|
|
|
|
|
totalCountMap = jdbcTemplate.queryForMap(sql);
|
|
|
|
if (totalCountMap.get("totalCount") == null) {
|
|
|
|
totalCountMap.put("totalCount", 0);
|
|
|
|
}
|
|
|
|
total = (Long)totalCountMap.get("totalCount");
|
|
|
|
obj52.put("dataType","5");
|
|
|
|
obj52.put("total",String.valueOf(total));
|
|
|
|
obj52.put("type","2");//血压
|
|
|
|
obj52.put("name",name);
|
|
|
|
obj52.put("idcard",patient.getIdcard());
|
|
|
|
result.add(obj52);
|
|
|
|
|
|
|
|
//6体征异常量
|
|
|
|
//血糖
|
|
|
|
com.alibaba.fastjson.JSONObject obj61 = new com.alibaba.fastjson.JSONObject();
|
|
|
|
sql = "select count(1) AS totalCount from device.wlyy_patient_health_index where `user` ='"+patient.getCode()+"' and type=1 and status = 1 and record_date BETWEEN '"+start_time+"' and '"+end_time+"'";
|
|
|
|
|
|
|
|
totalCountMap = jdbcTemplate.queryForMap(sql);
|
|
|
|
if (totalCountMap.get("totalCount") == null) {
|
|
|
|
totalCountMap.put("totalCount", 0);
|
|
|
|
}
|
|
|
|
total = (Long)totalCountMap.get("totalCount");
|
|
|
|
obj61.put("dataType","6");
|
|
|
|
obj61.put("total",String.valueOf(total));
|
|
|
|
obj61.put("type","1");//血糖
|
|
|
|
obj61.put("name",name);
|
|
|
|
obj61.put("idcard",patient.getIdcard());
|
|
|
|
result.add(obj61);
|
|
|
|
|
|
|
|
//血压
|
|
|
|
com.alibaba.fastjson.JSONObject obj62 = new com.alibaba.fastjson.JSONObject();
|
|
|
|
sql = "select count(1) AS totalCount from device.wlyy_patient_health_index where `user` ='"+patient.getCode()+"' and type=2 and status = 1 and record_date BETWEEN '"+start_time+"' and '"+end_time+"'";
|
|
|
|
|
|
|
|
totalCountMap = jdbcTemplate.queryForMap(sql);
|
|
|
|
if (totalCountMap.get("totalCount") == null) {
|
|
|
|
totalCountMap.put("totalCount", 0);
|
|
|
|
}
|
|
|
|
total = (Long)totalCountMap.get("totalCount");
|
|
|
|
obj62.put("dataType","6");
|
|
|
|
obj62.put("total",String.valueOf(total));
|
|
|
|
obj62.put("type","2");//血压
|
|
|
|
obj62.put("name",name);
|
|
|
|
obj62.put("idcard",patient.getIdcard());
|
|
|
|
result.add(obj62);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}catch (JSONException ex){
|
|
}catch (JSONException ex){
|
|
ex.printStackTrace();
|
|
ex.printStackTrace();
|
|
error = ex.getMessage();
|
|
error = ex.getMessage();
|