Browse Source

Merge branch 'dev' of lyr/patient-co-management into dev

lyr 8 years ago
parent
commit
8a12d8cb49

+ 56 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -29,6 +29,7 @@ import com.yihu.wlyy.repository.doctor.DoctorTeamMemberDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientSickDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
import com.yihu.wlyy.service.common.SMSService;
import com.yihu.wlyy.util.MD5;
import org.apache.commons.lang3.StringUtils;
@ -91,6 +92,8 @@ public class DoctorInfoService extends BaseService {
    private ConsultTeamDao consultTeamDao;
    @Autowired
    SMSService smsService;
    @Autowired
    DoctorWorkTimeService workTimeService;
    /**
     * 获取医生的签约病人
@ -616,6 +619,7 @@ public class DoctorInfoService extends BaseService {
        return doctorDao.findAll(spec, pageRequest);
    }
    public Page<Doctor> findFamousDoctor(String key, Integer type, int page, int pageSize, Integer level) {
        if (pageSize <= 0) {
            pageSize = 10;
@ -643,6 +647,58 @@ public class DoctorInfoService extends BaseService {
        return doctorDao.findAll(spec, pageRequest);
    }
    public List<Doctor> findFamousDoctorList(String key, Integer type, int page, int pageSize, Integer level) throws Exception {
        if (pageSize <= 0) {
            pageSize = 10;
        }
        if (page <= 0) {
            page = 1;
        }
        // 排序
        Sort sort = new Sort(Sort.Direction.DESC, "name");
        // 查询全部
        Map<String, SearchFilter> filters = new HashMap<String, SearchFilter>();
        if (StringUtils.isNotEmpty(key)) {
            filters.put("name", new SearchFilter("name", SearchFilter.Operator.LIKE, key));
        }
        filters.put("isFamous", new SearchFilter("isFamous", SearchFilter.Operator.EQ, type));
        if (level != null && level > 0 && level < 4) {
            filters.put("level", new SearchFilter("level", SearchFilter.Operator.EQ, level));
        }
        Specification<Doctor> spec = DynamicSpecifications.bySearchFilter(filters.values(), Doctor.class);
        List<Doctor> doctors = doctorDao.findAll(spec, sort);
        List<Doctor> workingDoctor = new ArrayList<>();
        List<Doctor> returnList = new ArrayList<>();
        if (doctors.size() > 0) {
            for (Doctor doc : doctors) {
                JSONObject iswork = type == 1 ? workTimeService.isFamousDoctorWorking(doc.getCode()) : workTimeService.isDoctorWorking(doc.getCode());
                if (iswork.getString("status").equals("1")) {
                    workingDoctor.add(doc);
                }
            }
            int start = (page - 1) * pageSize;
            int end = start + pageSize;
            if(end > workingDoctor.size()){
                end = workingDoctor.size();
            }
            if(start < workingDoctor.size()) {
                returnList = workingDoctor.subList(start, end);
            }
        }
        return returnList;
    }
    public void updateTeamHealthDoctor(String newDoctorCode, String oldDoctorCode, String patient) throws Exception {
        //得到患者的签约信息
        SignFamily signFamily = signFamilyDao.findByPatient(patient);

+ 2 - 7
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -352,7 +352,7 @@ public class DoctorController extends BaseController {
            int pagesize) {
        try {
            JSONArray array = new JSONArray();
            Page<Doctor> list = doctorInfoService.findFamousDoctor(key, type, page, pagesize, level);
            List<Doctor> list = doctorInfoService.findFamousDoctorList(key, type, page, pagesize, level);
            if (list != null) {
                for (Doctor doctor : list) {
                    JSONObject json = new JSONObject();
@ -378,12 +378,7 @@ public class DoctorController extends BaseController {
                    json.put("dept", doctor.getDept());
                    json.put("deptName", doctor.getDeptName());
                    json.put("expertise", doctor.getExpertise());
                    JSONObject iswork = workTimeService.isDoctorWorking(doctor.getCode());
                    if (iswork.getString("status").equals("1")) {
                        json.put("isworking", 1);
                    } else {
                        json.put("isworking", 0);
                    }
                    json.put("isworking", 1);
                    array.put(json);
                }
            }