| 
					
				 | 
			
			
				@ -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; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -530,6 +531,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()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1604,6 +1606,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                doctor.put("chargeTypeList",chargeDictDOLists); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(doctorCode)) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5918,7 +5921,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.outpatient_type!=3 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND outpatient.type =2 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND outpatient.outpatient_type !=2 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND consult.status = 0 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(doctor)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = sql + "AND room.doctor='" + doctor + "' " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -6804,6 +6808,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; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -6821,6 +6826,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("号源已经被预约,请选择其他号源"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -8310,6 +8318,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; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 |