|  | @ -397,55 +397,7 @@ public class PrescriptionService extends BaseService {
 | 
	
		
			
				|  |  |         return statusObj;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 长处方统计-点击柱状图获取详情
 | 
	
		
			
				|  |  |      * @param interval
 | 
	
		
			
				|  |  |      * @param date
 | 
	
		
			
				|  |  |      * @param disease
 | 
	
		
			
				|  |  |      * @param type
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> getPrescriptionTotalDetailTime(int interval,String date,String disease,String type){
 | 
	
		
			
				|  |  |         //如果是日就是按一天,周就是从本周一到本周日,月就是本月第一天到本月最后一天
 | 
	
		
			
				|  |  |         String startTime = "";
 | 
	
		
			
				|  |  |         String endTime = "";
 | 
	
		
			
				|  |  |         if (interval==1){
 | 
	
		
			
				|  |  |             startTime = date+" 00:00:00";
 | 
	
		
			
				|  |  |             endTime = " 23:59:59";
 | 
	
		
			
				|  |  |         }else if (interval==2){
 | 
	
		
			
				|  |  |             startTime = DateUtil.getMondayOfThisDate(DateUtil.strToDate(date));
 | 
	
		
			
				|  |  |             endTime = DateUtil.getSundayOfThisDate(DateUtil.strToDate(date));
 | 
	
		
			
				|  |  |             startTime += " 00:00:00";
 | 
	
		
			
				|  |  |             endTime += "23:59:59";
 | 
	
		
			
				|  |  |         }else if (interval==3){
 | 
	
		
			
				|  |  |             startTime = DateUtil.getFristDayOfMonthThisDate(DateUtil.strToDate(date+"-01"));
 | 
	
		
			
				|  |  |             endTime = DateUtil.getLastDayOfMonthThisDate(DateUtil.strToDate(date+"-01"));
 | 
	
		
			
				|  |  |             startTime += " 00:00:00";
 | 
	
		
			
				|  |  |             endTime += " 23:59:59";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String sql = "SELECT * FROM wlyy_prescription p ";
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(disease)){
 | 
	
		
			
				|  |  |             sql += " JOIN wlyy_prescription_diagnosis d ON  d.prescription_code = p.code WHERE d.health_problem ='"+disease+"' ";
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             sql +=" WHERE 1=1 ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if ("2".equals(type)){//已完成
 | 
	
		
			
				|  |  |             sql += " AND p.`status` = "+PrescriptionLog.PrescriptionLogStatus.finish.getValue() ;
 | 
	
		
			
				|  |  |         }else if ("3".equals(type)){//居民取消
 | 
	
		
			
				|  |  |             sql += " AND p.`status` = "+PrescriptionLog.PrescriptionLogStatus.patient_canel.getValue() ;
 | 
	
		
			
				|  |  |         }else if ("4".equals(type)){//审核不通过
 | 
	
		
			
				|  |  |             sql += " AND p.`status` = "+PrescriptionLog.PrescriptionLogStatus.no_reviewed.getValue() ;
 | 
	
		
			
				|  |  |         }else if ("5".equals(type)){//进行中
 | 
	
		
			
				|  |  |             sql += " AND  p.`status` < " + PrescriptionLog.PrescriptionLogStatus.finish.getValue() +
 | 
	
		
			
				|  |  |                     " AND p.`status`>= " + PrescriptionLog.PrescriptionLogStatus.revieweding.getValue() ;
 | 
	
		
			
				|  |  |         }else if ("6".equals(type)){//其他原因取消
 | 
	
		
			
				|  |  |             sql += " AND p.`status` <= "+PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue() ;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         sql += " AND p.create_time <= ? " +
 | 
	
		
			
				|  |  |                 " AND p.create_time >= ? ";
 | 
	
		
			
				|  |  |         List<Map<String,Object>> resultList = jdbcTemplate.queryForList(sql,new Object[]{endTime,startTime});
 | 
	
		
			
				|  |  |         return resultList;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 长处方统计--长处方记录筛选
 | 
	
	
		
			
				|  | @ -458,9 +410,11 @@ public class PrescriptionService extends BaseService {
 | 
	
		
			
				|  |  |      * @param endTime
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> getPrescriptionByCondition(String level, String area, String disease, String status, String type, String startTime,String endTime){
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> getPrescriptionByCondition(String level, String area, String disease, String status, String type, String startTime,String endTime,int pageNo, int pageSize){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sql = "SELECT * FROM wlyy_prescription p ";
 | 
	
		
			
				|  |  |         String sql = "SELECT p.code,p.patient_name,p.doctor_name,p.hospital_name,p.dispensary_type,p.status," +
 | 
	
		
			
				|  |  |                 "p.create_time,GROUP_CONCAT(d.health_problem) AS health_problem, GROUP_CONCAT(d.health_problem_name) AS health_problem_name " +
 | 
	
		
			
				|  |  |                 "FROM wlyy_prescription p LEFT JOIN wlyy_prescription_diagnosis d ON p.code = d.prescription_code";
 | 
	
		
			
				|  |  |         //判断疾病
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(disease)){
 | 
	
		
			
				|  |  |             if ("1".equals(disease)){
 | 
	
	
		
			
				|  | @ -468,9 +422,9 @@ public class PrescriptionService extends BaseService {
 | 
	
		
			
				|  |  |             }else if ("2".equals(disease)){
 | 
	
		
			
				|  |  |                 disease = tnb;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             sql += " JOIN wlyy_prescription_diagnosis d ON  d.prescription_code = p.code WHERE d.health_problem ='"+disease+"' ";
 | 
	
		
			
				|  |  |             sql += " WHERE d.health_problem ='"+disease+"' ";
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             sql +=" WHERE 1=1 ";
 | 
	
		
			
				|  |  |             sql +="  WHERE 1=1 ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         //判断状态
 | 
	
		
			
				|  |  |         if ("2".equals(status)){//已完成
 | 
	
	
		
			
				|  | @ -508,14 +462,17 @@ public class PrescriptionService extends BaseService {
 | 
	
		
			
				|  |  |             sql += "AND p.hospital = '"+area+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         List<Map<String,Object>> resultList = new ArrayList<>();
 | 
	
		
			
				|  |  |         int start = (pageNo-1)*pageSize;
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(startTime) && StringUtils.isNotBlank(endTime)){
 | 
	
		
			
				|  |  |             startTime += " 00:00:00";
 | 
	
		
			
				|  |  |             endTime += " 23:59:59";
 | 
	
		
			
				|  |  |             sql += " AND p.create_time <= ? " +
 | 
	
		
			
				|  |  |                     " AND p.create_time >= ? ";
 | 
	
		
			
				|  |  |             resultList = jdbcTemplate.queryForList(sql,new Object[]{endTime,startTime});
 | 
	
		
			
				|  |  |             sql +=" GROUP BY p.code ORDER  BY p.create_time DESC limit ?,?";
 | 
	
		
			
				|  |  |             resultList = jdbcTemplate.queryForList(sql,new Object[]{endTime,startTime,start,pageSize});
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             resultList = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |             sql +=" GROUP BY p.code ORDER  BY p.create_time DESC limit ?,?";
 | 
	
		
			
				|  |  |             resultList = jdbcTemplate.queryForList(sql,new Object[]{start,pageSize});
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return resultList;
 | 
	
		
			
				|  |  |     }
 | 
	
	
		
			
				|  | @ -525,13 +482,17 @@ public class PrescriptionService extends BaseService {
 | 
	
		
			
				|  |  |      * @param keyWord
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> getPrescriptionByKeyWord(String keyWord){
 | 
	
		
			
				|  |  |         String sql = "SELECT * FROM wlyy_prescription p where 1=1";
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> getPrescriptionByKeyWord(String keyWord,int pageNo,int pageSize){
 | 
	
		
			
				|  |  |         String sql = "SELECT p.code,p.patient_name,p.doctor_name,p.hospital_name,p.dispensary_type,p.status," +
 | 
	
		
			
				|  |  |                 "p.create_time,GROUP_CONCAT(d.health_problem) AS health_problem, GROUP_CONCAT(d.health_problem_name) AS health_problem_name " +
 | 
	
		
			
				|  |  |                 "FROM wlyy_prescription p LEFT JOIN wlyy_prescription_diagnosis d ON p.code = d.prescription_code WHERE 1=1 " ;
 | 
	
		
			
				|  |  |         //判断关键字
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(keyWord)){
 | 
	
		
			
				|  |  |             sql += " AND (p.patient_name like '%"+keyWord+"%' or p.doctor_name like '%"+keyWord+"%')";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         List<Map<String,Object>> resultList = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         sql += " GROUP BY p.code ORDER  BY p.create_time DESC limit ?,?";
 | 
	
		
			
				|  |  |         int start = (pageNo-1)*pageSize;
 | 
	
		
			
				|  |  |         List<Map<String,Object>> resultList = jdbcTemplate.queryForList(sql,new Object[]{start,pageSize});
 | 
	
		
			
				|  |  |         return resultList;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 |