瀏覽代碼

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

liuwenbin 7 年之前
父節點
當前提交
86d78901e3
共有 29 個文件被更改,包括 630 次插入268 次删除
  1. 2 2
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/SignController.java
  2. 2 2
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/LogService.java
  3. 25 0
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/SystemDictService.java
  4. 3 5
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/dataFilter/SignDataFilter.java
  5. 46 46
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java
  6. 9 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java
  7. 1 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/DoctorFeldsherTemplateJob.java
  8. 1 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/consult/FinishConsultJob.java
  9. 1 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/patient/PatientSchemeListDao.java
  10. 1 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/patient/PrenatalInspectorPlanDao.java
  11. 15 4
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/third/jw/ZyDictService.java
  12. 17 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/web/quota/JobController.java
  13. 3 0
      patient-co/patient-co-wlyy-job/src/main/resources/system.properties
  14. 122 115
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  15. 103 23
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prenatalInspector/PrenatalInspectorPreCardService.java
  16. 33 13
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java
  17. 102 16
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsAllService.java
  18. 12 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java
  19. 20 7
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java
  20. 11 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java
  21. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prenatalInspector/PrenatalController.java
  22. 13 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java
  23. 8 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prenatalInspector/PrenatalInspectorContoller.java
  24. 5 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java
  25. 16 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
  26. 6 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java
  27. 48 9
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/OnePayController.java
  28. 1 1
      patient-co/patient-co-wlyy/src/main/resources/wechat/weixin_menu.txt
  29. 2 2
      patient-co/patient-co-wlyy/src/main/resources/wechat/weixin_menu_jimei.txt

+ 2 - 2
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/SignController.java

@ -105,9 +105,9 @@ public class SignController {
    @RequestMapping(value = "getSickMedicalSimpleListInfo",method = RequestMethod.POST)
    @ApiOperation("查询老年人体检记录接口")
    public Result getSickMedicalSimpleListInfo (
            @ApiParam(name="TIME_START",value="修改的开始时间",defaultValue = "2017-6-6 00:00:00")
            @ApiParam(name="TIME_START",value="修改的开始时间",defaultValue = "2012-2-6 00:00:00")
            @RequestParam(value="TIME_START",required = false) String TIME_START,
            @ApiParam(name="TIME_END",value="修改的开始时间",defaultValue = "2017-6-7 23:59:59")
            @ApiParam(name="TIME_END",value="修改的开始时间",defaultValue = "2012-2-7 23:59:59")
            @RequestParam(value="TIME_END",required = false) String TIME_END){
        try {
            String response = signZYService.getSickMedicalSimpleListInfo(TIME_START,TIME_END);

+ 2 - 2
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/LogService.java

@ -69,7 +69,7 @@ public class LogService {
    {
        try {
            //成功日志是否保存
            Boolean saveSuccessLog = systemDictService.getSaveSuccessLog();
            Boolean saveSuccessLog = systemDictService.getSaveSuccessLogSign();
            if(!isSuccess || saveSuccessLog) {
                //空数据不保存
                if(StringUtil.isEmpty(response) || response.contains("\"DATA\":[]"))
@ -115,7 +115,7 @@ public class LogService {
        try
        {
            //成功日志是否保存
            Boolean saveSuccessLog = systemDictService.getSaveSuccessLog();
            Boolean saveSuccessLog = systemDictService.getSaveSuccessLogSign();
            if(!isSuccess || saveSuccessLog || action.equals("0")) {
                SignFamilyLog obj = new SignFamilyLog();
                obj.setAction(action);

+ 25 - 0
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/SystemDictService.java

@ -472,6 +472,31 @@ public class SystemDictService {
        }
    }
    /**
     * http_log是否记录成功消息,签约工程单独算
     * @return
     */
    public Boolean getSaveSuccessLogSign()
    {
        try{
            SystemDict dict = systemDictDao.findByDictNameAndCode(dictName, "SAVE_SUCCESS_LOG_SIGN");
            String re = dict.getValue();
            if("1".equals(re))
            {
                return true;
            }
            else{
                return false;
            }
        }
        catch (Exception ex)
        {
            ex.printStackTrace();
            return false;
        }
    }
    /**
     *默认患者指标录入默认sn码
     **/

+ 3 - 5
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/dataFilter/SignDataFilter.java

@ -375,11 +375,9 @@ public class SignDataFilter {
    private String getAgeDisease(SignFamily signFamily) {
        //得到患者年龄
        StringBuffer returnLevel2KeyBuffer = new StringBuffer("0");
        int age = IdCardUtil.getAgeForIdcard(signFamily.getIdcard());
        if (0 == age) {
            errorModels.add(ErrorModel.newEM(signFamily.getCode(), ErrorModel.sign_idcard_error_age));
        }
        if (age >= 65) {
        //原来是身份证解析年龄,现在根据患者分组
        String group = cachePool.getPatientGroup(signFamily.getPatient());
        if ("3".equals(group)) {
            returnLevel2KeyBuffer.append(",3");
        }
        //疾病标签

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

@ -308,52 +308,52 @@ public class CurrentDayAllQuotaJob implements Job {
//        computequota_1(sql, signFamilies, null); //统计今天的签约
//        computequota_2(); //统计今天的解约
//        computequota_3(); //统计今天的健康咨询量
//        computequota_4(); //统计今天的随访量
//        computequota_5(); //统计今天的健康指导
//        computequota_6(sql, signFamilies, null); //统计今天的签约患者性别
//        computequota_7(sql, signFamilies, null);//统计今天的签约患者分组
//        computequota_8(sql, signFamilies, null);//统计今天的签约患者年龄
//        computequota_9();//统计今天的待签约
//        computequota_10();//统计今天的改签
//        computequota_12(sql, signFamilies, null);//统计今天的签约下按年龄分组后再
//        computequota_13(sql, signFamilies, null);//统计今天的签约量
//        computequota_16_1(sql, signFamilies, null);//统计今天的签约数的扣费钱
//        computequota_15(sql, signFamilies, null);//统计今天的健康分布统计
//        computequota_17(sql, signFamilies, null);//统计今天的年龄疾病
//        computequota_20();//统计今天的已经签约患者绑定设备
//        computequota_21();//统计今天的已经签约微信关注人数
//        computequota_49();//统计今天的已经签约未扣费微信关注人数
//        computequota_50();//统计今天的已经签约已扣费微信关注人数
//        computequota_22();//未回复的咨询量
//        computequota_23();//及时回复的咨询量
//        computequota_24();//及时回复的咨询量时间分布
//        computequota_25();//统计质询量总数
//        computequota_26();//统计未缴费签约总数
//        computequota_27();//统计代预约量
//        computequota_28();//统计平均值
//        computequota_31(); //统计续签夸团队
//        computequota_32(); //统计续签夸社区
//        computequota_33(); //统计续签夸区
//        computequota_34(); //续签团队签入
//        computequota_35(teamSignOutFamilies); //统计团队签出
//        computequota_36(sql, signFamilies, null); //签约服务类型
//        //computequota_37(); //统计团队转签 没用指标
//        computequota_38(); //续签机构签入
//        computequota_39(orgSignOutFamilies); //统计机构签出
//        computequota_40(); //续签区签入
//        computequota_41(townSignOutFamilies); //统计区签出
//        computequota_42(teamSignFamilies); //统计团队续签
//        computequota_43(townSignFamilies); //统计社区续签
//        computequota_44(orgSignFamilies); //统计区续签
//        computequota_29(citySignFamilies); //统计市级续签
//        //computequota_45(); //统计社区转签 没用指标
//        //computequota_46(); //统计区转签  没用指标
//        computequota_30(); //统计团队续签原因
////        computequota_47(); //统计社区续签原因 没用指标
////        computequota_48(); //统计区续签原因 没用指标
        computequota_1(sql, signFamilies, null); //统计今天的签约
        computequota_2(); //统计今天的解约
        computequota_3(); //统计今天的健康咨询量
        computequota_4(); //统计今天的随访量
        computequota_5(); //统计今天的健康指导
        computequota_6(sql, signFamilies, null); //统计今天的签约患者性别
        computequota_7(sql, signFamilies, null);//统计今天的签约患者分组
        computequota_8(sql, signFamilies, null);//统计今天的签约患者年龄
        computequota_9();//统计今天的待签约
        computequota_10();//统计今天的改签
        computequota_12(sql, signFamilies, null);//统计今天的签约下按年龄分组后再
        computequota_13(sql, signFamilies, null);//统计今天的签约量
        computequota_16_1(sql, signFamilies, null);//统计今天的签约数的扣费钱
        computequota_15(sql, signFamilies, null);//统计今天的健康分布统计
        computequota_17(sql, signFamilies, null);//统计今天的年龄疾病
        computequota_20();//统计今天的已经签约患者绑定设备
        computequota_21();//统计今天的已经签约微信关注人数
        computequota_49();//统计今天的已经签约未扣费微信关注人数
        computequota_50();//统计今天的已经签约已扣费微信关注人数
        computequota_22();//未回复的咨询量
        computequota_23();//及时回复的咨询量
        computequota_24();//及时回复的咨询量时间分布
        computequota_25();//统计质询量总数
        computequota_26();//统计未缴费签约总数
        computequota_27();//统计代预约量
        computequota_28();//统计平均值
        computequota_31(); //统计续签夸团队
        computequota_32(); //统计续签夸社区
        computequota_33(); //统计续签夸区
        computequota_34(); //续签团队签入
        computequota_35(teamSignOutFamilies); //统计团队签出
        computequota_36(sql, signFamilies, null); //签约服务类型
        //computequota_37(); //统计团队转签 没用指标
        computequota_38(); //续签机构签入
        computequota_39(orgSignOutFamilies); //统计机构签出
        computequota_40(); //续签区签入
        computequota_41(townSignOutFamilies); //统计区签出
        computequota_42(teamSignFamilies); //统计团队续签
        computequota_43(townSignFamilies); //统计社区续签
        computequota_44(orgSignFamilies); //统计区续签
        computequota_29(citySignFamilies); //统计市级续签
        //computequota_45(); //统计社区转签 没用指标
        //computequota_46(); //统计区转签  没用指标
        computequota_30(); //统计团队续签原因
//        computequota_47(); //统计社区续签原因 没用指标
//        computequota_48(); //统计区续签原因 没用指标
        //1.3.8需求开发
        computequota_51(citySignFamilies);//统计市级续签服务类型维度

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

@ -107,6 +107,7 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
            } else {
                logger.info("prescription_pay_query_job reorder job job exist");
            }
            //居民24小时未回复的咨询自动关闭 每小时59分开始执行一次
            if (!quartzHelper.isExistJob("finish_consult_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("finish_consult_job");
@ -151,7 +152,14 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
                logger.info("onepay_query_job  job exist");
            }
            //产检提醒 每天早上8点执行一次
            if (!quartzHelper.isExistJob("prenatal_inspector_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("prenatal_inspector_job");
                quartzHelper.addJob(PrenatalInspectorJob.class, trigger, "prenatal_inspector_job", new HashMap<String, Object>());
                logger.info("prenatal_inspector_job success");
            } else {
                logger.info("prenatal_inspector_job exist");
            }
            // 启动redis 消息队列线程
            logger.info("redis message start");

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/DoctorFeldsherTemplateJob.java

@ -240,7 +240,7 @@ public class DoctorFeldsherTemplateJob implements Job {
        Date today = new Date();
        if (minutes <= 30 && minutes > 0) {
            PatientSchemeList patient = schemeListDao.findPatientBySchemecode(schemecode, (short) type);
            PatientSchemeList patient = schemeListDao.findPatientBySchemecode(schemecode,type);
            String patientCode = patient.getPatientcode();
            String day = formatDay.format(today);

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/consult/FinishConsultJob.java

@ -40,7 +40,7 @@ public class FinishConsultJob implements Job {
            sql.append("SELECT s.id session_id, s.name session_name, s.create_date session_create_time, s.last_message_time, ")
            .append("t.id topic_id, t.name topic_name, t.create_time topic_create_time, t.start_message_id ")
            .append("FROM ").append(imDb).append(".sessions s,").append(imDb).append(".wlyy_consults t ")
            .append("WHERE s.id = t.session_id  AND t.end_message_id IS NULL AND s.last_content_type in(1,2,3,4) and s.last_sender_id IN ( ")
            .append("WHERE s.id = t.session_id  AND t.end_message_id IS NULL AND s.last_content_type in(1,2,3,4,15) and s.last_sender_id IN ( ")
            .append("SELECT id FROM ").append(imDb).append(".doctors d where d.id<>t.patient) ")
            .append("AND UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(s.last_message_time) > 24*3600 ")
            .append("ORDER BY t.create_time");

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/patient/PatientSchemeListDao.java

@ -23,5 +23,5 @@ public interface PatientSchemeListDao extends PagingAndSortingRepository<Patient
    //根据schemecode查询患者监测方案
    @Query(" select p from PatientSchemeList p where p.schemecode = ?1 and p.type = ?2 ")
    PatientSchemeList findPatientBySchemecode(String schemecode,short type);
    PatientSchemeList findPatientBySchemecode(String schemecode,Integer type);
}

+ 1 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/patient/PrenatalInspectorPlanDao.java

@ -15,6 +15,6 @@ public interface PrenatalInspectorPlanDao extends PagingAndSortingRepository<Pre
    @Query("select a from PrenatalInspectorPlan a where a.inspectionCode = ?1 and a.status = '0' ")
    List<PrenatalInspectorPlan> findByCode(String inspectionCode);
    @Query("select a from PrenatalInspectorPlan a where a.inspectionTime is not null and a.status = '0' and ( TO_DAYS(a.inspectionTime)- TO_DAYS(NOW())=7 or TO_DAYS(a.inspectionTime)- TO_DAYS(NOW())=1 ) ")
    @Query("select a from PrenatalInspectorPlan a where a.inspectionTime is not null and a.status = '0' and a.del ='1' and ( TO_DAYS(a.inspectionTime)- TO_DAYS(NOW())=7 or TO_DAYS(a.inspectionTime)- TO_DAYS(NOW())=1 ) ")
    List<PrenatalInspectorPlan> findWxTipList();
}

+ 15 - 4
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/third/jw/ZyDictService.java

@ -135,7 +135,6 @@ public class ZyDictService {
        zyIvStaffRegTypeAllotDictDao.save(zyIvStaffRegTypeAllotDictTemp);
    }
    @Transactional
    public void synchronizeZ_iv_staff_dict() {
        logger.info("synchronized zy_iv_staff_dict start");
        String dictName = this.IV_STAFF_DICT;
@ -147,11 +146,24 @@ public class ZyDictService {
            zyIvStaffDictDao.deleteAll();
            //新增数据
            logger.info("save table zy_iv_staff_dict  ,size:" + zyIvStaffDicts.size());
            zyIvStaffDictDao.save(zyIvStaffDicts);
            List<ZyIvStaffDict> zyIvStaffRegTypeAllotDictTemp = new ArrayList<>();
            for (int i = 0; i < zyIvStaffDicts.size(); i++) {
                zyIvStaffRegTypeAllotDictTemp.add(zyIvStaffDicts.get(i));
                //批量提交
                if (((zyIvStaffRegTypeAllotDictTemp.size() % 2000) == 0) || (zyIvStaffRegTypeAllotDictTemp.size() == i)) {
                    saveZ_iv_staff_dict(zyIvStaffRegTypeAllotDictTemp);
                    zyIvStaffRegTypeAllotDictTemp = new ArrayList<>();
                }
            }
            logger.info("synchronized zy_iv_staff_dict end");
        }
    }
    @Transactional
    private void saveZ_iv_staff_dict(List<ZyIvStaffDict> zyIvStaffDicts) {
        zyIvStaffDictDao.save(zyIvStaffDicts);
    }
    public void synchronizeZy_iv_physic_dict() {
        logger.info("synchronized zy_iv_physic_dict start");
        String dictName = this.IV_PHYSIC_DICT;
@ -181,7 +193,6 @@ public class ZyDictService {
        zyIvPhysicDictDao.save(zyIvPhysicDictsTemp);
    }
    @Transactional
    public void synchronizeZy_iv_org_physic_allot_dict() {
        logger.info("synchronized zy_iv_org_physic_allot_dict start");
        String dictName = this.IV_ORG_PHYSIC_ALLOT_DICT;
@ -240,7 +251,6 @@ public class ZyDictService {
        zyIvDiagnoseClassDictDao.save(zIvDiagnoseClassDicts);
    }
    @Transactional
    public void synchronizeZy_iv_dept_staff_allot_dict() {
        logger.info("synchronized zy_iv_dept_staff_allot_dict start");
        String dictName = this.IV_DEPT_STAFF_ALLOT_DICT;
@ -266,6 +276,7 @@ public class ZyDictService {
        }
    }
    @Transactional
    private void saveZy_iv_dept_staff_allot_dict(List<ZyIvDeptStaffAllotDict> syIvDeptStaffAllotDictz) {
        zyIvDeptStaffAllotDictDao.save(syIvDeptStaffAllotDictz);
    }

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

@ -429,6 +429,23 @@ public class JobController extends BaseController {
        }
    }
    /**
     * 产检提醒
     * @author ysj
     * @date 2017/10/10 14:16
     */
    @RequestMapping(value = "/executePrenatalInspectorJob", method = RequestMethod.POST)
    @ApiOperation("产检提醒")
    public String executePrenatalInspectorJob() {
        try {
            quartzHelper.startNow(PrenatalInspectorJob.class, UUID.randomUUID().toString(), 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

@ -87,6 +87,9 @@ sfexpress_reorder_job=0 0/10 * * * ?
#同步智业字典
zy_dict_job=0 0 1 * * ?
#产检提醒
prenatal_inspector_job=0 0 8 * * ?
#遍历支付成功,院内结算失败的的记录,重新结算,3分钟跑一次
zy_execute_sick_settle_job=0 0/3 * * * ?
#处理当天支付,页面回调及异步回调失败的支付,每3分钟一次去主动查询并保存

+ 122 - 115
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -785,73 +785,76 @@ public class ConsultTeamService extends ConsultService {
     * @return
     * @throws Exception
     */
    public int addTeamConsult(ConsultTeam ct, String patient,String agent) throws Exception {
    public JSONObject addTeamConsult(ConsultTeam ct, String patient,String agent) throws Exception {
        JSONObject re = new JSONObject();
        if (exist(patient, ct.getType())) {//判断是否有未结束的咨询移到同步方法中
            re.put("status",-3);
            return re;
        }
        synchronized (patient.intern()){//新增同步块,防止居民网络不好时多次点击,或者im服务器响应慢导致同时发起多个咨询
            if (exist(patient, ct.getType())) {//判断是否有未结束的咨询移到同步方法中
                return -3;
            }
        JSONObject users = new JSONObject();
            JSONObject users = new JSONObject();
        if(patient.equals(agent)){
            agent = null;
        }
            if(patient.equals(agent)){
                agent = null;
        // 咨询三师
        if (ct.getType() == 1) {
            // 查询三师签约信息
            SignFamily sc = signFamilyDao.findBySanshiPatientYes(patient);
            if (sc == null) {
                // 不存在三师签约
                re.put("status",-2);
                return re;
            }
            // 咨询三师
            if (ct.getType() == 1) {
                // 查询三师签约信息
                SignFamily sc = signFamilyDao.findBySanshiPatientYes(patient);
                if (sc == null) {
                    // 不存在三师签约
                    return -2;
                }
                ct.setTeam(sc.getTeamCode());
                // 设置健康管理师,三师咨询默认给健康管理师处理
                //查找病人所在的团队
                DoctorTeam doctorTeam = doctorTeamDao.findBySanshiParientCode(patient);
                //得到团队的健康管理师
                DoctorTeamMember doctorTeamMemberHealthy = doctorTeamDoctor.findDoctorSanshi2ByTeam(doctorTeam.getCode(), 3);
                DoctorTeamMember doctorTeamMember = doctorTeamDoctor.findDoctorSanshi2ByTeam(doctorTeam.getCode(), 2);
                if (doctorTeamMemberHealthy == null) {
                    ct.setDoctor(doctorTeamMember.getMemberCode());
                    users.put(doctorTeamMember.getMemberCode(), 0);
                } else {
                    users.put(doctorTeamMemberHealthy.getMemberCode(), 0);
                    if (doctorTeamMember != null) {
                        if (users.isNull(doctorTeamMember.getMemberCode())) {
                            users.put(doctorTeamMember.getMemberCode(), 1);
                        }
            ct.setTeam(sc.getTeamCode());
            // 设置健康管理师,三师咨询默认给健康管理师处理
            //查找病人所在的团队
            DoctorTeam doctorTeam = doctorTeamDao.findBySanshiParientCode(patient);
            //得到团队的健康管理师
            DoctorTeamMember doctorTeamMemberHealthy = doctorTeamDoctor.findDoctorSanshi2ByTeam(doctorTeam.getCode(), 3);
            DoctorTeamMember doctorTeamMember = doctorTeamDoctor.findDoctorSanshi2ByTeam(doctorTeam.getCode(), 2);
            if (doctorTeamMemberHealthy == null) {
                ct.setDoctor(doctorTeamMember.getMemberCode());
                users.put(doctorTeamMember.getMemberCode(), 0);
            } else {
                users.put(doctorTeamMemberHealthy.getMemberCode(), 0);
                if (doctorTeamMember != null) {
                    if (users.isNull(doctorTeamMember.getMemberCode())) {
                        users.put(doctorTeamMember.getMemberCode(), 1);
                    }
                    ct.setDoctor(doctorTeamMemberHealthy.getMemberCode());
                }
                // 设置家庭医生
                ct.setDoctor(doctorTeamMemberHealthy.getMemberCode());
            }
            // 设置家庭医生
                ct.setAdminTeamId(sc.getAdminTeamId());
            } else if (ct.getType() == 2) {
                // 咨询家庭医生
                SignFamily sf = signFamilyDao.findByjiatingPatient(patient);
            ct.setAdminTeamId(sc.getAdminTeamId());
        } else if (ct.getType() == 2) {
            // 咨询家庭医生
            SignFamily sf = signFamilyDao.findByjiatingPatient(patient);
                if (sf == null) {
                    // 不存在家庭签约
                    return -1;
                }
                ct.setTeam(sf.getTeamCode());
                // 设置健康管理师,家庭医生咨询默认给健康管理师处理
                //查找病人所在的团队
                //1.3.3.2 更改从签约记录判断团队成员,分配建管师
                if(StringUtils.isNotBlank(sf.getDoctorHealth())) {
                    users.put(sf.getDoctorHealth(), 0);
                    ct.setDoctor(sf.getDoctorHealth());
                    if (StringUtils.isNotBlank(sf.getDoctor())) {
                        if (users.isNull(sf.getDoctor())) {
                            users.put(sf.getDoctor(), 1);
                        }
            if (sf == null) {
                // 不存在家庭签约
                re.put("status",-1);
                return re;
            }
            ct.setTeam(sf.getTeamCode());
            // 设置健康管理师,家庭医生咨询默认给健康管理师处理
            //查找病人所在的团队
            //1.3.3.2 更改从签约记录判断团队成员,分配建管师
            if(StringUtils.isNotBlank(sf.getDoctorHealth())) {
                users.put(sf.getDoctorHealth(), 0);
                ct.setDoctor(sf.getDoctorHealth());
                if (StringUtils.isNotBlank(sf.getDoctor())) {
                    if (users.isNull(sf.getDoctor())) {
//                        users.put(sf.getDoctor(), 1); 全科默认也收到消息
                        users.put(sf.getDoctor(), 0);
                    }
                } else {
                    ct.setDoctor(sf.getDoctor());
                    users.put(sf.getDoctor(), 0);
                }
            } else {
                ct.setDoctor(sf.getDoctor());
                users.put(sf.getDoctor(), 0);
            }
//            DoctorTeam doctorTeam = doctorTeamDao.findByParientCode(patient);
//            //得到团队的健康管理师
@ -871,69 +874,73 @@ public class ConsultTeamService extends ConsultService {
//                ct.setDoctor(doctorTeamMemberHealthy.getMemberCode());
//            }
                // 设置家庭医生
                ct.setAdminTeamId(sf.getAdminTeamId());
            }
            // 设置患者信息
            ct.setPatient(patient);
            // 查询患者信息
            Patient tempPatient = patientDao.findByCode(patient);
            // 设置患者姓名
            ct.setName(tempPatient.getName());
            // 设置患者生日
            ct.setBirthday(tempPatient.getBirthday());
            //新增性别
            ct.setSex(tempPatient.getSex());
            // 设置患者头像
            ct.setPhoto(tempPatient.getPhoto());
            // 设置操作日期
            ct.setCzrq(new Date());
            ct.setDel("1");
            ct.setStatus(0);
            ct.setEvaluate(0);
            // 医生未读数量为1
            ct.setDoctorRead(1);
            // 添加咨询记录
            Consult consult = addConsult(ct.getPatient(), null, ct.getSymptoms(), ct.getImages(), ct.getType());
            // 设置关联指导
            consult.setGuidance(ct.getGuidance());
            // 设置咨询标识
            ct.setConsult(consult.getCode());
            // 设置家庭医生
            ct.setAdminTeamId(sf.getAdminTeamId());
        }
        // 设置患者信息
        ct.setPatient(patient);
        // 查询患者信息
        Patient tempPatient = patientDao.findByCode(patient);
        // 设置患者姓名
        ct.setName(tempPatient.getName());
        // 设置患者生日
        ct.setBirthday(tempPatient.getBirthday());
        //新增性别
        ct.setSex(tempPatient.getSex());
        // 设置患者头像
        ct.setPhoto(tempPatient.getPhoto());
        // 设置操作日期
        ct.setCzrq(new Date());
        ct.setDel("1");
        ct.setStatus(0);
        ct.setEvaluate(0);
        // 医生未读数量为1
        ct.setDoctorRead(1);
        // 添加咨询记录
        Consult consult = addConsult(ct.getPatient(), null, ct.getSymptoms(), ct.getImages(), ct.getType());
        // 设置关联指导
        consult.setGuidance(ct.getGuidance());
        // 设置咨询标识
        ct.setConsult(consult.getCode());
            //推送给IM去创建议题,取得成员消息
        //推送给IM去创建议题,取得成员消息
//        JSONObject messages = ImUtill.getCreateTopicMessage(patient, tempPatient.getName(), consult.getTitle(), "咨询问题:"+consult.getSymptoms(), consult.getImages());
            JSONObject messages = ImUtill.getCreateTopicMessage(patient, tempPatient.getName(), consult.getTitle(), consult.getSymptoms(), consult.getImages(),agent);
            users.put(patient, 0);//+ " "+(tempPatient.getSex()==1?"(男 ":"(女 ") + IdCardUtil.getAgeForIdcard(tempPatient.getIdcard())+")"
            JSONObject obj = ImUtill.createTopics(patient + "_" + ct.getTeam() + "_" + ct.getType(), consult.getCode(), tempPatient.getName(), users, messages, ImUtill.SESSION_TYPE_MUC);
            if (obj == null) {
                throw new RuntimeException("IM消息发送异常!");
            }
            if(obj.getInt("status")==-1){//im议题创建失败
                throw new RuntimeException(obj.getString("message"));
            }
            ct.setStartMsgId(obj.get("start_msg_id").toString());
            consultTeamDao.save(ct);
            consultDao.save(consult);
            for (String key : users.keySet()) {
                if (patient.equals(key)) {
                    continue;
                }
                //记录咨询的医生详情误删
                ConsultTeamDoctor cd = new ConsultTeamDoctor();
                cd.setConsult(consult.getCode());
                cd.setDel("1");
                cd.setCzrq(new Date());
                cd.setTo(key);
                consultTeamDoctorDao.save(cd);
        JSONObject messages = ImUtill.getCreateTopicMessage(patient, tempPatient.getName(), consult.getTitle(), consult.getSymptoms(), consult.getImages(),agent);
        users.put(patient, 0);//+ " "+(tempPatient.getSex()==1?"(男 ":"(女 ") + IdCardUtil.getAgeForIdcard(tempPatient.getIdcard())+")"
        JSONObject obj = ImUtill.createTopics(patient + "_" + ct.getTeam() + "_" + ct.getType(), consult.getCode(), tempPatient.getName(), users, messages, ImUtill.SESSION_TYPE_MUC);
        if (obj == null) {
            throw new RuntimeException("IM消息发送异常!");
        }
        if(obj.getInt("status")==-1){//im议题创建失败
            throw new RuntimeException(obj.getString("message"));
        }
        ct.setStartMsgId(obj.get("start_msg_id").toString());
        consultTeamDao.save(ct);
        consultDao.save(consult);
        JSONArray doctor = new JSONArray();
        for (String key : users.keySet()) {
            if (patient.equals(key)) {
                continue;
            }
            doctor.put(key);
            //记录咨询的医生详情误删
            ConsultTeamDoctor cd = new ConsultTeamDoctor();
            cd.setConsult(consult.getCode());
            cd.setDel("1");
            cd.setCzrq(new Date());
            cd.setTo(key);
            consultTeamDoctorDao.save(cd);
        }
            // 保存医生咨询信息
            // 添加咨询转发记录
            // 添加医生咨询日志
            String content = addLogs(ct);
        // 保存医生咨询信息
        // 添加咨询转发记录
        // 添加医生咨询日志
        String content = addLogs(ct);
        re.put("doctor",doctor);
        re.put("status",1);
        return re;
            return 1;
        }
    }
    /**

+ 103 - 23
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prenatalInspector/PrenatalInspectorPreCardService.java

@ -2,15 +2,18 @@ package com.yihu.wlyy.service.app.prenatalInspector;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.device.entity.DevicePatientHealthIndex;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.prenatal.PrenatalInspectorPlan;
import com.yihu.wlyy.entity.patient.prenatal.PrenatalInspectorPlanLibrary;
import com.yihu.wlyy.entity.patient.prenatal.PrenatalInspectorPreCard;
import com.yihu.wlyy.health.repository.DevicePatientHealthIndexDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.patient.*;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.health.PatientHealthIndexService;
import com.yihu.wlyy.service.app.sign.FamilyContractService;
import com.yihu.wlyy.service.third.jw.JwMaternalChildService;
import com.yihu.wlyy.service.third.jw.ZyDictService;
@ -18,14 +21,13 @@ import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * Created by yeshijie on 2017/6/6.
@ -34,6 +36,8 @@ import java.util.Map;
@Transactional(rollbackFor = Exception.class)
public class PrenatalInspectorPreCardService extends BaseService {
    private static Logger logger = LoggerFactory.getLogger(PrenatalInspectorPreCardService.class);
    @Autowired
    private PrenatalInspectorPreCardDao prenatalInspectorPreCardDao;
    @Autowired
@ -56,6 +60,10 @@ public class PrenatalInspectorPreCardService extends BaseService {
    private DoctorDao doctorDao;
    @Autowired
    private ZyDictService zyDictService;
    @Autowired
    private PatientHealthIndexService healthIndexService;
    @Autowired
    private DevicePatientHealthIndexDao healthIndexDao;
//    public
@ -95,12 +103,14 @@ public class PrenatalInspectorPreCardService extends BaseService {
        }
        Patient patient = patientDao.findByCode(patientCode);
        try{
            boolean checkFlag = true;//是否查询预建卡接口。有建卡记录且建卡记录有结束妊娠才查询预建卡
            String response = jwMaternalChildService.getEhrMaternalFirstExamRecord(patient.getIdcard(),hospital);
            JSONObject json = JSONObject.parseObject(response);
            JSONArray data = null;
            if(json.getInteger("status")==200){
                data = json.getJSONObject("data").getJSONArray("DATA");
            }
            Map<String,String> map = new HashMap<>();//存储产检号,用于去除预建卡信息中重复记录
            if(data!=null&&data.size()>0){//有建卡信息
                for (int i=0;i<data.size();i++) {
                    JSONObject planJson = new JSONObject();
@ -119,8 +129,9 @@ public class PrenatalInspectorPreCardService extends BaseService {
                    planJson.put("mensesLast",MENSES_LAST);
                    planJson.put("expectedTime",EXPECTED_TIME);
                    Date date = new Date();
                    map.put("PREGNANCY_NO","PREGNANCY_NO");
                    if(StringUtils.isBlank(END_TIME)){
                        checkFlag = checkFlag?false:checkFlag;
                        //未结束妊娠,生成待产检计划
                        List<PrenatalInspectorPlan> plans = prenatalInspectorPlanDao.findByPatient(patientCode);
                        boolean flag = false;
@ -164,7 +175,7 @@ public class PrenatalInspectorPreCardService extends BaseService {
                        //计算距离下次产检时间
                        Long nextExamDay = 0l;
                        for (PrenatalInspectorPlan plan:plans) {
                            Long temp = DateUtil.getDays(date,plan.getInspectionStartTime());
                            Long temp = DateUtil.getDays(plan.getInspectionTime(),date);
                            if(nextExamDay==0||nextExamDay>temp){
                                nextExamDay = temp;
                            }
@ -179,10 +190,10 @@ public class PrenatalInspectorPreCardService extends BaseService {
                            JSONObject bedJson = JSONObject.parseObject(bedRecode);
                            JSONArray bedData = null;
                            if(bedJson.getInteger("status")==200){
                                bedData = json.getJSONObject("data").getJSONArray("DATA");
                                bedData = bedJson.getJSONObject("data").getJSONArray("DATA");
                            }
                            if(bedData!=null&&bedData.size()>0){
                                JSONObject exam = data.getJSONObject(data.size()-1);
                                JSONObject exam = bedData.getJSONObject(bedData.size()-1);
                                precontract_org_name = exam.getString("PRECONTRACT_ORG_NAME");
                            }
                        }catch (Exception e){
@ -192,18 +203,25 @@ public class PrenatalInspectorPreCardService extends BaseService {
                    }
                    re.add(planJson);
                }
            }else{
                //没有建卡信息,请求预建卡接口
                response = jwMaternalChildService.getEhrMaternalPreFirstExamRecord(patient.getIdcard(),hospital);
                JSONObject preJson = JSONObject.parseObject(response);
            }
            //请求预建卡接口
            if(checkFlag){
                String resp = jwMaternalChildService.getEhrMaternalPreFirstExamRecord(patient.getIdcard(),hospital);
                JSONObject preJson = JSONObject.parseObject(resp);
                JSONArray preData = null;
                if(preJson.getInteger("status")==200){
                    preData = preJson.getJSONObject("data").getJSONArray("DATA");
                    if(preData!=null&&preData.size()>0){
                        JSONArray rep = new JSONArray();
                        for (int i=0;i<preData.size();i++){
                            JSONObject planJson = new JSONObject();
                            JSONObject pregnancy = preData.getJSONObject(i);
                            String PREGNANCY_NO = pregnancy.getString("PREGNANCY_NO");//智业产检号
                            if(map.containsKey(PREGNANCY_NO)){
                                continue;//去重
                            }
                            String END_MANNER = pregnancy.getString("END_MANNER");//妊娠终止方式
                            String END_TIME = pregnancy.getString("END_TIME");//结束妊娠
                            String MENSES_LAST = pregnancy.getString("MENSES_LAST");//末次月经
@ -219,7 +237,6 @@ public class PrenatalInspectorPreCardService extends BaseService {
                            if(plans==null||plans.size()==0){//判断是否已经生成产检记录
                                //预建卡还没产检,有产检就会生成产检记录,建卡接口就会有数据
                                Long days = DateUtil.getDays(dueday,date);
//                                days = days>365?0:days;//老早前的测试数据处理
                                List<PrenatalInspectorPlanLibrary> libraries = prenatalInspectorPlanLibraryDao.findByDays(days);
                                plans = new ArrayList<>();
                                PrenatalInspectorPlan plan = null;
@ -231,10 +248,7 @@ public class PrenatalInspectorPreCardService extends BaseService {
                                    plan.setCzrq(date);
                                    plan.setDel("1");
                                    plan.setCheckItem(library.getCheckItem());
//                                    plan.setInspectionCode(PREGNANCY_NO);//产检号
                                    plan.setInspectionTime(DateUtil.getPrenatalInspectorDate(dueday,-library.getEndDay().intValue()));
//                                    plan.setInspectionEndTime(DateUtil.getPrenatalInspectorDate(lastMenstrualDate,library.getEndDay().intValue()));
//                                    plan.setInspectionStartTime(DateUtil.getPrenatalInspectorDate(dueday,-library.getEndDay().intValue()));
                                    plan.setName(library.getName());
                                    plan.setThisFocus(library.getThisFocus());
                                    plan.setThisNote(library.getThisNote());
@ -249,7 +263,7 @@ public class PrenatalInspectorPreCardService extends BaseService {
                            //计算距离下次产检时间
                            Long nextExamDay = 0l;
                            for (PrenatalInspectorPlan plan:plans) {
                                Long temp = DateUtil.getDays(date,plan.getInspectionStartTime());
                                Long temp = DateUtil.getDays(plan.getInspectionTime(),date);
                                if(nextExamDay==0||nextExamDay>temp){
                                    nextExamDay = temp;
                                }
@ -257,11 +271,20 @@ public class PrenatalInspectorPreCardService extends BaseService {
                            planJson.put("plans",plans);//待产检列表
                            planJson.put("nextExamDay",nextExamDay);//距离下次产检天数
                            planJson.put("precontractOrgName",null);//产床医院
                            re.add(planJson);
                            rep.add(planJson);
                        }
                        //重新排序
                        if(rep.size()>0&&re.size()>0){
                            for (int i=0;i<re.size();i++){
                                rep.add(re.getJSONObject(i));
                            }
                            return rep;
                        }
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
        }
@ -352,8 +375,8 @@ public class PrenatalInspectorPreCardService extends BaseService {
     * @param patientCode
     * @return
     */
    public String reExamRecode(String patientCode,String pregnancyNo){
        String re = "";
    public JSONArray reExamRecode(String patientCode,String pregnancyNo){
        JSONArray re = new JSONArray();
        try {
            SignFamily signFamily = signFamilyDao.findByPatient(patientCode);
            String hospital = null;
@ -363,7 +386,15 @@ public class PrenatalInspectorPreCardService extends BaseService {
            Patient patient = patientDao.findByCode(patientCode);
            String response = jwMaternalChildService.getEhrMaternalReExamRecord(patient.getIdcard(),hospital,pregnancyNo);
            return response;
            JSONObject json = JSONObject.parseObject(response);
            JSONArray data = null;
            if(json.getInteger("status")==200){
                data = json.getJSONObject("data").getJSONArray("DATA");
            }
            if(data!=null&&data.size()>0){
                return data;
            }
            return re;
        }catch (Exception e){
            e.printStackTrace();
        }
@ -513,12 +544,33 @@ public class PrenatalInspectorPreCardService extends BaseService {
     * 新建产检预建卡
     */
    @Transactional
    public String addPrenatalInspectorPreCard(PrenatalInspectorPreCard preCard,String patientcCode){
    public String addPrenatalInspectorPreCard(PrenatalInspectorPreCard preCard,String patientCode){
        SignFamily signFamily = signFamilyDao.findByPatient(patientcCode);
        SignFamily signFamily = signFamilyDao.findByPatient(patientCode);
        if(signFamily==null){
            return "-1";
        }
        //判断是否有预建卡
        try {
            String resp = jwMaternalChildService.getEhrMaternalPreFirstExamRecord(preCard.getIdcard(),signFamily.getHospital());
            JSONObject preJson = JSONObject.parseObject(resp);
            JSONArray preData = null;
            if(preJson.getInteger("status")==200){
                preData = preJson.getJSONObject("data").getJSONArray("DATA");
                if(preData!=null&&preData.size()>0){
                    JSONObject temp = preData.getJSONObject(0);
                    String END_MANNER = temp.getString("END_MANNER");//妊娠终止方式
                    if(StringUtils.isBlank(END_MANNER)){
                        return "-2";
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            return "-3";
        }
        //获取团队长
        Doctor doctor = doctorDao.findByAdminTeamId(signFamily.getAdminTeamId());
        preCard.setDoctor(doctor.getCode());
@ -588,4 +640,32 @@ public class PrenatalInspectorPreCardService extends BaseService {
        return preCard.getCode();
    }
    /**
     * 保存体征数据 有保存体征数据才更新
     * @param preCard
     * @param patientCode
     */
    public void saveHealthIndex(PrenatalInspectorPreCard preCard,String patientCode){
        if(StringUtils.isNotBlank(preCard.getHeight())&&StringUtils.isNotBlank(preCard.getWeight())){
            //先判断体征数据是否变更
            DevicePatientHealthIndex index = healthIndexDao.findLastData(patientCode, 3);
            String height = index.getValue2();
            String weight = index.getValue1();
            if(!preCard.getHeight().equals(height)||!preCard.getWeight().equals(weight)){
                //更新体征数据
                JSONObject json = new JSONObject();
                json.put("time",DateUtil.dateToStrLong(preCard.getCzrq()));
                json.put("height",preCard.getHeight());
                json.put("weight",preCard.getWeight());
                try {
                    healthIndexService.addPatientHealthIndex(json.toString(), "3", patientCode, null);
                }catch (Exception e){
                    e.printStackTrace();
                    logger.error("预建卡时 保存体征数据失败。。。");
                }
            }
        }
    }
}

+ 33 - 13
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java

@ -469,6 +469,10 @@ public class PatientPrescriptionPayService extends BaseService {
            e.printStackTrace();
            isSuccess = false;
            response.getWriter().write(e.getMessage());
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            error = sw.toString();
        }
        System.out.println("recipeReturnUrl result: " + resultMap);
        //记录支付log日志到数据库  支付
@ -760,6 +764,10 @@ public class PatientPrescriptionPayService extends BaseService {
            }
        } catch (Exception e) {
            response.getWriter().write(e.getMessage());
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            error = sw.toString();
        }
        //                记录log日志到数据库
        logger.info("api - " + config.getReceiveRecipeNotify());
@ -1092,12 +1100,24 @@ public class PatientPrescriptionPayService extends BaseService {
//            易联众新增字段代支付v1.3.7
            map.put("principalCardNo", ssc); //实际结算卡号( 默认为绑卡主体卡号)
            if (!patient.equals(repUid)) {
                String principalCardNo = null;
                Patient person = patientDao.findByCode(repUid);
                String repOpenId = person.getOpenid();
                BindCard repCard = onePayService.ownerCard(repOpenId);
                String repSsc = repCard.getAttachCardNo();
                map.put("principalCardNo", repSsc); //实际签约卡号( 默认为绑卡主体卡号)
                prescriptionPay.setPrincipalCardNo(repSsc);
                String repSsc = person.getSsc();
                List<BindCard> repCard = onePayService.bindCardList(openid);
                for (BindCard cards : repCard) {
                    String attachCardNo = cards.getAttachCardNo();
                    if (StringUtil.isNotEmpty(attachCardNo) && StringUtil.isNotEmpty(repSsc) && repSsc.equals(attachCardNo)) {
                        principalCardNo = repSsc;
                    }
                }
                if (StringUtils.isNotEmpty(principalCardNo)){
                    map.put("principalCardNo", principalCardNo); //实际签约卡号( 默认为绑卡主体卡号)
                    prescriptionPay.setPrincipalCardNo(principalCardNo);
                }else {
                    resultMap.put("status", "-4");
                    return resultMap;
                }
            }
            params.put("requestContent", objectMapper.writeValueAsString(map));// 请求结构体
            logger.info("================================>" + "Before msBody");
@ -1403,7 +1423,7 @@ public class PatientPrescriptionPayService extends BaseService {
        return result;
    }
    
    public String getSignFamilyPayResult(String outChargeNo, String accessToken, String appId, String appSecret) throws Exception {
        PayConfigura config = configuraDao.findWorkConfigura();
        int flag = 0;
@ -1415,7 +1435,7 @@ public class PatientPrescriptionPayService extends BaseService {
//      ***************************  测通流程 ***************************************
        OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), appId, appSecret, signType, encryptType);
    
        try {
            RequestParams requestParams = new RequestParams();
            requestParams.setAppId(appId);
@ -1423,12 +1443,12 @@ public class PatientPrescriptionPayService extends BaseService {
            requestParams.setSignType(signType);
            requestParams.setEncryptType(encryptType);
            requestParams.setTransType(config.getChargeQueryType());
        
            //业务参数
            JSONObject params = new JSONObject();
            params.put("outChargeNo", outChargeNo);  //接入应用结算业务流水号
            params.put("wxToken", accessToken);
        
            requestParams.setParam(params);
            msgBody = JSON.toJSONString(requestParams);
@ -1436,13 +1456,13 @@ public class PatientPrescriptionPayService extends BaseService {
            //执行支付 返回原生返回值
            ResponseParams<JSONObject> res = onepayClient.execute(requestParams);
            response = JSON.toJSONString(res);
        
            if (OnepayDefaultClient.isSuccessful(res)) {
                //业务处理*******************
//                只返回业务出参
                flag = 1;
                result = JSON.toJSONString(res.getParam());
            
                logger.info("请求成功,返回参数: " + result);
            } else {
                isSuccess = false;
@ -1455,7 +1475,7 @@ public class PatientPrescriptionPayService extends BaseService {
            ex.printStackTrace(pw);
            error = sw.toString();
        }
    
        //type = 3易联众接口保存http日志
        logger.info("api - " + config.getChargeQueryType());
        logger.info("request - " + msgBody);
@ -1465,7 +1485,7 @@ public class PatientPrescriptionPayService extends BaseService {
        if (!isSuccess) {
            throw new Exception(error);
        }
    
        return result;
    }
}

+ 102 - 16
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsAllService.java

@ -1101,7 +1101,7 @@ public class StatisticsAllService extends BaseService {
                JSONObject json = new JSONObject(redisData);
                data.put("code", String.valueOf(json.get("code")));
                data.put("name", String.valueOf(json.get("name")));
                data.put("amount", Long.valueOf(String.valueOf(json.get("num"))));
                data.put("amount",String.valueOf(json.get("num")));
        } else {
            Calendar today = Calendar.getInstance();
            today.add(Calendar.DATE, -1);
@ -2500,10 +2500,17 @@ public class StatisticsAllService extends BaseService {
        if (resultList != null) {
            DecimalFormat df = new DecimalFormat("0.0000");
            for (Map<String, Object> map : resultList) {
            Iterator iterator  = resultList.iterator();
            while (iterator.hasNext()){
                Map<String, Object> map  = (Map<String, Object>)iterator.next();
                Integer expenseStatus0amountNum = expenseStatus0.get(map.get("code").toString());
                Integer expenseStatus1amountNum = expenseStatus1.get(map.get("code").toString());
                Integer expenseStatus1SigjnNum = expenseStatus1Sigjn.get(map.get("code").toString());
                if(expenseStatus0amountNum==null||expenseStatus1amountNum==null||expenseStatus1SigjnNum==null){
                    iterator.remove();
                    continue;
                }
                if (expenseStatus0amountNum == null) {
                    expenseStatus0amountNum = 0;
                }
@ -2515,7 +2522,6 @@ public class StatisticsAllService extends BaseService {
                map.put("weChatAmount1", expenseStatus1amountNum);//微信关注已交费数
                map.put("signAccount", expenseStatus1SigjnNum);//签约已缴费的数目
                map.put("bindRate", getRangeDouuble(expenseStatus1amountNum, expenseStatus1SigjnNum, 2));//微信关注率
            }
            if ((level == 4 && "1".equals(lowLevel)) || (level == 2)) {
@ -2562,11 +2568,12 @@ public class StatisticsAllService extends BaseService {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("name", expenseStatus1Sigjn.get("name"));
        jsonObject.put("code", area);
        Long  weChatAmount0 =  (Long) expenseStatus0.get("amount");
        Long  weChatAmount1 =  (Long) expenseStatus1.get("amount");
        Long  weChatAmount0 =  Long.valueOf(expenseStatus0.get("amount").toString());
        Long  weChatAmount1 =  Long.valueOf(expenseStatus1.get("amount").toString());
        Long  signAccount =  Long.valueOf(expenseStatus1Sigjn.get("amount").toString());
        jsonObject.put("weChatAmount0", weChatAmount0);//微信关注未交费数
        jsonObject.put("weChatAmount1", weChatAmount1);//微信关注已交费数
        jsonObject.put("bindRate", getRangeDouuble(weChatAmount0.intValue(), weChatAmount1.intValue(), 2));//微信关注率
        jsonObject.put("bindRate", getRangeDouuble(weChatAmount1.intValue(), signAccount.intValue(), 2));//微信关注率
        return jsonObject;
    }
@ -2867,25 +2874,48 @@ public class StatisticsAllService extends BaseService {
        return Double.valueOf(filesize);
    }
    public JSONArray getLevelTwoLowLevelTotalSignAndRenew(String area, int level, String index, int sort, String lowLevel, String year) throws Exception {
    public JSONArray getLevelTwoLowLevelTotalSignAndRenew(String area, int level, String index, int sort, String lowLevel, String year, String lowCode) throws Exception {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String lastDate = year + "-06-30";
        String timeKey = redisTemplate.opsForValue().get("quota:timeKey");
        String low_level = String.valueOf(StringUtils.isEmpty(lowLevel) ? (level - 1) : lowLevel);
        List<Map<String, Object>> resultList = new ArrayList<>();//续签量
        //从redis获取续签量列表 团队,机构 区的续签量根据index来区分
        JSONArray renewJA = getLevel2ListForRedis(index, level + "", lowLevel, area, timeKey);
        //续签量
        List<Map<String, Object>> resultList = new ArrayList<>();
        //续签的的列表转map
        Map<String, Integer> renewMap = new HashMap<>();
        if (renewJA != null && renewJA.length() > 0) {
            for (int i = 0; i < renewJA.length(); i++) {
                JSONObject jo = renewJA.getJSONObject(i);
                renewMap.put(jo.getString("code"), jo.getInt("num"));
        
        //如果服务团队维度CODE为空,则走旧方法,不为空,则走新方法
        if(org.apache.commons.lang.StringUtils.isBlank(lowCode)){
            //旧方法
            //从redis获取续签量列表 团队,机构 区的续签量根据index来区分
            JSONArray renewJA = getLevel2ListForRedis(index, level + "", lowLevel, area, timeKey);
            if (renewJA != null && renewJA.length() > 0) {
                for (int i = 0; i < renewJA.length(); i++) {
                    JSONObject jo = renewJA.getJSONObject(i);
                    renewMap.put(jo.getString("code"), jo.getInt("num"));
                }
            }
        }else{
            //新方法
            List<WlyyQuotaResult> wlyyQuotaResults = findQuotaResultsWithLevelType2AndParentQuatoCode(DateUtil.getNextDay(new Date(),-1),level,Integer.parseInt(lowLevel), index, area,lowCode);
    
            for (WlyyQuotaResult wlyyQuotaResult: wlyyQuotaResults) {
                if("3".equals(low_level)){
                    renewMap.put(wlyyQuotaResult.getTown(),Integer.parseInt(wlyyQuotaResult.getResult()));
                }else if("2".equals(low_level)){
                    renewMap.put(wlyyQuotaResult.getOrgCode(),Integer.parseInt(wlyyQuotaResult.getResult()));
                }else if("1".equals(low_level)){
                    renewMap.put(wlyyQuotaResult.getQkdoctorCode(),Integer.parseInt(wlyyQuotaResult.getResult()));
                }else{
                    continue;
                }
                
            }
        }
    
        //自建结果集
        resultList = getLowLevelMapKey(level, low_level, area);
@ -2893,7 +2923,22 @@ public class StatisticsAllService extends BaseService {
        if (resultList != null) {
            DecimalFormat df = new DecimalFormat("0.0000");
            //查询去年的签约转map
            List<WlyyQuotaResult> yearsYear = findQuotaResultList(lastDate, Integer.valueOf(low_level), "1");
            List<WlyyQuotaResult> yearsYear = new ArrayList<>();
            if(org.apache.commons.lang.StringUtils.isBlank(lowCode)){
                yearsYear = findQuotaResultList(lastDate, Integer.valueOf(low_level), "1");
            }else{
                if("3".equals(lowCode)){
                    //老年人
                    yearsYear = findQuotaResultsWithLevelType1AndLevelType2(lastDate,Integer.valueOf(low_level),"17","3");
                }else if("4".equals(lowCode)){
                    //高血压
                    yearsYear = findQuotaResultsWithLevelType1AndLevelType2(lastDate,Integer.valueOf(low_level),"17","1");
                }else if("5".equals(lowCode)){
                    //糖尿病
                    yearsYear = findQuotaResultsWithLevelType1AndLevelType2(lastDate,Integer.valueOf(low_level),"17","2");
                }else{}
            }
            
            Map<String, WlyyQuotaResult> resultMap = new HashMap<>();
            yearsYear.stream().forEach(one -> {
                if ("1".equals(low_level)) {
@ -3004,4 +3049,45 @@ public class StatisticsAllService extends BaseService {
        }
        return 1;
    }
    
    /**
     * 根据父级的quato_code,查找二级数据列表
     * @param date
     * @param level
     * @param index
     * @param area
     * @param lowCode
     * @return
     */
    public List<WlyyQuotaResult> findQuotaResultsWithLevelType2AndParentQuatoCode(String date, int Level ,int lowLevel, String index, String area,String lowCode) {
    
        String sql = " select * from wlyy_quota_result w where w.quota_date ='" + date + "' and w.quato_code='" + index + "' and w.level1_type= '" + lowLevel +"' and w.level2_type = " + lowCode;
    
        if(4 == Level){
            sql += " and city='" + area + "' ";
        }else if (3 == Level){
            // 区、城镇级别
            sql += " and town='" + area + "' ";
        }else if (2 == Level){
            // 机构级别
            sql += " and org_code='" + area + "' ";
        }else if (1 == Level){
            // 团队级别
            sql += " and qkdoctor_code ='" + area + "'";
        }else{}
        List<WlyyQuotaResult> results = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyQuotaResult.class));
        return results;
    }
    
    public List<WlyyQuotaResult> findQuotaResultsWithLevelType1AndLevelType2(String date, int level, String index,String lowCode) {
        String sql = " select * from wlyy_quota_result w where " +
                " w.quota_date ='" + date + "' and " +
                " w.quato_code='" + index + "' and " +
                " w.level1_type='" + level+ "' and " +
                " w.level2_type= " + lowCode;
        List<WlyyQuotaResult> results = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyQuotaResult.class));
        return results;
    }
}

+ 12 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java

@ -4207,6 +4207,17 @@ public class StatisticsService extends BaseService {
        WlyyQuotaResult wlyyQuotaResult = new WlyyQuotaResult();
    
        if(StringUtils.isNoneBlank(lowCode)){
            if("3".equals(lowCode)){
                //老年人
                lowCode = "3";
            }else if("4".equals(lowCode)){
                //高血压
                lowCode = "1";
            }else if("5".equals(lowCode)){
                //糖尿病
                lowCode = "2";
            }else{}
            index = "17";
            wlyyQuotaResult = findOneQuotaResultWithLevelType2(date, Integer.valueOf(level), index, code,lowCode);
        }else{
            wlyyQuotaResult = findOneQuotaResult(date, Integer.valueOf(level), index, code);
@ -4854,5 +4865,6 @@ public class StatisticsService extends BaseService {
        }
        return null;
    }
    
}

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

@ -25,6 +25,8 @@ import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.RequestParams;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.utils.DateUtil;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -130,7 +132,7 @@ public class OnePayService {
    /**
     * 查询绑卡信息(所有卡)
     */
    private List<BindCard> bindCardList(String openid) throws Exception {
    public List<BindCard> bindCardList(String openid) throws Exception {
        Boolean isSuccess = true;
        String msgBody = "";
        String response = "";
@ -322,12 +324,23 @@ public class OnePayService {
            map.put("principalCardNo", ssc); //实际签约卡号( 默认为绑卡主体卡号)
            charge.setPrincipalSsc(ssc);
            if (!patient.equals(repUid)) {
                Patient people = patientDao.findByCode(repUid);
                String repOpenId = people.getOpenid();
                BindCard repCard = ownerCard(repOpenId);
                String repSsc = repCard.getAttachCardNo();
                map.put("principalCardNo", repSsc); //实际签约卡号( 默认为绑卡主体卡号)
                charge.setPrincipalSsc(repSsc);
                String principalCardNo = null;
                Patient person = patientDao.findByCode(repUid);
                String repSsc = person.getSsc();
                List<BindCard> repCard = bindCardList(openid);
                for (BindCard cards : repCard) {
                    String attachCardNo = cards.getAttachCardNo();
                    if (StringUtil.isNotEmpty(attachCardNo) && StringUtil.isNotEmpty(repSsc) && repSsc.equals(attachCardNo)) {
                        principalCardNo = repSsc;
                    }
                }
                if (StringUtils.isNotEmpty(principalCardNo)){
                    map.put("principalCardNo", principalCardNo); //实际签约卡号( 默认为绑卡主体卡号)
                    charge.setPrincipalSsc(principalCardNo);
                }else {
                    return "-1";
                }
            }
            params.put("requestContent", objectMapper.writeValueAsString(map));// 请求结构体

+ 11 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java

@ -1,3 +1,4 @@
package com.yihu.wlyy.web.common.account;
import com.yihu.wlyy.entity.login.LoginLog;
@ -399,6 +400,10 @@ public class WechatController extends WeixinBaseController {
                    //判断是否打过标签
                   //if (!(Patient.isWchatTage.yes.getValue() == p.getIsWxtag())) {
                    //清空患者的微信标签
                    if(p.getWxtagid()!=null){
                        weiXinTagUtil.deleteTagWithOpenid(p.getOpenid(),p.getWxtagid());
                    }
                    //给患者打微信标签
                    weiXinTagUtil.addTagWithOpenid(openid, p.getCode(), p.getName());
                    //}
@ -496,8 +501,12 @@ public class WechatController extends WeixinBaseController {
                    loginLogService.saveLog(loginLog);
                    //判断是否打过标签
                    //if (!(Patient.isWchatTage.yes.getValue() == p.getIsWxtag())) {
                        //给患者打微信标签
                        weiXinTagUtil.addTagWithOpenid(openid, p.getCode(), p.getName());
                    //清空患者的微信标签
                    if(p.getWxtagid()!=null){
                        weiXinTagUtil.deleteTagWithOpenid(p.getOpenid(),p.getWxtagid());
                    }
                    //给患者打微信标签
                    weiXinTagUtil.addTagWithOpenid(openid, p.getCode(), p.getName());
                    //}
                    return write(200, "登录成功", "data", map);
                }

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prenatalInspector/PrenatalController.java

@ -60,8 +60,8 @@ public class PrenatalController extends BaseController{
                                             @ApiParam(name = "patient", value = "居民code", defaultValue = "d9de442323324a759ac82857c4692184")
                                             @RequestParam(value = "patient", required = true) String patient){
        try {
            String response = preCardService.reExamRecode(patient,pregnancyNo);
            return response;
            JSONArray response = preCardService.reExamRecode(patient,pregnancyNo);
            return write(200, "查询成功!", "data", response);
        }catch (Exception e){
            error(e);
            return error(-1,"查询失败");

+ 13 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java

@ -353,8 +353,11 @@ public class ConsultController extends WeixinBaseController {
            System.out.println("guidance2="+guidance);
            // 保存到数据库
            int res = 0;
            JSONArray dts = null;
            synchronized (getRepUID().intern()){//新增同步方法。设备保存写在service层但是不生效,写在controller层才生效
                res = consultTeamService.addTeamConsult(consult, getRepUID(),getUID());
                JSONObject re = consultTeamService.addTeamConsult(consult, getRepUID(),getUID());
                res = re.getInt("status");
                dts = re.getJSONArray("doctor");
            }
            if (res == -1) {
                return error(-1, "家庭签约信息不存在或已过期,无法进行家庭医生咨询!");
@ -377,7 +380,15 @@ public class ConsultController extends WeixinBaseController {
            }
            // 推送消息给医生
            pushMsgTask.put(consult.getDoctor(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.指定咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.您有新的指定咨询.name(), consult.getConsult());
            if(dts==null||dts.length()==0){
                pushMsgTask.put(consult.getDoctor(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.指定咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.您有新的指定咨询.name(), consult.getConsult());
            }else {
                for (int i=0;i<dts.length();i++){
                    String doctorCode = dts.getString(i);
                    pushMsgTask.put(doctorCode, MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.指定咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.您有新的指定咨询.name(), consult.getConsult());
                }
            }
            BusinessLogs.info(BusinessLogs.BusinessType.consult, getRepUID(), getUID(), new JSONObject(consult));
            return write(200, "提交成功", "data", consult);
        } catch (Exception ex) {

+ 8 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prenatalInspector/PrenatalInspectorContoller.java

@ -40,10 +40,14 @@ public class PrenatalInspectorContoller extends BaseController{
            String code = preCardService.addPrenatalInspectorPreCard(preCard,getRepUID());
            if("-1".equals(code)){
                return error(-1,"居民未签约,无法添加预建卡信息");
            }else if("-3".equals(code)){
                return error(-1,"获取预建卡信息失败");
            }else if("-2".equals(code)){
                return error(-1,"已有预建卡信息,请不要重复添加");
            }
            String re = preCardService.uploadPreExam(code);
            preCardService.saveHealthIndex(preCard,getRepUID());//保存体征数据
            String re = preCardService.uploadPreExam(code);//上传智业
            if(StringUtils.isNotBlank(re)){
                System.out.println("re======"+re);
                return error(-1,re);
            }
            return success("预建卡保存成功!");
@ -85,9 +89,8 @@ public class PrenatalInspectorContoller extends BaseController{
    public String getEhrMaternalReExamRecord(@ApiParam(name = "pregnancyNo", value = "产检号", defaultValue = "")
                                             @RequestParam(value = "pregnancyNo", required = true) String pregnancyNo){
        try {
            String response = preCardService.reExamRecode(getUID(),pregnancyNo);
//            String response = preCardService.reExamRecode("d9de442323324a759ac82857c4692184",pregnancyNo);
            return response;
            JSONArray response = preCardService.reExamRecode(getUID(),pregnancyNo);//-- d9de442323324a759ac82857c4692184
            return write(200, "查询成功!", "data", response);
        }catch (Exception e){
            error(e);
            return error(-1,"查询失败");

+ 5 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java

@ -92,6 +92,8 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
                return error(-1, "续方居民信息挂号号或处方号不存在!");
            } else if ("-3".equals(result.get("status").toString())) {
                return error(-1, "您没有需要待结算的信息!");
            } else if ("-4".equals(result.get("status").toString())) {
                return error(-1, "附属卡未绑定!");
            } else {
                return write(200, "支付成功!", "data", result);
            }
@ -117,9 +119,10 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            return error(-1, "获取失败!");
        }
    }
    
    /**
     * 查询家庭签约支付结果
     *
     * @return
     */
    @RequestMapping(value = "/getSignFamilyPayResult", method = RequestMethod.GET)
@ -133,7 +136,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            @ApiParam(value = "易联众app secret", name = "appSecret") String appSecret) throws Exception {
        try {
            String accessToken = getAccessToken();
            String result = payService.getSignFamilyPayResult(outChargeNo, accessToken,appId,appSecret);
            String result = payService.getSignFamilyPayResult(outChargeNo, accessToken, appId, appSecret);
            return write(200, "获取成功!", "data", result);
        } catch (Exception e) {
            error(e);

+ 16 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

@ -0,0 +1,16 @@
package com.yihu.wlyy.web.statistic;
import io.swagger.annotations.Api;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
 * Created by chenweida on 2017/10/13.
 */
@Controller
@RequestMapping(value = "/esstatistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,method = {RequestMethod.GET,RequestMethod.POST})
@Api(description = "ES统计查询")
public class EsStatisticsController {
}

+ 6 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

@ -264,8 +264,8 @@ public class StatisticsController extends BaseController {
            List<JSONArray> jsonArrays = new ArrayList<>();
            /**新版统计代码start**/
//            JSONArray jsonArray1 = statisticsESService.getLowLevelTotalDetail(endDate, area, level, indexes[0], sort, lowLevel, null, year);
//            jsonArrays.add(jsonArray1);
            JSONArray jsonArray1 = statisticsService.getLowLevelTotalDetail(endDate, area, level, indexes[0], sort, lowLevel, null, year);
            jsonArrays.add(jsonArray1);
//            JSONArray jsonArray2 = statisticsESService.getLowLevelTotalDetail(endDate, area, level, indexes[1], sort, lowLevel, null, year);
//            jsonArrays.add(jsonArray2);
            /**新版统计代码end**/
@ -1536,8 +1536,8 @@ public class StatisticsController extends BaseController {
     * @param level    level1_type等级 1:团队 2社区机构 3区级 4市级
     * @param sort     0:升序 1:降序
     * @param lowLevel 只有可能是 1,2,3,不传默认是level-1;
     *                 如果是服务类型维度code(老年人3,高血压4,糖尿病5)
     * @param year     不管根据当前时间找年度
     * @param lowCode  如果是服务类型维度code(老年人3,高血压4,糖尿病5)
     * @return
     */
    @RequestMapping("/lowlevel_all_sign_renew")
@ -1548,7 +1548,8 @@ public class StatisticsController extends BaseController {
            @RequestParam(required = true) int level,
            @RequestParam(required = true) int sort,
            @RequestParam(required = false) String lowLevel,
            @RequestParam(required = false) String year) {
            @RequestParam(required = false) String year,
            @RequestParam(required = false) String lowCode) {
        try {
            JSONObject result = new JSONObject();
@ -1562,7 +1563,7 @@ public class StatisticsController extends BaseController {
            }
            result.put("index_"+index, statisticsAllService.getLevelTwoLowLevelTotalSignAndRenew(area, level, index, sort, lowLevel, year));
            result.put("index_"+index, statisticsAllService.getLevelTwoLowLevelTotalSignAndRenew(area, level, index, sort, lowLevel, year,lowCode));
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {

+ 48 - 9
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/OnePayController.java

@ -86,21 +86,48 @@ public class OnePayController extends WeixinBaseController {
    @ResponseBody
    public String bindCard() throws Exception {
        try {
            String repUid = getRepUID();
            JSONObject json = new JSONObject();
            String msg = null;
            String uid = getUID();
            String openid = getOpenid();
            String repUid = getRepUID();
            String patient = uid;
            Patient people = patientDao.findByCode(uid);
            String ssc = people.getSsc();
            String createType = "sicard";
            if (!repUid.equals(uid)) {
                patient = repUid;
                createType = "family";
                people = patientDao.findByCode(repUid);
                ssc = people.getSsc();
            }
            Patient people = patientDao.findByCode(patient);
            String openid = people.getOpenid();
            BindCard bindCard = pay.bindCard(patient, openid);
            String sicardUrl = pay.createSicard(patient, openid, createType);
            if (bindCard != null) {
//            BindCard bindCard = pay.bindCard(patient, openid);
            List<BindCard> bindCard = pay.bindCardList(openid);
            String sicardUrl = pay.createSicard(uid, openid, createType);
            for (BindCard cards : bindCard) {
                String attachCardNo = cards.getAttachCardNo();
                if (StringUtil.isNotEmpty(attachCardNo) && StringUtil.isNotEmpty(ssc) && ssc.equals(attachCardNo)) {
                    String attachRelation = cards.getAttachRelation();
                    String attachIdType = cards.getAttachIdType();
                    String attachIdNo = cards.getAttachIdNo();
                    String attachName = cards.getAttachName();
                    json.put("attachRelation", attachRelation);
                    json.put("attachCardNo", attachCardNo);
                    json.put("attachIdType", attachIdType);
                    json.put("attachIdNo", attachIdNo);
                    json.put("attachName", attachName);
                    json.put("bindStatus", "000000");
                    json.put("sicardUrl", sicardUrl);
                    msg = "查询绑卡信息成功!";
                    return write(200, "", "data", json);
                } else {
                    json.put("sicardUrl", sicardUrl);
                    json.put("bindStatus", "030007");
                    msg = "生成电子社保卡成功!";
                }
            }
            return write(200, msg, "data", json);
            /*if (bindCard != null) {
                JSONObject json = new JSONObject(bindCard);
                json.put("bindStatus", "000000");
                json.put("sicardUrl", sicardUrl);
@ -111,7 +138,8 @@ public class OnePayController extends WeixinBaseController {
                json.put("sicardUrl", sicardUrl);
                json.put("bindStatus", "030007");
                return write(200, "生成电子社保卡成功!", "data", json);
            }
            }*/
        } catch (Exception e) {
            error(e);
            return write(-1, "查询电子社保卡失败!");
@ -139,6 +167,9 @@ public class OnePayController extends WeixinBaseController {
            if (StringUtils.isNotEmpty(openId)) {
                String settleNo = pay.charge(orgCode, chargeType, chargeRelation, totalAmount, patient, repUid, openId, getAccessToken());
                if ("-1".equals(settleNo)){
                    return write(-1, "附属卡未绑定!");
                }
                return write(200, "家庭医生签约支付成功!", "data", settleNo);
            } else {
                return write(-1, "openId为空!");
@ -388,6 +419,10 @@ public class OnePayController extends WeixinBaseController {
        } catch (Exception e) {
            isSuccess = false;
            response.getWriter().write(e.getMessage());
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            error = sw.toString();
        }
        //                记录log日志到数据库
        logService.saveHttpLog(isSuccess, config.getReturnUrl(), "支付页面跳转", "POST", null, "", responses, error, logService.onepayType);
@ -563,6 +598,10 @@ public class OnePayController extends WeixinBaseController {
            }
        } catch (Exception e) {
            response.getWriter().write(e.getMessage());
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            error = sw.toString();
        }
        //                记录log日志到数据库
        logService.saveHttpLog(isSuccess, config.getReceiveNotify(), "异步支付通知", "POST", null, params, responses, error, logService.onepayType);

+ 1 - 1
patient-co/patient-co-wlyy/src/main/resources/wechat/weixin_menu.txt

@ -51,7 +51,7 @@
        },
        {
            "type":"view",
            "name":"妇幼保健",
            "name":"孕检计划",
            "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2ffybj%2fhtml%2fyunjianjihua.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
        }
	  ]

+ 2 - 2
patient-co/patient-co-wlyy/src/main/resources/wechat/weixin_menu_jimei.txt

@ -51,8 +51,8 @@
        },
        {
            "type":"view",
            "name":"热量查询",
            "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2frlcx%2fhtml%2fserach-index.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
            "name":"孕检计划",
            "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2ffybj%2fhtml%2fyunjianjihua.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
        }
	  ]
   },