| 
					
				 | 
			
			
				@ -445,7 +445,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.disease_img AS \"diseaseImg\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.consumer as \"consumer\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.consumer_name as \"consumerName\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.consumer_mobile as \"consumerMobile\", "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.consumer_mobile as \"consumerMobile\", "+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.fee as \"fee\", "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("xm_ykyy_wx".equals(wechatId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (flag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql = sql + "date_format(o.create_time ,'%Y-%m-%d %H:%i:%S' ) AS createTime,"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -507,6 +508,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("patientCancelRemark", outpatientDO.getPatientCancelRemark()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("operator",outpatientDO.getOperator()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("status",outpatientDO.getStatus()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("fee",outpatientDO.getFee()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("createTime",DateUtil.dateToStrLong(outpatientDO.getCreateTime())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //居民详情 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1501,6 +1503,29 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String id = (String) doctor.get("id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(id, orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                doctor.put("workTime", times); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String deptTyepCode = "6"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<BaseDoctorHospitalDO> depts = baseDoctorHospitalDao.findByDoctorCode(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (null!=depts&&depts.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    BaseDoctorHospitalDO baseDoctorHospitalDO = depts.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String deptcode =  baseDoctorHospitalDO.getDeptCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String hosptitalCode = baseDoctorHospitalDO.getOrgCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    List<DictHospitalDeptDO> dictHospitalDeptDO = dictHospitalDeptDao.findByOrgCodeAndCode(hosptitalCode,deptcode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if(null!=dictHospitalDeptDO&&dictHospitalDeptDO.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        deptTyepCode = dictHospitalDeptDO.get(0).getDeptTypeCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String chargeTypeList = doctor.get("chargeType").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (chargeType.contains(",")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    chargeTypeList = chargeType.replace(",","','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "req_fee  as \"reqFee\",dept_type_code as \"deptTypeCode\" " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        " from wlyy_charge_dict where 1=1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sqlCharge+=" and charge_type in ( '"+chargeTypeList+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sqlCharge+=" and dept_type_code in ( '"+deptTyepCode+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<Map<String,Object>> chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                doctor.put("chargeTypeList",chargeDictDOLists); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(doctorCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //排序 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3374,8 +3399,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("sex",doctorDO.getSex()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("popularity",doctorDO.getPopularity()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("qrcode",doctorDO.getQrcode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //号别 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String deptTyepCode = "6"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<BaseDoctorHospitalDO> depts = baseDoctorHospitalDao.findByDoctorCode(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (null!=depts&&depts.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                BaseDoctorHospitalDO baseDoctorHospitalDO = depts.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String deptcode =  baseDoctorHospitalDO.getDeptCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String hosptitalCode = baseDoctorHospitalDO.getOrgCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<DictHospitalDeptDO> dictHospitalDeptDO = dictHospitalDeptDao.findByOrgCodeAndCode(hosptitalCode,deptcode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(null!=dictHospitalDeptDO&&dictHospitalDeptDO.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    deptTyepCode = dictHospitalDeptDO.get(0).getDeptTypeCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String chargeType = doctorDO.getChargeType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (chargeType.contains(",")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                chargeType = chargeType.replace(",","','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "req_fee  as \"reqFee\",dept_type_code as \"deptTypeCode\" " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " from wlyy_charge_dict where 1=1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCharge+=" and charge_type in ( '"+chargeType+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCharge+=" and dept_type_code in ( '"+deptTyepCode+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String,Object>> chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("chargeTypeList",chargeDictDOLists); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //机构科室信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByDoctorCode(doctorDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (hospitalDOs != null && hospitalDOs.size() > 0) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3609,7 +3656,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("learning",doctorDO.getLearning()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("sex",doctorDO.getSex()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("qrcode",doctorDO.getQrcode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //号别 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String deptTyepCode = "6"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<BaseDoctorHospitalDO> depts = baseDoctorHospitalDao.findByDoctorCode(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (null!=depts&&depts.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                BaseDoctorHospitalDO baseDoctorHospitalDO = depts.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String deptcode =  baseDoctorHospitalDO.getDeptCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String hosptitalCode = baseDoctorHospitalDO.getOrgCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<DictHospitalDeptDO> dictHospitalDeptDO = dictHospitalDeptDao.findByOrgCodeAndCode(hosptitalCode,deptcode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(null!=dictHospitalDeptDO&&dictHospitalDeptDO.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    deptTyepCode = dictHospitalDeptDO.get(0).getDeptTypeCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String chargeType = doctorDO.getChargeType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (chargeType.contains(",")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                chargeType = chargeType.replace(",","','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "req_fee  as \"reqFee\",dept_type_code as \"deptTypeCode\" " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " from wlyy_charge_dict where 1=1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCharge+=" and charge_type in ( '"+chargeType+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCharge+=" and dept_type_code in ( '"+deptTyepCode+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String,Object>> chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("chargeTypeList",chargeDictDOLists); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //机构科室信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByDoctorCode(doctorDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<BaseDoctorHospitalDO> hospitalDOList = new ArrayList<>(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4873,12 +4943,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      /*  if(page >=1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            page --; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (pagesize <= 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            pagesize = 10; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      wechatId = "12"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.id AS \"id\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.photo AS \"photo\", " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5038,6 +5107,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        list.stream().sorted(Comparator.comparing((Map<String, Object> h) -> ((String) h.get("workTotal"))).reversed().thenComparing(Comparator.comparing((Map<String, Object> h) -> ((String) h.get("consultStatus")))).reversed());*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String,Object> map:list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String doctor = map.get("id").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //号别 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String deptTyepCode = "6"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<BaseDoctorHospitalDO> depts = baseDoctorHospitalDao.findByDoctorCode(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (null!=depts&&depts.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                BaseDoctorHospitalDO baseDoctorHospitalDO = depts.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String deptcode =  baseDoctorHospitalDO.getDeptCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String hosptitalCode = baseDoctorHospitalDO.getOrgCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<DictHospitalDeptDO> dictHospitalDeptDO = dictHospitalDeptDao.findByOrgCodeAndCode(hosptitalCode,deptcode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(null!=dictHospitalDeptDO&&dictHospitalDeptDO.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    deptTyepCode = dictHospitalDeptDO.get(0).getDeptTypeCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String chargeType = map.get("chargeType").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (chargeType.contains(",")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                chargeType = chargeType.replace(",","','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "req_fee  as \"reqFee\",dept_type_code as \"deptTypeCode\" " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " from wlyy_charge_dict where 1=1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCharge+=" and charge_type in ( '"+chargeType+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlCharge+=" and dept_type_code in ( '"+deptTyepCode+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String,Object>> chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map.put("chargeTypeList",chargeDictDOLists); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //查询医生各项评价平均分 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sqlscore = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "AVG(a.score) AS \"score\"," + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5583,7 +5676,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> getVideoPrescriptionByDoctor(String doctor, String general_doctor, String wxId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String condition = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("xm_ykyy_wx".equals(wxId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        /*if ("xm_ykyy_wx".equals(wxId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (flag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                condition += "date_format(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\","; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5592,7 +5685,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            condition += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS \"time\","; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "room.outpatient_id AS \"id\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "room.patient_id AS \"patient_id\"," + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5602,7 +5695,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "patient.photo AS \"photo\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "patient.birthday AS \"birthday\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "patient.mobile AS \"mobile\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "room.consult_type AS \"consult_type\"," + condition + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "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\"," + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5636,7 +5729,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String idcard = (String) outpatient.get("idcard"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String patient_id = (String) outpatient.get("patient_id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                outpatient.put("age", DateUtil.getAgeForIdcard(idcard)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //转换日期格式 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                outpatient.put("time",null==outpatient.get("time")?"":DateUtil.dateToStrLong(DateUtil.strToDateLong(outpatient.get("time").toString()))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String outpatient_id = (String) outpatient.get("id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String isAlert = redisTemplate.opsForValue().get("patient_alert_" + patient_id); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5725,7 +5819,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String condition = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("xm_ykyy_wx".equals(wxId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(flag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                condition += "date_format(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\","; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                condition += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' )  AS \"time\","; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                condition += "date_format(room.reservation_time,'YYYY-MM-DD')  AS \"group_date\","; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                condition += "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\","; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5733,7 +5827,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            condition += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS \"time\","; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                condition += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS \"time\","; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            condition += "date_format(room.reservation_time ,'%Y-%m-%d' ) AS \"group_date\","; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -8737,12 +8831,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       return envelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //应声开具处方管理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop prescriptionManage(String keyWord,String startTime,String endTime,String checkStatus,Integer page,Integer pageSize){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop prescriptionManage(String keyWord,String doctorId,String startTime,String endTime,String checkStatus,Integer page,Integer pageSize){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = " select p.create_time as \"createTime\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " p.patient_name as \"patientName\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " p.idcard as \"idcard\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.card_no as \"cardNo\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " p.check_status as \"checkStatus\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " p.id as \"id\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " p.check_reason as \"checkReason\" " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " from wlyy_prescription p left join wlyy_outpatient o on p.outpatient_id  = o.id" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " where  1=1"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -8753,6 +8848,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(checkStatus)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" and p.check_status ="+checkStatus; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(doctorId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" and p.doctor = '"+doctorId+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("xm_ykyy_wx".equals(wechatId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (flag){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -8787,6 +8885,43 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String,Object> map:resultList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map.put("createTime",null==map.get("createTime")?"":DateUtil.dateToStrLong(DateUtil.strToDateLong(map.get("createTime").toString()))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String prescriptionId = map.get("id").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //获取处方信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<WlyyPrescriptionDO> prescriptionDOs = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDOs = prescriptionDao.findById(prescriptionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<WlyyPrescriptionVO> prescriptionVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<BusinessOrderDO> businessOrders = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BusinessOrderDO businessOrder = new BusinessOrderDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (prescriptionDOs != null && prescriptionDOs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                convertToModels(prescriptionDOs, prescriptionVOs, WlyyPrescriptionVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (WlyyPrescriptionVO vo : prescriptionVOs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    List<WlyyPrescriptionCheckDO> prescriptionCheckDO = prescriptionCheckDao.findByPrescriptionId(vo.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //疾病信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    vo.setDiagnosisVOs(findDiagnosisById(vo.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if(null!=prescriptionCheckDO&&prescriptionCheckDO.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        vo.setDispUser(prescriptionCheckDO.get(0).getOperate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        vo.setDispUserName(prescriptionCheckDO.get(0).getOperateName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //药品信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    List<WlyyPrescriptionInfoVO> infoVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    System.out.println("=====PrescriptionId======"+vo.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    convertToModels(prescriptionInfoDao.findByPrescriptionId(vo.getId(), 1), infoVOs, WlyyPrescriptionInfoVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    vo.setInfoVOs(infoVOs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //检查检验信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    List<WlyyInspectionVO> inspectionVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    vo.setInspectionVOs(convertToModels(wlyyInspectionDao.findByPrescriptionId(vo.getId(), 1), inspectionVOs, WlyyInspectionVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //支付信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(vo.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (null!=businessOrderDO){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        businessOrders.add(businessOrderDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map.put("prescriptions",prescriptionVOs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        MixEnvelop mixEnvelop = new MixEnvelop(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        mixEnvelop.setDetailModelList(resultList); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -8795,4 +8930,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        mixEnvelop.setTotalCount(count.intValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return  mixEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //作废处方 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String disablePrescription(String prescriptionId) throws  Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null!=prescriptionDO){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String hisId = prescriptionDO.getHisId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("xm_xzzx_wx".equalsIgnoreCase(wechatId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(prescriptionId,1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (null!=wlyyPrescriptionDiagnosisDOs&&wlyyPrescriptionDiagnosisDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    xzzxEntranceService.deleteCheckInputInfo(hisId,"0",prescriptionDO.getDoctor(),prescriptionDO.getPatientCode(),wlyyPrescriptionDiagnosisDOs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDO.setStatus(-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDO.setCheckStatus(5); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDO.setCheckReason("作废处方"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDao.save(prescriptionDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "作废成功"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "作废失败"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |