ソースを参照

每日推送接口,居民列表,居民搜索列表接口增加参数过滤只搜索有关注微信的居民

huangwenjie 7 年 前
コミット
d89698d121

+ 38 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -259,9 +259,12 @@ public class SignPatientLabelInfoService extends BaseService {
     * @param pagesize  页大小
     * @param isSlowDisease 是否是慢病管理
     * @param diseaseCondition
     * @param  isFollowWeChat
     * @return
     */
    public JSONArray getPatientByLabel(String doctor, String labelCode, String labelType, Long teamCode, int page, int pagesize, boolean isSlowDisease, String diseaseCondition) throws Exception {
    public JSONArray getPatientByLabel(String doctor, String labelCode, String labelType,
                                       Long teamCode, int page, int pagesize, boolean isSlowDisease,
                                       String diseaseCondition,boolean isFollowWeChat) throws Exception {
        Doctor doc = doctorDao.findByCode(doctor);
        if (doc == null) {
@ -307,6 +310,9 @@ public class SignPatientLabelInfoService extends BaseService {
            } else {
                throw new Exception("label is not exist");
            }
            if(isFollowWeChat){
                sql += "  AND p.openid IS NOT NULL AND p.openid <>'' ";
            }
            sql += " order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,t1.openid DESC ,convert(t1.name using gbk) ";
            args = new Object[]{doctor, doctor, teamCode};
        }else if("1".equals(labelType)){
@ -325,6 +331,11 @@ public class SignPatientLabelInfoService extends BaseService {
            if(StringUtils.isNotBlank(diseaseCondition)){
                sql = sql + " AND p.disease_condition ="+diseaseCondition;
            }
    
            if(isFollowWeChat){
                sql += "  AND p.openid IS NOT NULL AND p.openid <>'' ";
            }
            
            sql = sql +" order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,t1.openid DESC ,convert(t1.name using gbk) ";
            args = new Object[]{doctor, doctor, teamCode};
        }else if("3".equals(labelType) && isSlowDisease){
@ -345,7 +356,13 @@ public class SignPatientLabelInfoService extends BaseService {
                    "    AND t1.patient = t2.patient " +
                    "    AND (t1.doctor = ? or t1.doctor_health = ?)" +
                    "    AND t1.status > 0 " +
                    "    AND t1.admin_team_code = ? order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,t1.openid DESC ,convert(t1.name using gbk) ";
                    "    AND t1.admin_team_code = ? ";
    
            if(isFollowWeChat){
                sql += "  AND p.openid IS NOT NULL AND p.openid <>'' ";
            }
    
            sql = sql + " order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,t1.openid DESC ,convert(t1.name using gbk) ";
            if(StringUtils.isNotBlank(diseaseCondition)) {
                args = new Object[]{labelCode, diseaseCondition, labelType, doctor, doctor, teamCode};
            }else{
@ -365,7 +382,11 @@ public class SignPatientLabelInfoService extends BaseService {
                        "    t2.patient is null " +
                        "    AND (t1.doctor = ? or t1.doctor_health = ?) " +
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,t1.openid DESC ,convert(t1.name using gbk)";
                        "    AND t1.admin_team_code = ? ";
                if(isFollowWeChat){
                    sql += "  AND p.openid IS NOT NULL AND p.openid <>'' ";
                }
                sql  +=  "order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,t1.openid DESC ,convert(t1.name using gbk)";
                args = new Object[]{labelType, doctor, doctor, teamCode};
            }else {
@ -382,7 +403,11 @@ public class SignPatientLabelInfoService extends BaseService {
                        "    AND t1.patient = t2.patient " +
                        "    AND (t1.doctor = ? or t1.doctor_health = ?)" +
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,p.openid DESC ,convert(t1.name using gbk)";
                        "    AND t1.admin_team_code = ? " ;
                if(isFollowWeChat){
                    sql += "  AND p.openid IS NOT NULL AND p.openid <>'' ";
                }
                sql +=  " order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,p.openid DESC ,convert(t1.name using gbk)";
                args = new Object[]{labelCode, labelType, doctor, doctor, teamCode};
            }
@ -2003,6 +2028,7 @@ public class SignPatientLabelInfoService extends BaseService {
     *
     * @param doctor
     * @param filter
     * @param isFollowWeChat
     * @return
     * @throws Exception
     */
@ -2010,7 +2036,8 @@ public class SignPatientLabelInfoService extends BaseService {
                                        String labelCode, String labelType, long teamCode,
                                        String exLabelCode,
                                        String exLabelType,
                                        int page, int pagesize) throws Exception {
                                        int page, int pagesize,
                                        boolean isFollowWeChat) throws Exception {
        Doctor doc = doctorDao.findByCode(doctor);
        if (doc == null) {
            throw new Exception("doctor info can not find");
@ -2037,8 +2064,12 @@ public class SignPatientLabelInfoService extends BaseService {
                (StringUtils.isNotEmpty(labelCode) ? " AND t2.label = ? " : "") +
                (StringUtils.isNotEmpty(labelType) ? " AND t2.label_type = ? " : "") +
                (teamCode > 0 ? (" AND admin_team_code = " + teamCode) : "") +
                "  AND (t1.name like ? or p.address like ? or p.idcard like ? ) " +
                " ORDER BY  p.name DESC,p.address DESC, p.idcard DESC ";
                "  AND (t1.name like ? or p.address like ? or p.idcard like ? ) ";
        
        if(isFollowWeChat){
            sql += "   AND p.openid IS NOT NULL AND p.openid <>'' ";
        }
        sql +=  " ORDER BY  p.name DESC,p.address DESC, p.idcard DESC ";
        if (StringUtils.isNotEmpty(labelCode)) {
            args = new Object[]{doctor, doctor, labelCode, labelType, "%" + filter + "%", "%" + filter + "%", "%" + filter + "%"};
        } else if (StringUtils.isEmpty(labelCode) && StringUtils.isNotEmpty(labelType)) {

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

@ -1883,14 +1883,20 @@ public class SignWebService extends BaseService {
     *
     * @return
     */
    public JSONObject getOverDuePatients(String year, Long teamCode, String doctor, Integer page, Integer pageSize) {
    public JSONObject getOverDuePatients(String year, Long teamCode, String doctor, boolean isFollowWeChat,Integer page, Integer pageSize) {
        StringBuffer sql = new StringBuffer("SELECT IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age," +
                "t.patient code,t.idcard,t.name,t.mobile,t.openid,p.photo," +
                "t.ssc,t.type signType,p.sex ,t.expenses_status expensesStatus,c.disease " +
                " FROM wlyy_sign_family t " +
                " LEFT JOIN wlyy_patient p ON t.patient = p.code " +
                " LEFT JOIN (select patient,group_concat(label) disease,sum(label) lablesum from wlyy_sign_patient_label_info where label_type = 3 and status=1 GROUP BY patient) c on t.patient = c.patient " +
                " WHERE t.doctor ='" + doctor + "' AND t.admin_team_code =" + teamCode + " AND t.sign_year ='" + year + "' AND t.status =-4 order by p.standard_status DESC ,p.disease_condition DESC,c.lablesum DESC,p.openid DESC LIMIT " + page * pageSize + "," + pageSize);
                " WHERE t.doctor ='" + doctor + "' AND t.admin_team_code =" + teamCode + " AND t.sign_year ='" + year + "' AND t.status =-4 ");
        if(isFollowWeChat){
            sql.append(" AND p.openid IS NOT NULL AND p.openid <>'' order by p.standard_status DESC ,p.disease_condition DESC,c.lablesum DESC DESC LIMIT " + page * pageSize + "," + pageSize);
        }else{
            sql.append(" order by p.standard_status DESC ,p.disease_condition DESC,c.lablesum DESC,p.openid DESC LIMIT " + page * pageSize + "," + pageSize);
        }
        
        List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql.toString());
        JSONObject json = new JSONObject();
        json.put("result", rs);

+ 10 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java

@ -53,7 +53,8 @@ public class SignPatientLabelInfoController extends BaseController {
    public String getPatientByParams(@RequestParam String filter,
                                     @RequestParam String teamCode,
                                     @RequestParam int page,
                                     @RequestParam int pagesize) {
                                     @RequestParam int pagesize,
                                     @RequestParam(required = false, defaultValue = "false") boolean isFollowWeChat) {
        try {
            if (StringUtils.isEmpty(filter)) {
                return error(-1, "搜索条件不能为空!");
@ -62,7 +63,7 @@ public class SignPatientLabelInfoController extends BaseController {
                return error(-1, "团队不能为空!");
            }
            long team = Long.parseLong(teamCode);
            JSONArray temp = labelInfoService.getPatientByParams(getUID(), filter, null, null, team, null, null, page, pagesize);
            JSONArray temp = labelInfoService.getPatientByParams(getUID(), filter, null, null, team, null, null, page, pagesize,isFollowWeChat);
            return write(200, "查询成功!", "data", temp);
        } catch (Exception e) {
            error(e);
@ -154,7 +155,8 @@ public class SignPatientLabelInfoController extends BaseController {
                                        @RequestParam(required = false) int page,
                                        @RequestParam(required = false) int pagesize,
                                        @RequestParam(required = false) String diseaseCondition,
                                        @RequestParam(required = false) boolean isSlowDisease) {
                                        @RequestParam(required = false) boolean isSlowDisease,
                                        @RequestParam(required = false, defaultValue = "false") boolean isFollowWeChat) {
        try {
            if (StringUtils.isEmpty(labelCode)) {
                return error(-1, "标签cdoe不能为空");
@ -171,12 +173,12 @@ public class SignPatientLabelInfoController extends BaseController {
            //labelType=9 签约过期的居民列表
            if (labelType.equals("9")) {
                JSONObject jsonObject = signWebService.getOverDuePatients(labelCode, teamCode, getUID(), page, pagesize);
                JSONObject jsonObject = signWebService.getOverDuePatients(labelCode, teamCode, getUID(),isFollowWeChat, page, pagesize);
                return write(200, "查询成功", "data", jsonObject);
            }
            JSONArray result = labelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page, pagesize,isSlowDisease,diseaseCondition);
//            JSONArray result = labelInfoService.getPatientByLabel("xy201703150222", labelCode, labelType, teamCode, page, pagesize,isSlowDisease,diseaseCondition);
            JSONArray result = labelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page, pagesize,isSlowDisease,diseaseCondition,isFollowWeChat);
//            JSONArray result = labelInfoService.getPatientByLabel("xy201703150222", labelCode, labelType, teamCode, page, pagesize,isSlowDisease,diseaseCondition,isFollowWeChat);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
@ -292,7 +294,8 @@ public class SignPatientLabelInfoController extends BaseController {
            @RequestParam(required = false) String labelType,
            @RequestParam(required = false) Long teamCode,
            @RequestParam(required = false) boolean isSlowDisease,
            @RequestParam(required = false) String diseaseCondition) {
            @RequestParam(required = false) String diseaseCondition,
            @RequestParam(required = false) boolean isBindWechat) {
        try {
            if (StringUtils.isEmpty(labelType)) {
                return error(-1, "标签类型不能为空");