|  | @ -119,6 +119,7 @@ import java.math.BigDecimal;
 | 
	
		
			
				|  |  | import java.net.URL;
 | 
	
		
			
				|  |  | import java.text.DecimalFormat;
 | 
	
		
			
				|  |  | import java.text.ParseException;
 | 
	
		
			
				|  |  | import java.text.SimpleDateFormat;
 | 
	
		
			
				|  |  | import java.util.*;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /**
 | 
	
	
		
			
				|  | @ -2181,7 +2182,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |      * @param diagnosisJson
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public Map<String, Object> makeDiagnosis(String outPatientId,String prescriptionId, String advice, String type, String infoJsons, String diagnosisJson, String inspectionJson, String emrJson) throws Exception {
 | 
	
		
			
				|  |  |     public Map<String, Object> makeDiagnosis(String outPatientId,String prescriptionId, String advice, String type, String infoJsons, String diagnosisJson, String inspectionJson, String emrJson,String hisId) throws Exception {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Map<String, Object> result = new HashedMap();
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -2199,6 +2200,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             wlyyPrescriptionDO1 = prescriptionDao.findById(prescriptionId);
 | 
	
		
			
				|  |  |             prescriptionDO =wlyyPrescriptionDO1.get(0);
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             if (StringUtils.isNotBlank(hisId)){
 | 
	
		
			
				|  |  |                 prescriptionDO.setHisId(hisId);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             prescriptionDO.setOutpatientId(outPatientId);
 | 
	
		
			
				|  |  |             prescriptionDO.setType(1);
 | 
	
		
			
				|  |  |             prescriptionDO.setDept(outpatientDO.getDept());
 | 
	
	
		
			
				|  | @ -4301,7 +4305,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return times;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 医生可接单列表(图文复诊、视频复诊、协同门诊)
 | 
	
		
			
				|  |  |      *
 | 
	
	
		
			
				|  | @ -4311,7 +4314,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |      * @query_status 0:图文复诊候诊 1:图文复诊抢单列表
 | 
	
		
			
				|  |  |      * @dept 部门
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<Map<String, Object>> findWaitingRoomOutpatientByDoctor(String doctor, Integer type, Integer query_status, String dept) {
 | 
	
		
			
				|  |  |     public List<Map<String, Object>> findWaitingRoomOutpatientByDoctor(String doctor, Integer type, Integer query_status, String dept,String sex,String keyword,String ageGroup) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String sql = "SELECT " +
 | 
	
		
			
				|  |  |                 "room.outpatient_id AS \"id\"," +
 | 
	
	
		
			
				|  | @ -4327,6 +4330,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 "outpatient.consumer_name as \"consumerName\"," +
 | 
	
		
			
				|  |  |                 "outpatient.consumer_mobile as \"consumerMobile\", ";
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equals(wechatId)) {
 | 
	
		
			
				|  |  |             flag =true;
 | 
	
		
			
				|  |  |             if(flag){
 | 
	
		
			
				|  |  |                 sql += "date_format(room.reservation_time ,'yyyy-MM-dd hh24:mi:ss' ) AS \"timedate_format\",";
 | 
	
		
			
				|  |  |             }else {
 | 
	
	
		
			
				|  | @ -4374,6 +4378,31 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         if (StringUtils.isNoneBlank(dept)) {
 | 
	
		
			
				|  |  |             sql += " AND outpatient.dept='" + dept + "' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if(StringUtils.isNoneBlank(sex)){
 | 
	
		
			
				|  |  |             sql += " AND patient.sex=" + sex + " ";
 | 
	
		
			
				|  |  |         }if(StringUtils.isNoneBlank(keyword)){
 | 
	
		
			
				|  |  |             sql += " AND patient.name like '%" + keyword + "%' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if(StringUtils.isNoneBlank(ageGroup)){
 | 
	
		
			
				|  |  |             String[] age = ageGroup.split(",");
 | 
	
		
			
				|  |  |             Calendar nowBegin = Calendar.getInstance();
 | 
	
		
			
				|  |  |             Calendar nowEnd = Calendar.getInstance();
 | 
	
		
			
				|  |  |             nowBegin.add(Calendar.YEAR,-Integer.parseInt(age[0]));
 | 
	
		
			
				|  |  |             nowEnd.add(Calendar.YEAR,-Integer.parseInt(age[1]));
 | 
	
		
			
				|  |  |             SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
 | 
	
		
			
				|  |  |             String beginAge =  sf.format(nowBegin.getTime());
 | 
	
		
			
				|  |  |             String endAge =  sf.format(nowEnd.getTime());
 | 
	
		
			
				|  |  |             if("xm_ykyy_wx".equals(wechatId)){
 | 
	
		
			
				|  |  |                 if (flag){
 | 
	
		
			
				|  |  |                     sql+=" and patient.birthday > '" + endAge + "' and patient.birthday<'" + beginAge + "'";
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     sql+=" and patient.birthday > to_date('" + endAge + "', 'yyyy-mm-dd') and patient.birthday < to_date('" + beginAge + "','yyyy-mm-dd')";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 sql+=" and patient.birthday > '" + endAge + "' and patient.birthday<'" + beginAge + "'";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         logger.info("接口名称:findWaitingRoomOutpatientByDoctor-->sql="+sql);
 | 
	
		
			
				|  |  |         List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 |