Browse Source

代码修改

LAPTOP-KB9HII50\70708 10 months ago
parent
commit
79f022c4d1

+ 51 - 0
business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java

@ -7172,6 +7172,57 @@ public class StatisticsEsService {
        return result;
    }
    /**
     * 全院诊室患者
     */
    public JSONObject orgConsultPatient(String startDate,String endDate){
        JSONObject json = new JSONObject();
        String sql = "SELECT COUNT(if(op.`status`=3,1,null)) status3,COUNT(if(op.`status`=1,1,null)) status2 " +
                ",COUNT(if(op.`status`=0 and op.pay_status=1,1,null)) status1 from  wlyy_outpatient op " +
                "where 1=1 ";
        if(StringUtils.isNotBlank(startDate)){
            sql += " and create_time>='"+startDate+"' ";
        }
        if(StringUtils.isNotBlank(endDate)){
            sql += " and create_time<'"+endDate+"' ";
        }
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list.size()>0){
            Map<String,Object> map = list.get(0);
            json.put("status1",map.get("status1")+"");//候诊中
            json.put("status2",map.get("status2")+"");//就诊中
            json.put("status3",map.get("status3")+"");//已结束
        }else {
            json.put("status1","0");//候诊中
            json.put("status2","0");//就诊中
            json.put("status3","0");//已结束
        }
        return json;
    }
    /**
     * 科室诊室患者
     */
    public List<Map<String,Object>> deptConsultPatient(String startDate,String endDate){
        String sql = "SELECT d.code,d.name,if(t.status1 is null,0,t.status1) status1, " +
                "if(t.status2 is null,0,t.status2) status2,if(t.status3 is null,0,t.status3) status3 " +
                "from dict_hospital_dept d LEFT JOIN ( " +
                "SELECT COUNT(if(op.`status`=3,1,null)) status3,COUNT(if(op.`status`=1,1,null)) status2 " +
                ",COUNT(if(op.`status`=0 and op.pay_status=1,1,null)) status1, op.dept from  wlyy_outpatient op " +
                "where 1=1 ";
        if(StringUtils.isNotBlank(startDate)){
            sql += " and create_time>='"+startDate+"' ";
        }
        if(StringUtils.isNotBlank(endDate)){
            sql += " and create_time<'"+endDate+"' ";
        }
        sql += " GROUP BY op.dept) t on d.code=t.dept " +
                "WHERE d.consult_dept_flag=1 " +
                "ORDER BY t.status3 desc";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    public SaveModel findOneBySaveModelList(String startDate, String endDate, String area, int level, String index, String timeLevel,
                                            String slaveKey1, String slaveKey2, String interval, String lowLevel){

+ 10 - 14
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -4194,9 +4194,8 @@ public class ImService {
     * @return
     */
    @Transactional(readOnly = true)
    public List<Map<String, Object>> findConsultRecordByDoctorNew(String doctor, String id,
                                                                  String type, Integer status,
                                                                  int page, int pagesize,
    public List<Map<String, Object>> findConsultRecordByDoctorNew(String doctor, String id,String type, Integer status,
                                                                  int page, int pagesize,String dept,
                                                                  String title, String start_time, String end_time, String patient) {
        String sql = "";
        sql = "SELECT " +
@ -4268,6 +4267,9 @@ public class ImService {
        if (org.apache.commons.lang.StringUtils.isNotBlank(patient)) {
            sql += " AND (op.consumer='" + patient + "' or op.patient ='" + patient + "')";
        }
        if(!StringUtils.isEmpty(dept)){
            sql += " AND op.dept='" + dept + "' ";
        }
        if (!StringUtils.isEmpty(title)) {
            title = "%" + title + "%";
@ -4417,7 +4419,8 @@ public class ImService {
     *
     * @return
     */
    public Long countConsultRecordByDoctor2(String doctor, String id, String type, Integer status, String title, String start_time, String end_time) {
    public Long countConsultRecordByDoctor2(String doctor, String id, String type, Integer status, String title,
                                            String start_time, String end_time,String dept) {
        String sql = "";
        sql = "SELECT " +
                " COUNT(1) AS \"total\" " +
@ -4438,7 +4441,9 @@ public class ImService {
        if (org.apache.commons.lang.StringUtils.isNotBlank(doctor)) {
            sql += " AND op.doctor='" + doctor + "' ";
        }
        if(!StringUtils.isEmpty(dept)){
            sql += " AND op.dept='" + dept + "' ";
        }
        if (!StringUtils.isEmpty(title)) {
            title = "%" + title + "%";
            sql += " and (op.patient_name like '" + title + "' OR op.doctor_name like '" + title + "' OR op.dept_name like '" + title + "' )";
@ -4450,11 +4455,9 @@ public class ImService {
                } else {
                    sql += " and op.create_time >= to_date('" + start_time + "','YYYY-MM-DD HH24:MI:SS')";
                }
            } else {
                sql += " and op.create_time >= '" + start_time + "'";
            }
        }
        if (!StringUtils.isEmpty(end_time)) {
@ -4464,11 +4467,9 @@ public class ImService {
                } else {
                    sql += " and op.create_time <= to_date('" + end_time + "','YYYY-MM-DD HH24:MI:SS')";
                }
            } else {
                sql += " and op.create_time <= '" + end_time + "'";
            }
        }
        //咨询类型
@ -4555,11 +4556,9 @@ public class ImService {
                } else {
                    sql += " and a.create_time >= to_date('" + start_time + "','YYYY-MM-DD HH24:MI:SS')";
                }
            } else {
                sql += " and a.create_time >= '" + start_time + "'";
            }
        }
        if (!StringUtils.isEmpty(end_time)) {
@ -4569,11 +4568,9 @@ public class ImService {
                } else {
                    sql += " and a.create_time <= to_date('" + end_time + "','YYYY-MM-DD HH24:MI:SS')";
                }
            } else {
                sql += " and a.create_time <= '" + end_time + "'";
            }
        }
        //咨询类型
@ -4599,7 +4596,6 @@ public class ImService {
        }
        sql = sql + "\tORDER BY a.create_time desc ";
        List<Map<String, Object>> mapList = hibenateUtils.createSQLQuery(sql);
        for (Map<String, Object> map : mapList) {
            if (map.get("patientIdcard") != null) {

+ 5 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java

@ -833,6 +833,8 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "title",required = false) String title,
			@ApiParam(name = "patient", value = "患者id")
			@RequestParam(value = "patient",required = false) String patient,
			@ApiParam(name = "dept", value = "科室编码")
			@RequestParam(value = "dept",required = false) String dept,
			@ApiParam(name = "id", value = "咨询ID")
			@RequestParam(value = "id",required = false) String id,
			@ApiParam(name = "type", value = "咨询类型")
@ -849,7 +851,8 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "pagesize",required = false) int pagesize
	)throws Exception{
		try {
			List<Map<String,Object>>  data = imService.findConsultRecordByDoctorNew(doctor, id,type,status, page,pagesize, title,start_time,end_time,patient);
			List<Map<String,Object>>  data = imService.findConsultRecordByDoctorNew(doctor, id,type,status, page,pagesize,
					dept, title,start_time,end_time,patient);
			if (data != null) {
				for(Map<String,Object> consult :data){
@ -869,7 +872,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
				}
			}
			Long total = imService.countConsultRecordByDoctor2(doctor, id,type,status,title,start_time,end_time);
			Long total = imService.countConsultRecordByDoctor2(doctor, id,type,status,title,start_time,end_time,dept);
			JSONObject result = new JSONObject();
			result.put("total",total);

+ 32 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/statistics/EsStatisticsEndpoint.java

@ -1770,6 +1770,7 @@ class EsStatisticsEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "doctor", value = "医生id") @RequestParam(value = "doctor", required = false) String doctor,
            @ApiParam(name = "title", value = "咨询标题关键字") @RequestParam(value = "title", required = false) String title,
            @ApiParam(name = "patient", value = "患者id") @RequestParam(value = "patient", required = false) String patient,
            @ApiParam(name = "dept", value = "科室编码") @RequestParam(value = "dept", required = false) String dept,
            @ApiParam(name = "id", value = "咨询ID") @RequestParam(value = "id", required = false) String id,
            @ApiParam(name = "type", value = "咨询类型") @RequestParam(value = "type", required = true) String type,
            @ApiParam(name = "status", value = "咨询状态:0全部,1候诊中,2就诊中,3结束") @RequestParam(value = "status", required = true) Integer status,
@ -1779,7 +1780,8 @@ class EsStatisticsEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "pagesize", value = "分页大小") @RequestParam(value = "pagesize", required = false) int pagesize
    ) throws Exception {
        try {
            List<Map<String, Object>> data = imService.findConsultRecordByDoctorNew(doctor, id, type, status, page, pagesize, title, start_time, end_time, patient);
            List<Map<String, Object>> data = imService.findConsultRecordByDoctorNew(doctor, id, type, status, page,
                    pagesize,dept, title, start_time, end_time, patient);
            if (data != null) {
                for (Map<String, Object> consult : data) {
@ -1799,7 +1801,7 @@ class EsStatisticsEndpoint extends EnvelopRestEndpoint {
                }
            }
            Long total = imService.countConsultRecordByDoctor2(doctor, id, type, status, title, start_time, end_time);
            Long total = imService.countConsultRecordByDoctor2(doctor, id, type, status, title, start_time, end_time,dept);
            JSONObject result = new JSONObject();
            result.put("total", total);
@ -1810,6 +1812,34 @@ class EsStatisticsEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "orgConsultPatient")
    @ApiOperation(value = "全院诊室患者")
    public ObjEnvelop orgConsultPatient(@ApiParam(name = "startTime", value = "开始时间 YYYY-MM-DD HH:MM:SS")
                                      @RequestParam(value = "startTime", required = false) String startTime,
                                      @ApiParam(name = "endTime", value = "结束时间 YYYY-MM-DD HH:MM:SS")
                                      @RequestParam(value = "endTime", required = false) String endTime) {
        try {
            JSONObject result = statisticsEsService.orgConsultPatient(startTime,endTime);
            return ObjEnvelop.getSuccess("查询成功",result);
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError("查询失败");
        }
    }
    @GetMapping(value = "deptConsultPatient")
    @ApiOperation(value = "科室诊室患者")
    public ListEnvelop deptConsultPatient(@ApiParam(name = "startTime", value = "开始时间 YYYY-MM-DD HH:MM:SS")
                                        @RequestParam(value = "startTime", required = false) String startTime,
                                        @ApiParam(name = "endTime", value = "结束时间 YYYY-MM-DD HH:MM:SS")
                                        @RequestParam(value = "endTime", required = false) String endTime) {
        try {
            List<Map<String,Object>> result = statisticsEsService.deptConsultPatient(startTime,endTime);
            return ListEnvelop.getSuccess("查询成功",result);
        } catch (Exception e) {
            e.printStackTrace();
            return ListEnvelop.getError("查询失败");
        }
    }
    /**
     * 获取i健康的医生信息登录大屏