|  | @ -4,12 +4,12 @@ import com.alibaba.fastjson.JSONArray;
 | 
												
													
														
															|  | import com.alibaba.fastjson.JSONObject;
 |  | import com.alibaba.fastjson.JSONObject;
 | 
												
													
														
															|  | import com.yihu.jw.dao.PatientHospitalRecordDao;
 |  | import com.yihu.jw.dao.PatientHospitalRecordDao;
 | 
												
													
														
															|  | import com.yihu.jw.dao.SpecialistPatientRelationDao;
 |  | import com.yihu.jw.dao.SpecialistPatientRelationDao;
 | 
												
													
														
															|  | import com.yihu.jw.dao.rehabilitation.PatientRehabilitationPlanDao;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.dao.rehabilitation.RehabilitationDetailAppointmentDao;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.dao.rehabilitation.RehabilitationDetailDao;
 |  | 
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.dao.rehabilitation.*;
 | 
												
													
														
															|  | import com.yihu.jw.entity.specialist.SpecialistPatientRelationDO;
 |  | import com.yihu.jw.entity.specialist.SpecialistPatientRelationDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanDO;
 |  | import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanDO;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanLogDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationDetailDO;
 |  | import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationDetailDO;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationOperateRecordsDO;
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.specialist.*;
 |  | import com.yihu.jw.restmodel.specialist.*;
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.web.Envelop;
 |  | import com.yihu.jw.restmodel.web.Envelop;
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.web.MixEnvelop;
 |  | import com.yihu.jw.restmodel.web.MixEnvelop;
 | 
												
											
												
													
														
															|  | @ -59,6 +59,10 @@ public class SpecialistService{
 | 
												
													
														
															|  |     private RehabilitationDetailDao rehabilitationDetailDao;
 |  |     private RehabilitationDetailDao rehabilitationDetailDao;
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private RehabilitationDetailAppointmentDao rehabilitationDetailAppointmentDao;
 |  |     private RehabilitationDetailAppointmentDao rehabilitationDetailAppointmentDao;
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private PatientRehabilitationPlanLogDao patientRehabilitationPlanLogDao;
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private RehabilitationOperateRecordsDao rehabilitationOperateRecordsDao;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public MixEnvelop<Boolean, Boolean> createSpecialistsPatientRelation(SpecialistPatientRelationDO specialistPatientRelationDO){
 |  |     public MixEnvelop<Boolean, Boolean> createSpecialistsPatientRelation(SpecialistPatientRelationDO specialistPatientRelationDO){
 | 
												
													
														
															|  |         specialistPatientRelationDao.save(specialistPatientRelationDO);
 |  |         specialistPatientRelationDao.save(specialistPatientRelationDO);
 | 
												
											
												
													
														
															|  | @ -1299,8 +1303,9 @@ public class SpecialistService{
 | 
												
													
														
															|  |         JSONArray planObject = new JSONArray();
 |  |         JSONArray planObject = new JSONArray();
 | 
												
													
														
															|  |         JSONArray planDetailObject = new JSONArray();
 |  |         JSONArray planDetailObject = new JSONArray();
 | 
												
													
														
															|  |         JSONArray specialistPatientRelation = new JSONArray();
 |  |         JSONArray specialistPatientRelation = new JSONArray();
 | 
												
													
														
															|  | 
 |  |         JSONArray rehabilitationOperateRecords = new JSONArray();
 | 
												
													
														
															|  |         for (String patientCode:patient){
 |  |         for (String patientCode:patient){
 | 
												
													
														
															|  |             List<PatientRehabilitationPlanDO> planList  = patientRehabilitationPlanDao.findByPatientAndCreateUserAAndTeamCode(patientCode,doctorCode,Integer.parseInt(teamCode));{
 |  | 
 | 
												
													
														
															|  | 
 |  |             List<PatientRehabilitationPlanDO> planList  = patientRehabilitationPlanDao.findByPatientAndCreateUserAndTeamCode(patientCode,doctorCode,Integer.parseInt(teamCode));{
 | 
												
													
														
															|  |                 for (PatientRehabilitationPlanDO plan:planList){
 |  |                 for (PatientRehabilitationPlanDO plan:planList){
 | 
												
													
														
															|  |                     plan.setCreateUser(toDoctorCode);
 |  |                     plan.setCreateUser(toDoctorCode);
 | 
												
													
														
															|  |                     plan.setCreateUserName(toDoctorName);
 |  |                     plan.setCreateUserName(toDoctorName);
 | 
												
											
												
													
														
															|  | @ -1309,7 +1314,14 @@ public class SpecialistService{
 | 
												
													
														
															|  |                     plan.setUpdateTime(new Date());
 |  |                     plan.setUpdateTime(new Date());
 | 
												
													
														
															|  |                     patientRehabilitationPlanDao.save(plan);
 |  |                     patientRehabilitationPlanDao.save(plan);
 | 
												
													
														
															|  |                     planObject.add(plan.getId());
 |  |                     planObject.add(plan.getId());
 | 
												
													
														
															|  |                     List<RehabilitationDetailDO> planDetails  = rehabilitationDetailDao.findByPlanIdAndTypeAndDoctor(plan.getId(),2,doctorCode);
 |  | 
 | 
												
													
														
															|  | 
 |  |                     PatientRehabilitationPlanLogDO planLogDO = new PatientRehabilitationPlanLogDO();
 | 
												
													
														
															|  | 
 |  |                     planLogDO.setId(UUID.randomUUID().toString().replace("-",""));
 | 
												
													
														
															|  | 
 |  |                     planLogDO.setPlanId(plan.getId());
 | 
												
													
														
															|  | 
 |  |                     planLogDO.setCreateTime(new Date());
 | 
												
													
														
															|  | 
 |  |                     planLogDO.setCreateUser(doctorCode);
 | 
												
													
														
															|  | 
 |  |                     planLogDO.setCreateUserName(toDoctorName);
 | 
												
													
														
															|  | 
 |  |                     patientRehabilitationPlanLogDao.save(planLogDO);
 | 
												
													
														
															|  | 
 |  |                     List<RehabilitationDetailDO> planDetails  = rehabilitationDetailDao.findByPlanIdAndTypeAndDoctorAndStatusNot(plan.getId(),2,doctorCode,1);//未完成的任务
 | 
												
													
														
															|  |                     for (RehabilitationDetailDO planDetail:planDetails){
 |  |                     for (RehabilitationDetailDO planDetail:planDetails){
 | 
												
													
														
															|  |                         planDetail.setDoctor(toDoctorCode);
 |  |                         planDetail.setDoctor(toDoctorCode);
 | 
												
													
														
															|  |                         planDetail.setDoctorName(toDoctorName);
 |  |                         planDetail.setDoctorName(toDoctorName);
 | 
												
											
												
													
														
															|  | @ -1318,6 +1330,16 @@ public class SpecialistService{
 | 
												
													
														
															|  |                         planDetail.setUpdateUserName(doctorName);
 |  |                         planDetail.setUpdateUserName(doctorName);
 | 
												
													
														
															|  |                         rehabilitationDetailDao.save(planDetail);
 |  |                         rehabilitationDetailDao.save(planDetail);
 | 
												
													
														
															|  |                         planDetailObject.add(planDetail.getId());
 |  |                         planDetailObject.add(planDetail.getId());
 | 
												
													
														
															|  | 
 |  |                         List<RehabilitationOperateRecordsDO> operateList = rehabilitationOperateRecordsDao.findByRehabilitationDetailIdAndDoctorCodeAndStatusNot(planDetail.getId(),doctorCode,1);
 | 
												
													
														
															|  | 
 |  |                         for (RehabilitationOperateRecordsDO operateRecordsDO:operateList){
 | 
												
													
														
															|  | 
 |  |                             operateRecordsDO.setDoctorCode(toDoctorCode);
 | 
												
													
														
															|  | 
 |  |                             operateRecordsDO.setDoctorName(toDoctorName);
 | 
												
													
														
															|  | 
 |  |                             operateRecordsDO.setUpdateTime(new Date());
 | 
												
													
														
															|  | 
 |  |                             operateRecordsDO.setUpdateUser(doctorCode);
 | 
												
													
														
															|  | 
 |  |                             operateRecordsDO.setUpdateUserName(doctorName);
 | 
												
													
														
															|  | 
 |  |                             rehabilitationOperateRecordsDao.save(operateRecordsDO);
 | 
												
													
														
															|  | 
 |  |                             rehabilitationOperateRecords.add(operateRecordsDO.getId());
 | 
												
													
														
															|  | 
 |  |                         }
 | 
												
													
														
															|  |                     }
 |  |                     }
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
											
												
													
														
															|  | @ -1335,6 +1357,7 @@ public class SpecialistService{
 | 
												
													
														
															|  |         result.put("planList",planObject);
 |  |         result.put("planList",planObject);
 | 
												
													
														
															|  |         result.put("planDetailList",planDetailObject);
 |  |         result.put("planDetailList",planDetailObject);
 | 
												
													
														
															|  |         result.put("relationList",specialistPatientRelation);
 |  |         result.put("relationList",specialistPatientRelation);
 | 
												
													
														
															|  | 
 |  |         result.put("rehabilitationOperateRecords",rehabilitationOperateRecords);
 | 
												
													
														
															|  |         return  result;
 |  |         return  result;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | }
 |  | }
 |