|  | @ -9,12 +9,14 @@ import com.yihu.jw.doctor.dao.BaseDoctorDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.care.course.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.order.BusinessOrderDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.order.dao.BusinessOrderDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.org.dao.BaseOrgDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.patient.dao.BasePatientDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.ResponseContant;
 | 
	
		
			
				|  |  | import com.yihu.jw.util.idcard.IdCardUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.utils.StringUtil;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.jdbc.core.BeanPropertyRowMapper;
 | 
	
	
		
			
				|  | @ -49,6 +51,8 @@ public class CourseService {
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private RecruitStudentsRecordDao recruitStudentsRecordDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private RecruitStudentsDao recruitStudentsDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BusinessOrderDao businessOrderDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private PatientOrderRefundDao patientOrderRefundDao;
 | 
	
	
		
			
				|  | @ -674,6 +678,69 @@ public class CourseService {
 | 
	
		
			
				|  |  |         return object;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 招生报名
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public JSONObject enrollment(String patient,String recruitStudentsId){
 | 
	
		
			
				|  |  |         JSONObject result = new JSONObject();
 | 
	
		
			
				|  |  |         RecruitStudentsDO recruitStudentsDO = recruitStudentsDao.findOne(recruitStudentsId);
 | 
	
		
			
				|  |  |         long now = System.currentTimeMillis();
 | 
	
		
			
				|  |  |         long start = recruitStudentsDO.getStartTime().getTime();
 | 
	
		
			
				|  |  |         if(now<start){
 | 
	
		
			
				|  |  |             result.put(ResponseContant.resultFlag, ResponseContant.fail);
 | 
	
		
			
				|  |  |             result.put(ResponseContant.resultMsg, "招生未开始");
 | 
	
		
			
				|  |  |             return result;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         long end = recruitStudentsDO.getEndTime().getTime();
 | 
	
		
			
				|  |  |         if(now>end){
 | 
	
		
			
				|  |  |             result.put(ResponseContant.resultFlag, ResponseContant.fail);
 | 
	
		
			
				|  |  |             result.put(ResponseContant.resultMsg, "招生已结束");
 | 
	
		
			
				|  |  |             return result;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if(isEnrollment(patient,recruitStudentsId)){
 | 
	
		
			
				|  |  |             result.put(ResponseContant.resultFlag, ResponseContant.fail);
 | 
	
		
			
				|  |  |             result.put(ResponseContant.resultMsg, "请不要重复报名");
 | 
	
		
			
				|  |  |             return result;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         BasePatientDO patientDO = patientDao.findById(patient);
 | 
	
		
			
				|  |  |         RecruitStudentsRecordDO recordDO = new RecruitStudentsRecordDO();
 | 
	
		
			
				|  |  |         recordDO.setDel(1);
 | 
	
		
			
				|  |  |         recordDO.setStatus("1");
 | 
	
		
			
				|  |  |         recordDO.setCreateTime(new Date());
 | 
	
		
			
				|  |  |         recordDO.setMobile(patientDO.getMobile());
 | 
	
		
			
				|  |  |         recordDO.setOrderNo(getOrderNo("1"));
 | 
	
		
			
				|  |  |         recordDO.setOrgCode(recruitStudentsDO.getOrgCode());
 | 
	
		
			
				|  |  |         recordDO.setOrgName(recruitStudentsDO.getOrgName());
 | 
	
		
			
				|  |  |         recordDO.setPatient(patientDO.getId());
 | 
	
		
			
				|  |  |         recordDO.setPatientName(patientDO.getName());
 | 
	
		
			
				|  |  |         recordDO.setPrice(recruitStudentsDO.getFee());
 | 
	
		
			
				|  |  |         recordDO.setSex(IdCardUtil.getSex(patientDO.getSex(),patientDO.getIdcard()));
 | 
	
		
			
				|  |  |         recordDO.setRecruitName(recruitStudentsDO.getTheme());
 | 
	
		
			
				|  |  |         recordDO.setRecruitStudentsId(recruitStudentsId);
 | 
	
		
			
				|  |  |         recruitStudentsRecordDao.save(recordDO);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         result.put(ResponseContant.resultFlag, ResponseContant.success);
 | 
	
		
			
				|  |  |         result.put("recordDO",recordDO);
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 绑定居民是否已经报名 有待审核,待付款,已付款,退款中的订单都不能报名
 | 
	
		
			
				|  |  |      * @param patient
 | 
	
		
			
				|  |  |      * @param recruitStudentsId
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public boolean isEnrollment(String patient,String recruitStudentsId){
 | 
	
		
			
				|  |  |         String sql = "select * from base_recruit_students_record where recruit_students_id = '"+recruitStudentsId+
 | 
	
		
			
				|  |  |                 "' and patient='"+patient+"' and status in ('1','2','3','6') and del =1 ";
 | 
	
		
			
				|  |  |         List<RecruitStudentsRecordDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(RecruitStudentsRecordDO.class));
 | 
	
		
			
				|  |  |         if(list.size()>0){
 | 
	
		
			
				|  |  |             return true;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return false;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public CourseSalesOrderRecordDO buyCourseOrder(String patient, String patientName, String courseId,String payType){
 | 
	
		
			
				|  |  |         CourseDO courseDO = courseDao.findOne(courseId);
 | 
	
		
			
				|  |  | 
 |