|
@ -8572,4 +8572,129 @@ public class StatisticsEsService {
|
|
|
System.out.println(JSON.toJSONString(re));
|
|
|
return re;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 诊后随访头部
|
|
|
* @param startDate
|
|
|
* @param endDate
|
|
|
* @param flag
|
|
|
* @param area
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject getFollowUpHeaderTotal(String startDate,String endDate,Integer flag) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if (flag == 1) {
|
|
|
startDate = DateUtil.getFirstMonthDay() + " 00:00:00";
|
|
|
endDate = DateUtil.getLastMonthDay() + " 23:59:59";
|
|
|
} else if (flag == 2) {
|
|
|
startDate = DateUtil.getMonthDate(new Date(), -6) + " 00:00:00";
|
|
|
endDate = DateUtil.getStringDateShort() + " 23:59:59";
|
|
|
} else if (flag == 3) {
|
|
|
startDate = DateUtil.getCurrentYearStartTime() + " 00:00:00";
|
|
|
endDate = DateUtil.getCurrentYearEndTime() + " 23:59:59";
|
|
|
}
|
|
|
//开通详情
|
|
|
String sql = "select dept_name,diagnosis_name from base_disease_hospital where status=1 and create_time>='"+startDate+"' and create_time <='"+endDate+"'";
|
|
|
List<Map<String,Object>> diseaseList = jdbcTemplate.queryForList(sql);
|
|
|
Set<String> deptSet = new HashSet<>();
|
|
|
Set<String> diagnosisSet = new HashSet<>();
|
|
|
for (Map<String,Object> map:diseaseList){
|
|
|
String dept = map.get("dept_name").toString();
|
|
|
String str[] = dept.split(",");
|
|
|
for (int i=0;i<str.length;i++){
|
|
|
deptSet.add(str[i]);
|
|
|
}
|
|
|
String diagnosisName = map.get("diagnosis_name").toString();
|
|
|
String str1[] = diagnosisName.split(",");
|
|
|
for (int i=0;i<str1.length;i++){
|
|
|
diagnosisSet.add(str1[i]);
|
|
|
}
|
|
|
}
|
|
|
jsonObject.put("dept",deptSet);//开通的科室
|
|
|
jsonObject.put("diagnosisName",diagnosisSet);//开通的疾病
|
|
|
//下转次数:
|
|
|
String turnSql = "select count(1) as total from wlyy_rehabilitation_patient_info where create_time>='"+startDate+"' and create_time <='"+endDate+"' ";
|
|
|
String turnTotal = "0";
|
|
|
String shoudongTurnTotal = "0";
|
|
|
String zidongTurnTotal = "0";
|
|
|
Map<String,Object> turnMap = jdbcTemplate.queryForMap(turnSql);
|
|
|
if (turnMap!=null){
|
|
|
if (turnMap.get("total")!=null){
|
|
|
turnTotal = turnMap.get("total").toString();
|
|
|
}
|
|
|
}
|
|
|
String zidongTurnSql = turnSql+" and from_source =2 ";
|
|
|
Map<String,Object> zidongTurnMap = jdbcTemplate.queryForMap(zidongTurnSql);
|
|
|
if (zidongTurnMap!=null){
|
|
|
if (zidongTurnMap.get("total")!=null){
|
|
|
zidongTurnTotal = zidongTurnMap.get("total").toString();
|
|
|
}
|
|
|
}
|
|
|
String shoudongTurnSql = turnSql+ " and from_source=1 ";
|
|
|
Map<String,Object> shoudongTurnMap = jdbcTemplate.queryForMap(shoudongTurnSql);
|
|
|
if (shoudongTurnMap!=null){
|
|
|
if (shoudongTurnMap.get("total")!=null){
|
|
|
shoudongTurnTotal = shoudongTurnMap.get("total").toString();
|
|
|
}
|
|
|
}
|
|
|
jsonObject.put("zidongTurnTotal",zidongTurnTotal);//自动下转
|
|
|
jsonObject.put("shoudongTurnTotal",shoudongTurnTotal);//手动下转
|
|
|
jsonObject.put("turnTotal",turnTotal);//下转总数
|
|
|
|
|
|
//下转人数
|
|
|
String turnPersonTotal = "0";
|
|
|
String turnPersonSql = "select count(DISTINCT patient) as total from wlyy_rehabilitation_patient_info where create_time>='"+startDate+"' and create_time <='"+endDate+"' ";
|
|
|
Map<String,Object> turnPersonMap = jdbcTemplate.queryForMap(turnPersonSql);
|
|
|
if (turnPersonMap!=null){
|
|
|
if (turnPersonMap.get("total")!=null){
|
|
|
turnPersonTotal = turnPersonMap.get("total").toString();
|
|
|
}
|
|
|
}
|
|
|
//下转人数性别
|
|
|
String turnSexSql = "SELECT\n" +
|
|
|
"\tcount(DISTINCT patient) AS total,\n" +
|
|
|
"\tsex\n" +
|
|
|
"FROM\n" +
|
|
|
"\twlyy_rehabilitation_patient_info\n" +
|
|
|
"WHERE\n" +
|
|
|
"\tcreate_time >= '"+startDate+"'\n" +
|
|
|
"AND create_time <= '"+endDate+"'\n" +
|
|
|
"GROUP BY\n" +
|
|
|
"\tsex";
|
|
|
List<Map<String,Object>> sexMapList = jdbcTemplate.queryForList(turnSexSql);
|
|
|
for (Map<String,Object> map:sexMapList){
|
|
|
if (map.get("sex")!=null){
|
|
|
if (map.get("sex").toString().equalsIgnoreCase("1")){
|
|
|
map.put("sexName","男");
|
|
|
}else if (map.get("sex").toString().equalsIgnoreCase("2")){
|
|
|
map.put("sexName","女");
|
|
|
}else {
|
|
|
map.put("sexName","未知");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
jsonObject.put("turnPersonTotal",turnPersonTotal);//下转人数
|
|
|
jsonObject.put("sexMapList",sexMapList);//性别分布
|
|
|
//随访次数
|
|
|
String followUpTotal = "0";//随访总次数
|
|
|
String followupSql = "select COUNT(1) total from wlyy_followup where followup_date >='"+startDate+"' and followup_date <='"+endDate+"'";
|
|
|
Map<String,Object> followupMap = jdbcTemplate.queryForMap(followupSql);
|
|
|
if (followupMap!=null){
|
|
|
if (followupMap.get("total")!=null){
|
|
|
followUpTotal = followupMap.get("total").toString();
|
|
|
}
|
|
|
}
|
|
|
String followupCompleteTotal = "0";
|
|
|
String followupCompleteSql = followupSql + " and status = 1 ";
|
|
|
Map<String,Object> followupCompleteMap = jdbcTemplate.queryForMap(followupCompleteSql);
|
|
|
if (followupCompleteMap!=null){
|
|
|
if (followupCompleteMap.get("total")!=null){
|
|
|
followupCompleteTotal = followupCompleteMap.get("total").toString();
|
|
|
}
|
|
|
}
|
|
|
String rate = getTwoRange(Integer.parseInt(followupCompleteTotal),Integer.parseInt(followUpTotal),0);
|
|
|
jsonObject.put("followupCompleteRate",rate);
|
|
|
jsonObject.put("followupTotal",followUpTotal);
|
|
|
return jsonObject;
|
|
|
}
|
|
|
}
|