소스 검색

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

trick9191 7 년 전
부모
커밋
11f65da2f1

+ 1 - 1
patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -2574,7 +2574,7 @@ public class SignWebService extends BaseService {
    }
    public List<String> findOpenidsByTown(String town) {
        String sql = "select w.openid from wlyy_sign_family w ,dm_hospital d where w.hospital=d.`code` and d.town='" + town + "' and w.openid is not null and w.openid !=''";
        String sql = "select  w.openid from wlyy_sign_family w ,dm_hospital d where w.hospital=d.`code` and d.town='" + town + "' and w.openid is not null and w.openid !=''";
        return jdbcTemplate.queryForList(sql, String.class);
    }

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionReviewedDao.java

@ -12,7 +12,7 @@ import java.util.List;
 */
public interface PrescriptionReviewedDao extends PagingAndSortingRepository<PrescriptionReviewed, Long>, JpaSpecificationExecutor<PrescriptionReviewed> {
    @Query("select p from PrescriptionReviewed p where p.prescriptionCode=?1")
    @Query(value = "select p from PrescriptionReviewed p where p.prescriptionCode=?1 order by p.reviewedTime desc")
    PrescriptionReviewed findByPrescriptionCode(String prescriptionCode);
    @Query("select p from PrescriptionReviewed p where p.prescriptionCode=?1 and p.status=?2")

+ 12 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -1295,6 +1295,13 @@ public class PrescriptionInfoService extends BaseService {
                " LEFT(pr.create_time,19) AS createTime, " +
                " pr.doctor, " +
                " pr.dispensary_type AS dispensaryType," +
                " e.address, " +
                " e.province_name AS provinceName, " +
                " e.city_name AS cityName," +
                " e.town_name AS townName," +
                " e.street_name AS streetName," +
                " e.hospital_name AS hospitalName," +
                " e.hospital_address AS hospitalAddress," +
                " e.expressage_code AS expressageCode, " +
                " e.expressage_name AS expressageName, " +
                " e.expressage_hospital_address AS expressageHospitalAddress, " +
@ -1360,7 +1367,7 @@ public class PrescriptionInfoService extends BaseService {
            param.add(endDate + " 23:59:59");
        }
        if (StringUtils.isNotBlank(hospital)) {
            pre_sql.append(" AND e.hospital_code = ? ");
            pre_sql.append(" AND e.patient_hospital_code = ? ");
            param.add(hospital);
        }
        if (StringUtils.isNotBlank(state)) {
@ -1402,7 +1409,7 @@ public class PrescriptionInfoService extends BaseService {
            param.add(endDate + " 23:59:59");
        }
        if (StringUtils.isNotBlank(hospital)) {
            pre_sql.append(" AND e.hospital_code = ? ");
            pre_sql.append(" AND e.patient_hospital_code = ? ");
            param.add(hospital);
        }
        if (StringUtils.isNotBlank(state)) {
@ -1446,13 +1453,13 @@ public class PrescriptionInfoService extends BaseService {
    }
    public JSONArray getHospitalListTitle(String teamCode) {
        StringBuffer pre_sql = new StringBuffer("SELECT e.hospital_code AS hospitalCode ,e.hospital_name AS hospitalName FROM " +
        StringBuffer pre_sql = new StringBuffer("SELECT e.patient_hospital_code AS hospitalCode ,e.patient_hospital_name AS hospitalName FROM " +
                "  wlyy_prescription pr " +
                "  JOIN wlyy_prescription_expressage e ON pr.code = e.prescription_code " +
                "  WHERE pr.admin_team_id = ? " +
                "  AND (e.expressage_code IS NULL OR e.expressage_code ='') " +
                "  AND pr.dispensary_type =3 " +
                "  GROUP BY e.hospital_code ");
                "  GROUP BY e.patient_hospital_code ");
        List<Map<String, Object>> list = jdbcTemplate.queryForList(pre_sql.toString(), new Object[]{teamCode});
        return new JSONArray(list);
    }
@ -1708,7 +1715,7 @@ public class PrescriptionInfoService extends BaseService {
                    sql +=" AND d.`name` LIKE '%"+name+"%' ";
                }
                if(page!=null&&size!=null){
                    sql += " LIMIT "+(page-1)+","+size;
                    sql += " LIMIT "+(page-1)*size+","+size;
                }
        String totalSql = "SELECT " +
                " count(1) AS total" +

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

@ -2582,7 +2582,8 @@ public class SignWebService extends BaseService {
    }
    public List<String> findOpenidsByTown(String town) {
        String sql = "select w.openid from wlyy_sign_family w ,dm_hospital d where w.hospital=d.`code` and d.town='" + town + "' and w.openid is not null and w.openid !=''";
        String sql = "select distinct w.openid from wlyy_sign_family w ,dm_hospital d where w.hospital=d.`code` and d.town='" + town + "' and w.openid is not null and w.openid !='' and w.`status`>0 " +
                " and w.expenses_status ='1' ";
        return jdbcTemplate.queryForList(sql, String.class);
    }

+ 8 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/WechatTagController.java

@ -37,6 +37,7 @@ public class WechatTagController extends BaseController {
            String string = weiXinTagUtil.createTag(tagName);
            return write(200, "创建成功", "date", string);
        } catch (Exception e) {
            error(e);
            return error(-1, "失败");
        }
    }
@ -49,6 +50,7 @@ public class WechatTagController extends BaseController {
            String string = weiXinTagUtil.deleteTag(tageId);
            return write(200, "删除成功", "date", string);
        } catch (Exception e) {
            error(e);
            return error(-1, "失败");
        }
    }
@ -60,6 +62,7 @@ public class WechatTagController extends BaseController {
            String string = weiXinTagUtil.queryTags();
            return write(200, "查询成功", "date", string);
        } catch (Exception e) {
            error(e);
            return error(-1, "失败");
        }
    }
@ -73,6 +76,7 @@ public class WechatTagController extends BaseController {
            String string = weiXinTagUtil.queryTagWithOpenid(openid);
            return write(200, "查询成功", "date", string);
        } catch (Exception e) {
            error(e);
            return error(-1, "失败");
        }
    }
@ -88,6 +92,7 @@ public class WechatTagController extends BaseController {
            String string = weiXinTagUtil.addTagWithOpenid(java.util.Arrays.asList(openis), tageId,null,null);
            return write(200, "查询成功", "date", string);
        } catch (Exception e) {
            error(e);
            return error(-1, "失败");
        }
    }
@ -103,6 +108,7 @@ public class WechatTagController extends BaseController {
            String string = weiXinTagUtil.deleteTagWithOpenid(java.util.Arrays.asList(openis), tageId);
            return write(200, "查询成功", "date", string);
        } catch (Exception e) {
            error(e);
            return error(-1, "失败");
        }
    }
@ -117,6 +123,7 @@ public class WechatTagController extends BaseController {
            String string = weiXinTagUtil.addTagWithOpenid(openids, tageId,null,null);
            return write(200, "查询成功", "date", string);
        } catch (Exception e) {
            error(e);
            return error(-1, "失败");
        }
    }
@ -130,6 +137,7 @@ public class WechatTagController extends BaseController {
            String string = weiXinTagUtil.deleteTagWithOpenid(openids, tageId);
            return write(200, "查询成功", "date", string);
        } catch (Exception e) {
            error(e);
            return error(-1, "失败");
        }
    }

+ 40 - 10
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/util/WeiXinTagUtil.java

@ -21,6 +21,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -74,26 +75,55 @@ public class WeiXinTagUtil {
        try {
            net.sf.json.JSONObject params = new net.sf.json.JSONObject();
            params.put("openid_list", net.sf.json.JSONArray.fromObject(openIds));
            params.put("tagid", tagId);
            String result = httpUtil.sendPost(add_user_tag + weiXinAccessTokenUtils.getAccessToken(), params.toString());
            //为openID分组
            List<List<String>> list = getSplitList(openIds,40);
            net.sf.json.JSONObject resultJson = net.sf.json.JSONObject.fromObject(result);
            if(list!=null&&list.size()>0){
            if (resultJson.containsKey("errcode")) {
                Integer status = resultJson.getInt("errcode");
                if (status != 0) {
                    throw new Exception("创建失败," + result);
                for(List<String> ops : list){
                    params.put("openid_list", net.sf.json.JSONArray.fromObject(openIds));
                    params.put("tagid", tagId);
                    String result = httpUtil.sendPost(add_user_tag + weiXinAccessTokenUtils.getAccessToken(), params.toString());
                    net.sf.json.JSONObject resultJson = net.sf.json.JSONObject.fromObject(result);
                }
            }
            return result;
//            if (resultJson.containsKey("errcode")) {
//                Integer status = resultJson.getInt("errcode");
//                if (status != 0) {
//                    throw new Exception("创建失败," + result);
//                }
//            }
            return "1";
        } catch (Exception e) {
            logger.error(e.getMessage());
            return null;
        }
    }
    /**
     *
     * @param list 要拆分的集合
     * @param size 指定的大小
     * @return
     */
    public static List<List<String>> getSplitList(List<String> list , int size)
    {
        List<List<String>> returnList = new ArrayList<List<String>>();
        int listSize = list.size();
        int num = listSize%size==0?listSize/size:(listSize/size+1);
        int start = 0;
        int end = 0;
        for(int i=1;i<=num;i++)
        {
            start = (i-1)*size;
            end = i*size>listSize?listSize:i*size;
            System.out.println(start+":"+end);
            returnList.add(list.subList(start, end));
        }
        return returnList;
    }
    /**
     * 根据openID给用户打标签,
     *