|
@ -4,6 +4,7 @@ import com.yihu.wlyy.entity.address.Town;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
|
|
|
import com.yihu.wlyy.entity.organization.Hospital;
|
|
|
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
|
|
|
import com.yihu.wlyy.entity.statistics.PopulationBase;
|
|
|
import com.yihu.wlyy.entity.statistics.WlyyQuotaResult;
|
|
|
import com.yihu.wlyy.repository.address.CityDao;
|
|
@ -18,6 +19,8 @@ import com.yihu.wlyy.util.Constant;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import com.yihu.wlyy.util.MapListUtils;
|
|
|
import com.yihu.wlyy.util.SystemConf;
|
|
|
import io.swagger.models.auth.In;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
import org.slf4j.Logger;
|
|
@ -4865,6 +4868,89 @@ public class StatisticsService extends BaseService {
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
public Map<String,Object> getPrescriptionTotalCount(String startDate, String endDate, Integer adminTeamId){
|
|
|
//格式化时间
|
|
|
startDate = startDate +" 00:00:00";
|
|
|
endDate = endDate +" 23:59:59";
|
|
|
//总数
|
|
|
String totalSql ="SELECT " +
|
|
|
" count(1) total" +
|
|
|
" FROM " +
|
|
|
" wlyy_prescription p " +
|
|
|
" WHERE " +
|
|
|
" p.admin_team_id = ? " +
|
|
|
" AND p.create_time <= ? " +
|
|
|
" AND p.create_time >= ? ";
|
|
|
//进行中
|
|
|
String processingSql ="SELECT " +
|
|
|
" count(1) processingCount " +
|
|
|
" FROM " +
|
|
|
" wlyy_prescription p " +
|
|
|
" WHERE " +
|
|
|
" p.admin_team_id = ? " +
|
|
|
" AND p.`status` < " + PrescriptionLog.PrescriptionLogStatus.finish.getValue() +
|
|
|
" AND p.`status`>= " + PrescriptionLog.PrescriptionLogStatus.revieweding.getValue() +
|
|
|
" AND p.create_time <= ? " +
|
|
|
" AND p.create_time >= ? ";
|
|
|
//已完成,已经取消,审核不通过,其他原因取消
|
|
|
String stateSql = "SELECT " +
|
|
|
" count(1) count" +
|
|
|
" FROM " +
|
|
|
" wlyy_prescription p " +
|
|
|
" WHERE " +
|
|
|
" p.admin_team_id = ? " +
|
|
|
" AND p.`status` = ? " +
|
|
|
" AND p.create_time <= ? " +
|
|
|
" AND p.create_time >= ? ";
|
|
|
Map<String,Object> rs = new HashedMap();
|
|
|
//总数
|
|
|
List<Map<String,Object>> total = jdbcTemplate.queryForList(totalSql,new Object[]{adminTeamId,endDate,startDate});
|
|
|
if(total!=null&&total.size()>0){
|
|
|
rs.put("total",total.get(0).get("total"));
|
|
|
}else{
|
|
|
rs.put("total",0);
|
|
|
}
|
|
|
//进行中
|
|
|
List<Map<String,Object>> processingCount = jdbcTemplate.queryForList(processingSql,new Object[]{adminTeamId,endDate,startDate});
|
|
|
if(total!=null&&total.size()>0){
|
|
|
rs.put("processingCount",processingCount.get(0).get("processingCount"));
|
|
|
}else{
|
|
|
rs.put("processingCount",0);
|
|
|
}
|
|
|
//已完成
|
|
|
List<Map<String,Object>> finishCount = jdbcTemplate.queryForList(stateSql,new Object[]{adminTeamId,PrescriptionLog.PrescriptionLogStatus.finish.getValue(),endDate,startDate});
|
|
|
if(total!=null&&total.size()>0){
|
|
|
rs.put("finishCount",finishCount.get(0).get("count"));
|
|
|
}else{
|
|
|
rs.put("finishCount",0);
|
|
|
}
|
|
|
//已取消
|
|
|
List<Map<String,Object>> patientCancelCount = jdbcTemplate.queryForList(stateSql,new Object[]{adminTeamId,PrescriptionLog.PrescriptionLogStatus.patient_canel.getValue(),endDate,startDate});
|
|
|
if(total!=null&&total.size()>0){
|
|
|
rs.put("patientCancelCount",patientCancelCount.get(0).get("count"));
|
|
|
}else{
|
|
|
rs.put("patientCancelCount",0);
|
|
|
}
|
|
|
//审核不通过
|
|
|
List<Map<String,Object>> noReviewedCount = jdbcTemplate.queryForList(stateSql,new Object[]{adminTeamId,PrescriptionLog.PrescriptionLogStatus.no_reviewed.getValue(),endDate,startDate});
|
|
|
if(total!=null&&total.size()>0){
|
|
|
rs.put("noReviewedCount",noReviewedCount.get(0).get("count"));
|
|
|
}else{
|
|
|
rs.put("noReviewedCount",0);
|
|
|
}
|
|
|
//其他原因取消
|
|
|
List<Map<String,Object>> payOuttimeCount = jdbcTemplate.queryForList(stateSql,new Object[]{adminTeamId,PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue(),endDate,startDate});
|
|
|
if(total!=null&&total.size()>0){
|
|
|
rs.put("payOuttimeCount",payOuttimeCount.get(0).get("count"));
|
|
|
}else{
|
|
|
rs.put("payOuttimeCount",0);
|
|
|
}
|
|
|
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|