Quellcode durchsuchen

专科医生家医列表搜索

huangwenjie vor 6 Jahren
Ursprung
Commit
6d03c87363

+ 3 - 2
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistController.java

@ -269,9 +269,10 @@ public class SpecialistController extends EnvelopRestEndpoint {
    @GetMapping(value = SpecialistMapping.specialist.findDoctorAndDoctorHealthBySpecialDoctor)
    @ApiOperation(value = "获取当前专科医生有关联的家庭医生和健管师列表")
    public MixEnvelop findDoctorAndDoctorHealthBySpecialDoctor(
            @ApiParam(name = "doctor", value = "专科医生code") @RequestParam(required = true)String doctor){
            @ApiParam(name = "doctor", value = "专科医生code") @RequestParam(required = true)String doctor,
            @ApiParam(name = "name", value = "家庭医生姓名") @RequestParam(required = false)String name){
        try {
            return specialistService.findDoctorAndDoctorHealthBySpecialDoctor(doctor);
            return specialistService.findDoctorAndDoctorHealthBySpecialDoctor(doctor,name);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());

+ 60 - 27
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

@ -626,33 +626,66 @@ public class SpecialistService{
        return MixEnvelop.getSuccess(SpecialistMapping.api_success,patientSignInfoVOs.get(0));
    }
    
    public MixEnvelop findDoctorAndDoctorHealthBySpecialDoctor(String doctor) {
        String sql = "SELECT " +
                "doctor.CODE AS CODE," +
                "doctor.NAME AS NAME," +
                "doctor.sex AS sex," +
                "doctor.birthday AS birthday," +
                "doctor.photo AS photo," +
                "doctor.mobile AS mobile," +
                "doctor.hospital AS hospital," +
                "doctor.hospital_name AS hospitalName," +
                "doctor.dept AS dept," +
                "doctor.dept_name AS deptName," +
                "doctor.job AS job," +
                "doctor.job_name AS jobName," +
                "doctor.LEVEL AS LEVEL," +
                "doctor.qrcode AS qrcode," +
                "doctor.czrq AS czrq," +
                "doctor.del AS del," +
                "doctor.idcard AS idcard " +
                "FROM wlyy.wlyy_doctor doctor JOIN ( " +
                "SELECT a.doctor AS doctorcode FROM wlyy.wlyy_sign_family a RIGHT JOIN ( " +
                "SELECT patient FROM wlyy_specialist_patient_relation WHERE sign_status> 0 AND `status`>=0 AND doctor='"+doctor+"') b ON a.patient=b.patient WHERE a.`status`=1 AND a.expenses_status = 1 " +
                "UNION  " +
                "SELECT a.doctor_health AS doctorcode FROM wlyy.wlyy_sign_family a RIGHT JOIN ( " +
                "SELECT patient FROM wlyy_specialist_patient_relation WHERE sign_status> 0 AND `status`>=0 AND doctor='"+doctor+"') b ON a.patient=b.patient WHERE a.`status`=1 AND a.expenses_status = 1 " +
                ") " +
                "t ON doctor.CODE=t.doctorcode";
    public MixEnvelop findDoctorAndDoctorHealthBySpecialDoctor(String doctor,String name) {
    
        String sql = "";
        
        if(StringUtils.isNotBlank(name)){
            sql = "SELECT " +
                    "doctor.CODE AS CODE," +
                    "doctor.NAME AS NAME," +
                    "doctor.sex AS sex," +
                    "doctor.birthday AS birthday," +
                    "doctor.photo AS photo," +
                    "doctor.mobile AS mobile," +
                    "doctor.hospital AS hospital," +
                    "doctor.hospital_name AS hospitalName," +
                    "doctor.dept AS dept," +
                    "doctor.dept_name AS deptName," +
                    "doctor.job AS job," +
                    "doctor.job_name AS jobName," +
                    "doctor.LEVEL AS LEVEL," +
                    "doctor.qrcode AS qrcode," +
                    "doctor.czrq AS czrq," +
                    "doctor.del AS del," +
                    "doctor.idcard AS idcard " +
                    "FROM wlyy.wlyy_doctor doctor JOIN ( " +
                    "SELECT a.doctor AS doctorcode FROM wlyy.wlyy_sign_family a RIGHT JOIN ( " +
                    "SELECT patient FROM wlyy_specialist_patient_relation WHERE sign_status> 0 AND `status`>=0 AND doctor='"+doctor+"') b ON a.patient=b.patient WHERE a.`status`=1 AND a.expenses_status = 1 " +
                    "UNION  " +
                    "SELECT a.doctor_health AS doctorcode FROM wlyy.wlyy_sign_family a RIGHT JOIN ( " +
                    "SELECT patient FROM wlyy_specialist_patient_relation WHERE sign_status> 0 AND `status`>=0 AND doctor='"+doctor+"') b ON a.patient=b.patient WHERE a.`status`=1 AND a.expenses_status = 1 " +
                    ") " +
                    "t ON doctor.CODE=t.doctorcode and doctor.NAME like '%"+name+"%'";
        }else{
            sql = "SELECT " +
                    "doctor.CODE AS CODE," +
                    "doctor.NAME AS NAME," +
                    "doctor.sex AS sex," +
                    "doctor.birthday AS birthday," +
                    "doctor.photo AS photo," +
                    "doctor.mobile AS mobile," +
                    "doctor.hospital AS hospital," +
                    "doctor.hospital_name AS hospitalName," +
                    "doctor.dept AS dept," +
                    "doctor.dept_name AS deptName," +
                    "doctor.job AS job," +
                    "doctor.job_name AS jobName," +
                    "doctor.LEVEL AS LEVEL," +
                    "doctor.qrcode AS qrcode," +
                    "doctor.czrq AS czrq," +
                    "doctor.del AS del," +
                    "doctor.idcard AS idcard " +
                    "FROM wlyy.wlyy_doctor doctor JOIN ( " +
                    "SELECT a.doctor AS doctorcode FROM wlyy.wlyy_sign_family a RIGHT JOIN ( " +
                    "SELECT patient FROM wlyy_specialist_patient_relation WHERE sign_status> 0 AND `status`>=0 AND doctor='"+doctor+"') b ON a.patient=b.patient WHERE a.`status`=1 AND a.expenses_status = 1 " +
                    "UNION  " +
                    "SELECT a.doctor_health AS doctorcode FROM wlyy.wlyy_sign_family a RIGHT JOIN ( " +
                    "SELECT patient FROM wlyy_specialist_patient_relation WHERE sign_status> 0 AND `status`>=0 AND doctor='"+doctor+"') b ON a.patient=b.patient WHERE a.`status`=1 AND a.expenses_status = 1 " +
                    ") " +
                    "t ON doctor.CODE=t.doctorcode";
        }
        
        List<SignFamilyDoctorVO> patientSignInfoVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamilyDoctorVO.class));
        return MixEnvelop.getSuccess(SpecialistMapping.api_success,patientSignInfoVOs);
    }