| 
					
				 | 
			
			
				@ -8,6 +8,7 @@ import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.dict.DictHospitalDeptDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.doctor.BaseDoctorDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.org.BaseOrgDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.patient.BasePatientDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.patient.PatientMedicareCardDO; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -37,6 +38,7 @@ import com.yihu.jw.hospital.message.service.SystemMessageService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.dao.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.service.entrance.EntranceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.org.dao.BaseOrgDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.patient.dao.BaseDoctorPatientFollowDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.patient.dao.BasePatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.patient.dao.BasePatientMedicareCardDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -155,6 +157,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private SystemMessageService systemMessageService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private HibenateUtils hibenateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BaseDoctorPatientFollowDao baseOrgPatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Value("${demo.flag}") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2927,7 +2931,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param consutlSort 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> findDoctorByHospitalAndDiseaseAndDept(String iswork,String orgCode, String dept, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> findDoctorByHospitalAndDiseaseAndDept(String iswork,String patientid,String orgCode, String dept, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                          String diseaseKey, String doctorNameKey, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                          String jobTitleNameKey, String outpatientType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                          String keyName, String workingTime, String consultStatus,String chargType,String consutlSort,Integer page,Integer pagesize) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2954,10 +2958,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.outpatient_type AS outpatientType," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " a.total as consultTotal," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " h.org_name as orgName," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " follow.patient as followid," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " h.org_code as orgCode" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " base_doctor d " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " JOIN base_doctor_hospital h ON h.doctor_code = d.id "+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " Left join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient='"+patientid+"'"+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " Left join ( select count(id) as total,doctor from wlyy_outpatient where status = 2 GROUP BY doctor ) a on a.doctor = d.id "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(workingTime)){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4394,4 +4400,22 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void followOrgByPatient(String patientid, String doctorid, String type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<BaseDoctorPatientFollowDO> list =baseOrgPatientDao.findByDoctorAndPatient(patientid,doctorid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("1".equals(type)){//关注 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(list.isEmpty()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                BaseDoctorPatientFollowDO baseOrgPatientFollowDO = new BaseDoctorPatientFollowDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                baseOrgPatientFollowDO.setDoctor(doctorid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                baseOrgPatientFollowDO.setPatient(patientid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                baseOrgPatientDao.save(baseOrgPatientFollowDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if("0".equals(type)){//取消关注 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(!list.isEmpty()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (BaseDoctorPatientFollowDO baseOrgPatientFollowDO:list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    baseOrgPatientDao.delete(baseOrgPatientFollowDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |