Explorar el Código

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

lyr hace 8 años
padre
commit
3c564dcd44

+ 3 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorDao.java

@ -30,6 +30,9 @@ public interface DoctorDao extends PagingAndSortingRepository<Doctor, Long>, Jpa
    @Query("select d from Doctor d where d.del = 1")
    List<Doctor> findAllDoctors();
    @Query("select d from Doctor d where d.del = 1 and d.name like ?1")
    List<Doctor> findDoctorsByName(String name);
    @Query("select d from Doctor d where d.del = 1 and d.hospital = ?1")
    Iterable<Doctor> findHospitalDoctors(String hospital);

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

@ -744,28 +744,32 @@ public class DoctorInfoService extends BaseService {
    }
    @Transactional
    public JSONArray findWorkingDoctorListByDept(String dept, String hospital, String level, String key) throws Exception {
        String sql = "select * from wlyy_doctor where dept = ? and hospital = ? and status = 1";
        Object[] args = null;
    public JSONArray findWorkingDoctorListByDept(String dept, String hospital, String level, String key, int page, int pagesize) throws Exception {
        String sql = "select * from wlyy_doctor where  status = 1";
        List<Object> args = new ArrayList<>();
        if (!StringUtils.isEmpty(dept)) {
            sql += " and dept = ? ";
            args.add(dept);
        }
        if (!StringUtils.isEmpty(hospital)) {
            sql += " and hospital = ? ";
            args.add(hospital);
        }
        if (!StringUtils.isEmpty(level)) {
            sql += " and level = ? ";
            args.add(Integer.valueOf(level));
        }
        if (!StringUtils.isEmpty(key)) {
            sql += " and name like ? ";
            args.add("%" + key + "%");
        }
        if (StringUtils.isNotEmpty(level) && StringUtils.isNotEmpty(key)) {
            args = new Object[]{dept, hospital, Integer.valueOf(level), "%" + key + "%"};
        } else if (StringUtils.isEmpty(level) && StringUtils.isNotEmpty(key)) {
            args = new Object[]{dept, hospital, "%" + key + "%"};
        } else if (StringUtils.isNotEmpty(level) && StringUtils.isEmpty(key)) {
            args = new Object[]{dept, hospital, Integer.valueOf(level)};
        } else {
            args = new Object[]{dept, hospital};
        if (page >= 0) {
            sql += " limit " + page * pagesize + "," + pagesize;
        }
        List<Doctor> doctors = jdbcTemplate.query(sql, args, new BeanPropertyRowMapper(Doctor.class));
        List<Doctor> doctors = jdbcTemplate.query(sql, args.toArray(), new BeanPropertyRowMapper(Doctor.class));
        JSONArray workingDoctor = new JSONArray();
        if (doctors.size() > 0) {
            for (Doctor doc : doctors) {

+ 38 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/hospital/HospitalDeptService.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.service.app.hospital;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.organization.HospitalDept;
import com.yihu.wlyy.repository.organization.HospitalDeptDao;
import com.yihu.wlyy.service.BaseService;
@ -10,12 +11,16 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.persistence.DynamicSpecifications;
import org.springside.modules.persistence.SearchFilter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -27,6 +32,8 @@ import java.util.Map;
public class HospitalDeptService extends BaseService {
    @Autowired
    private HospitalDeptDao hospitalDeptDao;
    @Autowired
    JdbcTemplate jdbcTemplate;
    public Page<HospitalDept> findDeptByHsoptail(String hospital, String key, long id, int pageSize) {
        if (pageSize <= 0) {
@ -50,4 +57,35 @@ public class HospitalDeptService extends BaseService {
        Specification<HospitalDept> spec = DynamicSpecifications.bySearchFilter(filters.values(), HospitalDept.class);
        return hospitalDeptDao.findAll(spec,pageRequest);
    }
    /**
     * 查询科室列表
     *
     * @param hospital
     * @param key
     * @param page
     * @param pagesize
     * @return
     */
    public List<HospitalDept> getHospitalDept(String hospital, String key, int page, int pagesize){
        String sql = "select * from dm_hospital_dept " +
                " where" +
                "    exists (select * from wlyy_doctor where wlyy_doctor.dept = dm_hospital_dept.code)" +
                " and hospital = ? ";
        List<Object> args = new ArrayList<>();
        args.add(hospital);
        if(StringUtils.isNotEmpty(key)){
            sql += " and name like ? ";
            args.add("%" + key + "%");
        }
        sql += " limit "+ (page*pagesize) + "," + pagesize;
        List<HospitalDept> hosList = jdbcTemplate.query(sql,args.toArray(),new BeanPropertyRowMapper(HospitalDept.class));
        return hosList;
    }
}

+ 50 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/hospital/HospitalService.java

@ -1,11 +1,14 @@
package com.yihu.wlyy.service.app.hospital;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.thoughtworks.xstream.persistence.XmlArrayList;
import com.yihu.wlyy.entity.address.Town;
import com.yihu.wlyy.repository.address.TownDao;
import org.apache.commons.collections.ArrayStack;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
@ -13,6 +16,8 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.persistence.DynamicSpecifications;
@ -31,6 +36,8 @@ public class HospitalService extends BaseService {
	private HospitalDao hospitalDao;
	@Autowired
	private TownDao townDao;
	@Autowired
	JdbcTemplate jdbcTemplate;
	/**
	 * 获取医院列表
@ -71,4 +78,47 @@ public class HospitalService extends BaseService {
	public List<Hospital> getHositalByTownCode(String town) {
		return hospitalDao.findByTownCode(town);
	}
	/**
	 * 查询医院列表
	 *
	 * @param type
	 * @param province
	 * @param city
	 * @param town
	 * @param key
	 * @param page
	 * @param pagesize
	 * @return
	 */
	public List<Hospital> getHospitals(int type,String province,String city,String town,String key,int page,int pagesize){
		String sql = "select * from dm_hospital where exists (select * from wlyy_doctor where wlyy_doctor.hospital = dm_hospital.code) and level = ? ";
		List<Object> args = new ArrayList<>();
		args.add(type);
		if(StringUtils.isNotEmpty(province)){
			sql += " and province = ? ";
			args.add(province);
		}
		if(StringUtils.isNotEmpty(city)){
			sql += " and city = ? ";
			args.add(city);
		}
		if(StringUtils.isNotEmpty(town)){
			sql += " and town = ? ";
			args.add(town);
		}
		if(StringUtils.isNotEmpty(key)){
			sql += " and name like ? ";
			args.add("%" + key + "%");
		}
		sql += " limit "+ (page*pagesize) + "," + pagesize;
		List<Hospital> hosList = jdbcTemplate.query(sql,args.toArray(),new BeanPropertyRowMapper(Hospital.class));
		return hosList;
	}
}

+ 63 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/talk/TalkGroupService.java

@ -77,6 +77,23 @@ public class TalkGroupService extends BaseService {
        discussionGroupMemberDao.save(member);
    }
    /**
     * 判断成员是否已在讨论组内
     *
     * @param group
     * @param member
     * @return
     */
    public boolean isMemberExists(String group, String member) {
        WlyyTalkGroupMember m = discussionGroupMemberDao.findByGroupCodeAndMemberCode(group, member);
        if (m != null) {
            return true;
        } else {
            return false;
        }
    }
    /**
     * 移除讨论组成员
     *
@ -392,6 +409,13 @@ public class TalkGroupService extends BaseService {
    }
    /**
     * 搜索转发医生
     *
     * @param doctor
     * @param filter
     * @return
     */
    public JSONObject searchImDoctor(String doctor, String filter) {
        JSONObject result = new JSONObject();
        String sqlDoc = "select * from wlyy_doctor where name like ? ";
@ -469,5 +493,44 @@ public class TalkGroupService extends BaseService {
        }
        return result;
    }
    /**
     * 查询医生IM列表
     *
     * @param doctor 医生
     * @param type 聊天对象类型 1:居民 2:医生
     * @return
     */
    public JSONArray getImList(String doctor,int type){
        return null;
    }
    /**
     * 查询医生最近联系IM列表
     *
     * @param doctor 医生
     * @param type 聊天对象类型 1:居民 2:医生
     * @return
     */
    public JSONArray getRecentImList(String doctor,int type){
        return null;
    }
    /**
     * 医生查询
     *
     * @param filter
     * @return
     */
    public List<Doctor> searchDoctor(String filter){
        List<Doctor> doctors = doctorDao.findDoctorsByName("%" + filter + "%");
        return doctors;
    }
}

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

@ -74,14 +74,10 @@ public class DoctorController extends BaseController {
    @Autowired
    private PatientInfoService patientInfoService;
    @Autowired
    private PatientService patientService;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private TblBasicDao tblBasicDao;
    @Autowired
    private HospitalDeptService hospitalDeptService;
    @Autowired
    private HospitalDeptService deptService;
    @Autowired
    private DoctorWorkTimeService workTimeService;
    /**
@ -240,6 +236,101 @@ public class DoctorController extends BaseController {
        }
    }
    /**
     * 查询存在医生的医院列表
     *
     * @param type     类型 1:医院 2社区
     * @param province 省份
     * @param city     城市
     * @param town     城镇
     * @param key      名字搜索
     * @param page     第几页
     * @param pagesize 页大小
     * @return
     */
    @RequestMapping(value = "hospital_list")
    @ResponseBody
    public String hospitals(@RequestParam(required = true) int type,
                            @RequestParam(required = false) String province,
                            @RequestParam(required = false) String city,
                            @RequestParam(required = false) String town,
                            @RequestParam(required = false) String key,
                            @RequestParam(required = true) int page,
                            @RequestParam(required = true) int pagesize) {
        try {
            if (type != 1 || type != 2) {
                return error(-1, "医院类型错误");
            }
            List<Hospital> hos = hospitalService.getHospitals(type, province, city, town, key, page, pagesize);
            return write(200, "查询成功", "data", hos);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    /**
     * 查询某个医院存在医生科室列表
     *
     * @param hospital 医院
     * @param key      科室名字搜索
     * @param page     第几页
     * @param pagesize 页大小
     * @return
     */
    @RequestMapping(value = "/dept_list")
    @ResponseBody
    public String deptList(@RequestParam(required = true) String hospital,
                           @RequestParam(required = false) String key,
                           @RequestParam(required = true) int page,
                           @RequestParam(required = true) int pagesize) {
        try {
            if (StringUtils.isEmpty(hospital)) {
                return error(-1, "医院不能为空");
            }
            List<HospitalDept> dept = deptService.getHospitalDept(hospital, key, page, pagesize);
            return write(200, "查询成功", "data", dept);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    /**
     * 根据科室查询当前在工作医生
     *
     * @param dept
     * @param hospital
     * @param level
     * @param key
     * @param page
     * @param pagesize
     * @return
     */
    @RequestMapping(value = "/doctor_list")
    @ResponseBody
    public String findWorkingDoctorByDept(@RequestParam(required = false) String dept,
                                          @RequestParam(required = false) String hospital,
                                          @RequestParam(required = false, defaultValue = "") String level,
                                          @RequestParam(required = false, defaultValue = "") String key,
                                          @RequestParam(required = false, defaultValue = "-1") int page,
                                          @RequestParam(required = false, defaultValue = "15") int pagesize) {
        try {
            if(page > 1){
                page = page - 1;
            }
            JSONArray doctors = doctorInfoService.findWorkingDoctorListByDept(dept, hospital, level, key, page, pagesize);
            return write(200, "查询成功", "data", doctors);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    /**
     * 根据机构查找科室
     *
@ -334,37 +425,6 @@ public class DoctorController extends BaseController {
        }
    }
    /**
     * 根据科室查询当前在工作医生
     *
     * @param dept
     * @param hospital
     * @param level
     * @param key
     * @return
     */
    @RequestMapping(value = "/findDoctorByDeptAndName")
    @ResponseBody
    public String findWorkingDoctorByDept(@RequestParam(required = true) String dept,
                                          @RequestParam(required = true) String hospital,
                                          @RequestParam(required = false, defaultValue = "") String level,
                                          @RequestParam(required = false, defaultValue = "") String key) {
        try {
            if (StringUtils.isEmpty(dept)) {
                return error(-1, "科室不能为空");
            }
            if (StringUtils.isEmpty(hospital)) {
                return error(-1, "医院不能为空");
            }
            JSONArray doctors = doctorInfoService.findWorkingDoctorListByDept(dept, hospital, level, key);
            return write(200, "查询成功", "data", doctors);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    /**
     * 名医列表
     *

+ 55 - 4
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/discussion/DoctorDiscussionGroupController.java

@ -336,6 +336,11 @@ public class DoctorDiscussionGroupController extends BaseController {
            @RequestParam(required = true) String doctor,
            @RequestParam(required = true) String doctorName, int doctorType) {
        try {
            if (talkGroupService.isMemberExists(groupCode, groupName)) {
                return error(-2, "成员已在该讨论组");
            }
            WlyyTalkGroupMember member = new WlyyTalkGroupMember();
            member.setGroupCode(groupCode);
@ -395,6 +400,9 @@ public class DoctorDiscussionGroupController extends BaseController {
            if (membersJArray != null) {
                for (int i = 0; i < membersJArray.length(); i++) {
                    JSONObject object = membersJArray.getJSONObject(i);
                    if (talkGroupService.isMemberExists(groupCode, object.getString("doctor"))) {
                        return error(-2, "添加失败,有成员已在该讨论组");
                    }
                    //指定的讨论组另一医生成员
                    WlyyTalkGroupMember doctorTalkMember = new WlyyTalkGroupMember();
@ -700,7 +708,7 @@ public class DoctorDiscussionGroupController extends BaseController {
    /**
     * 医生聊天对象搜索
     * 医生转发对象搜索
     *
     * @param filter
     * @return
@ -709,11 +717,11 @@ public class DoctorDiscussionGroupController extends BaseController {
    @ResponseBody
    public String imSearch(@RequestParam(required = true) String filter) {
        try {
            if(StringUtils.isEmpty(filter)){
                return error(-1,"搜索字段不能为空");
            if (StringUtils.isEmpty(filter)) {
                return error(-1, "搜索字段不能为空");
            }
            JSONObject result = talkGroupService.searchImDoctor(getUID(),filter);
            JSONObject result = talkGroupService.searchImDoctor(getUID(), filter);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
@ -721,4 +729,47 @@ public class DoctorDiscussionGroupController extends BaseController {
            return error(-1, "查询失败");
        }
    }
    /**
     * 查询医生与居民、医生聊天列表
     *
     * @param type 类型: 1居民  2医生
     * @return
     */
    @RequestMapping(value = "/im_list")
    @ResponseBody
    public String getPatientDoctorIm(@RequestParam(required = true) int type) {
        try {
            if (type != 1 || type != 2) {
                return error(-1, "类型错误");
            }
            JSONArray result = talkGroupService.getImList(getUID(), type);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    /**
     * 查询医生最近的联系人
     *
     * @param type 类型: 1居民  2医生
     * @return
     */
    @RequestMapping(value = "/recent_im_list")
    @ResponseBody
    public String getRecentIm(int type){
        try{
            if (type != 1 || type != 2) {
                return error(-1, "类型错误");
            }
            JSONArray result = talkGroupService.getRecentImList(getUID(), type);
            return write(200, "查询成功", "data", result);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
}