|  | @ -1024,12 +1024,12 @@ public class RehabilitationInfoService {
 | 
	
		
			
				|  |  |         String limitSql = " LIMIT " + (page - 1) * pagesize + "," + pagesize;
 | 
	
		
			
				|  |  |         String filterSql = "";
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(idcard)) {
 | 
	
		
			
				|  |  |             filterSql += " and d.idcard='" + idcard + "'";
 | 
	
		
			
				|  |  |             filterSql += " and d.idcard='" + idcard + "' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isBlank(status)) {
 | 
	
		
			
				|  |  |             //看全部数据
 | 
	
		
			
				|  |  |             filterSql += "	(AND d.create_user = '" + doctorId + "'  OR ISNULL(  d.create_user  ) )\n" +
 | 
	
		
			
				|  |  |                     "	AND ( ISNULL( d.type ) OR d.type = 2 ) ORDER BY d.create_time DESC ";
 | 
	
		
			
				|  |  |             filterSql += "	AND (d.create_user = '" + doctorId + "'  OR ISNULL(  d.create_user  ) )\n" +
 | 
	
		
			
				|  |  |                     "	    AND ( ISNULL( d.type ) OR d.type = 2 ) ORDER BY d.create_time DESC ";
 | 
	
		
			
				|  |  |             detailSql += filterSql + limitSql;
 | 
	
		
			
				|  |  |             countSql += filterSql;
 | 
	
		
			
				|  |  |             list = jdbcTemplate.queryForList(detailSql);
 | 
	
	
		
			
				|  | @ -1062,7 +1062,7 @@ public class RehabilitationInfoService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             if ("7".equals(status)) {
 | 
	
		
			
				|  |  |                 //已经分配医生
 | 
	
		
			
				|  |  |                 filterSql += "	AND d.create_user = '" + doctorId + "'  OR ISNULL(  d.create_user  )\n" +
 | 
	
		
			
				|  |  |                 filterSql += "	AND ( d.create_user = '" + doctorId + "'  OR ISNULL(  d.create_user  ) )  \n" +
 | 
	
		
			
				|  |  |                         "	AND ( ISNULL( d.type ) OR d.type = 2 ) and d.status='7' ";
 | 
	
		
			
				|  |  |                 filterSql += " ORDER BY d.create_time DESC ";
 | 
	
		
			
				|  |  |                 detailSql += filterSql + limitSql;
 | 
	
	
		
			
				|  | @ -1244,21 +1244,17 @@ public class RehabilitationInfoService {
 | 
	
		
			
				|  |  |         return map;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * todayTaskCount 今日任务项,等后面在整
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<Map<String, Object>> getPatientRehabilitationByPatientId(String patientId) {
 | 
	
		
			
				|  |  |         String sql = "SELECT DISTINCT \n" +
 | 
	
		
			
				|  |  |                 "	 a.id,a.`name`,a.birthday,a.phone,a.sex,a.mobile,c.age,\n" +
 | 
	
		
			
				|  |  |                 "	 b.plan_doctor_name 'planDoctorName',d. `name` 'diseaseName',c.dept_name 'deptName',\n" +
 | 
	
		
			
				|  |  |                 "	 b.`status` 'planStatus', \n" +
 | 
	
		
			
				|  |  |                 "		(\n" +
 | 
	
		
			
				|  |  |                 "			SELECT count(1) 	FROM wlyy_patient_rehabilitation_plan w \n" +
 | 
	
		
			
				|  |  |                 "			INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id \n" +
 | 
	
		
			
				|  |  |                 "			WHERE		1 = 1 	AND w.patient = a.id \n" +
 | 
	
		
			
				|  |  |                 "		)'itemAllCount',\n" +
 | 
	
		
			
				|  |  |                 "		(\n" +
 | 
	
		
			
				|  |  |                 "			SELECT count(1) 	FROM wlyy_patient_rehabilitation_plan w \n" +
 | 
	
		
			
				|  |  |                 "			INNER JOIN wlyy_rehabilitation_plan_detail q ON w.id = q.plan_id \n" +
 | 
	
		
			
				|  |  |                 "			WHERE		1 = 1 	AND q.`status`='1'		AND w.patient = a.id \n" +
 | 
	
		
			
				|  |  |                 "		)'finishCount'\n" +
 | 
	
		
			
				|  |  |                 "	 b.`status` 'planStatus', c.hospital_name 'hospitalName',\n" +
 | 
	
		
			
				|  |  |                 "	 (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q WHERE	1 = 1 AND q.plan_id = b.id )'itemAllCount',\n" +
 | 
	
		
			
				|  |  |                 "	 (SELECT count(1) FROM wlyy_rehabilitation_plan_detail q WHERE	1 = 1 AND q.`status`='1' AND q.plan_id = b.id )'finishCount',\n" +
 | 
	
		
			
				|  |  |                 "	 0 'todayTaskCount'\n" +
 | 
	
		
			
				|  |  |                 "FROM\n" +
 | 
	
		
			
				|  |  |                 "	base_patient a\n" +
 | 
	
		
			
				|  |  |                 "	INNER JOIN wlyy_patient_rehabilitation_plan b ON a.id = b.patient\n" +
 | 
	
	
		
			
				|  | @ -1266,11 +1262,41 @@ public class RehabilitationInfoService {
 | 
	
		
			
				|  |  |                 "	INNER JOIN base_disease_hospital d ON  d.id=b.disease\n" +
 | 
	
		
			
				|  |  |                 "WHERE\n" +
 | 
	
		
			
				|  |  |                 "	1 = 1 \n" +
 | 
	
		
			
				|  |  |                 "	AND a.del = '1'\n";
 | 
	
		
			
				|  |  |                 "	AND a.del = '1' ";
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(patientId)) {
 | 
	
		
			
				|  |  |             sql += "	AND a.id='" + patientId + "' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         return list;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public List<Map<String, Object>> getRehabilitationPatientCountNew(String doctorId) {
 | 
	
		
			
				|  |  |         String sql = "SELECT\n" +
 | 
	
		
			
				|  |  |                 "	CASE \n" +
 | 
	
		
			
				|  |  |                 "		WHEN d.`status`='0' THEN '未下转'\n" +
 | 
	
		
			
				|  |  |                 "		WHEN d.`status`='1' THEN '待分配'\n" +
 | 
	
		
			
				|  |  |                 "		WHEN d.`status`='2' THEN '创建计划过程失败'\n" +
 | 
	
		
			
				|  |  |                 "		WHEN d.`status`='3' THEN '患者无住院病历信息'\n" +
 | 
	
		
			
				|  |  |                 "		WHEN d.`status`='5' THEN '同步居民失败'\n" +
 | 
	
		
			
				|  |  |                 "		WHEN d.`status`='7' THEN '已管理'\n" +
 | 
	
		
			
				|  |  |                 "  END 'statusName',\n" +
 | 
	
		
			
				|  |  |                 "  d.`status`,count(1) 'count' \n" +
 | 
	
		
			
				|  |  |                 "FROM\n" +
 | 
	
		
			
				|  |  |                 "	base_patient p\n" +
 | 
	
		
			
				|  |  |                 "	INNER JOIN wlyy_rehabilitation_patient_info d ON p.id = d.patient\n" +
 | 
	
		
			
				|  |  |                 "	LEFT JOIN wlyy_patient_rehabilitation_plan q ON d.`code` = q.patient_info_code \n" +
 | 
	
		
			
				|  |  |                 "WHERE\n" +
 | 
	
		
			
				|  |  |                 "	1 = 1 \n" +
 | 
	
		
			
				|  |  |                 " 	AND ( d.create_user = '" + doctorId + "'  OR q.plan_doctor='" + doctorId + "' OR ISNULL( d.create_user ) ) \n" +
 | 
	
		
			
				|  |  |                 "	AND ( ISNULL( d.type ) OR d.type = 2 )\n" +
 | 
	
		
			
				|  |  |                 "	GROUP BY d.`status`";
 | 
	
		
			
				|  |  |         List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         return list;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public List<Map<String, Object>> getPatientPlanItem(String patientId, String planId, String startTime, String endTime, String doctorId, String type) {
 | 
	
		
			
				|  |  |         String sql = " ";
 | 
	
		
			
				|  |  |         return null;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |