| 
					
				 | 
			
			
				@ -12,6 +12,7 @@ import com.yihu.jw.entity.base.dict.DictDeptDescDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				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.ConsultDo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.im.ConsultTeamDo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.org.BaseOrgDO; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -79,6 +80,7 @@ import com.yihu.jw.util.wechat.WeixinMessagePushUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.GenerateUserSig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.Pkis.PKIService_PortType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.Pkis.PKIService_ServiceLocator; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.StringUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.WebserviceUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.hibernate.HibenateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.wechat.dao.BasePatientWechatDao; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -366,13 +368,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param size 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findReOutpatientList(String patient, Integer status, String startTime, String endTime, Integer page, Integer size) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findReOutpatientList(String patient, Integer status, String startTime, String endTime,String outpatientType, Integer page, Integer size) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalSql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " COUNT(1) AS \"total\" " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " wlyy_outpatient o " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.patient =:patient AND o.outpatient_type != '2' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.patient =:patient  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> totalParams = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        totalParams.put("patient", patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (status != null) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -388,6 +390,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalParams.put("endTime", DateUtil.strToDateLong(endTime + " 23:59:59")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(outpatientType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+=" AND o.outpatient_type = :outpatientType "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalParams.put("outpatientType", outpatientType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       /* totalParams.add(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(status!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql +=  " AND o.status = ? "; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -428,6 +434,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.hospital_name AS \"hospitalName\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.win_no AS \"winNo\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.type AS  \"type\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.outpatient_type AS  \"outpatientType\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.dept AS \"dept\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.dept_name AS \"deptName\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.patient AS \"patient\", " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -480,7 +487,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("endTime", DateUtil.strToDateLong(endTime + " 23:59:59")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql += " AND o.outpatient_type != '2' ORDER BY o.create_time DESC "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(outpatientType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND o.outpatient_type = '"+outpatientType+"' ORDER BY o.create_time DESC "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("sql="+sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params, page, size); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(Map<String, Object> map:list){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -523,6 +532,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("operator",outpatientDO.getOperator()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("status",outpatientDO.getStatus()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("fee",outpatientDO.getFee()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("icd10Name",outpatientDO.getIcd10Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("createTime",DateUtil.dateToStrLong(outpatientDO.getCreateTime())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //居民详情 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -850,51 +860,65 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setStatus("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setIdcard(patientDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setOutpatientType("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (outpatientDO.getRegisterDate() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientDO.setRegisterDate(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionExpressageDO previous = checkOutPatientPre(outpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //2.物流信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson, WlyyPrescriptionExpressageDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null!=previous.getId()&&previous.getOneselfPickupFlg()!=expressageDO.getOneselfPickupFlg()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WlyyOutpatientDO wlyyOutpatientDO = new WlyyOutpatientDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wlyyOutpatientDO.setRemindCount(previous.getOneselfPickupFlg()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return wlyyOutpatientDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionExpressageDO expressageDO = new WlyyPrescriptionExpressageDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(!outpatientDO.getOutpatientType().equalsIgnoreCase("3")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WlyyPrescriptionExpressageDO previous = checkOutPatientPre(outpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //2.物流信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            expressageDO = objectMapper.readValue(expressageJson, WlyyPrescriptionExpressageDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (null!=previous.getId()&&previous.getOneselfPickupFlg()!=expressageDO.getOneselfPickupFlg()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                WlyyOutpatientDO wlyyOutpatientDO = new WlyyOutpatientDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyOutpatientDO.setRemindCount(previous.getOneselfPickupFlg()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return wlyyOutpatientDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("WX_MONEY"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Double price = 0.0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String chargeType1 = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (outpatient.getOutpatientType().equalsIgnoreCase("1")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(outpatientDO.getType().equalsIgnoreCase("1")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                chargeType1 = doctorDO.getTwfzChargeType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if(outpatientDO.getType().equalsIgnoreCase("2")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                chargeType1 = doctorDO.getSpfzChargeType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if (outpatient.getOutpatientType().equalsIgnoreCase("3")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(outpatientDO.getType().equalsIgnoreCase("1")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                chargeType1 = doctorDO.getTwzxChargeType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if(outpatientDO.getType().equalsIgnoreCase("2")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                chargeType1 = doctorDO.getSpzxChargeType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (doctorDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (outpatient.getOutpatientType().equalsIgnoreCase("1")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(outpatientDO.getType().equalsIgnoreCase("1")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    chargeType1 = doctorDO.getTwfzChargeType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else if(outpatientDO.getType().equalsIgnoreCase("2")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    chargeType1 = doctorDO.getSpfzChargeType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if (outpatient.getOutpatientType().equalsIgnoreCase("3")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(outpatientDO.getType().equalsIgnoreCase("1")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    chargeType1 = doctorDO.getTwzxChargeType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else if(outpatientDO.getType().equalsIgnoreCase("2")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    chargeType1 = doctorDO.getSpzxChargeType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if (outpatient.getOutpatientType().equalsIgnoreCase("2")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                chargeType1 = doctorDO.getXtfzChargeType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(doctorDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (StringUtils.isNoneBlank(chargeType1)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    WlyyChargeDictDO chargeDictDO = wlyyChargeDictDao.findByChargeType(chargeType1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (chargeDictDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        price = chargeDictDO.getReqFee(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        price = Double.parseDouble(hospitalSysDictDO.getDictValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                price = Double.parseDouble(hospitalSysDictDO.getDictValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if (outpatient.getOutpatientType().equalsIgnoreCase("2")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            chargeType1 = doctorDO.getXtfzChargeType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(doctorDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNoneBlank(chargeType1)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                WlyyChargeDictDO chargeDictDO = wlyyChargeDictDao.findByChargeType(chargeType1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNoneBlank(chargeType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                WlyyChargeDictDO chargeDictDO = wlyyChargeDictDao.findByChargeType(chargeType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (chargeDictDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    price = chargeDictDO.getReqFee(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    price = Double.parseDouble(hospitalSysDictDO.getDictValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            price = Double.parseDouble(hospitalSysDictDO.getDictValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        /*if (doctorDO != null && StringUtils.isNoneBlank(doctorDO.getFee())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            price = Double.parseDouble(doctorDO.getFee()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -915,6 +939,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if (outpatient.getOutpatientType().equalsIgnoreCase("2")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            businessOrderService.recharge(outpatient.getId(), "协同复诊-诊查费", "5", "协同复诊-诊查费", outpatient.getConsumer(), outpatient.getConsumerName(), outpatient.getDoctor(), price); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if ("3".equalsIgnoreCase(outpatient.getOutpatientType())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BusinessOrderDO businessOrderDO = businessOrderService.recharge(outpatient.getId(), "专家咨询费", "1", "专家咨询费", outpatient.getConsumer(), outpatient.getConsumerName(), outpatient.getDoctor(), price); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -931,36 +957,37 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new RuntimeException("号源已经被预约,请选择其他号源"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (0==expressageDO.getOneselfPickupFlg()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String drugCode= expressageDO.getHospitalCode()==null?"5550":expressageDO.getHospitalCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                expressageDO.setHospitalCode(drugCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!outpatientDO.getOutpatientType().equalsIgnoreCase("3")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (0==expressageDO.getOneselfPickupFlg()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String drugCode= expressageDO.getHospitalCode()==null?"5550":expressageDO.getHospitalCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    expressageDO.setHospitalCode(drugCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                System.out.println("进入物流信息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                expressageDO.setDel(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                expressageDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                expressageDO.setOutpatientId(outpatient.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                prescriptionExpressageDao.save(expressageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                System.out.println("写入自取信息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String drugStoreCode = expressageDO.getHospitalCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                BaseDrugStoreDO baseDrugStoreDO = baseDrugStoreDao.findDrugByid(drugStoreCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (null!=baseDrugStoreDO){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    expressageDO.setCityCode(baseDrugStoreDO.getCityCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    expressageDO.setCityName(baseDrugStoreDO.getCityName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    expressageDO.setProvinceCode(baseDrugStoreDO.getProvinceCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    expressageDO.setProvinceName(baseDrugStoreDO.getProvinceName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    expressageDO.setTownCode(baseDrugStoreDO.getTownCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    expressageDO.setTownName(baseDrugStoreDO.getTownName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    expressageDO.setHospitalCode(baseDrugStoreDO.getDrugStoreCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    expressageDO.setHospitalName(baseDrugStoreDO.getHospitalName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    expressageDO.setHospitalAddress(baseDrugStoreDO.getAddress()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                expressageDO.setDel(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                expressageDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                expressageDO.setOutpatientId(outpatient.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                prescriptionExpressageDao.save(expressageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            System.out.println("进入物流信息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            expressageDO.setDel(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            expressageDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            expressageDO.setOutpatientId(outpatient.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionExpressageDao.save(expressageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            System.out.println("写入自取信息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String drugStoreCode = expressageDO.getHospitalCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BaseDrugStoreDO baseDrugStoreDO = baseDrugStoreDao.findDrugByid(drugStoreCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (null!=baseDrugStoreDO){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                expressageDO.setCityCode(baseDrugStoreDO.getCityCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                expressageDO.setCityName(baseDrugStoreDO.getCityName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                expressageDO.setProvinceCode(baseDrugStoreDO.getProvinceCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                expressageDO.setProvinceName(baseDrugStoreDO.getProvinceName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                expressageDO.setTownCode(baseDrugStoreDO.getTownCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                expressageDO.setTownName(baseDrugStoreDO.getTownName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                expressageDO.setHospitalCode(baseDrugStoreDO.getDrugStoreCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                expressageDO.setHospitalName(baseDrugStoreDO.getHospitalName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                expressageDO.setHospitalAddress(baseDrugStoreDO.getAddress()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            expressageDO.setDel(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            expressageDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            expressageDO.setOutpatientId(outpatient.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionExpressageDao.save(expressageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("心脏中心同步患者开始"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1180,18 +1207,27 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String, Object> checkOutpatient(String patient,String wxId,boolean flag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String, Object> checkOutpatient(String patient,String wxId,boolean flag,String outpatientType) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //-1卡余额不足,,-2 存在未结束的诊断热 1成功 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> rs = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //1.余额判断改到前端判断 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //net.sf.json.JSONObject json = entranceService.qutpatientBalance(cardNo,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("consultAccount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String accountControl = "0"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (null!=wlyyHospitalSysDictDO){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            accountControl = wlyyHospitalSysDictDO.getDictValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //1.判断 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //net.sf.json.JS余额判断改到前端ONObject json = entranceService.qutpatientBalance(cardNo,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (flag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<WlyyOutpatientDO> outpatientDOS = outpatientDao.findByPatientListByStatus(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<WlyyOutpatientDO> outpatientDOS = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (StringUtils.isNotBlank(outpatientType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    outpatientDOS = outpatientDao.findByPatientListByStatusAndType(patient,outpatientType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    outpatientDOS = outpatientDao.findByPatientListByStatus(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (outpatientDOS!=null&&outpatientDOS.size()!=0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    WlyyOutpatientDO outpatientDO = outpatientDOS.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (outpatientDO.getHisStatus()!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (outpatientDO.getHisStatus()!=null&&"0".equalsIgnoreCase(accountControl)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        logger.info("您上一次就诊进入"+outpatientDO.getHisStatus()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if(outpatientDO.getHisStatus()!=1&&outpatientDO.getHisStatus()!=-1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            logger.info("您上一次就诊进入======"+outpatientDO.getHisStatus()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1209,7 +1245,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    }else if (outpatientDO.getHisStatus()==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    }else if (outpatientDO.getHisStatus()==null&&"0".equalsIgnoreCase(accountControl)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        rs.put("outpatient", outpatientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        rs.put("code", -3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        rs.put("mes", "您上一次就诊未结算,请结算后才能发起复诊。"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1227,16 +1263,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //2.判断是否有未结束的 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientDO> list = outpatientDao.findByPatientList(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientDO> list = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(outpatientType)&&outpatientType.equalsIgnoreCase("3")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            list = outpatientDao.findByPatientAndDoctorList(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            list = outpatientDao.findByPatientList(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (list != null && list.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("outpatient", list.get(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("code", -2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("mes", "存在未结束的诊断"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(!list.get(0).getOutpatientType().equalsIgnoreCase("3")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                rs.put("outpatient", list.get(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                rs.put("code", -2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                rs.put("mes", "存在未结束的诊断"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                rs.put("outpatient", list.get(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                rs.put("code", -2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                rs.put("mes", "存在未结束的咨询"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("code", 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("mes", "验证通过"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1600,7 +1646,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        chargeTypeList = chargeType.replace(",","','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            "req_fee  as \"reqFee\",dept_type_code as \"deptTypeCode\" " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            "req_fee  as \"reqFee\",zj_fee  as \"zjFee\",xt_fee  as \"xtFee\",dept_type_code as \"deptTypeCode\" " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            " from wlyy_charge_dict where 1=1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sqlCharge+=" and charge_type in ( '"+chargeTypeList+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3517,7 +3563,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    chargeType = chargeType.replace(",","','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "req_fee  as \"reqFee\",dept_type_code as \"deptTypeCode\" " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "req_fee  as \"reqFee\",zj_fee  as \"zjFee\",xt_fee  as \"xtFee\",dept_type_code as \"deptTypeCode\" " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        " from wlyy_charge_dict where 1=1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sqlCharge+=" and charge_type in ( '"+chargeType+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (StringUtils.isNoneBlank(deptTyepCode)){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3525,6 +3571,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sqlCharge = "SELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\tm.req_fee as \"twfzFee\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\ta.req_fee as \"spfzFee\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\tb.req_fee as \"spzxFee\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\tv.req_fee as \"twzxFee\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\td.req_fee as \"xtzxFee\"\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "FROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\tbase_doctor t\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "LEFT JOIN wlyy_charge_dict m ON t.twfz_charge_type = m.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "LEFT JOIN wlyy_charge_dict a ON t.spfz_charge_type = a.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "LEFT JOIN wlyy_charge_dict d ON t.xtfz_charge_type = d.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "WHERE t.id = '"+doctorDO.getId()+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("chargeTypeList",chargeDictDOLists); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //机构科室信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByDoctorCode(doctorDO.getId()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3784,7 +3845,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    chargeType = chargeType.replace(",","','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "req_fee  as \"reqFee\",dept_type_code as \"deptTypeCode\" " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "req_fee  as \"reqFee\",zj_fee  as \"zjFee\",xt_fee  as \"xtFee\",dept_type_code as \"deptTypeCode\" " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        " from wlyy_charge_dict where 1=1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sqlCharge+=" and charge_type in ( '"+chargeType+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(StringUtils.isNoneBlank(deptTyepCode)){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3809,6 +3870,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "LEFT JOIN wlyy_charge_dict d ON t.xtfz_charge_type = d.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "WHERE t.id = '"+doctorDO.getId()+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("chargeTypeList",chargeDictDOLists); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //机构科室信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByDoctorCode(doctorDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<BaseDoctorHospitalDO> hospitalDOList = new ArrayList<>(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3935,16 +3997,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                data.put("gender", IdCardUtil.getSexForIdcard(wlyyOutpatientDO.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                data.put("question", wlyyOutpatientDO.getIcd10Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String msg = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    data.put("type", "9"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个图文复诊已被医生取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "9", "doctorRefuseRemind", cancelRemark); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    data.put("type", "16"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个视频复诊已被医生取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "16", "doctorRefuseRemind", cancelRemark); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())||"2".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        data.put("type", "9"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个图文复诊已被医生取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "9", "doctorRefuseRemind", cancelRemark); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        data.put("type", "16"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个视频复诊已被医生取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "16", "doctorRefuseRemind", cancelRemark); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        data.put("type", "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个图文咨询已被医生取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "1", "doctorRefuseRemind", cancelRemark); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        data.put("type", "17"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个视频咨询已被医生取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "17", "doctorRefuseRemind", cancelRemark); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                data.put("msg", msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                messageDO.setData(data.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                systemMessageService.saveMessage(messageDO); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4041,6 +4117,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                contentMsg = "医生已取消您的复诊申请,取消原因:"+remindMsg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                first = outpatientDO.getConsumerName() + ",您好!您的视频复诊已取消"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("1".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                contentMsg = "医生已取消您的复诊申请,取消原因:"+remindMsg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                first = outpatientDO.getConsumerName() + ",您好!您的图文咨询已取消"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("17".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                contentMsg = "医生已取消您的复诊申请,取消原因:"+remindMsg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                first = outpatientDO.getConsumerName() + ",您好!您的视频咨询已取消"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("doctorRefuseRemind医生拒诊入参:outpatientId="+outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if("outPatientTimeOutRemind".equalsIgnoreCase(titelType)) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4075,12 +4159,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("1".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                contentMsg = "您有一个图文咨询订单待支付,点击完成支付,如您已支付请忽略本条信息"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                first = consPatientDO.getName() + ",您好!您有一个图文咨询订单待支付,请及时支付。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                msgUrl="/ims-wx/index.html#/chatRoom?type=1&consultCode="+consultTeam.getConsult(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (StringUtils.isNotBlank(outpatientId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    msgUrl="/ims-wx/index.html#/chatRoom?type=1&consultCode="+consultTeam.getConsult(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info("图文咨询订单待支付微信消息模板推送开始"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else if ("17".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                contentMsg = "您有一个视频咨询订单待支付,点击完成支付,如您已支付请忽略本条信息"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                first =  consPatientDO.getName() + ",您好!您有一个视频咨询订单待支付,请及时支付。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                msgUrl="/ims-wx/index.html#/chatRoom?type=1&consultCode="+consultTeam.getConsult(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (StringUtils.isNotBlank(outpatientId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    msgUrl="/ims-wx/index.html#/chatRoom?type=1&consultCode="+consultTeam.getConsult(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info("视频咨询订单待支付微信消息模板推送开始"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4095,7 +4187,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            contentMsg = "" + remindMsg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            remark = "请您尽快回复"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if ("outpatientMsgRemind".equalsIgnoreCase(titelType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          if (StringUtils.isNotEmpty(outpatientId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              if ("16".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  first = doctorDO.getName() + doctorDO.getJobTitleName() + "医生已向您发起视频通话邀请,请点击详情进入视频诊室。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  contentMsg = "您的视频复诊已开始,错过将重新排队"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4103,8 +4195,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  msgUrl="/ims-wx/index.html#/returnVisit/preChat?type=16&outpatientId="+outpatientId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  logger.info("视频问诊已接诊提醒微信模板消息发送开始"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          if (consultTeam!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              if ("17".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  first = consDoctorDO.getName() + consDoctorDO.getJobTitleName() + "医生已向您发起视频通话邀请,请点击详情进入视频诊室。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  contentMsg = "您的视频咨询已开始,错过将重新排队"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  remark = "点击消息进入视频诊室接听视频通话,开始视频复诊。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  if (StringUtils.isNotEmpty(outpatientId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                      msgUrl="/ims-wx/index.html#/returnVisit/preChat?type=17&outpatientId="+outpatientId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                      msgUrl="/ims-wx/index.html#/zx/prechat?consultCode="+consultTeam.getConsult(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  logger.info("视频咨询已接诊提醒微信模板消息发送开始"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          /*if (consultTeam!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              if ("17".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  first = consDoctorDO.getName() + consDoctorDO.getJobTitleName() + "医生已向您发起视频通话邀请,请点击详情进入视频诊室。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  contentMsg = "您的视频咨询已开始,错过将重新排队"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4112,7 +4214,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  msgUrl="/ims-wx/index.html#/zx/prechat?consultCode="+consultTeam.getConsult(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  logger.info("视频咨询已接诊提醒微信模板消息发送开始"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          }*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if ("videoOrderRemind".equalsIgnoreCase(titelType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4124,7 +4226,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else if ("17".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                first = "您的视频咨询已预约成功。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                contentMsg = "预计" + consDoctorDO.getName() + "医生将于" + DateUtil.dateToStrLong(consultTeam.getCzrq()) + " 与您进行视频咨询。请留意微信公众号消息。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                msgUrl="/ims-wx/index.html#/zx/prechat?consultCode="+consultTeam.getConsult(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (StringUtils.isNotEmpty(outpatientId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    msgUrl="/ims-wx/index.html#/returnVisit/preChat?type=17&outpatientId="+outpatientId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    msgUrl="/ims-wx/index.html#/zx/prechat?consultCode="+consultTeam.getConsult(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info("视频咨询已预约成功微信消息模板推送开始"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            remark = "咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4202,17 +4308,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setFirst(newConfig.getFirst().replace("key2", "视频复诊")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setKeyword1( "视频复诊支付"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword2(outpatientDO.getHospitalName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword3(outpatientDO.getDoctorName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //发起微信消息模板推送 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.info("眼科微信消息模板推送 就诊支付提醒开始"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //咨询支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (consultTeam!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_pay_notice_zx", scene, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    BeanUtils.copyProperties(config, newConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setFirst(config.getFirst().replace("key1", consPatientDO.getName())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if ("1".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setFirst(newConfig.getFirst().replace("key2", "图文咨询")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setKeyword1("图文咨询支付"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4220,13 +4315,31 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setFirst(newConfig.getFirst().replace("key2", "视频咨询")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setKeyword1("视频咨询支付"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword2( hospitalDO.getOrgName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword3( consDoctorDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword2(outpatientDO.getHospitalName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword3(outpatientDO.getDoctorName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //发起微信消息模板推送 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.info("眼科微信消息模板推送 咨询支付提醒开始"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.info("眼科微信消息模板推送 就诊支付提醒开始"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //咨询支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (consultTeam!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_pay_notice_zx", scene, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        BeanUtils.copyProperties(config, newConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setFirst(config.getFirst().replace("key1", consPatientDO.getName())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if ("1".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            newConfig.setFirst(newConfig.getFirst().replace("key2", "图文咨询")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            newConfig.setKeyword1("图文咨询支付"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } else if ("17".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            newConfig.setFirst(newConfig.getFirst().replace("key2", "视频咨询")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            newConfig.setKeyword1("视频咨询支付"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setKeyword2( hospitalDO.getOrgName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setKeyword3( consDoctorDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        //发起微信消息模板推送 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        logger.info("眼科微信消息模板推送 咨询支付提醒开始"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else if ("prescriptionPayRemind".equalsIgnoreCase(titelType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                scene = "cfzfts"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_prescription_pay_notice", scene, 1); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4255,49 +4368,53 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_outpatient_msg_notice_jz", scene, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    BeanUtils.copyProperties(config, newConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getDoctorName()).replace("key2", doctorDO.getJobTitleName())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setFirst(config.getFirst().replace("key1", outpatientDO.getDoctorName()).replace("key2", StringUtils.isNoneBlank(doctorDO.getJobTitleName())?doctorDO.getJobTitleName():"")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword1( outpatientDO.getDoctorName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword2(DateUtil.dateToStrLong(outpatientDO.getAdmDate())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword3(outpatientDO.getDeptName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword4( outpatientDO.getIcd10Name()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if ("16".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setRemark(config.getRemark().replace("key1", "视频复诊")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } else if ("17".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setRemark(config.getRemark().replace("key1", "视频咨询")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setUrl(newConfig.getUrl().replace("type=16","type=17") + "" + outpatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //发起微信消息模板推送 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.info("眼科微信消息模板推送 视频问诊接诊提醒开始"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (consultTeam!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_outpatient_msg_notice_zx", scene, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    BeanUtils.copyProperties(config, newConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setFirst(config.getFirst().replace("key1", consPatientDO.getName()).replace("key2", consDoctorDO.getJobTitleName())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword1( consDoctorDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword2(DateUtil.dateToStrLong(consultTeam.getCzrq()));//咨询暂无挂号时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword3( hospitalDO.getDeptName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword4( consultTeam.getSymptoms()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if ("16".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setRemark(config.getRemark().replace("key1", "视频复诊")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } else if ("17".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setRemark(config.getRemark().replace("key1", "视频咨询")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.info("眼科微信消息模板推送 视频问诊接诊提醒开始"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (consultTeam!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_outpatient_msg_notice_zx", scene, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        BeanUtils.copyProperties(config, newConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setFirst(config.getFirst().replace("key1", consPatientDO.getName()).replace("key2", consDoctorDO.getJobTitleName())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setKeyword1( consDoctorDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setKeyword2(DateUtil.dateToStrLong(consultTeam.getCzrq()));//咨询暂无挂号时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setKeyword3( hospitalDO.getDeptName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setKeyword4( consultTeam.getSymptoms()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if ("16".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            newConfig.setRemark(config.getRemark().replace("key1", "视频复诊")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } else if ("17".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            newConfig.setRemark(config.getRemark().replace("key1", "视频咨询")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        //发起微信消息模板推送 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        logger.info("眼科微信消息模板推送 视频咨询接诊提醒开始"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //发起微信消息模板推送 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setUrl(newConfig.getUrl() + "" + consultTeam.getConsult()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.info("眼科微信消息模板推送 视频咨询接诊提醒开始"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else if ("videoOrderRemind".equalsIgnoreCase(titelType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                scene = "spwzyytx"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (StringUtils.isNotEmpty(outpatientId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_video_notice_fz", scene, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_video_notice", scene, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    BeanUtils.copyProperties(config, newConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if ("16".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频复诊")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if ("17".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频咨询")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword1( outpatientDO.getConsumerName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword2( outpatientDO.getDeptName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword3( outpatientDO.getDoctorName()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4306,24 +4423,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //发起微信消息模板推送 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.info("眼科微信消息模板推送 视频问诊预约提醒开始"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (consultTeam!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_video_notice_zx", scene, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    BeanUtils.copyProperties(config, newConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if ("17".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频咨询")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (consultTeam!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_video_notice", scene, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        BeanUtils.copyProperties(config, newConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if ("17".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            newConfig.setFirst(config.getFirst().replaceFirst("key1", "视频咨询")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setKeyword1(consPatientDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setKeyword2(hospitalDO.getDeptName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setKeyword3(consDoctorDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setKeyword4(DateUtil.dateToStrLong(consultTeam.getCzrq())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setKeyword5(generalDoctorWaitingNumber(consDoctorDO.getId(), wxId, outpatientId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        //发起微信消息模板推送 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        logger.info("眼科微信消息模板推送 视频咨询预约提醒开始"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword1(consPatientDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword2(hospitalDO.getDeptName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword3(consDoctorDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword4(DateUtil.dateToStrLong(consultTeam.getCzrq())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setKeyword5(generalDoctorWaitingNumber(consDoctorDO.getId(), wxId, outpatientId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //发起微信消息模板推送 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.info("眼科微信消息模板推送 视频咨询预约提醒开始"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else if ("evaluateRemind".equalsIgnoreCase(titelType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                scene = "fwqjtx"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_evaluate_notice", scene, 1); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4573,9 +4689,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //协同门诊 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (3 == type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND room.reservation_type=2 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if (4==type){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //专家咨询 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND room.reservation_type=3 AND room.consult_type =1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if (1==type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //在线复诊 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND room.reservation_type=1 AND room.consult_type=" + type; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND room.reservation_type=1 AND room.consult_type =1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if (2==type) {//视频复诊 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //在线复诊 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND room.reservation_type !=3 AND room.consult_type =2"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(dept)) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4584,7 +4708,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNoneBlank(sex)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND patient.sex=" + sex + " "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }if(StringUtils.isNoneBlank(keyword)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND patient.name like '%" + keyword + "%' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND outpatient.patient_name like '%" + keyword + "%' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNoneBlank(ageGroup)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String[] age = ageGroup.split(","); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4621,8 +4745,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                       if (StringUtils.isNotBlank(basePatientDO.getIdcard())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                           patientAge = DateUtil.getAgeForIdcard(basePatientDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                           outpatient.put("patientAge", DateUtil.getAgeForIdcard(basePatientDO.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                           patientSex =basePatientDO.getSex(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                       patientSex =basePatientDO.getSex(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                outpatient.put("patientAge", patientAge); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5284,7 +5408,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    chargeType = chargeType.replace(",","','"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "req_fee  as \"reqFee\",dept_type_code as \"deptTypeCode\" " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "req_fee  as \"reqFee\",zj_fee  as \"zjFee\",xt_fee  as \"xtFee\",dept_type_code as \"deptTypeCode\" " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        " from wlyy_charge_dict where 1=1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sqlCharge+=" and charge_type in ( '"+chargeType+"')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (StringUtils.isNoneBlank(deptTyepCode)){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5309,6 +5433,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "LEFT JOIN wlyy_charge_dict d ON t.xtfz_charge_type = d.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "WHERE t.id = '"+map.get("id")+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map.put("chargeTypeList",chargeDictDOLists); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //查询医生各项评价平均分 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sqlscore = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "AVG(a.score) AS \"score\"," + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5896,6 +6021,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND room.outpatient_id=outpatient.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND consult.relation_code=outpatient.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND outpatient.pay_status=1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND outpatient.type =2 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND outpatient.outpatient_type !=2 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND consult.status = 0 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(doctor)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = sql + "AND room.doctor='" + doctor + "' " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -6000,7 +6127,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return waitCount.toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public com.alibaba.fastjson.JSONArray getWaitingForVisitVideoPrescriptionByDoctor(String doctor, String wxId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public com.alibaba.fastjson.JSONArray getWaitingForVisitVideoPrescriptionByDoctor(String doctor, String wxId,String outpatientType,String keyWord) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String condition = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("xm_ykyy_wx".equals(wxId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(flag){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -6046,11 +6173,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND outpatient.status = 0 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND outpatient.pay_status = 1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND room.doctor='" + doctor + "' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND room.reservation_time is not null " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND room.consult_type= 2 ";/* + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND room.reservation_time is not null ";/* + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND room.reservation_time >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' order by room.reservation_time ASC "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                "AND room.reservation_time>='"+DateUtil.getStringDate("yyyy-MM-dd")+" 00:00:00"+"' ";*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(outpatientType)&&"1".equalsIgnoreCase(outpatientType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+="  AND room.consult_type= 2 and room.reservation_type in (1,2)"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if (StringUtils.isNotBlank(outpatientType)&&"4".equalsIgnoreCase(outpatientType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+="  AND room.consult_type= 2 and room.reservation_type = 3"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND room.consult_type= 2 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(keyWord)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND outpatient.patient_name like '%"+keyWord+"%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("xm_ykyy_wx".equals(wxId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(flag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += " AND room.reservation_time >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -6434,7 +6569,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND outpatient.doctor='" + doctor + "' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND outpatient.pay_status = 1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND outpatient.outpatient_type= '" + outpatient_type + "'  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("1".equals(outpatient_type)) {//复诊 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("1".equals(outpatient_type)||"3".equals(outpatient_type)) {//复诊 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = sql + " AND outpatient.type= '" + type + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("2".equals(type)) {//视频复诊才需要判断时间, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("xm_ykyy_wx".equals(wxId)) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -6575,21 +6710,27 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("2".equals(outpatient.getOutpatientType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                systemMessageDO.setTitle("协同门诊"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                systemMessageDO.setType("3"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //1.图文 2.视频 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else if ("3".equals(outpatient.getOutpatientType())) {//专家咨询 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //1.图文 2.视频 3家医 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("1".equals(outpatient.getType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    systemMessageDO.setTitle("图文复诊"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    systemMessageDO.setType("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    systemMessageDO.setTitle("图文咨询"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    systemMessageDO.setType("4"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (payFlag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        saveInquirySystemMessage(outpatient,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    systemMessageDO.setTitle("视频复诊预约成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } else if("3".equals(outpatient.getType())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    systemMessageDO.setTitle("家医咨询"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    systemMessageDO.setType("15"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (payFlag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        saveInquirySystemMessage(outpatient,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    systemMessageDO.setTitle("视频咨询预约成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    systemMessageDO.setType("2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (payFlag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        saveInquirySystemMessage(outpatient,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    msg = "您的视频复诊已预约成功。\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    msg = "您的视频咨询已预约成功。\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            "预计" + outpatient.getDoctorName() + "医生将于" + outpatient.getRegisterDate() + " 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    systemMessageDO.setReceiver(outpatient.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    systemMessageDO.setReceiverName(outpatient.getDoctorName()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -6608,7 +6749,40 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    systemMessageService.saveMessage(systemMessageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sendWxTemplateMsg(wechatId, outpatient.getId(),null, "17", "videoOrderRemind", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else if ("1".equals(outpatient.getOutpatientType()))  {//在线复诊 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //1.图文 2.视频 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if ("1".equals(outpatient.getType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        systemMessageDO.setTitle("图文复诊"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        systemMessageDO.setType("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if (payFlag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            saveInquirySystemMessage(outpatient,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        systemMessageDO.setTitle("视频复诊预约成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        systemMessageDO.setType("2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if (payFlag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            saveInquirySystemMessage(outpatient,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        msg = "您的视频复诊已预约成功。\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                "预计" + outpatient.getDoctorName() + "医生将于" + outpatient.getRegisterDate() + " 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        systemMessageDO.setReceiver(outpatient.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        systemMessageDO.setReceiverName(outpatient.getDoctorName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        systemMessageDO.setRelationCode(outpatient.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        systemMessageDO.setSender(outpatient.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        systemMessageDO.setSenderName(outpatient.getPatientName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        systemMessageDO.setRelationCode(outpatient.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        data.put("name", outpatient.getPatientName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        data.put("age", IdCardUtil.getAgeForIdcard(outpatient.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        data.put("gender", IdCardUtil.getSexForIdcard_new(outpatient.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        data.put("question", outpatient.getDescription()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        data.put("msg", msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        systemMessageDO.setData(data.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        systemMessageService.saveMessage(systemMessageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        sendWxTemplateMsg(wechatId, outpatient.getId(),null, "17", "videoOrderRemind", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BasePatientDO patient = basePatientDao.findById(outpatient.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                ykyyService.pushNotificationToYktPatient(patient.getYktId(), systemMessageDO.getTitle(), data.get("msg").toString()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -6629,14 +6803,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        systemMessageDO.setType("11"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject data = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (outpatient!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("1".equals(outpatient.getType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                type = "9"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                msg = outpatient.getPatientName() + ",您好!您有一个图文复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else if ("2".equals(outpatient.getType())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                type = "16"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                msg = outpatient.getPatientName() + ",您好!您有一个视频复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("1"==outpatient.getOutpatientType()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("1".equals(outpatient.getType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    type = "9"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    msg = outpatient.getPatientName() + ",您好!您有一个图文复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } else if ("2".equals(outpatient.getType())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    type = "16"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    msg = outpatient.getPatientName() + ",您好!您有一个视频复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if ("3"==outpatient.getOutpatientType()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("1".equals(outpatient.getType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    type = "1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    msg = outpatient.getPatientName() + ",您好!您有一个图文咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } else if ("2".equals(outpatient.getType())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    type = "17"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    msg = outpatient.getPatientName() + ",您好!您有一个视频咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageDO.setSender(outpatient.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageDO.setSenderName(outpatient.getDoctorName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageDO.setRelationCode(outpatient.getId()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -6725,6 +6908,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        one.setDept(outpatientDO.getDept()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        one.setDeptName(outpatientDO.getDeptName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        one.setType(outpatientDO.getType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        one.setOutpatientType(outpatientDO.getOutpatientType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatient = outpatientDao.save(one); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPatientRegisterTimeDO registerTimeDO = null; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -6742,6 +6926,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                registerTimeDO.setOutpatientId(outpatient.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                registerTimeDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientRegisterTimeDao.save(registerTimeDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                one.setRegisterDate(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                outpatientDao.save(one); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new RuntimeException("号源已经被预约,请选择其他号源"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -8231,6 +8418,33 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean sendOutPatientSuggest(String advicesJson) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyConsultAdvice> advices = (List<WlyyConsultAdvice>) com.alibaba.fastjson.JSONArray.parseArray(advicesJson, WlyyConsultAdvice.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (advices!=null&&advices.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WlyyConsultAdvice advice = advices.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String consult =  advice.getConsult(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String sql = "select t.relation_code as \"relationCode\" from wlyy_consult t where t.id = '"+consult+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<Map<String,Object>> map = hibenateUtils.createSQLQuery(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(map!=null&&map.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String outpatientId= map.get(0).get("relationCode").toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               if (wlyyOutpatientDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   StringBuffer content = new StringBuffer(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   StringBuffer icd10Code = new StringBuffer(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   for (WlyyConsultAdvice consultAdvice:advices){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                       content.append(consultAdvice.getAdviceValue()+","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                       icd10Code.append(consultAdvice.getAdviceKey()+","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   if (content!=null&&content.length()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                       System.out.println("content+====="+content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                       content.deleteCharAt(content.length()-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                       icd10Code.deleteCharAt(icd10Code.length()-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   wlyyOutpatientDO.setIcd10Name(content.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   wlyyOutpatientDO.setIcd10(icd10Code.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   outpatientDao.save(wlyyOutpatientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        wlyyConsultAdviceDao.save(advices); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -9186,8 +9400,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public com.alibaba.fastjson.JSONObject selectHospitalInfo(String doctorId,String orgCode){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         * 1、今日待就诊:今日当前家庭医生在当前医院的未完成的协同门诊书 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -9202,8 +9414,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         6、累计就诊:当前医院累计协同门诊的已接诊数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Date startTime  = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" 00:00:00"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Date endTime  = DateUtil.strToDateLong(DateUtil.getStringDateShort()+" 23:59:59"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String nowDate = DateUtil.getStringDateShort(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Date startTime  = DateUtil.strToDateLong(nowDate+" 00:00:00"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Date endTime  = DateUtil.strToDateLong(nowDate+" 23:59:59"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 1、今日待就诊:今日当前家庭医生在当前医院的未完成的协同门诊书 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientDO> outpatientDOS =  outpatientDao.findByGeneralDoctorAndStatusAndDate(doctorId,startTime,endTime,"0,1,2"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -9220,8 +9434,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //在线医生:当前医院在班的专科医生数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql ="SELECT d.id as \"id\",d.name as \"name\" FROM base_doctor d WHERE (EXISTS (SELECT 1 FROM wlyy_doctor_work_time t WHERE t.doctor = d.id AND t.start_time >=:startTime AND t.end_time <=:endTime ) OR  d.consult_status = '1')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> params = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("startTime",startTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("endTime",endTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("xm_ykyy_wx".equals(wechatId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (flag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                params.put("startTime",DateUtil.dateToStrLong(startTime)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                params.put("endTime",DateUtil.dateToStrLong(endTime)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                params.put("startTime","to_date('"+nowDate+" 00:00:00','yyyy-mm-dd hh24:mi:ss')"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                params.put("endTime","to_date('"+nowDate+" 23:59:59','yyyy-mm-dd hh24:mi:ss')"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("startTime",DateUtil.dateToStrLong(startTime)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("endTime",DateUtil.dateToStrLong(endTime)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("onlineDoctors",list.size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 |