Forráskód Böngészése

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

yeshijie 7 éve
szülő
commit
ff56b3ed92
24 módosított fájl, 842 hozzáadás és 52 törlés
  1. 12 3
      common/common-entity/src/main/java/com/yihu/device/entity/DevicePatientHealthIndex.java
  2. 10 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/Patient.java
  3. 4 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/family/FamilyMemberService.java
  4. 6 0
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/model/Patient.java
  5. 13 3
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/model/PatientHealthIndex.java
  6. 10 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/Patient.java
  7. 13 3
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/device/PatientHealthIndex.java
  8. 10 0
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/entity/Patient.java
  9. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/HealthEduArticlePatientService.java
  10. 6 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/hospital/HospitalService.java
  11. 243 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java
  12. 183 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  13. 65 10
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  14. 92 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java
  15. 8 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/DoctorService.java
  16. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java
  17. 58 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java
  18. 11 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java
  19. 15 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcDoctorController.java
  20. 29 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcEduArticleController.java
  21. 6 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcLableController.java
  22. 0 14
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkzl/EduArticleController.java
  23. 36 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/WechatMenuController.java
  24. 9 0
      patient-co/patient-co-wlyy/src/main/resources/wechat/weixin_menu_feldsher.txt

+ 12 - 3
common/common-entity/src/main/java/com/yihu/device/entity/DevicePatientHealthIndex.java

@ -23,9 +23,9 @@ public class DevicePatientHealthIndex extends IdEntity {
	private String intervene;
	// 血糖/收缩压/体重/腰围/早餐前空腹
	private String value1;
	// 舒张压/早餐后空腹
	// 舒张压/早餐后空腹/身高
	private String value2;
	// 午餐空腹
	// 午餐空腹/身高
	private String value3;
	// 午餐后
	private String value4;
@ -35,7 +35,7 @@ public class DevicePatientHealthIndex extends IdEntity {
	private String value6;
	// 睡前
	private String value7;
	// 健康指标类型(1血糖,2血压,3体重,4腰围)
	// 健康指标类型(1血糖,2血压,3体重/身高/BMI,4腰围)
	private int type;
	// 记录时间
@ -51,6 +51,8 @@ public class DevicePatientHealthIndex extends IdEntity {
	//设备编号
	private String deviceSn;
	private int status;//状态:0为标准,1为异常
	public String getUser() {
		return user;
	}
@ -186,4 +188,11 @@ public class DevicePatientHealthIndex extends IdEntity {
		this.deviceSn = deviceSn;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
}

+ 10 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/Patient.java

@ -72,7 +72,7 @@ public class Patient extends IdEntity implements Serializable {
	private String address;
	// 疾病类型,0健康,1高血压,2糖尿病,3高血压+糖尿病
	private Integer disease;
	// 病情:0绿标,1黄标,2红标
	// 病情:0绿标,1黄标,2红标,3重点关注
	private Integer diseaseCondition;
	// 病历记录总数
	private Integer recordAmount;
@ -98,6 +98,8 @@ public class Patient extends IdEntity implements Serializable {
	private Integer isWxtag;
	//微信iagId
	private Integer wxtagid;
	//居民预警状态:0为标准,1为预警状态
	private Integer standardStatus;
	public Integer getSicardStatus() {
@ -430,4 +432,11 @@ public class Patient extends IdEntity implements Serializable {
		}
	}
	public Integer getStandardStatus() {
		return standardStatus;
	}
	public void setStandardStatus(Integer standardStatus) {
		this.standardStatus = standardStatus;
	}
}

+ 4 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/family/FamilyMemberService.java

@ -109,7 +109,10 @@ public class FamilyMemberService extends BaseService {
                map1.put("sex", map.get("sex"));
                map1.put("isAuthorize", map.get("is_authorize"));//0:未授权,1:已授权
                map1.put("birthday", map.get("birthday"));
                map1.put("idcard", StringUtils.isEmpty(String.valueOf(map.get("idcard"))) ? "" : map.get("idcard").toString());
                String idCard = StringUtils.isEmpty(String.valueOf(map.get("idcard"))) ? "" : String.valueOf(map.get("idcard"));
                map1.put("idcard", CommonUtil.getIdcardEncode(idCard));
                map1.put("idcardAll", idCard);
                map1.put("photo", map.get("photo"));
                map1.put("mobile", map.get("mobile"));
                map1.put("address", StringUtils.isEmpty(String.valueOf(map.get("address"))) ? "" : map.get("address"));

+ 6 - 0
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/model/Patient.java

@ -81,6 +81,8 @@ public class Patient extends IdEntity implements Serializable {
	private String openid;
	// 用户状态:1正常,0禁用,-1恶意注册,2审核中
	private Integer status;
	//居民预警状态:0为标准,1为预警状态
	private Integer standardStatus;
	public Patient(Long id) {
@ -319,4 +321,8 @@ public class Patient extends IdEntity implements Serializable {
	public void setStatus(Integer status) {
		this.status = status;
	}
	public static long getSerialVersionUID() {
		return serialVersionUID;
	}
}

+ 13 - 3
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/model/PatientHealthIndex.java

@ -21,9 +21,9 @@ public class PatientHealthIndex extends IdEntity {
	private String intervene;
	// 血糖/收缩压/体重/腰围/早餐前空腹
	private String value1;
	// 舒张压/早餐后空腹
	// 舒张压/早餐后空腹/身高
	private String value2;
	// 午餐空腹
	// 午餐空腹/身高
	private String value3;
	// 午餐后
	private String value4;
@ -33,7 +33,7 @@ public class PatientHealthIndex extends IdEntity {
	private String value6;
	// 睡前
	private String value7;
	// 健康指标类型(1血糖,2血压,3体重,4腰围)
	// 健康指标类型(1血糖,2血压,3体重/身高/BMI,4腰围)
	private int type;
	// 记录时间
	private Date recordDate;
@ -48,6 +48,8 @@ public class PatientHealthIndex extends IdEntity {
	//设备编号
	private String deviceSn;
	private int status;//状态:0为标准,1为异常
	public String getUser() {
		return user;
	}
@ -182,4 +184,12 @@ public class PatientHealthIndex extends IdEntity {
	public void setDeviceSn(String deviceSn) {
		this.deviceSn = deviceSn;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
}

+ 10 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/Patient.java

@ -74,6 +74,8 @@ public class Patient extends IdEntity {
	private Integer status;
	// 用户手机备注
	private String mobileRemarks;
	//居民预警状态:0为标准,1为预警状态
	private Integer standardStatus;
	public Patient() {
	}
@ -312,4 +314,12 @@ public class Patient extends IdEntity {
	public void setMobileRemarks(String mobileRemarks) {
		this.mobileRemarks = mobileRemarks;
	}
	public Integer getStandardStatus() {
		return standardStatus;
	}
	public void setStandardStatus(Integer standardStatus) {
		this.standardStatus = standardStatus;
	}
}

+ 13 - 3
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/entity/device/PatientHealthIndex.java

@ -23,9 +23,9 @@ public class PatientHealthIndex extends IdEntity {
	private String intervene;
	// 血糖/收缩压/体重/腰围/早餐前空腹
	private String value1;
	// 舒张压/早餐后空腹
	// 舒张压/早餐后空腹/身高
	private String value2;
	// 午餐空腹
	// 午餐空腹/BMI
	private String value3;
	// 午餐后
	private String value4;
@ -35,7 +35,7 @@ public class PatientHealthIndex extends IdEntity {
	private String value6;
	// 睡前
	private String value7;
	// 健康指标类型(1血糖,2血压,3体重,4腰围)
	// 健康指标类型(1血糖,2血压,3体重/身高/BMI,4腰围)
	private int type;
	// 记录时间
	private Date recordDate;
@ -50,6 +50,8 @@ public class PatientHealthIndex extends IdEntity {
	//设备编号
	private String deviceSn;
	private int status;//状态:0为标准,1为异常
	public String getUser() {
		return user;
	}
@ -184,4 +186,12 @@ public class PatientHealthIndex extends IdEntity {
	public void setDeviceSn(String deviceSn) {
		this.deviceSn = deviceSn;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
}

+ 10 - 0
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/entity/Patient.java

@ -76,6 +76,8 @@ public class Patient extends IdEntity {
	private String mobileRemarks;
	// 居委会
	private String sickVillage;
	//居民预警状态:0为标准,1为预警状态
	private Integer standardStatus;
	public Patient() {
	}
@ -322,4 +324,12 @@ public class Patient extends IdEntity {
	public void setMobileRemarks(String mobileRemarks) {
		this.mobileRemarks = mobileRemarks;
	}
	public Integer getStandardStatus() {
		return standardStatus;
	}
	public void setStandardStatus(Integer standardStatus) {
		this.standardStatus = standardStatus;
	}
}

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/HealthEduArticlePatientService.java

@ -118,6 +118,7 @@ public class HealthEduArticlePatientService extends BaseService {
                "     , wlyy_health_edu_article b" +
                " where" +
                "      a.article = b.code" +
                " and (a.type =1 or a.type is null or a.type = '')"+  //添加类型判断是集美的推送还是三师原来的推送
                " and a.patient = ?" +
                (id > 0 ? " and a.id < ? " : "") +
                (wheaType > 0 ? " and a.wheaType = ? " : "") +
@ -160,6 +161,7 @@ public class HealthEduArticlePatientService extends BaseService {
        " wlyy_patient p"+
        " where"+
        " a.article = b.code"+
        " and (a.type =1 or a.type is null or a.type = '')"+  //添加类型判断是集美的推送还是三师原来的推送
        " and a.patient = p.code"+
        " and a.doctor =? "+
        " group BY a.batch_no,a.article,a.attached_content,b.summary,a.doctor order by a.czrq desc  limit ?,? ";

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

@ -118,7 +118,12 @@ public class HospitalService extends BaseService {
            sql += " and code = ? ";
            args.add(hospitalId);
        }
        sql += " limit " + (page * pagesize) + "," + pagesize;
        //修复分页数错误引起的BUG--huangwenjie--2017.09.06
        pagesize = page * pagesize;
        page = (page - 1) * pagesize;
        sql += " limit " + page + "," + pagesize;
        List<Hospital> hosList = jdbcTemplate.query(sql, args.toArray(), new BeanPropertyRowMapper(Hospital.class));

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

@ -497,6 +497,249 @@ public class SignPatientLabelInfoService extends BaseService {
        }
    }
    /**
     * 根据标签查询患者信息
     *
     * @param labelCode 标签code
     * @param labelType 标签类型
     * @return
     */
    public JSONArray getPatientByLabelCount(String doctor, String labelCode, String labelType, Long teamCode) throws Exception {
        Doctor doc = doctorDao.findByCode(doctor);
        if (doc == null) {
            throw new Exception("doctor info can not find");
        }
        Map<String, JSONObject> result = new TreeMap<>();
        List<Map<String, Object>> signList = new ArrayList<>();
        String sql = "";
        Object[] args = null;
        if (labelType.equals("5")) {
            Calendar today = Calendar.getInstance();
            Calendar startDate = Calendar.getInstance();
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
            sql = "select * " +
                    " from " +
                    "     wlyy_sign_family " +
                    " where (doctor = ? or doctor_health = ?) and status > 0 and admin_team_code = ? ";
            if (labelCode.equals("1")) {
                int week = today.get(Calendar.DAY_OF_WEEK) - 2;
                if (week == -1) {
                    week = 6;
                }
                startDate.add(Calendar.DATE, -week);
                sql += " and apply_date between '" + (df.format(startDate.getTime()) + " 00:00:00")
                        + "' and '" + (df.format(today.getTime()) + " 23:59:59'");
            } else if (labelCode.equals("2")) {
                startDate.set(Calendar.DATE, 1);
                sql += " and apply_date between '" + (df.format(startDate.getTime()) + " 00:00:00")
                        + "' and '" + (df.format(today.getTime()) + " 23:59:59'");
            } else if (labelCode.equals("3")) {
                startDate.add(Calendar.DATE, 30);
                sql += " and end between '" + (df.format(today.getTime()) + " 00:00:00")
                        + "' and '" + (df.format(startDate.getTime()) + " 23:59:59'");
            } else {
                throw new Exception("label is not exist");
            }
            sql += " order by openid desc,convert(name using gbk) ";
            args = new Object[]{doctor, doctor, teamCode};
        }else if("1".equals(labelType)){
            sql = "SELECT " +
                    " f.* " +
                    "FROM " +
                    " wlyy_sign_family_server s ,( " +
                    "  SELECT " +
                    "   t1.*, p.openid AS ptOpenid " +
                    "  FROM " +
                    "   wlyy_sign_family t1, " +
                    "   wlyy_patient p " +
                    "  WHERE " +
                    "  p. CODE = t1.patient " +
                    "  AND ( " +
                    "   t1.doctor = ? " +
                    "   OR t1.doctor_health = ? " +
                    "  ) " +
                    "  AND t1. STATUS > 0 " +
                    "  AND t1.admin_team_code = ?" +
                    " ) f " +
                    "WHERE " +
                    " f. CODE = s.sign_code " +
                    " AND s.server_type ='"+labelCode+"' " +
                    " ORDER BY " +
                    " f.ptOpenid DESC";
            args = new Object[]{doctor, doctor, teamCode};
        } else {
            if (labelCode.equals("0")) {
                sql = "SELECT " +
                        "    t1.* " +
                        " FROM " +
                        "    wlyy_sign_family t1 " +
                        " left join " +
                        "    (select l.patient,l.label,l.label_type,l.label_name from wlyy_sign_family f left join wlyy_sign_patient_label_info l on f.patient = l.patient where (f.doctor = '" + doctor + "' or f.doctor_health = '" + doctor + "') and f.status > 0 and l.label_type = ? and l.status = 1) t2 " +
                        " on t1.patient = t2.patient " +
                        " WHERE " +
                        "    t2.patient is null " +
                        "    AND (t1.doctor = ? or t1.doctor_health = ?) " +
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? order by t1.openid desc,convert(t1.name using gbk) ";
                args = new Object[]{labelType, doctor, doctor, teamCode};
            }else {
                sql = "SELECT " +
                        "    t1.* " +
                        " FROM " +
                        "    wlyy_sign_family t1, " +
                        "    wlyy_sign_patient_label_info t2 " +
                        " WHERE " +
                        "    t2.label = ? " +
                        "    AND t2.label_type = ? " +
                        "    AND t2.status = 1 " +
                        "    AND t1.patient = t2.patient " +
                        "    AND (t1.doctor = ? or t1.doctor_health = ?)" +
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? order by t1.openid desc,convert(t1.name using gbk) ";
                args = new Object[]{labelCode, labelType, doctor, doctor, teamCode};
            }
        }
        signList = jdbcTemplate.queryForList(sql, args);
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
                Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
                if (p == null) {
                    continue;
                }
                if (result.containsKey(p.getCode())) {
                    JSONObject jsonP = result.get(p.getCode());
                    if (!String.valueOf(jsonP.get("signType")).equals(String.valueOf(sign.get("type")))) {
                        jsonP.put("signType", 3);
                    }
                    if (String.valueOf(sign.get("type")).equals("2")) {
                        jsonP.put("qyrq", sign.get("apply_date") != null ? DateUtil.dateToStr((Date) sign.get("apply_date"), DateUtil.YYYY_MM_DD) : "");
                        // 缴费情况
                        jsonP.put("expensesStatus", sign.get("expenses_status") != null ? String.valueOf(sign.get("expenses_status")) : "0");
                        // 缴费时间
                        jsonP.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
                        // 缴费类型
                        jsonP.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")) : "");
                        if (StringUtils.isEmpty(String.valueOf(jsonP.get("expensesStatus"))) || String.valueOf(jsonP.get("expensesStatus")).equals("0")) {
                            boolean epTime = false;
                            try {
                                epTime = redisTemplate.opsForSet().isMember("expenses:remind:set", p.getCode());
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                            if (!epTime) {
                                jsonP.put("expensesRemindStatus", 0);
                            } else {
                                jsonP.put("expensesRemindStatus", 1);
                            }
                        }
                        boolean epTime = false;
                        try {
                            epTime = redisTemplate.opsForSet().isMember("wechat:focus:remind:set", p.getCode());
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        if (!epTime) {
                            jsonP.put("wechatFocusRemind", 0);
                        } else {
                            jsonP.put("wechatFocusRemind", 1);
                        }
                    }
                    continue;
                }
                //List<SignPatientLabelInfo> labels = labelInfoDao.findByPatientAndStatus(sign.get("patient").toString(), 1);
                JSONObject json = new JSONObject();
                // 设置患者标识
                json.put("code", p.getCode());
                // 设置患者姓名
                json.put("name", p.getName());
                // 设置患者手机号
                json.put("mobile", p.getMobile());
                // 设置患者微信openid
                json.put("openid", StringUtils.isNotEmpty(p.getOpenid()) ? p.getOpenid() : "");
                // 设置患者联系电话
                json.put("phone", p.getPhone());
                // 设置患者紧急联系人
                json.put("emerMobile", sign.get("emer_mobile") == null ? "" : String.valueOf(sign.get("emer_mobile")));
                // 设置患者头像
                json.put("photo", p.getPhoto());
                // 设置患者年龄
                json.put("age", IdCardUtil.getAgeForIdcard(p.getIdcard()));
                // 设置患者性别
                json.put("sex", p.getSex());
                // 设置签约日期
                json.put("qyrq", sign.get("apply_date") != null ? DateUtil.dateToStr((Date) sign.get("apply_date"), DateUtil.YYYY_MM_DD) : "");
                // 设置签约类型
                json.put("signType", sign.get("type") == null ? "" : sign.get("type"));
                // 身份证号
                json.put("idcard", p.getIdcard());
                // 社保号
                json.put("ssc", p.getSsc());
                if (String.valueOf(sign.get("type")).equals("2")) {
                    // 缴费情况
                    json.put("expensesStatus", sign.get("expenses_status") != null ? String.valueOf(sign.get("expenses_status")) : "0");
                    // 缴费时间
                    json.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
                    // 缴费类型
                    json.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")) : "");
                    if (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0")) {
                        boolean epTime = false;
                        try {
                            epTime = redisTemplate.opsForSet().isMember("expenses:remind:set", p.getCode());
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        if (!epTime) {
                            json.put("expensesRemindStatus", 0);
                        } else {
                            json.put("expensesRemindStatus", 1);
                        }
                    }
                } else {
                    // 缴费情况
                    json.put("expensesStatus", "1");
                }
                boolean epTime = false;
                try {
                    epTime = redisTemplate.opsForSet().isMember("wechat:focus:remind:set", p.getCode());
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (!epTime) {
                    json.put("wechatFocusRemind", 0);
                } else {
                    json.put("wechatFocusRemind", 1);
                }
                // 患者标签
                //json.put("labels", labels == null ? "" : labels);
                result.put(p.getCode(), json);
            }
        }
        if (result.size() > 0) {
            List<JSONObject> list = Lists.newArrayList(result.values());
            return new JSONArray(list);
        } else {
            return new JSONArray();
        }
    }
    /**
     * 获取团队下的患者
     *

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

@ -588,6 +588,74 @@ public class PrescriptionInfoService extends BaseService {
        }
    }
    public void setTotalSQL(StringBuffer pre_sql, List<Object> params, Integer teamCode, String state, String startDate, String endDate, String nameKeyword, String patient) {
        if (teamCode != null && teamCode > 0) {
            pre_sql.append(" AND pr.admin_team_id =?");
        }
        params.add(teamCode);
        if (StringUtils.isNotBlank(state)) {
            pre_sql.append(" AND pr.status IN (" + state + ") ");
        }
        if (StringUtils.isNotBlank(startDate)) {
            pre_sql.append(" AND pr.create_time >= ? ");
            params.add(startDate+" 00:00:00");
        }
        if (StringUtils.isNotBlank(endDate)) {
            pre_sql.append(" AND pr.create_time <= ? ");
            params.add(endDate+" 23:59:59");
        }
        if (StringUtils.isNotBlank(nameKeyword)) {
            pre_sql.append(" AND pr.patient_name like ? ");
            params.add("%" + nameKeyword + "%");
        }
        if (StringUtils.isNotBlank(patient)) {
            pre_sql.append(" AND pr.patient = ?");
            params.add(patient);
        }
    }
    /**
     * 获取处方详情总数
     * @param teamCode
     * @param state
     * @param diseases
     * @param startDate
     * @param endDate
     * @param nameKeyword
     * @param patient
     * @return
     */
    public JSONObject getDoctorPrescriptionTotal(Integer teamCode, String state, String diseases, String startDate, String endDate, String nameKeyword, String patient) {
        StringBuffer pre_sql = new StringBuffer("SELECT count(1) AS total" +
                " FROM " +
                " wlyy_prescription pr " +
                " LEFT JOIN wlyy_patient p ON pr.patient = p.`code` ");
        List<Object> params = new ArrayList<>();
        //先判断疾病类型是否为空
        if (StringUtils.isNotBlank(diseases)) {
            //疾病类型不为空,关联查询疾病类型表
            pre_sql.append(" ,wlyy_prescription_diagnosis s " +
                    " WHERE s.prescription_code = pr.code " +
                    " AND s.health_problem = ?");
            params.add(diseases);
            setTotalSQL(pre_sql, params, teamCode, state, startDate, endDate, nameKeyword, patient);
        } else {
            //查询所有疾病类型表
            pre_sql.append(" WHERE 1=1 ");
            setTotalSQL(pre_sql, params, teamCode, state, startDate, endDate, nameKeyword, patient);
        }
        List<Map<String, Object>> rs = jdbcTemplate.queryForList(pre_sql.toString(), params.toArray());
        JSONObject jsonRs = new JSONObject();
        if(rs!=null && rs.size()>0){
            jsonRs.put("total",rs.get(0).get("total"));
        }else{
            jsonRs.put("total",0);
        }
        return jsonRs;
    }
    /**
     * 获取续方信息
     *
@ -855,6 +923,26 @@ public class PrescriptionInfoService extends BaseService {
        return new JSONArray(rs);
    }
    public JSONObject getHDoctorPrescriptionExpressageTotal(String teamCode, String type, String doctor, String nameKey, String startDate, String endDate, String hospital, String state) {
        StringBuffer pre_sql = new StringBuffer("SELECT count(1) AS total " +
                " FROM " +
                " wlyy_prescription pr " +
                " LEFT JOIN wlyy_patient p ON pr.patient = p.`code` " +
                " JOIN wlyy_prescription_expressage e ON pr.code = e.prescription_code " +
                " WHERE 1=1 AND pr.status >="+PrescriptionLog.PrescriptionLogStatus.pay_success.getValue()+" ");
        List<Object> params = new ArrayList<>();
        setExpressageTotalSql(pre_sql, params, teamCode, type, doctor, nameKey, startDate, endDate, hospital, state);
        List<Map<String, Object>> rs = jdbcTemplate.queryForList(pre_sql.toString(), params.toArray());
        JSONObject jsonRs=new JSONObject();
        if(rs!=null&&rs.size()>0){
            jsonRs.put("total",rs.get(0).get("total"));
        }else{
            jsonRs.put("total",0);
        }
        return jsonRs;
    }
    public void setExpressageSql(StringBuffer pre_sql, List<Object> param, String teamCode, String type, String doctor, String nameKey, String startDate, String endDate, String hospital, String state, Integer page, Integer size) {
        if (StringUtils.isNotBlank(type)) {
@ -896,6 +984,43 @@ public class PrescriptionInfoService extends BaseService {
        }
    }
    public void setExpressageTotalSql(StringBuffer pre_sql, List<Object> param, String teamCode, String type, String doctor, String nameKey, String startDate, String endDate, String hospital, String state) {
        if (StringUtils.isNotBlank(type)) {
            if ("1".equals(type)) {
                pre_sql.append(" AND e.expressage_Code = ?");
                param.add(doctor);
            } else {
                pre_sql.append(" AND e.accept_Code = ?");
                param.add(doctor);
            }
        }
        if (StringUtils.isNotBlank(teamCode)) {
            pre_sql.append(" AND pr.admin_team_id = ? ");
            param.add(teamCode);
        }
        if (StringUtils.isNotBlank(nameKey)) {
            pre_sql.append(" AND p.name LIKE ? ");
            param.add("%" + nameKey + "%");
        }
        if (StringUtils.isNotBlank(startDate)) {
            pre_sql.append(" AND pr.create_time >= ? ");
            param.add(startDate + " 00:00:00");
        }
        if (StringUtils.isNotBlank(endDate)) {
            pre_sql.append(" AND pr.create_time <= ? ");
            param.add(endDate + " 23:59:59");
        }
        if (StringUtils.isNotBlank(hospital)) {
            pre_sql.append(" AND e.hospital_code = ? ");
            param.add(hospital);
        }
        if (StringUtils.isNotBlank(state)) {
            pre_sql.append(" AND pr.status = ? ");
            param.add(state);
        }
    }
    /**
     * 获取订单跟踪下拉列表
     * @param doctor
@ -1076,6 +1201,27 @@ public class PrescriptionInfoService extends BaseService {
        return new JSONArray(rs);
    }
    public JSONObject getDoctorPrescriptionExpressageTotal(Integer teamCode, String nameKey, String startDate, String endDate, String hospital, String state, String dispensaryType, String AllocationType) {
        StringBuffer pre_sql = new StringBuffer("SELECT count(1) AS total " +
                " FROM " +
                " wlyy_prescription pr " +
                " LEFT JOIN wlyy_patient p ON pr.patient = p.`code` " +
                " JOIN wlyy_prescription_expressage e ON pr.code = e.prescription_code " +
                " JOIN wlyy_prescription_reviewed r ON pr.code = r.prescription_code " +
                " WHERE r.status=1 AND pr.status >="+PrescriptionLog.PrescriptionLogStatus.pay_success.getValue()+" ");
        List<Object> params = new ArrayList<>();
        setDoctorExpressageTotalSql(pre_sql, params, teamCode, nameKey, startDate, endDate, hospital, state, dispensaryType, AllocationType);
        List<Map<String, Object>> rs = jdbcTemplate.queryForList(pre_sql.toString(), params.toArray());
        JSONObject jsonRs = new JSONObject();
        if(rs!=null && rs.size()>0){
            jsonRs.put("total",rs.get(0).get("total"));
        }else{
            jsonRs.put("total",0);
        }
        return jsonRs;
    }
    public void setDoctorExpressageSql(StringBuffer pre_sql, List<Object> param, Integer teamCode, String nameKey, String startDate, String endDate, String hospital, String state, String dispensaryType, String AllocationType, Integer page, Integer size) {
        if (StringUtils.isNotBlank(nameKey)) {
            pre_sql.append(" AND p.name LIKE ? ");
@ -1118,6 +1264,43 @@ public class PrescriptionInfoService extends BaseService {
        }
    }
    public void setDoctorExpressageTotalSql(StringBuffer pre_sql, List<Object> param, Integer teamCode, String nameKey, String startDate, String endDate, String hospital, String state, String dispensaryType, String AllocationType) {
        if (StringUtils.isNotBlank(nameKey)) {
            pre_sql.append(" AND p.name LIKE ? ");
            param.add("%" + nameKey + "%");
        }
        if (teamCode != null && teamCode > 0) {
            pre_sql.append(" AND pr.admin_team_id = ? ");
            param.add(teamCode);
        }
        if (StringUtils.isNotBlank(startDate)) {
            pre_sql.append(" AND pr.create_time >= ? ");
            param.add(startDate + " 00:00:00");
        }
        if (StringUtils.isNotBlank(endDate)) {
            pre_sql.append(" AND pr.create_time <= ? ");
            param.add(endDate + " 23:59:59");
        }
        if (StringUtils.isNotBlank(hospital)) {
            pre_sql.append(" AND e.hospital_code = ? ");
            param.add(hospital);
        }
        if (StringUtils.isNotBlank(state)) {
            pre_sql.append(" AND pr.status = ? ");
            param.add(state);
        }
        if (StringUtils.isNotBlank(dispensaryType)) {
            pre_sql.append(" AND pr.dispensary_type = ? ");
            param.add(dispensaryType);
        }
        if (StringUtils.isNotBlank(AllocationType)) {
            //1为未分配建管师列表
            if ("1".equals(AllocationType)) {
                pre_sql.append(" AND e.expressage_code IS NULL ");
            }
        }
    }
    public JSONObject getCountExpressage(String teamCode) {
        StringBuffer pre_sql = new StringBuffer("SELECT " +
                " count(1) AS count  " +

+ 65 - 10
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -44,6 +44,7 @@ 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;
@ -1162,7 +1163,7 @@ public class FamilyContractService extends BaseService {
                }
            }
            new Thread(new SignUploadTask(sf.getCode(), httpUtil,jwUrl)).start();
            new Thread(new SignUploadTask(sf.getCode(), httpUtil, jwUrl)).start();
            JSONObject participants = new JSONObject();
            participants.put(sf.getPatient(), 0);
            if (StringUtils.equals(sf.getDoctor(), sf.getDoctorHealth())) {//全科和建管同一个人
@ -1182,8 +1183,8 @@ public class FamilyContractService extends BaseService {
        }
        BusinessLogs.info(BusinessLogs.BusinessType.sign, signDoctorCode, sf.getPatient(), new JSONObject(sf));
        //签约成功之后给患者新增标签
        String openId=sf.getOpenid();
       hospital=sf.getHospital();
        String openId = sf.getOpenid();
        hospital = sf.getHospital();
        return temp;
    }
@ -1501,7 +1502,7 @@ public class FamilyContractService extends BaseService {
                    String ms = sf.getName() + ",您好!祝贺您,成功签约" + doc.getName() + "医生团队,您已可以享受家庭医生所带来的无微不至的健康保健服务。" +
                            "为了给您提供更好的服务,请尽快完成缴费。您可登录签约居民的微信账号,进入签约管理,选择待缴费的签约记录进行缴费操作,如需线下缴费,请尽快到" + (hos != null ? hos.getName() : "") + "社区(地址:" +
                            (hos != null ? hos.getAddress() : "") + ")缴费。";
                    data.put("content",ms);
                    data.put("content", ms);
                    //String first = (String) json.get("first");
                    data.remove("first");
                    data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
@ -1509,7 +1510,7 @@ public class FamilyContractService extends BaseService {
                }
            }
            new Thread(new SignUploadTask(sf.getCode(), httpUtil,jwUrl)).start();
            new Thread(new SignUploadTask(sf.getCode(), httpUtil, jwUrl)).start();
            JSONObject participants = new JSONObject();
            participants.put(sf.getPatient(), 0);
            if (StringUtils.equals(sf.getDoctor(), sf.getDoctorHealth())) {//全科和建管同一个人
@ -1529,8 +1530,8 @@ public class FamilyContractService extends BaseService {
        result.put("status", 1);
        BusinessLogs.info(BusinessLogs.BusinessType.sign, caller, sf.getPatient(), new JSONObject(sf));
        //签约成功之后给患者新增标签
        String openId=sf.getOpenid();
        String hospital=sf.getHospital();
        String openId = sf.getOpenid();
        String hospital = sf.getHospital();
        return result;
    }
@ -1665,8 +1666,8 @@ public class FamilyContractService extends BaseService {
        }
        //根据openId给患者清掉标签
        String openId=sf.getOpenid();
        String hospital=sf.getHospital();
        String openId = sf.getOpenid();
        String hospital = sf.getHospital();
        return 1;
    }
@ -2845,7 +2846,7 @@ public class FamilyContractService extends BaseService {
     */
    public SignFamily getSignFamilyBySessionId(String sessionId, String patient) {
        SignFamily signFamily = null;
        String sql = "select id from " +im_dataBase_name + ".topics where  session_id = '" + sessionId + "' order by create_time desc limit 0, 1";
        String sql = "select id from " + im_dataBase_name + ".topics where  session_id = '" + sessionId + "' order by create_time desc limit 0, 1";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        if (list != null && list.size() > 0) {
            String consultCode = list.get(0).get("id").toString();
@ -3998,4 +3999,58 @@ public class FamilyContractService extends BaseService {
        }
    }
    /**
     * 查找医生所属团队下的某个居民
     *
     * @param teamCode
     * @param patientName
     * @param page
     * @param pageSize
     * @return
     */
    public List<Patient> signPatientsByName(Long teamCode, String patientName, Integer page, Integer pageSize) {
        StringBuffer sb = new StringBuffer("SELECT " +
                "  p.* " +
                " FROM " +
                "  wlyy_sign_family a ," +
                "  wlyy_patient p ," +
                "WHERE " +
                "  a.admin_team_code =? " +
                " AND a.patient=p.`code` " +
                " AND a.`status` IN (1, 2) ");
        List params = new ArrayList<>();
        params.add(teamCode);
        if (!org.springframework.util.StringUtils.isEmpty(patientName)) {
            sb.append(" AND a.`name` LIKE ? ");
            params.add("%" + patientName + "%");
        }
        pageSize = page * pageSize;
        page = (page - 1) * pageSize;
        sb.append(" limit " + page + "," + pageSize);
        List<Patient> patients = jdbcTemplate.query(sb.toString(), params.toArray(), new BeanPropertyRowMapper(Patient.class));
        return patients;
    }
    public Integer signPatientsByNameCount(Long teamCode, String patientName) {
        StringBuffer sb = new StringBuffer("SELECT " +
                "  p.* " +
                " FROM " +
                "  wlyy_sign_family a ," +
                "  wlyy_patient p ," +
                "WHERE " +
                "  a.admin_team_code =? " +
                " AND a.patient=p.`code` " +
                " AND a.`status` IN (1, 2) ");
        List params = new ArrayList<>();
        params.add(teamCode);
        if (!org.springframework.util.StringUtils.isEmpty(patientName)) {
            sb.append(" AND a.`name` LIKE ? ");
            params.add("%" + patientName + "%");
        }
        Integer patients = jdbcTemplate.queryForObject(sb.toString(), params.toArray(), Integer.class);
        return patients;
    }
}

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

@ -281,6 +281,98 @@ public class SignWebService extends BaseService {
        return patients;
    }
    /**
     * 获取区签约居民数目
     * @param doctor
     * @return
     */
    public JSONObject getSignWebByDoctorCount(String doctor) {
        Doctor d = doctorDao.findByCode(doctor);
        String sql ;
        if (d != null && d.getLevel() == 3) {
             sql ="SELECT  " +
                    "( " +
                    " SELECT " +
                    "  count(1) " +
                    " FROM " +
                    "  wlyy_sign_family " +
                    " WHERE " +
                    "  doctor_health = '"+doctor+"' " +
                    " AND doctor IS NULL " +
                    " AND STATUS = 0 " +
                    " AND type = 2 " +
                    " AND expenses_status = '0' " +
                    " ) AS waitSignCount, " +
                    "( " +
                    " SELECT " +
                    "  count(1) " +
                    " FROM " +
                    "  wlyy_sign_family " +
                    " WHERE " +
                    "  (doctor = '"+doctor+"' or doctor_health = '"+doctor+"') " +
                    " AND STATUS > 0 " +
                    " AND type = 2 " +
                    " AND expenses_status = '0'  " +
                    " ) AS waitPayCount, " +
                    "( " +
                    " SELECT " +
                    " count(1) " +
                    " FROM " +
                    " wlyy_sign_family " +
                    " WHERE " +
                    " (doctor = '"+doctor+"' or doctor_health = '"+doctor+"') " +
                    " AND STATUS = 1 " +
                    " AND type = 2 " +
                    " AND expenses_status = '1'  " +
                    " ) AS signCount";
        }else{
             sql ="SELECT  " +
                    "( " +
                    " SELECT " +
                    "  count(1) " +
                    " FROM " +
                    "  wlyy_sign_family " +
                    " WHERE " +
                    "  doctor = '"+doctor+"' " +
                    " AND STATUS = 0 " +
                    " AND type = 2 " +
                    " AND expenses_status = '0' " +
                    " ) AS waitSignCount, " +
                    "( " +
                    " SELECT " +
                    "  count(1) " +
                    " FROM " +
                    "  wlyy_sign_family " +
                    " WHERE " +
                    "  (doctor = '"+doctor+"' or doctor_health = '"+doctor+"') " +
                    " AND STATUS > 0 " +
                    " AND type = 2 " +
                    " AND expenses_status = '0'  " +
                    " ) AS waitPayCount, " +
                    "( " +
                    " SELECT " +
                    " count(1) " +
                    " FROM " +
                    " wlyy_sign_family " +
                    " WHERE " +
                    " (doctor = '"+doctor+"' or doctor_health = '"+doctor+"') " +
                    " AND STATUS = 1 " +
                    " AND type = 2 " +
                    " AND expenses_status = '1'  " +
                    " ) AS signCount";
        }
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list!=null&&list.size()>0){
            return new JSONObject(list.get(0));
        }
        return new JSONObject();
    }
    /**
     * 查询家庭签约已缴费未关注人数
     *

+ 8 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/DoctorService.java

@ -126,7 +126,12 @@ public class DoctorService extends TokenService {
            sql += " and level = ? ";
            args.add(level);
        }
        sql += " limit " + (page * pagesize) + "," + pagesize;
        //修复分页数错误引起的BUG--huangwenjie--2017.09.06
        pagesize = page * pagesize;
        page = (page - 1) * pagesize;
        sql += " limit " + page + "," + pagesize;
        List<Doctor> doctorList = jdbcTemplate.query(sql, args.toArray(), new BeanPropertyRowMapper(Doctor.class));
@ -149,8 +154,8 @@ public class DoctorService extends TokenService {
            args.add(level);
        }
        List<Doctor> doctorList = jdbcTemplate.query(sql, args.toArray(), new BeanPropertyRowMapper(Doctor.class));
        Integer doctorList = jdbcTemplate.queryForObject(sql, args.toArray(), Integer.class);
        return doctorList.size();
        return doctorList;
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java

@ -420,7 +420,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                        //创建时间
                        heap.setCzrq(createTime);
                        heap.setSignCode(patientService.getSignCodeByPatient(p));
                        heap.setSendType(1);
                        heap.setSendType(1);//i健康推送
                        heap.setTitle(temp.getTitle());
                        list.add(heap);
                        consultService.sendMucMessageBySingnType(doctor.getCode(), doctor.getName(), p, "{\"title\":\"" + temp.getTitle()+ "\",\"type\":0,\"id\":\"" + temp.getCode() + "\",\"img\":\"" + temp.getUrl() + "\",\"content\":\"为了您的健康,我给您发送了一篇文章,请咨询查阅,如有问题,可随时与我沟通\"}", "4", patientTemp.getName());

+ 58 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java

@ -80,6 +80,23 @@ public class PrescriptionInfoController extends BaseController {
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getDoctorPrescriptionTotal", method = RequestMethod.GET)
    @ApiOperation(value = "获取全科医生数目/建管师续方列表数目/搜索数目")
    public String getDoctorPrescriptionTotal(@RequestParam(required = false) @ApiParam(value = "团队code", name = "teamCode") Integer teamCode,
                                        @RequestParam(required = false) @ApiParam(value = "续方状态", name = "state") String state,
                                        @RequestParam(required = false) @ApiParam(value = "所有诊断:1 糖尿病 2高血压", name = "dispensary") String diseases,
                                        @RequestParam(required = false) @ApiParam(name = "startDate", value = "开始时间") String startDate,
                                        @RequestParam(required = false) @ApiParam(name = "endDate", value = "结束时间") String endDate,
                                        @RequestParam(required = false) @ApiParam(name = "nameKeyword", value = "患者姓名模糊匹配") String nameKeyword,
                                        @RequestParam(required = false) @ApiParam(name = "patient", value = "患者Code") String patient) {
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.getDoctorPrescriptionTotal(teamCode, state, diseases, startDate, endDate, nameKeyword, patient));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getContinuedPrescriptionAsDoctor", method = RequestMethod.GET)
    @ApiOperation(value = "续方详情")
@ -239,6 +256,24 @@ public class PrescriptionInfoController extends BaseController {
        }
    }
    @RequestMapping(value = "/getHDoctorPrescriptionExpressageTotal", method = RequestMethod.GET)
    @ApiOperation(value = "获取健康管理师续方订单列表数目")
    public String getHDoctorPrescriptionExpressageTotal
            (@RequestParam(required = false) @ApiParam(value = "团队Code", name = "teamCode") String teamCode,
             @RequestParam(required = false) @ApiParam(value = "1:需跟踪;2:已接收", name = "type") String type,
             @RequestParam(required = false) @ApiParam(value = "患者姓名关键字", name = "nameKey") String nameKey,
             @RequestParam(required = false) @ApiParam(value = "开始时间", name = "startDate") String startDate,
             @RequestParam(required = false) @ApiParam(value = "结束时间", name = "endDate") String endDate,
             @RequestParam(required = false) @ApiParam(value = "服务站", name = "hospital") String hospital,
             @RequestParam(required = false) @ApiParam(value = "配送状态", name = "state") String state) {
        try {
            return write(200, "操作成功!", "data", prescriptionInfoService.getHDoctorPrescriptionExpressageTotal(teamCode, type, getRepUID(), nameKey, startDate, endDate, hospital, state));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getPrescriptionExpressageFilter", method = RequestMethod.GET)
    @ApiOperation(value = "获取健康管理师续方订单列表过滤条件")
    public String getPrescriptionExpressageFilter() {
@ -286,6 +321,29 @@ public class PrescriptionInfoController extends BaseController {
        }
    }
    @RequestMapping(value = "/getDoctorPrescriptionExpressageTotal", method = RequestMethod.GET)
    @ApiOperation(value = "获取全科医生续方订单列表数目")
    public String getDoctorPrescriptionExpressageTotal
            (@RequestParam(required = false) @ApiParam(value = "团队Code", name = "teamCode") Integer teamCode,
             @RequestParam(required = false) @ApiParam(value = "居民搜素关键字", name = "nameKey") String nameKey,
             @RequestParam(required = false) @ApiParam(value = "开始时间", name = "startDate") String startDate,
             @RequestParam(required = false) @ApiParam(value = "结束时间", name = "endDate") String endDate,
             @RequestParam(required = false) @ApiParam(value = "机构", name = "hospital") String hospital,
             @RequestParam(required = false) @ApiParam(value = "配送状态", name = "state") String state,
             @RequestParam(required = false) @ApiParam(value = "配送方式:1 自取 2快递配送 3健管师配送", name = "dispensaryType") String
                     dispensaryType,
             @RequestParam(required = false) @ApiParam(value = "传1为未分配健管师", name = "AllocationType") String
                     allocationType) {
        try {
            return write(200, "操作成功!", "data",
                    prescriptionInfoService.
                            getDoctorPrescriptionExpressageTotal(teamCode, nameKey, startDate, endDate, hospital, state, dispensaryType, allocationType));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getCountExpressage", method = RequestMethod.GET)
    @ApiOperation(value = "获取指定团队未分配建管师订单数目")
    public String getCountExpressage

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

@ -335,6 +335,17 @@ public class DoctorSignController extends WeixinBaseController {
        }
    }
    @RequestMapping("/sign_info_count")
    @ApiOperation(value = "签约居民数目")
    public String getSignWebByDoctorCount(){
        try{
            //hxmD201703150222
            return write(200,"查询成功","data",signWebService.getSignWebByDoctorCount(getUID()));
        }catch (Exception e){
            return error(-1,"查询失败");
        }
    }
    /**
     * 查询今天是否全部提醒关注
     *

+ 15 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcDoctorController.java

@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.service.SignFamilyService;
import com.yihu.wlyy.service.app.sign.FamilyContractService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.PatientService;
@ -44,7 +44,8 @@ public class GcDoctorController extends BaseController {
    private DoctorService doctorService;
    @Autowired
    private AdminTeamService adminTeamService;
    @Autowired
    private FamilyContractService familyContractService;
    @RequestMapping(value = "/doctor", method = RequestMethod.GET)
@ -116,6 +117,7 @@ public class GcDoctorController extends BaseController {
        }
        return new ResultListModel(adminTeamModelList);
    }
    @RequestMapping(value = "/signPatientsByName", method = RequestMethod.GET)
    @ApiOperation("查找医生所属团队下的某个居民")
    public ResultPageListModel<PatientModel> signPatientsByName(
@ -125,10 +127,17 @@ public class GcDoctorController extends BaseController {
            @ApiParam(name = "pageSize", value = "每页大小", required = true) @RequestParam(value = "pageSize", required = true, defaultValue = "10") Integer pageSize
    ) {
        try {
            return new ResultPageListModel();
            List<Patient> patients = familyContractService.signPatientsByName(teamCode, patientName, page, pageSize);
            List<PatientModel> patientModels = new ArrayList<>();
            if (patients != null && patients.size() > 0) {
                patients.stream().forEach(one -> {
                    PatientModel patientModel = new PatientModel();
                    BeanUtils.copyProperties(one, patientModel);
                    patientModels.add(patientModel);
                });
            }
           Integer count= familyContractService.signPatientsByNameCount(teamCode, patientName);
            return new ResultPageListModel(page,pageSize,count,patientModels);
        } catch (Exception e) {
            return new ResultPageListModel(BaseResultModel.statusEm.find_error.getCode(), BaseResultModel.statusEm.find_error.getMessage() + "," + e.getMessage());
        }

+ 29 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcEduArticleController.java

@ -50,8 +50,6 @@ public class GcEduArticleController extends WeixinBaseController {
    @Autowired
    private ConsultService consultService;
    @Autowired
    private HealthEduArticleService healthEduArticleService;
    @Autowired
    private DoctorService doctorService;
    @Autowired
    private SignPatientLabelInfoService signPatientLabelInfoService;
@ -60,6 +58,32 @@ public class GcEduArticleController extends WeixinBaseController {
    @Autowired
    private GcEduArticleService gcEduArticleService;
    /**
     *
     * @param doctorCode
     * @param page
     * @param pagesize
     * @return
     */
    @RequestMapping(value = "logs", method = RequestMethod.POST)
    @ApiOperation("查询医生给患者推送记录 ")
    @ResponseBody
    public String getPatientHealthLogs(
            @ApiParam(name = "doctorCode", value = "医生code,为空从useragent取", required = false) @RequestParam(value = "doctorCode", required = false) String doctorCode,
            @ApiParam(name = "page", value = "当前页 起始1", required = false) @RequestParam(value = "page", required = false) int page,
            @ApiParam(name = "pagesize", value = "每页显示条数", required = false) @RequestParam(value = "pagesize", required = false) int pagesize) {
        try {
            if(org.springframework.util.StringUtils.isEmpty(doctorCode)){
                doctorCode=getUID();
            }
            //List<Map<String, Object>> result = gcEduArticleService.findByDoctor(doctorCode, page, pagesize);
            return write(200, "查询成功!", "list", "");
        } catch (Exception e) {
            return write(-1, "查询失败!");
        }
    }
    /**
     * 参考原来的教育文章推送
     * http://172.19.103.88:9092/wlyy//doctor/health/edu/send?code=2e6467b5bb2f4b81b598633624d7f98e&patient=e911d1b756cd4680ab241ab76a463282&teamCode=1&attachedContent=
@ -85,7 +109,7 @@ public class GcEduArticleController extends WeixinBaseController {
            @ApiParam(name = "sendMessage", value = "发送人信息", required = false) @RequestParam(value = "sendMessage", required = false) String sendMessage,
            @ApiParam(name = "teamId", value = "发送人是医生的时候,医生所属的团队", required = true) @RequestParam(value = "teamId", required = true) Long teamId,
            @ApiParam(name = "labelCode", value = "所选群组,多个用逗号分隔", required = true) @RequestParam(value = "labelCode", required = false, defaultValue = "") String labelCode,
            @ApiParam(name = "labelType", value = "标签类型  1 服务类型  2 健康情况 3 疾病类型 4 自定义标签", required = true) @RequestParam(value = "labelType", required = false, defaultValue = "") String labelType,
            @ApiParam(name = "labelType", value = "标签类型  1:服务类型(卫计委分组) 2:健康情况 3:疾病类型 4:团队标签(自定义标签)", required = true) @RequestParam(value = "labelType", required = false, defaultValue = "") String labelType,
            @ApiParam(name = "receiveCodes", value = "接收人code,多个逗号分割", required = false) @RequestParam(value = "receiveCodes", required = false, defaultValue = "") String receiveCodes,
            @ApiParam(name = "unReceiveCodes", value = "不接收人code,多个逗号分割(如果同时存在receiveCodes和unReceiveCodes,也不会发送)", required = false) @RequestParam(value = "unReceiveCodes", required = false, defaultValue = "") String unReceiveCodes,
            @ApiParam(name = "articleIds", value = "文章ID,多个逗号分割", required = true) @RequestParam(value = "articleIds", required = true) String articleIds,
@ -107,6 +131,7 @@ public class GcEduArticleController extends WeixinBaseController {
            //保存发送记录
            List<HealthEduArticlePatient> healthEduArticlePatients = gcEduArticleService.saveArticle(patientSet, sendCode, sendName, sendMessage, teamId, articleIdArr, articlePicArr, articleTitleArr);
            //推送微信模板消息和发送im消息
            sendWxTemplateAndIM(healthEduArticlePatients, sendType);
@ -138,7 +163,7 @@ public class GcEduArticleController extends WeixinBaseController {
            json.put("doctorName", one.getDoctorName());
            json.put("represented", patient.getCode());//被代理人
            json.put("date", DateUtil.dateToStrLong(DateUtil.getNowDate()));
            json.put("remark", org.springframework.util.StringUtils.isEmpty(one.getAttachedContent())?"  ":one.getAttachedContent());
            json.put("remark", org.springframework.util.StringUtils.isEmpty(one.getAttachedContent()) ? "  " : one.getAttachedContent());
            if (StringUtils.isNotBlank(patient.getOpenid())) {
                pushMsgTask.putWxMsg(getAccessToken(), 9,

+ 6 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcLableController.java

@ -101,7 +101,7 @@ public class GcLableController extends BaseController {
            @ApiParam(name = "pageSize", value = "每页大小", required = true) @RequestParam(value = "pageSize", required = true, defaultValue = "10") Integer pageSize
    ) {
        try {
            JSONArray result = signPatientLabelInfoService.getPatientByLabel("totoD2017031502222", labelCode, labelType, teamCode, page-1, pageSize);
            JSONArray result = signPatientLabelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page-1, pageSize);
            List<PatientModel> patientLabelModels = new ArrayList<>();
            for (int i = 0; i < result.length(); i++) {
                JSONObject jo = result.getJSONObject(i);
@ -115,7 +115,11 @@ public class GcLableController extends BaseController {
                patientLabelModels.add(patientModel);
            }
            return new ResultPageListModel(page,pageSize,0,patientLabelModels);
            return new ResultPageListModel(
                    page,
                    pageSize,
                    signPatientLabelInfoService.getPatientByLabelCount(getUID(), labelCode, labelType, teamCode).length()
                    ,patientLabelModels);
        } catch (Exception e) {
            return new ResultPageListModel(BaseResultModel.statusEm.find_error.getCode(), BaseResultModel.statusEm.find_error.getMessage() + "," + e.getMessage());
        }

+ 0 - 14
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkzl/EduArticleController.java

@ -1,14 +0,0 @@
package com.yihu.wlyy.web.third.jkzl;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by chenweida on 2017/8/28.
 */
@RestController
@RequestMapping(value = "/third/edu/article")
@Api(description = "总部健康教育文章")
public class EduArticleController {
}

+ 36 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/WechatMenuController.java

@ -116,4 +116,40 @@ public class WechatMenuController extends BaseController {
            return error(-1, "创建失败");
        }
    }
    /**
     * 医生助手微信菜单创建
     *
     * @return
     */
    @ApiOperation(value = "医生助手微信菜单创建")
    @RequestMapping(value = "/menu/create/feldsher", method = RequestMethod.POST)
    public String createMenuTestFeldsher() {
        try {
            String filePath = WechatCoreController.class.getResource("/").getPath() +
                    File.separator + "wechat" + File.separator + "weixin_menu_feldsher.txt";
            String url = " https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" + weiXinAccessTokenUtils.getAccessToken();
            // 读取微信菜单配置文件
            InputStreamReader reader = new InputStreamReader(new FileInputStream(filePath), "utf-8");
            BufferedReader bufferedReader = new BufferedReader(reader);
            String params = "";
            String readTxt = "";
            // 读取微信菜单
            while ((readTxt = bufferedReader.readLine()) != null) {
                System.out.println(readTxt);
                params += readTxt;
            }
            bufferedReader.close();
            reader.close();
            // 替换服务器地址、APPID
            params = params.replaceAll("server_url", wechat_base_url);
            params = params.replaceAll("appId", appId);
            // 请求微信接口创建菜单
            String jsonStr = HttpUtil.sendPost(url, params);
            return write(200, "创建成功!", "data", jsonStr);
        } catch (Exception e) {
            return error(-1, "创建失败");
        }
    }
}

+ 9 - 0
patient-co/patient-co-wlyy/src/main/resources/wechat/weixin_menu_feldsher.txt

@ -0,0 +1,9 @@
{
    "button": [
        {
            "name": "我的资料",
            "type": "view",
		    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fgrzx%2fhtml%2fmy-detail.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
        }
    ]
}