Ver código fonte

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

yeshijie 7 anos atrás
pai
commit
c15c3bce9a
14 arquivos alterados com 258 adições e 52 exclusões
  1. 6 6
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java
  2. 10 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java
  3. 9 4
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/SicardQueryJob.java
  4. 9 3
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/patient/PatientDao.java
  5. 18 14
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/charge/OnePayService.java
  6. 16 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/web/quota/JobController.java
  7. 3 0
      patient-co/patient-co-wlyy-job/src/main/resources/system.properties
  8. 86 11
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  9. 25 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/fzzb/HealthEducationArticleService.java
  10. 3 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java
  11. 15 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ElasticsearchUtil.java
  12. 22 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java
  13. 28 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
  14. 8 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

+ 6 - 6
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java

@ -173,7 +173,7 @@ public class CurrentDayAllQuotaJob implements Job {
     */
     */
    public Map<String,Object> getTowmRenewTotals(){
    public Map<String,Object> getTowmRenewTotals(){
        try{
        try{
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,fr.patient " +
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,fr.patient,fr.idcard " +
                    " from wlyy_sign_family_renew_log fr " +
                    " from wlyy_sign_family_renew_log fr " +
                    " where  " +
                    " where  " +
                    " fr.apply_date<'"+ tomorrow+"' and " +
                    " fr.apply_date<'"+ tomorrow+"' and " +
@ -199,7 +199,7 @@ public class CurrentDayAllQuotaJob implements Job {
     */
     */
    public Map<String,Object> getOrgRenewTotals(){
    public Map<String,Object> getOrgRenewTotals(){
        try{
        try{
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,fr.patient " +
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,fr.patient,fr.idcard " +
                    " from wlyy_sign_family_renew_log fr " +
                    " from wlyy_sign_family_renew_log fr " +
                    " where " +
                    " where " +
                    " fr.apply_date<'"+ tomorrow+"' and  fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "'and  fr.hospital=fr.old_hospital  and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10 ";
                    " fr.apply_date<'"+ tomorrow+"' and  fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "'and  fr.hospital=fr.old_hospital  and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10 ";
@ -221,7 +221,7 @@ public class CurrentDayAllQuotaJob implements Job {
     */
     */
    public Map<String,Object> getTeamRenewTotals(){
    public Map<String,Object> getTeamRenewTotals(){
        try{
        try{
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,fr.patient " +
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,fr.patient,fr.idcard " +
                    " from wlyy_sign_family_renew_log fr " +
                    " from wlyy_sign_family_renew_log fr " +
                    " where   " +
                    " where   " +
                    " fr.apply_date<'"+ tomorrow+"' and  fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "' and fr.admin_team_id=fr.old_admin_team_id  and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10 ";
                    " fr.apply_date<'"+ tomorrow+"' and  fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "' and fr.admin_team_id=fr.old_admin_team_id  and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10 ";
@ -239,7 +239,7 @@ public class CurrentDayAllQuotaJob implements Job {
    public Map<String,Object> getTeamRenewOut(){
    public Map<String,Object> getTeamRenewOut(){
        try{
        try{
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,fr.patient " +
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,fr.patient,fr.idcard " +
                    " from wlyy_sign_family_renew_log fr " +
                    " from wlyy_sign_family_renew_log fr " +
                    " where    " +
                    " where    " +
                    " fr.apply_date<'"+ tomorrow+"' and  fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "' and fr.admin_team_id!=fr.old_admin_team_id  and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10 ";
                    " fr.apply_date<'"+ tomorrow+"' and  fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "' and fr.admin_team_id!=fr.old_admin_team_id  and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10 ";
@ -257,7 +257,7 @@ public class CurrentDayAllQuotaJob implements Job {
    public Map<String,Object> getOrgRenewOut(){
    public Map<String,Object> getOrgRenewOut(){
        try{
        try{
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,fr.patient" +
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,fr.patient,fr.idcard" +
                    " from wlyy_sign_family_renew_log fr " +
                    " from wlyy_sign_family_renew_log fr " +
                    " where   " +
                    " where   " +
                    " fr.apply_date<'"+ tomorrow+"' and  fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "' and fr.admin_team_id!=fr.old_admin_team_id and fr.hospital!=fr.old_hospital and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10 ";
                    " fr.apply_date<'"+ tomorrow+"' and  fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "' and fr.admin_team_id!=fr.old_admin_team_id and fr.hospital!=fr.old_hospital and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10 ";
@ -275,7 +275,7 @@ public class CurrentDayAllQuotaJob implements Job {
    public Map<String,Object> getTownRenewOut(){
    public Map<String,Object> getTownRenewOut(){
        try{
        try{
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,fr.patient " +
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,fr.patient,fr.idcard " +
                    " from wlyy_sign_family_renew_log fr " +
                    " from wlyy_sign_family_renew_log fr " +
                    " where " +
                    " where " +
                    " fr.apply_date<'"+ tomorrow+"' and  fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "' and fr.admin_team_id!=fr.old_admin_team_id and fr.hospital!=fr.old_hospital and LEFT(fr.hospital,6)!=LEFT(fr.old_hospital,6)  and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10 ";
                    " fr.apply_date<'"+ tomorrow+"' and  fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "' and fr.admin_team_id!=fr.old_admin_team_id and fr.hospital!=fr.old_hospital and LEFT(fr.hospital,6)!=LEFT(fr.old_hospital,6)  and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10 ";

+ 10 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java

@ -188,7 +188,7 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
                logger.info("patient_followup_upload_job  job exist");
                logger.info("patient_followup_upload_job  job exist");
            }
            }
            //老年人体检消息发送记录,每天凌晨1点执行一次
            //老年人体检消息发送记录,每天凌晨8点执行一次
            if (!quartzHelper.isExistJob("patient_physical_examination_job")) {
            if (!quartzHelper.isExistJob("patient_physical_examination_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("patient_physical_examination_job");
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("patient_physical_examination_job");
                quartzHelper.addJob(PatientPhysicalExaminationJob.class, trigger, "patient_physical_examination_job", new HashMap<String, Object>());
                quartzHelper.addJob(PatientPhysicalExaminationJob.class, trigger, "patient_physical_examination_job", new HashMap<String, Object>());
@ -197,6 +197,15 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
                logger.info("patient_physical_examination_job  job exist");
                logger.info("patient_physical_examination_job  job exist");
            }
            }
            //电子社保卡绑定状态查询,每天每隔6小时执行一次
            if (!quartzHelper.isExistJob("sicard_query_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("sicard_query_job");
                quartzHelper.addJob(SicardQueryJob.class, trigger, "sicard_query_job", new HashMap<String, Object>());
                logger.info("sicard_query_job  job success");
            } else {
                logger.info("sicard_query_job  job exist");
            }
            // 启动redis 消息队列线程
            // 启动redis 消息队列线程
            logger.info("redis message start");
            logger.info("redis message start");
            new Thread(redisThread).start();
            new Thread(redisThread).start();

+ 9 - 4
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/SicardQueryJob.java

@ -12,6 +12,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.List;
/**
/**
@ -31,13 +33,16 @@ public class SicardQueryJob implements Job {
    public void execute(JobExecutionContext context) throws JobExecutionException {
    public void execute(JobExecutionContext context) throws JobExecutionException {
        logger.info("SicardQueryJob start ..........");
        logger.info("SicardQueryJob start ..........");
        try {
        try {
            List<Patient> patientList = patientDao.listNotupdated();
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
            String time = format.format(new Date());
//            List<String> patientList = patientDao.listNotupdated();
            List<String> patientList = patientDao.listNotupdatedByDate(time);
            if (patientList != null && patientList.size() > 0) {
            if (patientList != null && patientList.size() > 0) {
                for (Patient patient : patientList) {
                for (String openId : patientList) {
                    try {
                    try {
                        payService.bindCardList(patient.getOpenid());
                        payService.bindCardList(openId);
                    } catch (Exception e) {
                    } catch (Exception e) {
                        logger.info("SicardQueryJob error ..........continue this JOB,CODE:" + patient.getCode() + ",message:" + e.getMessage());
                        logger.info("SicardQueryJob error ..........continue this JOB,CODE:" + openId + ",message:" + e.getMessage());
                        continue;
                        continue;
                    }
                    }
                }
                }

+ 9 - 3
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/patient/PatientDao.java

@ -70,7 +70,13 @@ public interface PatientDao extends PagingAndSortingRepository<Patient, Long> {
    @Query("update Patient p set p.diseaseCondition = ?2 where p.idcard = ?1")
    @Query("update Patient p set p.diseaseCondition = ?2 where p.idcard = ?1")
    void updatePatientDiseascontionByIdcard(String idcard, Integer diseaseCondition);
    void updatePatientDiseascontionByIdcard(String idcard, Integer diseaseCondition);
    //获取已绑定社保卡但状态未更新数据(过滤掉为空情况)
    @Query(" select p from Patient p where password is null ")
    List<Patient> listNotupdated();
    //获取已绑定社保卡但状态未更新数据
    @Query(value = "SELECT DISTINCT openid FROM `wlyy_patient` WHERE `openid` IS NOT NULL AND `openid` <> ' ' " +
            " AND `openid` <> 'undefined' AND ( `sicard_time` IS NOT NULL OR `sicard_status` IS NOT NULL ) ORDER BY `sicard_time`",nativeQuery = true)
    List<String> listNotupdated();
    //获取已绑定社保卡但状态未更新当天数据
    @Query(value = "SELECT DISTINCT openid FROM `wlyy_patient` WHERE `openid` IS NOT NULL AND `openid` <> ' ' AND `openid` <> 'undefined' " +
            " AND `sicard_status` IS NULL AND `sicard_time` >= ?1 ORDER BY `sicard_time`",nativeQuery = true)
    List<String> listNotupdatedByDate(String beginTime);
}
}

+ 18 - 14
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/charge/OnePayService.java

@ -478,32 +478,36 @@ public class OnePayService {
            // 如医保卡绑卡信息返回参数
            // 如医保卡绑卡信息返回参数
            if (OnepayDefaultClient.isSuccessful(res)) {
            if (OnepayDefaultClient.isSuccessful(res)) {
                JavaType javaType = objectMapper.getTypeFactory().constructParametricType(List.class, BindCard.class);
                JavaType javaType = objectMapper.getTypeFactory().constructParametricType(List.class, BindCard.class);
                //获取本人绑卡情况
                String idNo = res.getParam().getString("idNo");
                Patient user = patientDao.findByIdcard(idNo);
                String userCode = user.getCode();
                List<BindCard> result = objectMapper.readValue(objectMapper.writeValueAsString(res.getParam().get("attachList")), javaType);
                List<BindCard> result = objectMapper.readValue(objectMapper.writeValueAsString(res.getParam().get("attachList")), javaType);
                //更新患者信息
                //更新患者信息
                if (result != null && result.size() > 0) {
                if (result != null && result.size() > 0) {
                    String userCode = "";
                    //获取本人绑卡情况
                    for (BindCard card : result) {
                    for (BindCard card : result) {
                        if (!"98".equals(card.getAttachRelation())) {
                        if ("98".equals(card.getAttachRelation())) {
                            String idcard = card.getAttachIdNo();
                            String idcard = card.getAttachIdNo();
                            Patient patient = patientDao.findByIdcard(idcard);
                            Patient patient = patientDao.findByIdcard(idcard);
                            userCode = patient.getCode();
                            patient.setSicardStatus(1);
                            patient.setSicardStatus(1);
//                            ********************以绑定时为主****************
                            patient.setSicardTime(new Date());
                            patient.setSicardTime(new Date());
//                            ************************************
                            patient.setPrincipalCode(userCode);
                            patient.setPrincipalCode(userCode);
                            patientDao.save(patient);
                            patientDao.save(patient);
                            LOGGER.info("myself ==========>  userCode " + userCode);
                        }
                    }
                    //获取家人绑卡情况
                    for (BindCard familyCard : result) {
                        if (!"98".equals(familyCard.getAttachRelation())) {
                            String idcard = familyCard.getAttachIdNo();
                            Patient patient = patientDao.findByIdcard(idcard);
                            patient.setSicardStatus(1);
                            patient.setSicardTime(new Date());
                            patient.setPrincipalCode(userCode);
                            patientDao.save(patient);
                            LOGGER.info("family ==========>  userCode "+userCode +" ========== >> "+patient.getOpenid());
                        }
                        }
                    }
                    }
                }
                }
                user.setSicardStatus(1);
//                            ********************以绑定时为主****************
                user.setSicardTime(new Date());
//                            ************************************
                user.setPrincipalCode(userCode);
                patientDao.save(user);
            } else {
            } else {
                isSuccess = false;
                isSuccess = false;
                error = "请求失败,返回结果:" + res.getRespCode() + "," + res.getRespMsg();
                error = "请求失败,返回结果:" + res.getRespCode() + "," + res.getRespMsg();
@ -520,6 +524,6 @@ public class OnePayService {
        if (!isSuccess) {
        if (!isSuccess) {
            throw new Exception(error);
            throw new Exception(error);
        }
        }
        LOGGER.info(error);
        LOGGER.info("OnePayService SicardQueryJob " + error);
    }
    }
}
}

+ 16 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/web/quota/JobController.java

@ -682,7 +682,22 @@ public class JobController extends BaseController {
        }
        }
    }
    }
    /**
     *电子社保卡绑定状态查询,立即启动
     *@author Reece
     *@date 2017/10/23 13:37
     */
    @RequestMapping(value = "/executeSicardQueryJob", method = RequestMethod.POST)
    @ApiOperation("电子社保卡绑定状态查询")
    public String executeSicardQueryJob() {
        try {
            quartzHelper.startNow(SicardQueryJob.class, "SICARD_QUERY_JOB", null);
            return write(200, "启动成功");
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
    /**
    /**
     * 医生评价分数统计
     * 医生评价分数统计

+ 3 - 0
patient-co/patient-co-wlyy-job/src/main/resources/system.properties

@ -122,6 +122,9 @@ patient_followup_upload_job=0 0/10 * * * ?
# 老年人体检系统发送提醒记录,每天8点执行一次
# 老年人体检系统发送提醒记录,每天8点执行一次
patient_physical_examination_job=0 0 8 * * ?
patient_physical_examination_job=0 0 8 * * ?
# 电子社保卡绑定状态查询,每隔6小时执行一次
sicard_query_job=0 0 6,12,18,23 * * ?
#统一支付平台支付成功后页面跳转地址
#统一支付平台支付成功后页面跳转地址
return_url={server}/wx/html/qygl/html/pay_result.html
return_url={server}/wx/html/qygl/html/pay_result.html
#统一支付平台支付接口地址
#统一支付平台支付接口地址

+ 86 - 11
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java

@ -1322,12 +1322,20 @@ public class StatisticsESService {
        return returnMap;
        return returnMap;
    }
    }
    /**
     *
     * @param level    level1_type等级 5:团队 4社区机构 3区级 2市级
     * @param area
     * @param lowLevel
     * @return
     * @throws Exception
     */
    public String getAvgAllInfo(int level, String area, String lowLevel) throws Exception {
    public String getAvgAllInfo(int level, String area, String lowLevel) throws Exception {
        JSONObject returnJo = new JSONObject();
        JSONObject returnJo = new JSONObject();
        JSONArray ja = new JSONArray();
        JSONArray ja = new JSONArray();
        //市级
        //市级
        if (level == 2) {
        if (level == 2) {
            if (StringUtils.isBlank(lowLevel)) {
            if ("3".equals(lowLevel)) {
                List<SaveModel> esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel0(DateUtil.dateToStrShort(new Date()), area, level, "28", SaveModel.timeLevel_DDL, "3");
                List<SaveModel> esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel0(DateUtil.dateToStrShort(new Date()), area, level, "28", SaveModel.timeLevel_DDL, "3");
                esModelList.forEach(one -> {
                esModelList.forEach(one -> {
                    JSONObject jo = new JSONObject();
                    JSONObject jo = new JSONObject();
@ -1336,8 +1344,8 @@ public class StatisticsESService {
                    jo.put("avgCount", getRangeDouuble(one.getResult1(), one.getResult2().intValue(), 2));
                    jo.put("avgCount", getRangeDouuble(one.getResult1(), one.getResult2().intValue(), 2));
                    ja.put(jo);
                    ja.put(jo);
                });
                });
            } else {
                List<SaveModel> esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel0(DateUtil.dateToStrShort(new Date()), area, level, "28", SaveModel.timeLevel_DDL, "2");
            } else if("4".equals(lowLevel)) {
                List<SaveModel> esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel0(DateUtil.dateToStrShort(new Date()), area, level, "28", SaveModel.timeLevel_DDL, "4");
                esModelList.forEach(one -> {
                esModelList.forEach(one -> {
                    JSONObject jo = new JSONObject();
                    JSONObject jo = new JSONObject();
                    jo.put("name", one.getHospitalName());
                    jo.put("name", one.getHospitalName());
@ -1347,7 +1355,7 @@ public class StatisticsESService {
                });
                });
            }
            }
        } else if (level == 3) {
        } else if (level == 3) {
            List<SaveModel> esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel0(DateUtil.dateToStrShort(new Date()), area, level, "28", SaveModel.timeLevel_DDL, "2");
            List<SaveModel> esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel0(DateUtil.dateToStrShort(new Date()), area, level, "28", SaveModel.timeLevel_DDL, "3");
            esModelList.forEach(one -> {
            esModelList.forEach(one -> {
                JSONObject jo = new JSONObject();
                JSONObject jo = new JSONObject();
                jo.put("name", one.getHospitalName());
                jo.put("name", one.getHospitalName());
@ -1357,7 +1365,7 @@ public class StatisticsESService {
            });
            });
        } else if (level == 4) {
        } else if (level == 4) {
            List<SaveModel> esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel0(DateUtil.dateToStrShort(new Date()), area, level, "28", SaveModel.timeLevel_DDL, "1");
            List<SaveModel> esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel0(DateUtil.dateToStrShort(new Date()), area, level, "28", SaveModel.timeLevel_DDL, "5");
            esModelList.forEach(one -> {
            esModelList.forEach(one -> {
                JSONObject jo = new JSONObject();
                JSONObject jo = new JSONObject();
                jo.put("name", one.getTeam());
                jo.put("name", one.getTeam());
@ -1847,7 +1855,7 @@ public class StatisticsESService {
            }
            }
        }
        }
//        quotaTime = "2017-10-19 00:00:00";
//        quotaTime = "2017-10-19 00:00:00";
        List<SaveModel> list = elasticsearchUtil.findOneDateQuotaLevel1(quotaTime,area,Integer.parseInt(level),"24","2");
        List<SaveModel> list = elasticsearchUtil.findOneDateQuotaLevel1(null,quotaTime,area,Integer.parseInt(level),"24","1");
        JSONArray array = new JSONArray();
        JSONArray array = new JSONArray();
        for(SaveModel saveModel : list){
        for(SaveModel saveModel : list){
            JSONObject jsonObject = new JSONObject();
            JSONObject jsonObject = new JSONObject();
@ -2735,6 +2743,73 @@ public class StatisticsESService {
        return new JSONArray(totalList);
        return new JSONArray(totalList);
    }
    }
    /**
     * 团队报告--长处方
     * @param startDate
     * @param endDate
     * @param adminTeamId
     * @return
     * @throws Exception
     */
    public Map<String,Object> getPrescriptionTotalCount(String startDate, String endDate, Integer adminTeamId)throws Exception{
        //格式化时间
        startDate = startDate +" 00:00:00";
        endDate = endDate +" 23:59:59";
        String index ="58";
        Map<String,Object> rs = new HashedMap();
        //总数
        List<SaveModel> totalList = elasticsearchUtil.findListDateQuotaLevel0(startDate,endDate,String.valueOf(adminTeamId),Integer.valueOf(SaveModel.teamLevel),index,"2",null);
        //进行中
        List<SaveModel> processingList = elasticsearchUtil.findListDateQuotaLevel0(startDate,endDate,String.valueOf(adminTeamId),Integer.valueOf(SaveModel.teamLevel),index,"2","1");
        //已完成
        List<SaveModel> finishedList = elasticsearchUtil.findListDateQuotaLevel0(startDate,endDate,String.valueOf(adminTeamId),Integer.valueOf(SaveModel.teamLevel),index,"2","2");
        //已经取消
        List<SaveModel> canceledList = elasticsearchUtil.findListDateQuotaLevel0(startDate,endDate,String.valueOf(adminTeamId),Integer.valueOf(SaveModel.teamLevel),index,"2","3");
        //审核不通过
        List<SaveModel> unPassList = elasticsearchUtil.findListDateQuotaLevel0(startDate,endDate,String.valueOf(adminTeamId),Integer.valueOf(SaveModel.teamLevel),index,"2","4");
        //其他原因取消
        List<SaveModel> otherList = elasticsearchUtil.findListDateQuotaLevel0(startDate,endDate,String.valueOf(adminTeamId),Integer.valueOf(SaveModel.teamLevel),index,"2","5");
        //总数
        if(totalList!=null && totalList.size()>0){
            rs.put("total",totalList.get(0).getResult2());
        }else{
            rs.put("total",0);
        }
        //进行中
        if(processingList!=null && processingList.size()>0){
            rs.put("processingCount",processingList.get(0).getResult2());
        }else {
            rs.put("processingCount", 0);
        }
        //已完成
        if(finishedList!=null && finishedList.size()>0){
            rs.put("finishCount",finishedList.get(0).getResult2());
        }else {
            rs.put("finishCount", 0);
        }
        //已取消
        if(canceledList!=null && canceledList.size()>0){
            rs.put("patientCancelCount",canceledList.get(0).getResult2());
        }else {
            rs.put("patientCancelCount", 0);
        }
        //审核不通过
        if(unPassList!=null && unPassList.size()>0){
            rs.put("noReviewedCount",unPassList.get(0).getResult2());
        }else {
            rs.put("noReviewedCount", 0);
        }
        //其他原因取消
        if(otherList!=null && otherList.size()>0){
            rs.put("payOuttimeCount",otherList.get(0).getResult2());
        }else {
            rs.put("payOuttimeCount", 0);
        }
        return rs;
    }
    public Map<String,Object> getPrescriptionCount(int level,String area,String disease) throws Exception{
    public Map<String,Object> getPrescriptionCount(int level,String area,String disease) throws Exception{
        String index ="58";
        String index ="58";
        Map<String,Object> rs = new HashedMap();
        Map<String,Object> rs = new HashedMap();
@ -2754,31 +2829,31 @@ public class StatisticsESService {
        if(StringUtils.isNotBlank(disease)){
        if(StringUtils.isNotBlank(disease)){
            processingList = elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"1");
            processingList = elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"1");
        }else{
        }else{
            processingList = elasticsearchUtil.findListDateQuotaLevel1(null,area,level,index,"2",null,disease);
            processingList = elasticsearchUtil.findListDateQuotaLevel1(null,area,level,index,"2",null,"1");
        }
        }
        //已完成
        //已完成
        if(StringUtils.isNotBlank(disease)){
        if(StringUtils.isNotBlank(disease)){
            finishedList = elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"2");
            finishedList = elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"2");
        }else{
        }else{
            finishedList = elasticsearchUtil.findListDateQuotaLevel1(null,area,level,index,"2",null,disease);
            finishedList = elasticsearchUtil.findListDateQuotaLevel1(null,area,level,index,"2",null,"2");
        }
        }
        //已经取消
        //已经取消
        if(StringUtils.isNotBlank(disease)){
        if(StringUtils.isNotBlank(disease)){
            canceledList = elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"3");
            canceledList = elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"3");
        }else{
        }else{
            canceledList = elasticsearchUtil.findListDateQuotaLevel1(null,area,level,index,"2",null,disease);
            canceledList = elasticsearchUtil.findListDateQuotaLevel1(null,area,level,index,"2",null,"3");
        }
        }
        //审核不通过
        //审核不通过
        if(StringUtils.isNotBlank(disease)){
        if(StringUtils.isNotBlank(disease)){
            unPassList = elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"4");
            unPassList = elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"4");
        }else{
        }else{
            unPassList = elasticsearchUtil.findListDateQuotaLevel1(null,area,level,index,"2",null,disease);
            unPassList = elasticsearchUtil.findListDateQuotaLevel1(null,area,level,index,"2",null,"4");
        }
        }
        //其他原因取消
        //其他原因取消
        if(StringUtils.isNotBlank(disease)){
        if(StringUtils.isNotBlank(disease)){
            otherList = elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"5");
            otherList = elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"5");
        }else{
        }else{
            otherList = elasticsearchUtil.findListDateQuotaLevel1(null,area,level,index,"2",null,disease);
            otherList = elasticsearchUtil.findListDateQuotaLevel1(null,area,level,index,"2",null,"5");
        }
        }
        //总数
        //总数

+ 25 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/fzzb/HealthEducationArticleService.java

@ -32,7 +32,9 @@ public class HealthEducationArticleService extends BaseService{
    @Autowired
    @Autowired
    private DoctorDao doctorDao;
    private DoctorDao doctorDao;
    private String baseUrl = "http://service.yihu.com:8085/WsPlatform/rest";
//    private String baseUrl = "http://service.yihu.com:8085/WsPlatform/rest";
    private String baseUrl = "http://172.17.110.230:83/WsPlatform/rest";
//    private String baseUrl = "http://172.19.103.87:9088/JkEdu";
    @Value("${yihu.yihu_OpenPlatform_appId}")
    @Value("${yihu.yihu_OpenPlatform_appId}")
    private String clientId;
    private String clientId;
@ -46,6 +48,7 @@ public class HealthEducationArticleService extends BaseService{
    private String cancelArticleCollection = "JkEdu.Behavior.cancelArticleCollection";//取消收藏接口
    private String cancelArticleCollection = "JkEdu.Behavior.cancelArticleCollection";//取消收藏接口
    private String saveArticleCollection = "JkEdu.Behavior.saveArticleCollection";//医生收藏接口
    private String saveArticleCollection = "JkEdu.Behavior.saveArticleCollection";//医生收藏接口
    private String getDoctorArticalByUserId = "JkEdu.Article.getDoctorArticalByUserId";//医生发表文章接口
    private String getDoctorArticalByUserId = "JkEdu.Article.getDoctorArticalByUserId";//医生发表文章接口
    private String getArticalList = "JkEdu.Article.getArticalList";//获取文章列表 多ID
    /**
    /**
     * 封装入参
     * 封装入参
@ -308,4 +311,25 @@ public class HealthEducationArticleService extends BaseService{
        }
        }
    }
    }
    public JSONArray getArticalList(String articleId,int articleState,int pageIndex,int pageSize) throws Exception{
        JSONArray re = new JSONArray();
        JSONObject json = null;
        try{
            JSONObject param = new JSONObject();
            param.put("articleId",articleId);
            param.put("articleState",articleState);
            param.put("pageIndex",pageIndex);
            param.put("pageSize",pageSize);
            String response = httpClientUtil.httpPost(baseUrl,getParamsMap(getArticalList,param.toString(),"1"));
            json = JSON.parseObject(response);
        }catch (Exception e){
            e.printStackTrace();
            return re;
        }
        if("10000".equals(json.getString("Code"))){
            return json.getJSONArray("Result");
        }else {
            throw new Exception(json.getString("Message"));
        }
    }
}
}

+ 3 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java

@ -694,7 +694,9 @@ public class OnePayService {
                Patient p = patientDao.findByCode(patient);
                Patient p = patientDao.findByCode(patient);
                p.setOpenid(openid);
                p.setOpenid(openid);
//            增加绑定电子社保卡信息
//            增加绑定电子社保卡信息
                p.setSicardTime(new Date());
                if (!"1".equals(p.getSicardStatus())){
                    p.setSicardTime(new Date());
                }
                patientDao.save(p);
                patientDao.save(p);
            } else {
            } else {
                isSuccess = false;
                isSuccess = false;

+ 15 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ElasticsearchUtil.java

@ -628,6 +628,20 @@ public class ElasticsearchUtil {
        List list = findDateQuotaLevel1(quotaDate, quotaDate, area, level, index, timelevel,null, null, null);
        List list = findDateQuotaLevel1(quotaDate, quotaDate, area, level, index, timelevel,null, null, null);
        return list;
        return list;
    }
    }
    /**
     * 1级维度
     * 查询某一天某一个所有1级维度下的指标 例如某个机构下的所有维度的患者列表
     *
     * @param area      code  厦门市 350200
     * @param level     等级 1 省 2 市 3 区县 4 机构 5团队
     * @param index     指标code
     * @param timelevel // 1日 2年
     * @return
     */
    public List<SaveModel> findOneDateQuotaLevel1(String startDate,String endDate, String area, int level, String index, String timelevel) throws Exception {
        List list = findDateQuotaLevel1(startDate, endDate, area, level, index, timelevel,null, null, null);
        return list;
    }
    /**
    /**
     * 2级维度
     * 2级维度
     * 查询某一天某一个2级维度的某个1级维度和2级维度下的指标  例如查询65岁以上的高血压患者
     * 查询某一天某一个2级维度的某个1级维度和2级维度下的指标  例如查询65岁以上的高血压患者
@ -854,6 +868,7 @@ public class ElasticsearchUtil {
    /**
    /**
     * 将参数转换成需要的SaveModel里的标识
     * 将参数转换成需要的SaveModel里的标识
     * @param level 等级  4 市  3区  2社区 1团队
     * @param level 等级  4 市  3区  2社区 1团队
     *  转换后的level  等级  2 市  3区  4社区 5团队
     * @return
     * @return
     * @author zhangdan
     * @author zhangdan
     * @time 2017-10-18
     * @time 2017-10-18

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

@ -612,9 +612,9 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                                       @ApiParam(name = "firstLevelCategoryId", value = "一级类别ID ,多个逗号隔开")
                                       @ApiParam(name = "firstLevelCategoryId", value = "一级类别ID ,多个逗号隔开")
                                       @RequestParam(value = "firstLevelCategoryId", required = false) String firstLevelCategoryId,
                                       @RequestParam(value = "firstLevelCategoryId", required = false) String firstLevelCategoryId,
                                       @ApiParam(name = "pageIndex", value = "起始页数 0开始,默认0")
                                       @ApiParam(name = "pageIndex", value = "起始页数 0开始,默认0")
                                       @RequestParam(value = "pageIndex", required = false) Integer pageIndex,
                                       @RequestParam(value = "pageIndex", required = false, defaultValue = "0") Integer pageIndex,
                                       @ApiParam(name = "pageSize", value = "每页显示数 ,默认5")
                                       @ApiParam(name = "pageSize", value = "每页显示数 ,默认5")
                                       @RequestParam(value = "pageSize", required = false) Integer pageSize){
                                       @RequestParam(value = "pageSize", required = false, defaultValue = "5") Integer pageSize){
        try {
        try {
            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getDoctorArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getUID());
            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getDoctorArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getUID());
//            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getDoctorArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"0de7295862dd11e69faffa163e8aee56");
//            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getDoctorArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"0de7295862dd11e69faffa163e8aee56");
@ -717,9 +717,9 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                                       @ApiParam(name = "firstLevelCategoryId", value = "一级类别ID ,多个逗号隔开")
                                       @ApiParam(name = "firstLevelCategoryId", value = "一级类别ID ,多个逗号隔开")
                                       @RequestParam(value = "firstLevelCategoryId", required = false) String firstLevelCategoryId,
                                       @RequestParam(value = "firstLevelCategoryId", required = false) String firstLevelCategoryId,
                                       @ApiParam(name = "pageIndex", value = "起始页数 0开始,默认0")
                                       @ApiParam(name = "pageIndex", value = "起始页数 0开始,默认0")
                                       @RequestParam(value = "pageIndex", required = false) Integer pageIndex,
                                       @RequestParam(value = "pageIndex", required = false, defaultValue = "0") Integer pageIndex,
                                       @ApiParam(name = "pageSize", value = "每页显示数 ,默认5")
                                       @ApiParam(name = "pageSize", value = "每页显示数 ,默认5")
                                       @RequestParam(value = "pageSize", required = false) Integer pageSize){
                                       @RequestParam(value = "pageSize", required = false, defaultValue = "5") Integer pageSize){
        try {
        try {
            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getDoctorArticalByUserId(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getUID());
            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getDoctorArticalByUserId(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getUID());
//            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getDoctorArticalByUserId(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"0de7295862dd11e69faffa163e8aee56");
//            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getDoctorArticalByUserId(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"0de7295862dd11e69faffa163e8aee56");
@ -730,4 +730,22 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
        }
        }
    }
    }
    @RequestMapping(value = "getArticalList",method = RequestMethod.GET)
    @ApiOperation("获取文章列表 多ID")
    public String getDoctorArticalByUserId(@ApiParam(name = "articleId", value = "文章ID")
                                           @RequestParam(value = "articleId", required = false) String articleId,
                                           @ApiParam(name = "pageIndex", value = "起始页数 0开始,默认0")
                                           @RequestParam(value = "pageIndex", required = false ,defaultValue = "0") int pageIndex,
                                           @ApiParam(name = "pageSize", value = "每页显示数 ,默认5")
                                           @RequestParam(value = "pageSize", required = false ,defaultValue = "5") int pageSize){
        try {
            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getArticalList(articleId,1,pageIndex,pageSize);
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败!");
        }
    }
}
}

+ 28 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

@ -31,7 +31,7 @@ import java.util.TreeMap;
 * Created by chenweida on 2017/10/13.
 * Created by chenweida on 2017/10/13.
 */
 */
@Controller
@Controller
@RequestMapping(value = "/esstatistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, method = {RequestMethod.GET, RequestMethod.POST})
@RequestMapping(value = "/statistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, method = {RequestMethod.GET, RequestMethod.POST})
@Api(description = "ES统计查询")
@Api(description = "ES统计查询")
public class EsStatisticsController extends BaseController {
public class EsStatisticsController extends BaseController {
@ -789,7 +789,7 @@ public class EsStatisticsController extends BaseController {
    /**
    /**
     * 获取得分平均数
     * 获取得分平均数
     *
     * http://172.19.103.11:9092/wlyy//statistics/getAVGSocre?level=4&area=350200
     * @param level
     * @param level
     * @param area
     * @param area
     * @return
     * @return
@ -798,7 +798,6 @@ public class EsStatisticsController extends BaseController {
    @ResponseBody
    @ResponseBody
    public String getAVGSocre(@RequestParam(required = true) String level, @RequestParam(required = true) String area) {
    public String getAVGSocre(@RequestParam(required = true) String level, @RequestParam(required = true) String area) {
        try {
        try {
            level = elasticsearchUtil.changeLevel(Integer.parseInt(level))+"";
            return write(200, "查询成功", "data", statisticsService.getAVGSocre(level, area));
            return write(200, "查询成功", "data", statisticsService.getAVGSocre(level, area));
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
@ -818,8 +817,12 @@ public class EsStatisticsController extends BaseController {
                                     @RequestParam(required = true) String statDate,
                                     @RequestParam(required = true) String statDate,
                                     @RequestParam(required = true) String endDate) {
                                     @RequestParam(required = true) String endDate) {
        try {
        try {
            level = elasticsearchUtil.changeLevel(Integer.parseInt(level))+"";
            return write(200, "查询成功", "data", statisticsESService.getAVGSocreByMonth(level, area, statDate, endDate));
            //新版没数据
            //level = elasticsearchUtil.changeLevel(Integer.parseInt(level))+"";
            //return write(200, "查询成功", "data", statisticsESService.getAVGSocreByMonth(level, area, statDate, endDate));
            //曲线图先用旧版  因为之前没有数据 等数据生成在切换到新版
            return write(200, "查询成功", "data", statisticsService.getAVGSocreByMonth(level, area, statDate, endDate));
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
            return error(-1, "查询失败");
            return error(-1, "查询失败");
@ -1606,6 +1609,26 @@ public class EsStatisticsController extends BaseController {
        }
        }
    }
    }
    /**
     * 团队工作报告--长处方
     * @param startDate
     * @param endDate
     * @param adminTeamId
     * @return
     */
    @RequestMapping("/getPrescriptionTotalCount")
    @ResponseBody
    public String getPrescriptionTotalCount(@ApiParam(name="startDate", value="开始时间 yyyy-MM-dd") @RequestParam(required = true)String startDate,
                                            @ApiParam(name="endDate", value="开始时间 yyyy-MM-dd") @RequestParam(required = true)String endDate,
                                            @ApiParam(name="adminTeamId", value="团队ID") @RequestParam(required = true)Integer adminTeamId){
        try{
            return write(200, "查询成功", "data", statisticsESService.getPrescriptionTotalCount(startDate,endDate,adminTeamId));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
    //=================================长处方分析===============================================
    //=================================长处方分析===============================================
//    @RequestMapping("/getPrescriptionCount")
//    @RequestMapping("/getPrescriptionCount")

+ 8 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

@ -29,7 +29,7 @@ import java.util.*;
 * Created by lyr on 2016/08/16.
 * Created by lyr on 2016/08/16.
 */
 */
@Controller
@Controller
@RequestMapping(value = "/statistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,method = {RequestMethod.GET,RequestMethod.POST})
@RequestMapping(value = "/old/statistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,method = {RequestMethod.GET,RequestMethod.POST})
@Api(description = "统计")
@Api(description = "统计")
public class StatisticsController extends BaseController {
public class StatisticsController extends BaseController {
@ -1652,6 +1652,13 @@ public class StatisticsController extends BaseController {
        }
        }
    }
    }
    /**
     * 团队工作报告--长处方
     * @param startDate
     * @param endDate
     * @param adminTeamId
     * @return
     */
    @RequestMapping("/getPrescriptionTotalCount")
    @RequestMapping("/getPrescriptionTotalCount")
    @ResponseBody
    @ResponseBody
    public String getPrescriptionTotalCount(@ApiParam(name="startDate", value="开始时间 yyyy-MM-dd") @RequestParam(required = true)String startDate,
    public String getPrescriptionTotalCount(@ApiParam(name="startDate", value="开始时间 yyyy-MM-dd") @RequestParam(required = true)String startDate,