|
@ -7600,6 +7600,8 @@ public class StatisticsEsService {
|
|
|
public static String[] calculatePreviousPeriod(String start, String end) {
|
|
|
if (start.length() > 10) {
|
|
|
start = start.substring(0, 10);
|
|
|
}
|
|
|
if (end.length() > 10) {
|
|
|
end = end.substring(0, 10);
|
|
|
}
|
|
|
// 将时间字符串转换为LocalDate对象
|
|
@ -7623,6 +7625,8 @@ public class StatisticsEsService {
|
|
|
public static String[] calculatePreviousYearPeriod(String start, String end) {
|
|
|
if (start.length() > 10) {
|
|
|
start = start.substring(0, 10);
|
|
|
}
|
|
|
if (end.length() > 10) {
|
|
|
end = end.substring(0, 10);
|
|
|
}
|
|
|
// 将时间字符串转换为LocalDate对象
|
|
@ -8582,7 +8586,7 @@ public class StatisticsEsService {
|
|
|
* @param flag
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject getFollowUpHeaderTotal(String startDate,String endDate,Integer flag,String deptCode) {
|
|
|
public JSONObject getFollowUpHeaderTotal(String startDate,String endDate,Integer flag,String deptCode,String isRate) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if(StringUtils.isBlank(startDate)){
|
|
|
if (flag == 1) {
|
|
@ -8694,6 +8698,53 @@ public class StatisticsEsService {
|
|
|
String rate = getTwoRange(Integer.parseInt(followupCompleteTotal),Integer.parseInt(followUpTotal),0);
|
|
|
jsonObject.put("followupCompleteRate",rate);
|
|
|
jsonObject.put("followupTotal",followUpTotal);
|
|
|
|
|
|
if("1".equals(isRate)){
|
|
|
// 计算上一个周期 开始时间period[0] 、结束时间period[1]
|
|
|
String[] period = calculatePreviousPeriod(startDate, endDate);
|
|
|
//计算去年同期时间段 开始时间periodYear[0] 、结束时间periodYear[1]
|
|
|
String[] periodYear = calculatePreviousYearPeriod(startDate, endDate);
|
|
|
|
|
|
//下转次数:
|
|
|
String turnSqlH = "select count(1) as total from wlyy_rehabilitation_patient_info where create_time>='"+period[0]+"' and create_time <='"+period[1]+"' ";
|
|
|
String turnSqlT = "select count(1) as total from wlyy_rehabilitation_patient_info where create_time>='"+periodYear[1]+"' and create_time <='"+periodYear[1]+"' ";
|
|
|
//下转人数:
|
|
|
String turnPersonSqlH = "select count(DISTINCT patient) as total from wlyy_rehabilitation_patient_info where create_time>='"+period[0]+"' and create_time <='"+period[0]+"' ";
|
|
|
String turnPersonSqlT = "select count(DISTINCT patient) as total from wlyy_rehabilitation_patient_info where create_time>='"+periodYear[1]+"' and create_time <='"+periodYear[1]+"' ";
|
|
|
|
|
|
//随访次数
|
|
|
String followupSqlH = "SELECT COUNT(f.id) planNum from wlyy_followup f where f.followup_date >='"+period[0]+"' and f.followup_date <='"+period[0]+"' ";
|
|
|
String followupSqlT = "SELECT COUNT(f.id) planNum from wlyy_followup f where f.followup_date >='"+periodYear[1]+"' and f.followup_date <='"+periodYear[1]+"' ";
|
|
|
if(StringUtils.isNotBlank(deptCode)){
|
|
|
turnSqlH += " and dept = '"+deptCode+"' ";
|
|
|
turnSqlT += " and dept = '"+deptCode+"' ";
|
|
|
turnPersonSqlH += " and dept = '"+deptCode+"' ";
|
|
|
turnPersonSqlT += " and dept = '"+deptCode+"' ";
|
|
|
followupSqlH += "SELECT COUNT(f.id) planNum from wlyy_followup f,base_doctor_hospital h " +
|
|
|
" where f.doctor_code=h.doctor_code and h.del=1 and h.dept_code='"+deptCode+"' " +
|
|
|
" and f.followup_date >='"+period[0]+"' and f.followup_date <='"+period[1]+"' ";
|
|
|
followupSqlT += "SELECT COUNT(f.id) planNum from wlyy_followup f,base_doctor_hospital h " +
|
|
|
" where f.doctor_code=h.doctor_code and h.del=1 and h.dept_code='"+deptCode+"' " +
|
|
|
" and f.followup_date >='"+periodYear[0]+"' and f.followup_date <='"+periodYear[1]+"' ";
|
|
|
}
|
|
|
|
|
|
Integer turnTotalH = jdbcTemplate.queryForObject(turnSqlH,Integer.class);
|
|
|
Integer turnTotalT = jdbcTemplate.queryForObject(turnSqlT,Integer.class);
|
|
|
Integer turnPersonTotalH = jdbcTemplate.queryForObject(turnPersonSqlH,Integer.class);
|
|
|
Integer turnPersonTotalT = jdbcTemplate.queryForObject(turnPersonSqlT,Integer.class);
|
|
|
Integer followUpTotalH = jdbcTemplate.queryForObject(followupSqlH,Integer.class);
|
|
|
Integer followUpTotalT = jdbcTemplate.queryForObject(followupSqlT,Integer.class);
|
|
|
|
|
|
jsonObject.put("turnTotal_hb", getRange((Integer.parseInt(turnTotal)- turnTotalH), turnTotalH, 0));//环比
|
|
|
jsonObject.put("turnTotal_tb", getRange((Integer.parseInt(turnTotal) - turnTotalT), turnTotalT, 0));//同比
|
|
|
|
|
|
jsonObject.put("turnPersonTotal_hb", getRange((Integer.parseInt(turnPersonTotal)- turnPersonTotalH), turnPersonTotalH, 0));//环比
|
|
|
jsonObject.put("turnPersonTotal_tb", getRange((Integer.parseInt(turnPersonTotal) - turnPersonTotalT), turnPersonTotalT, 0));//同比
|
|
|
|
|
|
jsonObject.put("followUpTotal_hb", getRange((Integer.parseInt(followUpTotal)- followUpTotalH), followUpTotalH, 0));//环比
|
|
|
jsonObject.put("followUpTotal_tb", getRange((Integer.parseInt(followUpTotal) - followUpTotalT), followUpTotalT, 0));//同比
|
|
|
}
|
|
|
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|