소스 검색

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

zd_123 7 년 전
부모
커밋
19ed6c7579

+ 0 - 1
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/save/es/ElastricSearchSave.java

@ -78,7 +78,6 @@ public class ElastricSearchSave {
            for (SaveModel obj : sms) {
                try {
                    JSONObject jo=new JSONObject();
                    obj.setCreateTime(new Date());
                    jo.put("doc",obj);
                    Update index = new Update.Builder(jo.toString()).index(esIndex).type(esType).id(obj.getId()).build();
                    bulk.addAction(index);

+ 0 - 1
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentMysqlToEsQuotaJob.java

@ -112,7 +112,6 @@ public class CurrentMysqlToEsQuotaJob implements Job {
        //初始化统计年份
        this.year = getNowYearByDate();
        timeLevel="2";
        //初始化开始时间
        if ("2".equals(timeLevel)) {
            //按年度到达量

+ 87 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java

@ -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;
    }
}

+ 14 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

@ -1646,4 +1646,18 @@ public class StatisticsController extends BaseController {
            return error(-1, "查询失败");
        }
    }
    @RequestMapping("/getPrescriptionTotalCount")
    @ResponseBody
    public String getPrescriptionTotalCount(@ApiParam(name="startDate", value="开始时间 yyyy-MM-dd") @RequestParam(required = true)String startDate,
                                            @ApiParam(name="endDate", value="开始时间 yyyy-MM-dd") @RequestParam(required = true)String endDate,
                                            @ApiParam(name="adminTeamId", value="团队ID") @RequestParam(required = true)Integer adminTeamId){
        try{
            return write(200, "查询成功", "data", statisticsService.getPrescriptionTotalCount(startDate,endDate,adminTeamId));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
}