|
@ -1,9 +1,15 @@
|
|
|
package com.yihu.jw.service;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.jw.dao.PatientHospitalRecordDao;
|
|
|
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.entity.specialist.SpecialistPatientRelationDO;
|
|
|
import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanDO;
|
|
|
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationDetailDO;
|
|
|
import com.yihu.jw.restmodel.specialist.*;
|
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
|
import com.yihu.jw.restmodel.web.MixEnvelop;
|
|
@ -47,6 +53,12 @@ public class SpecialistService{
|
|
|
private String basedb;
|
|
|
@Autowired
|
|
|
private StringRedisTemplate redisTemplate;
|
|
|
@Autowired
|
|
|
private PatientRehabilitationPlanDao patientRehabilitationPlanDao;
|
|
|
@Autowired
|
|
|
private RehabilitationDetailDao rehabilitationDetailDao;
|
|
|
@Autowired
|
|
|
private RehabilitationDetailAppointmentDao rehabilitationDetailAppointmentDao;
|
|
|
|
|
|
public MixEnvelop<Boolean, Boolean> createSpecialistsPatientRelation(SpecialistPatientRelationDO specialistPatientRelationDO){
|
|
|
specialistPatientRelationDao.save(specialistPatientRelationDO);
|
|
@ -1275,4 +1287,54 @@ public class SpecialistService{
|
|
|
specialistPatientRelationDao.updateSpecialistByPatient(patient, doctor, doctorName);
|
|
|
return Envelop.getSuccess("更新成功!");
|
|
|
}
|
|
|
|
|
|
|
|
|
public JSONObject transferPatients(String teamCode,String doctorCode,String toDoctorCode,String patients){
|
|
|
String[] patient = patients.split(",");
|
|
|
String sql =" select name from wlyy.wlyy_doctor where code='"+toDoctorCode+"'";
|
|
|
String toDoctorName = jdbcTemplate.queryForObject(sql,String.class);
|
|
|
sql =" select name from wlyy.wlyy_doctor where code='"+doctorCode+"'";
|
|
|
String doctorName = jdbcTemplate.queryForObject(sql,String.class);
|
|
|
JSONObject result = new JSONObject();
|
|
|
JSONArray planObject = new JSONArray();
|
|
|
JSONArray planDetailObject = new JSONArray();
|
|
|
JSONArray specialistPatientRelation = new JSONArray();
|
|
|
for (String patientCode:patient){
|
|
|
List<PatientRehabilitationPlanDO> planList = patientRehabilitationPlanDao.findByPatientAndCreateUserAAndTeamCode(patientCode,doctorCode,Integer.parseInt(teamCode));{
|
|
|
for (PatientRehabilitationPlanDO plan:planList){
|
|
|
plan.setCreateUser(toDoctorCode);
|
|
|
plan.setCreateUserName(toDoctorName);
|
|
|
plan.setUpdateUser(doctorCode);
|
|
|
plan.setUpdateUserName(doctorName);
|
|
|
plan.setUpdateTime(new Date());
|
|
|
patientRehabilitationPlanDao.save(plan);
|
|
|
planObject.add(plan.getId());
|
|
|
List<RehabilitationDetailDO> planDetails = rehabilitationDetailDao.findByPlanIdAndTypeAndDoctor(plan.getId(),2,doctorCode);
|
|
|
for (RehabilitationDetailDO planDetail:planDetails){
|
|
|
planDetail.setDoctor(toDoctorCode);
|
|
|
planDetail.setDoctorName(toDoctorName);
|
|
|
planDetail.setUpdateTime(new Date());
|
|
|
planDetail.setUpdateUser(doctorCode);
|
|
|
planDetail.setUpdateUserName(doctorName);
|
|
|
rehabilitationDetailDao.save(planDetail);
|
|
|
planDetailObject.add(planDetail.getId());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
List<SpecialistPatientRelationDO> relations = specialistPatientRelationDao.findListByTeamCodeAndPatientAndDoctor(Integer.parseInt(teamCode),patientCode,doctorCode);
|
|
|
for (SpecialistPatientRelationDO relation:relations){
|
|
|
relation.setDoctor(toDoctorCode);
|
|
|
relation.setDoctorName(toDoctorName);
|
|
|
relation.setUpdateTime(new Date());
|
|
|
relation.setUpdateUser(doctorCode);
|
|
|
relation.setUpdateUserName(doctorName);
|
|
|
specialistPatientRelationDao.save(relation);
|
|
|
specialistPatientRelation.add(relation.getId());
|
|
|
}
|
|
|
}
|
|
|
result.put("planList",planObject);
|
|
|
result.put("planDetailList",planDetailObject);
|
|
|
result.put("relationList",specialistPatientRelation);
|
|
|
return result;
|
|
|
}
|
|
|
}
|