|  | @ -7,6 +7,7 @@ import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.im.ConsultTeamDo;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.org.BaseOrgDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
 | 
	
	
		
			
				|  | @ -38,7 +39,6 @@ import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.hospital.doctor.WlyyDoctorWorkTimeVO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.hospital.prescription.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.web.MixEnvelop;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.base.BaseRequestMapping;
 | 
	
		
			
				|  |  | import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.common.IdCardUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.date.DateUtil;
 | 
	
	
		
			
				|  | @ -118,6 +118,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |     private WlyyDoctorClinicRoomDao wlyyDoctorClinicRoomDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BaseDoctorHospitalDao baseDoctorHospitalDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Value("${demo.flag}")
 | 
	
	
		
			
				|  | @ -1601,6 +1602,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             rs.put("outpatientType",doctorDO.getOutpatientType());
 | 
	
		
			
				|  |  |             rs.put("expertise",doctorDO.getExpertise());
 | 
	
		
			
				|  |  |             rs.put("introduce",doctorDO.getIntroduce());
 | 
	
		
			
				|  |  |             rs.put("consultStatus",doctorDO.getConsultStatus());// 咨询在线状态
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //机构科室信息
 | 
	
		
			
				|  |  |             List<BaseDoctorHospitalDO> hospitalDOs =  baseDoctorHospitalDao.findByDoctorCode(doctorDO.getId());
 | 
	
	
		
			
				|  | @ -1608,9 +1610,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                rs.put("hospital",hospitalDOs.get(0));
 | 
	
		
			
				|  |  |                BaseOrgDO org = baseOrgDao.findByCode(hospitalDOs.get(0).getOrgCode());
 | 
	
		
			
				|  |  |                rs.put("winNo",org.getWinNo());
 | 
	
		
			
				|  |  |                rs.put("deptName",hospitalDOs.get(0).getDeptName());
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                rs.put("hospital",null);
 | 
	
		
			
				|  |  |                rs.put("winNo",null);
 | 
	
		
			
				|  |  |                rs.put("deptName",null);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -1649,6 +1653,69 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(doctor);
 | 
	
		
			
				|  |  |                 rs.put("workTime",times);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |             //查询医生各项评价平均分
 | 
	
		
			
				|  |  |             String sqlscore = "SELECT " +
 | 
	
		
			
				|  |  |                     "AVG(a.score) AS score," +
 | 
	
		
			
				|  |  |                     "a.score_type AS score_type " +
 | 
	
		
			
				|  |  |                     "FROM base_evaluate a,base_evaluate_score b " +
 | 
	
		
			
				|  |  |                     "WHERE " +
 | 
	
		
			
				|  |  |                     "a.relation_code=b.id " +
 | 
	
		
			
				|  |  |                     "AND b.doctor='"+doctor+"' " +
 | 
	
		
			
				|  |  |                     "GROUP BY a.score_type";
 | 
	
		
			
				|  |  |             List<Map<String,Object>> listscore = jdbcTemplate.queryForList(sqlscore);
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |             if(listscore!=null&&listscore.size()>0){
 | 
	
		
			
				|  |  |                 rs.put("scoreDoctor",listscore);
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 rs.put("scoreDoctor",null);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |             //查询评价明细
 | 
	
		
			
				|  |  |             String sqlScoreList = "SELECT " +
 | 
	
		
			
				|  |  |                     "a.score as score," +
 | 
	
		
			
				|  |  |                     "a.score_type as score_type," +
 | 
	
		
			
				|  |  |                     "a.content as content," +
 | 
	
		
			
				|  |  |                     "b.create_time as create_time," +
 | 
	
		
			
				|  |  |                     "c.type as type," +
 | 
	
		
			
				|  |  |                     "c.name as patientname," +
 | 
	
		
			
				|  |  |                     "b.id as id," +
 | 
	
		
			
				|  |  |                     "c.photo as patientphoto," +
 | 
	
		
			
				|  |  |                     "b.type as niming " +
 | 
	
		
			
				|  |  |                     "FROM " +
 | 
	
		
			
				|  |  |                     "base_evaluate a " +
 | 
	
		
			
				|  |  |                     "LEFT JOIN base_evaluate_score b ON b.id=a.relation_code " +
 | 
	
		
			
				|  |  |                     "LEFT JOIN wlyy_consult_team c ON c.consult=b.relation_code AND c.doctor='"+doctor+"' " +
 | 
	
		
			
				|  |  |                     "WHERE a.relation_code=b.id AND b.doctor='"+doctor+"' ";
 | 
	
		
			
				|  |  |             List<Map<String,Object>> scoreList = jdbcTemplate.queryForList(sqlScoreList);
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |             if(scoreList!=null&&scoreList.size()>0){
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                 Set<String> datelist = new HashSet<>();
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                 HashMap<String,List<Map<String,Object>>> waitinglist = new HashMap<>();
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                 if(scoreList!=null&&scoreList.size()>0){
 | 
	
		
			
				|  |  |                     for(Map<String,Object> scorepatient :scoreList){
 | 
	
		
			
				|  |  |                         String id = (String)scorepatient.get("id");
 | 
	
		
			
				|  |  |             
 | 
	
		
			
				|  |  |                         if(id == null){
 | 
	
		
			
				|  |  |                             continue;
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                         
 | 
	
		
			
				|  |  |                         if(waitinglist.keySet().contains(id)){
 | 
	
		
			
				|  |  |                             waitinglist.get(id).add(scorepatient);
 | 
	
		
			
				|  |  |                         }else{
 | 
	
		
			
				|  |  |                             List<Map<String,Object>> _cu = new ArrayList<>();
 | 
	
		
			
				|  |  |                             _cu.add(scorepatient);
 | 
	
		
			
				|  |  |                             waitinglist.put(id,_cu);
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 rs.put("scoreList",waitinglist);
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 rs.put("scoreList",null);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return rs;
 | 
	
	
		
			
				|  | @ -1756,7 +1823,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 医生可接单列表
 | 
	
		
			
				|  |  |      * 医生可接单列表(图文)
 | 
	
		
			
				|  |  |      * @param doctor
 | 
	
		
			
				|  |  |      * @param type
 | 
	
		
			
				|  |  |      * @return
 | 
	
	
		
			
				|  | @ -1783,9 +1850,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 "WHERE " +
 | 
	
		
			
				|  |  |                 "room.patient_id=patient.id " +
 | 
	
		
			
				|  |  |                 "AND room.outpatient_id=outpatient.id " +
 | 
	
		
			
				|  |  |                 "AND outpatient.status = 0 " +
 | 
	
		
			
				|  |  |                 "AND (room.doctor IS NULL or room.doctor='"+doctor+"') " +
 | 
	
		
			
				|  |  |                 "AND room.consult_type="+type;
 | 
	
		
			
				|  |  |                 "AND outpatient.status = 0 ";
 | 
	
		
			
				|  |  |         if(type == 2){
 | 
	
		
			
				|  |  |             sql +=  "AND room.doctor IS NULL ";
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             sql +=  "AND (room.doctor IS NULL or room.doctor='"+doctor+"') ";
 | 
	
		
			
				|  |  |             
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         sql += "AND room.consult_type="+type;
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         if(list!=null&&list.size()>0){
 | 
	
	
		
			
				|  | @ -1903,9 +1976,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |      * @param orgCode 机构码
 | 
	
		
			
				|  |  |      * @param dept 部门CODE
 | 
	
		
			
				|  |  |      * @param diseaseKey 疾病名称
 | 
	
		
			
				|  |  |      * @param jobTitleNameKey
 | 
	
		
			
				|  |  |      * @param outpatientType
 | 
	
		
			
				|  |  |      * @param keyName
 | 
	
		
			
				|  |  |      * @param workingTime
 | 
	
		
			
				|  |  |      * @param consutlSort
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> findDoctorByHospitalAndDiseaseAndDept(String orgCode, String dept, String diseaseKey,String doctorNameKey) {
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> findDoctorByHospitalAndDiseaseAndDept(String orgCode, String dept,
 | 
	
		
			
				|  |  |                                                                           String diseaseKey, String doctorNameKey,
 | 
	
		
			
				|  |  |                                                                           String jobTitleNameKey, String outpatientType,
 | 
	
		
			
				|  |  |                                                                           String keyName, String workingTime, String consutlSort) {
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         String sql ="SELECT " +
 | 
	
		
			
				|  |  |                 " d.id, " +
 | 
	
	
		
			
				|  | @ -1916,11 +1997,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 " d.job_title_code AS jobTitleCode, " +
 | 
	
		
			
				|  |  |                 " d.job_title_name AS jobTitleName," +
 | 
	
		
			
				|  |  |                 " d.charge_type AS chargeType," +
 | 
	
		
			
				|  |  |                 " h.dept_name AS deptName" +
 | 
	
		
			
				|  |  |                 " h.dept_name AS deptName," +
 | 
	
		
			
				|  |  |                 " a.total as consultTotal" +
 | 
	
		
			
				|  |  |                 " FROM " +
 | 
	
		
			
				|  |  |                 " base_doctor d " +
 | 
	
		
			
				|  |  |                 " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
 | 
	
		
			
				|  |  |                 " WHERE  " +
 | 
	
		
			
				|  |  |                 " JOIN base_doctor_hospital h ON h.doctor_code = d.id "+
 | 
	
		
			
				|  |  |                 " Left join ( select count(id) as total,doctor from wlyy_consult_team GROUP BY doctor ) a on a.doctor = d.id ";
 | 
	
		
			
				|  |  |                 
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(workingTime)){
 | 
	
		
			
				|  |  |             sql+=" JOIN wlyy_doctor_work_time wk on wk.doctor = d.id ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         sql +=  " WHERE  " +
 | 
	
		
			
				|  |  |                 " h.org_code = '"+orgCode+"'";
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(diseaseKey)){
 | 
	
		
			
				|  |  |             sql+=" AND d.expertise like '%"+diseaseKey+"%'";
 | 
	
	
		
			
				|  | @ -1933,6 +2020,25 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(dept)){
 | 
	
		
			
				|  |  |             sql+=" AND h.dept_code = '"+dept+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(jobTitleNameKey)){
 | 
	
		
			
				|  |  |             sql+=" AND d.job_title_name AS = '"+jobTitleNameKey+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(outpatientType)){
 | 
	
		
			
				|  |  |             sql+=" AND d.outpatient_type AS = '"+outpatientType+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(keyName)){
 | 
	
		
			
				|  |  |             sql+=" AND (h.dept_name like '%"+keyName+"%' or d.name like '%"+keyName+"%' or d.expertise like '%"+keyName+"%' )";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(workingTime)){
 | 
	
		
			
				|  |  |             sql+=" AND wk.date = '"+workingTime+"' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         sql += " order by a.total "+ consutlSort;
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         return list;
 | 
	
	
		
			
				|  | @ -2142,4 +2248,189 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         String res = httpClientUtil.post("http://www.xmtyw.cn/wlyy/iHealth/userInfo", params, "UTF-8");
 | 
	
		
			
				|  |  |         return res;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取正在进行中的视频复诊/协同门诊
 | 
	
		
			
				|  |  |      * @param doctor
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> getVideoPrescriptionByDoctor(String doctor) {
 | 
	
		
			
				|  |  |         String sql ="SELECT " +
 | 
	
		
			
				|  |  |                 "room.outpatient_id AS id," +
 | 
	
		
			
				|  |  |                 "room.patient_id AS patient_id," +
 | 
	
		
			
				|  |  |                 "room.patient_name AS name," +
 | 
	
		
			
				|  |  |                 "patient.sex AS sex," +
 | 
	
		
			
				|  |  |                 "patient.idcard AS idcard," +
 | 
	
		
			
				|  |  |                 "patient.photo AS photo," +
 | 
	
		
			
				|  |  |                 "patient.birthday AS birthday," +
 | 
	
		
			
				|  |  |                 "room.consult_type AS consult_type," +
 | 
	
		
			
				|  |  |                 "room.reservation_time AS time," +
 | 
	
		
			
				|  |  |                 "room.reservation_type AS reservation_type," +
 | 
	
		
			
				|  |  |                 "outpatient.disease_img AS disease_img," +
 | 
	
		
			
				|  |  |                 "outpatient.description AS description," +
 | 
	
		
			
				|  |  |                 "outpatient.origin_con_no AS origin_con_no " +
 | 
	
		
			
				|  |  |                 "FROM " +
 | 
	
		
			
				|  |  |                 "wlyy_hospital_waiting_room room," +
 | 
	
		
			
				|  |  |                 "base_patient patient," +
 | 
	
		
			
				|  |  |                 "wlyy_outpatient outpatient, " +
 | 
	
		
			
				|  |  |                 "wlyy_consult_team consult " +
 | 
	
		
			
				|  |  |                 "WHERE " +
 | 
	
		
			
				|  |  |                 "room.patient_id=patient.id " +
 | 
	
		
			
				|  |  |                 "AND room.outpatient_id=outpatient.id " +
 | 
	
		
			
				|  |  |                 "AND consult.relation_code=outpatient.id " +
 | 
	
		
			
				|  |  |                 "AND outpatient.status = 1 " +
 | 
	
		
			
				|  |  |                 "AND room.doctor='"+doctor+"' " +
 | 
	
		
			
				|  |  |                 "AND room.consult_type= 2";
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         if(list!=null&&list.size()>0){
 | 
	
		
			
				|  |  |             //根据身份证计算年龄
 | 
	
		
			
				|  |  |             for(Map<String,Object> outpatient :list){
 | 
	
		
			
				|  |  |                 String idcard = (String)outpatient.get("idcard");
 | 
	
		
			
				|  |  |                 outpatient.put("age",DateUtil.getAgeForIdcard(idcard));
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                 String outpatient_id = (String)outpatient.get("id");
 | 
	
		
			
				|  |  |                 
 | 
	
		
			
				|  |  |                 
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         return list;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     public com.alibaba.fastjson.JSONArray getWaitingForVisitVideoPrescriptionByDoctor(String doctor) {
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         String sql ="SELECT " +
 | 
	
		
			
				|  |  |                 "room.outpatient_id AS id," +
 | 
	
		
			
				|  |  |                 "room.patient_id AS patient_id," +
 | 
	
		
			
				|  |  |                 "room.patient_name AS name," +
 | 
	
		
			
				|  |  |                 "patient.sex AS sex," +
 | 
	
		
			
				|  |  |                 "patient.idcard AS idcard," +
 | 
	
		
			
				|  |  |                 "patient.photo AS photo," +
 | 
	
		
			
				|  |  |                 "patient.birthday AS birthday," +
 | 
	
		
			
				|  |  |                 "room.consult_type AS consult_type," +
 | 
	
		
			
				|  |  |                 "room.reservation_time AS time," +
 | 
	
		
			
				|  |  |                 "date_format(room.reservation_time ,'%Y-%m-%d' ) AS group_date," +
 | 
	
		
			
				|  |  |                 "room.reservation_type AS reservation_type," +
 | 
	
		
			
				|  |  |                 "outpatient.disease_img AS disease_img," +
 | 
	
		
			
				|  |  |                 "outpatient.description AS description," +
 | 
	
		
			
				|  |  |                 "outpatient.origin_con_no AS origin_con_no " +
 | 
	
		
			
				|  |  |                 "FROM " +
 | 
	
		
			
				|  |  |                 "wlyy_hospital_waiting_room room," +
 | 
	
		
			
				|  |  |                 "base_patient patient," +
 | 
	
		
			
				|  |  |                 "wlyy_outpatient outpatient " +
 | 
	
		
			
				|  |  |                 "WHERE " +
 | 
	
		
			
				|  |  |                 "room.patient_id=patient.id " +
 | 
	
		
			
				|  |  |                 "AND room.outpatient_id=outpatient.id " +
 | 
	
		
			
				|  |  |                 "AND outpatient.status = 0 " +
 | 
	
		
			
				|  |  |                 "AND room.doctor='"+doctor+"' " +
 | 
	
		
			
				|  |  |                 "AND room.reservation_time is not null " +
 | 
	
		
			
				|  |  |                 "AND room.consult_type= 2 ";
 | 
	
		
			
				|  |  | //                "AND room.reservation_time>='"+DateUtil.getStringDate("yyyy-MM-dd")+" 00:00:00"+"' ";
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         Set<String> datelist = new HashSet<>();
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         HashMap<String,List<Map<String,Object>>> waitinglist = new HashMap<>();
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         if(list!=null&&list.size()>0){
 | 
	
		
			
				|  |  |             //根据身份证计算年龄
 | 
	
		
			
				|  |  |             for(Map<String,Object> outpatient :list){
 | 
	
		
			
				|  |  |                 String idcard = (String)outpatient.get("idcard");
 | 
	
		
			
				|  |  |                 outpatient.put("age",DateUtil.getAgeForIdcard(idcard));
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |                 String group_date = (String)outpatient.get("group_date");
 | 
	
		
			
				|  |  |                 
 | 
	
		
			
				|  |  |                 if(waitinglist.keySet().contains(group_date)){
 | 
	
		
			
				|  |  |                     waitinglist.get(group_date).add(outpatient);
 | 
	
		
			
				|  |  |                 }else{
 | 
	
		
			
				|  |  |                     List<Map<String,Object>> _cu = new ArrayList<>();
 | 
	
		
			
				|  |  |                     _cu.add(outpatient);
 | 
	
		
			
				|  |  |                     waitinglist.put(group_date,_cu);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         Collection<String> keyset= waitinglist.keySet();
 | 
	
		
			
				|  |  |         List<String> _list = new ArrayList<String>(keyset);
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         //对key键值按字典升序排序
 | 
	
		
			
				|  |  |         Collections.sort(_list);
 | 
	
		
			
				|  |  |         com.alibaba.fastjson.JSONArray result = new com.alibaba.fastjson.JSONArray();
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         for (int i = 0; i < _list.size(); i++) {
 | 
	
		
			
				|  |  |             com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
 | 
	
		
			
				|  |  |             if(_list.get(i).equals(DateUtil.getStringDateShort())){
 | 
	
		
			
				|  |  |                 object.put("day","today");
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 object.put("day",_list.get(i));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             object.put("data",waitinglist.get(_list.get(i)));
 | 
	
		
			
				|  |  |             result.add(object);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 医生抢单(视频)
 | 
	
		
			
				|  |  |      * @param outpatientCode
 | 
	
		
			
				|  |  |      * @param doctor
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void pickVideoPrescripitonWaitingPeople(String outpatientCode, String doctor) throws Exception{
 | 
	
		
			
				|  |  |         List<WlyyHospitalWaitingRoomDO> roomDOs =hospitalWaitingRoomDao.findByOutpatientId(outpatientCode);
 | 
	
		
			
				|  |  |         if(roomDOs!=null&&roomDOs.size()>0){
 | 
	
		
			
				|  |  |             for(WlyyHospitalWaitingRoomDO roomDO:roomDOs){
 | 
	
		
			
				|  |  |                     roomDO.setDoctor(doctor);
 | 
	
		
			
				|  |  |                     hospitalWaitingRoomDao.save(roomDO);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 复诊图文咨询人数,视频咨询人数, 专家咨询未完成
 | 
	
		
			
				|  |  |      * @param doctor
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONObject doctorIndexConsultCount(String doctor) {
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         //医生问诊量
 | 
	
		
			
				|  |  |         List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByDoctor(doctor);
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         Integer imgCount = 0;
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         Integer videoCount = 0;
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         for(WlyyOutpatientDO wlyyOutpatientDO:wlyyOutpatientDOs){
 | 
	
		
			
				|  |  |             //1.图文 2.视频
 | 
	
		
			
				|  |  |             if("1".equals(wlyyOutpatientDO.getType())){
 | 
	
		
			
				|  |  |                 imgCount ++;
 | 
	
		
			
				|  |  |             }else if("2".equals(wlyyOutpatientDO.getType())){
 | 
	
		
			
				|  |  |                 videoCount ++;
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 continue;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         String totalSql = "SELECT count(a.id) AS total " +
 | 
	
		
			
				|  |  |                 "FROM wlyy_consult a,wlyy_consult_team b " +
 | 
	
		
			
				|  |  |                 "WHERE a.id=b.consult AND b.doctor='"+doctor+"' AND a.type=1 AND b.`status`=0";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         Long zjCount = 0L;
 | 
	
		
			
				|  |  |         if (rstotal != null && rstotal.size() > 0) {
 | 
	
		
			
				|  |  |             zjCount = (Long) rstotal.get(0).get("total");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         JSONObject result = new JSONObject();
 | 
	
		
			
				|  |  |         result.put("imgCount",imgCount);
 | 
	
		
			
				|  |  |         result.put("videoCount",videoCount);
 | 
	
		
			
				|  |  |         result.put("zjCount",zjCount);
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |