فهرست منبع

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

yeshijie 4 سال پیش
والد
کامیت
9f1baf9191

+ 15 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistController.java

@ -531,4 +531,19 @@ public class SpecialistController extends EnvelopRestEndpoint {
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping(value="/transferPatients")
    @ApiOperation(value = "专科端转移居民")
    public Envelop transferPatients(@ApiParam(name="teamCode",value = "医生所在团队",required = true)@RequestParam(value = "teamCode",required = true) String teamCode,
                                    @ApiParam(name="doctorCode",value = "当前医生code",required = true)@RequestParam(value = "doctorCode",required = true)String doctorCode,
                                    @ApiParam(name="toDoctorCode",value = "接收患者医生code",required = true)@RequestParam(value = "toDoctorCode",required = true)String toDoctorCode,
                                    @ApiParam(name="patients",value = "患者JsonArray列表(包含code)",required = true)@RequestParam(value = "patients",required = true)String patients){
        try {
            return MixEnvelop.getSuccess(SpecialistMapping.api_success,specialistService.transferPatients(teamCode, doctorCode, toDoctorCode, patients));
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
}

+ 3 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/SpecialistPatientRelationDao.java

@ -32,4 +32,7 @@ public interface SpecialistPatientRelationDao extends PagingAndSortingRepository
    @Query("select p from SpecialistPatientRelationDO p where p.doctor=?1 and p.patient =?2 and p.teamCode =?3 and p.status>=0 and p.signStatus=1")
    public SpecialistPatientRelationDO findByDoctorAndPatientAndTeamCode(String doctor,String patient,Integer teamCode);
    @Query("select p from SpecialistPatientRelationDO p where p.teamCode=?1 and p.patient=?2 and p.doctor=?3 and p.status>=0 and p.signStatus=1")
    List<SpecialistPatientRelationDO> findListByTeamCodeAndPatientAndDoctor(Integer teamCode,String patient,String doctor);
}

+ 3 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/PatientRehabilitationPlanDao.java

@ -21,6 +21,9 @@ public interface PatientRehabilitationPlanDao extends PagingAndSortingRepository
    @Query(" select p from PatientRehabilitationPlanDO p where p.patient=?1 and p.createUser=?2 order by p.createTime desc ")
    List<PatientRehabilitationPlanDO> findByPatientAndCreateUser(String patient, String doctor);
    @Query(" select p from PatientRehabilitationPlanDO p where p.patient=?1 and p.createUser=?2 and p.teamCode=?3 order by p.createTime desc ")
    List<PatientRehabilitationPlanDO> findByPatientAndCreateUserAAndTeamCode(String patient, String doctor,Integer teamCode);
    @Query(" select p from PatientRehabilitationPlanDO p where p.patient=?1 order by p.createTime desc ")
    List<PatientRehabilitationPlanDO> findByPatients(String patientCode);

+ 3 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/RehabilitationDetailDao.java

@ -88,4 +88,7 @@ public interface RehabilitationDetailDao extends PagingAndSortingRepository<Reha
    @Modifying
    @Query("delete from RehabilitationDetailDO t where t.planId = ?1 and (t.executeTime > ?2 OR t.executeTime is null OR t.executeTime<>'')  and t.status <> 1 ")
    void deleteDetailByPlanId(String planId, Date dateShort);
    @Query("select d from RehabilitationDetailDO d where d.planId=?1 and d.type=?2 and d.doctor=?3 ")
    List<RehabilitationDetailDO> findByPlanIdAndTypeAndDoctor(String planId,Integer type,String doctor);
}

+ 62 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

@ -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;
    }
}