Jelajahi Sumber

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

huangwenjie 7 tahun lalu
induk
melakukan
a57f8123d5

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorAdminTeamMemberDao.java

@ -36,6 +36,10 @@ public interface DoctorAdminTeamMemberDao extends
            "AND m.doctorCode = d.code AND t.available = true AND m.available = true ORDER BY d.level")
    List<Doctor> findAllMembers(@Param(value = "teamId") long teamId);
    @Query("SELECT d,m.available as available FROM AdminTeamMember m, AdminTeam t, Doctor d WHERE t.id = :teamId AND t.id = m.teamId " +
            "AND m.doctorCode = d.code AND t.available = true ORDER BY d.level")
    List<Object[]> findMembers(@Param(value = "teamId") long teamId);
    @Query("SELECT case when count(A) > 0 then true else false END FROM AdminTeamMember A WHERE A.teamId = :teamId " +
            "AND A.doctorCode = :doctorCode AND A.available = true")
    Boolean isMemberExist(@Param(value = "teamId") long teamId, @Param(value = "doctorCode") String doctorCode);

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java

@ -433,4 +433,8 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
    //根据patient查找有效签约的hospital
    @Query("select a.hospital from SignFamily a where a.patient = ?1 and a.status = 1 and a.expensesStatus = '1'")
    String getHospital(String patient);
    //查看团队内医生签约人数
    @Query("select count(1) from SignFamily a where a.status >= 0 and a.adminTeamId = ?1 and (a.doctor = ?2 or a.doctorHealth = ?2)")
    int countByAdminTeamId(Long adminTeamId, String doctor);
}

+ 21 - 11
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -159,7 +159,7 @@ public class SignWebService extends BaseService {
     * @param pageSize
     * @return
     */
    public List<Map<String, Object>> getSignWebByDoctor(String doctor, int status, int page, int pageSize) {
    public List<Map<String, Object>> getSignWebByDoctor(String doctor, int status, String patientInfo, int page, int pageSize) {
        Doctor d = doctorDao.findByCode(doctor);
        String sql;
@ -171,6 +171,7 @@ public class SignWebService extends BaseService {
                    "    ,b.code  as  patient" +
                    "    ,b.idcard " +
                    "    ,b.name " +
                    "    ,b.mobile" +
                    "    ,b.province_name  as provinceName" +
                    "    ,b.city_name  as cityName" +
                    "    ,b.town_name  as townName" +
@ -188,7 +189,8 @@ public class SignWebService extends BaseService {
                    " ( select renew_flag,code,patient,doctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin from wlyy_sign_family where doctor_health = ? and doctor is null  and status = ? and type = 2" +
                    (status == 3 ? " and expenses_status = '1'" : "") + " order by begin desc ) a " +
                    " ,wlyy_patient b " +
                    " where a.patient = b.code  order by applyDate desc limit " + page * pageSize + "," + pageSize;
                    " where a.patient = b.code and (b.`name` like ? or b.code LIKE ? ) "+
                    " order by applyDate desc limit " + page * pageSize + "," + pageSize;
        } else {
            // 查询语句
            sql = "select " +
@ -197,6 +199,7 @@ public class SignWebService extends BaseService {
                    "    ,b.code  as  patient" +
                    "    ,b.idcard " +
                    "    ,b.name " +
                    "    ,b.mobile" +
                    "    ,b.province_name  as provinceName" +
                    "    ,b.city_name  as cityName" +
                    "    ,b.town_name  as townName" +
@ -214,7 +217,8 @@ public class SignWebService extends BaseService {
                    " ( select renew_flag,code,patient,doctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin from wlyy_sign_family where doctor = ?  and status = ? and type = 2" +
                    (status == 3 ? " and expenses_status = '1'" : "") + " order by begin desc ) a " +
                    " ,wlyy_patient b " +
                    " where a.patient = b.code  order by applyDate desc limit " + page * pageSize + "," + pageSize;
                    " where a.patient = b.code  and (b.`name` like ? or b.code LIKE ? ) "+
                    "order by applyDate desc limit " + page * pageSize + "," + pageSize;
        }
        // 查询已经签约语句
@ -224,6 +228,7 @@ public class SignWebService extends BaseService {
                "    ,b.code  as  patient" +
                "    ,b.idcard " +
                "    ,b.name " +
                "    ,b.mobile" +
                "    ,b.province_name  as provinceName" +
                "    ,b.city_name  as cityName" +
                "    ,b.town_name  as townName" +
@ -241,13 +246,15 @@ public class SignWebService extends BaseService {
                " ( select renew_flag,code,patient,doctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin from wlyy_sign_family where (doctor = ? or doctor_health = ?)  and status = ? and type = 2" +
                (status == 3 ? " and expenses_status = '1'" : "") + " order by begin desc ) a " +
                " ,wlyy_patient b " +
                " where a.patient = b.code  order by applyDate desc limit " + page * pageSize + "," + pageSize;
                " where a.patient = b.code  and (b.`name` like ? or b.code LIKE ? ) "+
                "order by applyDate desc limit " + page * pageSize + "," + pageSize;
        // 未缴费查询语句
        String sqlExpenses = "select " +
                "    a.code " +
                "    ,a.doctor " +
                "    ,b.code  as  patient" +
                "    ,b.name " +
                "    ,b.mobile" +
                "    ,b.idcard " +
                "    ,b.province_name  as provinceName" +
                "    ,b.city_name  as cityName" +
@ -265,7 +272,8 @@ public class SignWebService extends BaseService {
                " from " +
                " ( select patient_apply_date,renew_flag,code,patient,doctor,status,id,apply_date,reason,begin,expenses_status,LENGTH(trim(ifnull(expenses_status,''))) len from wlyy_sign_family where (doctor = ? or doctor_health = ?)  and status > ? and type = 2 order by begin desc ) a " +
                " ,wlyy_patient b " +
                " where a.patient = b.code and (a.expenses_status = '0' or a.len < 1) order by applyDate desc limit " + page * pageSize + "," + pageSize;
                " where a.patient = b.code and (a.expenses_status = '0' or a.len < 1) and (b.`name` like ? or b.code LIKE ? ) "+
                "order by applyDate desc limit " + page * pageSize + "," + pageSize;
        // 已解约查询语句
        String surrSql = "select " +
@ -273,6 +281,7 @@ public class SignWebService extends BaseService {
                "    ,a.doctor " +
                "    ,b.code  as  patient" +
                "    ,b.name " +
                "    ,b.mobile" +
                "    ,b.idcard " +
                "    ,b.province_name  as provinceName" +
                "    ,b.city_name  as cityName" +
@ -290,7 +299,8 @@ public class SignWebService extends BaseService {
                " from " +
                " ( select patient_apply_date,renew_flag,code,patient,doctor,status,id,apply_date,apply_unsign_date,reason,begin from wlyy_sign_family where (doctor = ? or doctor_health = ?)  and ( status = ? or status = ? ) and type = 2 order by begin desc ) a " +
                " ,wlyy_patient b " +
                " where a.patient = b.code  order by applyDate desc limit " + page * pageSize + "," + pageSize;
                " where a.patient = b.code  and (b.`name` or b.code like ? ) " +
                "order by applyDate desc limit " + page * pageSize + "," + pageSize;
        // 分页信息
        //PageRequest pageRequest = new PageRequest(page - 1, pageSize);
@ -299,19 +309,19 @@ public class SignWebService extends BaseService {
        List<Map<String, Object>> patients = null;
        switch (status) {
            case 1:// 待签约
                patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 0});
                patients = StringUtils.isBlank(patientInfo) ? jdbcTemplate.queryForList(sql, new Object[]{doctor, 0, "%%", "%%"}):jdbcTemplate.queryForList(sql, new Object[]{doctor, 0, "%"+patientInfo + "%", "%"+patientInfo + "%"});
                break;
            case 2:// 待解约
                patients = jdbcTemplate.queryForList(sql, new Object[]{doctor, 2});
                patients = StringUtils.isBlank(patientInfo) ? jdbcTemplate.queryForList(sql, new Object[]{doctor, 2, "%%", "%%"}) : jdbcTemplate.queryForList(sql, new Object[]{doctor, 2, "%"+patientInfo + "%", "%"+patientInfo + "%"});
                break;
            case 3:// 已签约
                patients = jdbcTemplate.queryForList(isSignSql, new Object[]{doctor, doctor, 1});
                patients = StringUtils.isBlank(patientInfo) ? jdbcTemplate.queryForList(isSignSql, new Object[]{doctor, doctor, 1, "%%", "%%"}) : jdbcTemplate.queryForList(isSignSql, new Object[]{doctor, doctor, 1, "%"+patientInfo + "%", "%"+patientInfo + "%"});
                break;
            case 4:// 4已经解约
                patients = jdbcTemplate.queryForList(surrSql, new Object[]{doctor, doctor, -3, -4});
                patients = StringUtils.isBlank(patientInfo) ? jdbcTemplate.queryForList(surrSql, new Object[]{doctor, doctor, -3, -4, "%%", "%%"}) : jdbcTemplate.queryForList(surrSql, new Object[]{doctor, doctor, -3, -4, "%"+patientInfo + "%", "%"+patientInfo + "%"});
                break;
            case 5: // 未缴费
                patients = jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor, doctor, 0});
                patients = StringUtils.isBlank(patientInfo) ? jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor, doctor, 0, "%%", "%%"}) : jdbcTemplate.queryForList(sqlExpenses, new Object[]{doctor, doctor, 0, "%"+patientInfo + "%", "%"+patientInfo + "%"});
        }
        return patients;

+ 16 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/team/AdminTeamService.java

@ -436,6 +436,22 @@ public class AdminTeamService extends BaseService {
        return memberDao.findAllMembers(teamId);
    }
    public List<Object[]> findMembers(long teamId) {
        List<Object[]> members= new ArrayList<>();
        List<Object[]> list= new ArrayList<>();
        int count = 0;
        members = memberDao.findMembers(teamId);
        for(Object[] member : members){
            Object[] obj = new Object[member.length + 1];
            System.arraycopy(member, 0, obj, 0, member.length);
            Doctor d = (Doctor) member[0];
            count = signFamilyDao.countByAdminTeamId(teamId, d.getCode());
            obj[obj.length - 1] = count;
            list.add(obj);
        }
        return list;
    }
    public List<Doctor> getMembers(long teamId, String doctorCode) {
        return memberDao.findAllHeathExcludeThis(teamId, doctorCode);
    }

+ 7 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java

@ -54,7 +54,7 @@ public class DoctorSignController extends WeixinBaseController {
    @Autowired
    private PatientService patientService;
    @RequestMapping(value = "getPatientFamilyServer", method = RequestMethod.GET)
    @RequestMapping(value = "getPatientFamilyServer",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取居民慢病服务类型")
    public String getPatientFamilyServer(@ApiParam(name = "patient", value = "居民code") @RequestParam(required = true) String patient) {
@ -231,11 +231,12 @@ public class DoctorSignController extends WeixinBaseController {
    public String getSignInfoByDoctor(
            @RequestParam(required = false) Integer status,
            @RequestParam(required = false) Integer doctorType,
            @RequestParam(required = false) String patientInfo,
            @RequestParam(required = false) Integer page,
            @RequestParam(required = false) Integer pageSize) {
        try {
            page = page > 0 ? page - 1 : 0;
            List<Map<String, Object>> listSign = signWebService.getSignWebByDoctor(getUID(), status, page, pageSize);
            page = page > 0 ? page -1 : 0;
            List<Map<String, Object>> listSign = signWebService.getSignWebByDoctor(getUID(), status, patientInfo, page, pageSize);
            JSONObject data = new JSONObject();
            List<JSONObject> jsonArray = new ArrayList<>();
@ -250,6 +251,7 @@ public class DoctorSignController extends WeixinBaseController {
                    json.put("doctorCode", temp.get("doctor"));
                    json.put("patientCode", temp.get("patient"));
                    json.put("patientName", temp.get("name"));
                    json.put("mobile", temp.get("mobile"));
                    json.put("age", IdCardUtil.getAgeForIdcard(String.valueOf(temp.get("idcard"))));
                    json.put("provinceName", temp.get("provinceName"));
                    json.put("cityName", temp.get("cityName"));
@ -475,7 +477,7 @@ public class DoctorSignController extends WeixinBaseController {
            } else {
                return write(200, "提醒成功!", "data", rs);
            }
        } catch (Exception e) {
        }catch (Exception e){
            error(e);
            return error(-1, "提醒失败");
        }
@ -832,6 +834,7 @@ public class DoctorSignController extends WeixinBaseController {
            return error(-1, "更新签约失败!");
        }
    }
    @RequestMapping(value = "/findPatientCertificate", method = {RequestMethod.GET})
    @ResponseBody
    @ApiOperation("获取居民服务类型凭证")

+ 10 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/team/AdminTeamController.java

@ -174,10 +174,16 @@ public class AdminTeamController extends BaseController {
    @ApiOperation(value = "获取团队成员")
    public String getTeamMembers(@PathVariable("team_id") long teamId) {
        try {
            List<Doctor> members = memberService.getMembers(teamId);
            return write(200, "OK", "data", new JSONArray(copyBeans(members, "id", "code", "name", "hospital",
                    "jobName", "level", "sex", "photo")));
            List<Object[]> members = memberService.findMembers(teamId);
            List<Map<String,Object>> list = new ArrayList<>();
            Map<String, Object> map = new HashMap();
            for(Object[] member : members){
                map = copyBeanProperties(member[0], "id", "code", "name", "hospital", "jobName", "level", "sex", "photo");
                map.put("available",member[1]);
                map.put("count",member[2]);
                list.add(map);
            }
            return write(200, "OK", "data", new JSONArray(list));
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());