Prechádzať zdrojové kódy

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

yeshijie 7 rokov pred
rodič
commit
30f285cc49
46 zmenil súbory, kde vykonal 1183 pridanie a 326 odobranie
  1. 41 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/BookingController.java
  2. 5 4
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/prescription/PrescriptionService.java
  3. 5 4
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/device_list_js.jsp
  4. 3 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/prescription/prescription_list_js.jsp
  5. 13 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java
  6. 108 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java
  7. 18 10
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/charge/OnePayService.java
  8. 7 6
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/prenatalInspector/PrenatalInspectorPreCardService.java
  9. 16 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/web/quota/JobController.java
  10. 39 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java
  11. 108 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prenatalInspector/PrenatalInspectorPreCardService.java
  12. 19 58
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java
  13. 8 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java
  14. 76 10
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java
  15. 124 64
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  16. 33 10
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/QrcodeService.java
  17. 41 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/RoleService.java
  18. 12 11
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java
  19. 12 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jkEduArticle/ThirdJkEduArticleService.java
  20. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/ThirdMessageService.java
  21. 1 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java
  22. 28 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java
  23. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/DateUtil.java
  24. 53 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/BaseController.java
  25. 7 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/LoginController.java
  26. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java
  27. 66 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEdu/DoctorJMJkEduArticleController.java
  28. 32 23
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEduPC/DoctorJMJkEduArticlePCController.java
  29. 8 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java
  30. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prenatalInspector/PrenatalController.java
  31. 16 30
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java
  32. 52 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/HealthEduArticleController.java
  33. 3 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcLableController.java
  34. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/service/GcEduArticleService.java
  35. 62 33
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkEduArticle/ThirdJkEduArticleController.java
  36. 3 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/controller/doctor/EduLableController.java
  37. 127 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/ylzpay/ThirdOnepayController.java
  38. 2 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/ylzpay/ThirdQrcodeController.java
  39. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/OnePayController.java
  40. 17 14
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java
  41. 2 0
      patient-co/patient-co-wlyy/src/main/resources/application-dev.yml
  42. 2 0
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml
  43. 2 0
      patient-co/patient-co-wlyy/src/main/resources/application-local.yml
  44. 2 0
      patient-co/patient-co-wlyy/src/main/resources/application-localtest.yml
  45. 2 0
      patient-co/patient-co-wlyy/src/main/resources/application-prod.yml
  46. 2 0
      patient-co/patient-co-wlyy/src/main/resources/application-test.yml

+ 41 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/BookingController.java

@ -484,4 +484,45 @@ public class BookingController extends WeixinBaseController {
        }
    }
    @RequestMapping(value = "GetDoctorArrange", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取医生排班接口(包含排班详细)")
    public String GetDoctorArrange(@ApiParam(name = "hospitalId", value = "医院ID", defaultValue = "350211G1102")
                                   @RequestParam(value = "hospitalId", required = true) String hospitalId,
                                   @ApiParam(name = "hosDeptId", value = "科室ID", defaultValue = "3020001")
                                   @RequestParam(value = "hosDeptId", required = true) String hosDeptId,
                                   @ApiParam(name = "doctorId", value = "医生ID", defaultValue = "AA2")
                                   @RequestParam(value = "doctorId", required = true) String doctorId) {
        try {
            String list = jwSmjkService.GetDoctorArrange(hospitalId,hosDeptId,doctorId);
            return list;
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
    /**
     * 获取转诊预约医生列表
     * @param hospitalId
     * @param hosDeptId
     * @return
     */
    @RequestMapping(value = "RegDeptSpeDoctorList",method = RequestMethod.POST)
    @ApiOperation("获取转诊预约医生列表")
    @ResponseBody
    public String getRegDeptSpeDoctorList(
            @ApiParam(name="hospitalId",value="医院编码",defaultValue = "350211A1001") @RequestParam(name="hospitalId",required = true) String hospitalId,
            @ApiParam(name="hosDeptId",value="科室编码",defaultValue = "1040610") @RequestParam(name="hosDeptId",required = true) String hosDeptId){
        try {
            //7天排班的医生列表
            String list = jwSmjkService.GetDoctorList(hospitalId,hosDeptId);
            return list;
        } catch (Exception ex) {
            ex.printStackTrace();
            return error(-1,"获取转诊预约医生列表列表失败");
        }
    }
}

+ 5 - 4
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/prescription/PrescriptionService.java

@ -50,6 +50,9 @@ public class PrescriptionService extends BaseService {
				"p.health_problem_name," +
				"p.pay," +
				"CASE p.STATUS " +
					"WHEN 10 THEN '开方中' " +
					"WHEN 21 THEN '药师审核失败' " +
					"WHEN 69 THEN '药品已配送' " +
					"WHEN 31 THEN '开方失败' " +
					"WHEN 40 THEN '开方完成/待支付' " +
					"WHEN 50 THEN '支付成功/待配药' " +
@ -122,10 +125,8 @@ public class PrescriptionService extends BaseService {
		prescriptionsql = prescriptionsql+ ") p ORDER BY p.create_time DESC";
		
		if(ispage){
			if(1 == page){
				page = page-1;
			}
			prescriptionsql = prescriptionsql +" limit " + page*pageSize+", "+pageSize;
			page = page-1;
			prescriptionsql = prescriptionsql +" limit " + page*pageSize+", "+(page+1)*pageSize;
		}
		
		list =  jdbcTemplate.query(prescriptionsql,new BeanPropertyRowMapper(PrescriptionVO.class));

+ 5 - 4
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/device_list_js.jsp

@ -68,19 +68,20 @@
                        //设备编号
                        var deviceCode = $("<input type='hidden' name='deviceCode' />")
                        deviceName.attr('value',$("#deviceCode").val());
                        deviceCode.attr('value',$("#inp_device_code").val());
                        //社区名称
                        var orgName = $("<input type='hidden' name='orgName' />")
                        deviceName.attr('value',$("#orgName").val());
                        orgName.attr('value',$("#inp_org_name").val());
                        //联系人
                        var orgName = $("<input type='hidden' name='linkman' />")
                        deviceName.attr('value',$("#linkman").val());
                        var linkman = $("<input type='hidden' name='linkman' />")
                        linkman.attr('value',$("#inp_linkman").val());
                        myform.append(deviceName);
                        myform.append(deviceCode);
                        myform.append(orgName);
                        myform.append(linkman);
                        myform.appendTo('body').submit(); //must add this line for higher html spec
                    })
				}

+ 3 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/prescription/prescription_list_js.jsp

@ -121,11 +121,14 @@
                    retrieve.statusBox = $("#inp_status").ligerComboBox({
                        width: 150,
                        data: [
                            {text: '开方中', statusId: '10'},
                            {text: '药师审核失败', statusId: '21'},
                            {text: '开方失败', statusId: '31'},
                            {text: '开方完成/待支付', statusId: '40'},
                            {text: '支付成功/待配药', statusId: '50'},
                            {text: '配药成功/待配送', statusId: '60'},
                            {text: '配送中', statusId: '65'},
                            {text: '药品已配送', statusId: '69'},
                            {text: '配送到患者手中/已完成', statusId: '100'},
                            {text: '线下退费', statusId: '-4'},
                            {text: '支付超时', statusId: '-3'},

+ 13 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java

@ -113,6 +113,19 @@ public class PrescriptionController extends BaseController{
			return Result.error(e.getMessage());
		}
	}
	
	@RequestMapping(value = "offlinepay",method = RequestMethod.POST)
	@ApiOperation("接收线下支付消息")
	public Result offlinepay(@ApiParam(name="data",value="json串",defaultValue = "{}")
	                                 @RequestParam(value = "data",required = true) String data){
		try {
			
			return prescriptionService.offlinepay(data);
		}catch (Exception e){
			e.printStackTrace();
			return Result.error(e.getMessage());
		}
	}
	/***************************************获取im消息*****************************************************/
	@RequestMapping(value = "getLoglist",method = RequestMethod.GET)

+ 108 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/prescription/PrescriptionService.java

@ -1229,4 +1229,112 @@ public class PrescriptionService extends ZysoftBaseService{
    
        return response;
    }
    
    /**
     * 接收线下支付消息
     * 收到该消息,直接修改出访卫已支付,已结算、等待发药状态
     * @param data
     * @return
     * @throws Exception
     */
    public Result offlinepay(String data)  throws Exception{
        String error = null;
        String status = "1";
        String errMsg = null;
        try{
            JSONObject json = JSONObject.parseObject(data);
            Integer code = json.getInteger("CODE");
            if(code==1){
                String orderNo = json.getString("ORDER_NO");//挂号编号
                String recipeNo = json.getString("RECIPE_NO");//处方编号
            
                Prescription prescription = prescriptionDao.findByVisitNoAndRecipeNo(orderNo,recipeNo);
                if(prescription.getStatus().equals(PrescriptionLog.PrescriptionLogStatus.pay_success.getValue())){
                
                    if(2 == prescription.getDispensaryType()){//如果是快递配送,则直接修改成配送中
                        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
                    } else{
                        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
                    }
                
                    prescription.setDrugDeliveryTime(new Date());
                    prescriptionDao.save(prescription);
                
                    //新增log表
                    PrescriptionLog log = new PrescriptionLog();
                    log.setPrescriptionCode(prescription.getCode());
                    log.setCode(getCode());
                    log.setCreateTime(new Date());
                    log.setType(PrescriptionLog.PrescriptionLogType.zy.getValue());
                    log.setUserType(2);
                    log.setHospital(prescription.getHospital());
                    log.setHospitalName(prescription.getHospitalName());
                    log.setUserName(prescription.getDoctorName());
                    log.setFlag(1);
                    log.setUserCode(prescription.getDoctor());
                    if(2 == prescription.getDispensaryType()){//如果是快递配送,则直接修改成配送中
                        log.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing.getValue());
                        log.setRemark("快递配送:配药成功,配送中");
                        prescriptionLogDao.save(log);
                    } else{
                        log.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_expressage.getValue());
                        log.setRemark("配药成功");
                        prescriptionLogDao.save(log);
                    
                        //健管师配送
                        PrescriptionExpressage expressage = prescriptionExpressageDao.findByPrescriptionCode(prescription.getCode());
                        if(StringUtils.isNotBlank(expressage.getExpressageCode())){
                            Message message = new Message();
                            message.setCzrq(new Date());
                            message.setCreateTime(new Date());
                            message.setRead(1);//设置未读
                            message.setOver("1");
                            message.setReceiver(expressage.getExpressageCode());
                            message.setSender("system");
                            message.setCode(getCode());
                            message.setSenderName("系统");
                            message.setTitle("居民"+prescription.getPatientName()+"的续方订单待取药");
                            message.setContent("您有一条新的续方订单待取药!");
                            message.setType(7);//续方订单待取药
                            message.setReadonly(1);//是否只读消息
                            message.setDel("1");
                            message.setRelationCode(prescription.getCode());
                            message.setPrescriptionStatus("0");//待取药
                            message.setData(prescription.getAdminTeamId()+"");
                            messageDao.save(message);
                        }
                    
                        //判断提示健管师有续方代配送,居民待取药
                        JSONObject message = new JSONObject();
                        message.put("title","dispensingComplete");
                        message.put("state",1);
                        message.put("prescription",prescription.getCode());
                        message.put("mes","success");
//                redisTemplate.convertAndSend(channelTopic,message.toString());
//                redisTemplate.watch(channelTopic);
                        redisTemplate.opsForList().leftPush(channelTopic,message.toString());
//                redisTemplate.unwatch();
                    }
                
                }else {
                    error = "code:"+prescription.getCode()+",status:"+prescription.getStatus();
                }
            }else{
                error = "code:"+code;
            }
        
        }catch (JSONException ex){
            ex.printStackTrace();
            error = ex.getMessage();
            errMsg = ex.getMessage();
            status = "0";
        }catch (Exception e){
            e.printStackTrace();
            error = e.getMessage();
            status = "0";
        }
        //添加日志
        return addZyPushLog(data,"offlinepay","接收线下支付消息",error,"POST",status,"1",errMsg);
        
    }
}

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

@ -486,25 +486,33 @@ public class OnePayService {
                    for (BindCard card : result) {
                        if ("98".equals(card.getAttachRelation())) {
                            String idcard = card.getAttachIdNo();
                            String bindCardNo= card.getAttachCardNo();
                            Patient patient = patientDao.findByIdcard(idcard);
                            userCode = patient.getCode();
                            patient.setSicardStatus(1);
                            patient.setSicardTime(new Date());
                            patient.setPrincipalCode(userCode);
                            patientDao.save(patient);
                            LOGGER.info("myself ==========>  userCode " + userCode);
                            String ssc = patient.getSsc();
                            if (bindCardNo.equals(ssc)){
                                patient.setSicardStatus(1);
                                patient.setSicardTime(new Date());
                                patient.setPrincipalCode(userCode);
                                patientDao.save(patient);
                                LOGGER.info("myself ==========>  userCode " + userCode);
                            }
                        }
                    }
                    //获取家人绑卡情况
                    for (BindCard familyCard : result) {
                        if (!"98".equals(familyCard.getAttachRelation())) {
                            String idcard = familyCard.getAttachIdNo();
                            String bindCardNo = familyCard.getAttachCardNo();
                            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());
                            String ssc = patient.getSsc();
                            if (bindCardNo.equals(ssc)){
                                patient.setSicardStatus(1);
                                patient.setSicardTime(new Date());
                                patient.setPrincipalCode(userCode);
                                patientDao.save(patient);
                                LOGGER.info("family ==========>  userCode "+userCode +" ========== >> "+patient.getOpenid());
                            }
                        }
                    }
                }

+ 7 - 6
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/prenatalInspector/PrenatalInspectorPreCardService.java

@ -135,10 +135,10 @@ public class PrenatalInspectorPreCardService extends BaseService {
                    String doctor = signFamily.getDoctor();
                    String doctorHealth = signFamily.getDoctorHealth();
                    if (StringUtils.isNotEmpty(doctor)) {
                        saveMessageRecord(plan.getId().toString(), doctor, content);
                        saveMessageRecord(plan.getId().toString(), doctor,code, content);
                    }
                    if (StringUtils.isNotEmpty(doctorHealth)) {
                        saveMessageRecord(plan.getId().toString(), doctorHealth, content);
                        saveMessageRecord(plan.getId().toString(), doctorHealth,code, content);
                    }
                }
            }
@ -153,10 +153,11 @@ public class PrenatalInspectorPreCardService extends BaseService {
     *
     * @param prenatalId
     * @param doctor
     * @param patient
     * @param content
     * @throws Exception
     */
    public void saveMessageRecord(String prenatalId, String doctor, String content) throws Exception {
    public void saveMessageRecord(String prenatalId, String doctor,String patient, String content) throws Exception {
        try {
            Doctor doc = doctorDao.findByCode(doctor);
            String doctorName = doc.getName();
@ -180,7 +181,7 @@ public class PrenatalInspectorPreCardService extends BaseService {
            }
            record.setRelation(prenatalId);
            record.setSender("SYSTEM");
            record.setSender(patient);
            record.setReceiver(doctor);
            record.setType(2);
            record.setName(doctorName);
@ -195,11 +196,11 @@ public class PrenatalInspectorPreCardService extends BaseService {
            message.setRead(1);
            message.setOver("1");
            message.setReceiver(doctor);
            message.setSender("SYSTEM");
            message.setSender(patient);
            message.setCode(getCode());
            message.setTitle("孕检提醒");
            message.setContent(content);
            message.setType(2);
            message.setType(13);
            messageDao.save(message);
            // 推送消息给医生
            pushMsgTask.put(doctor, "13", "孕检提醒", content, "");

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

@ -713,4 +713,20 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 医生端产检系统提醒
     * @return
     */
    @RequestMapping(value = "startDoctorPrenatalInspectorJob", method = RequestMethod.GET)
    @ApiOperation("医生端产检系统提醒")
    public String startDoctorPrenatalInspectorJob() {
        try {
            quartzHelper.startNow(DoctorPrenatalInspectorJob.class, "DoctorPrenatalInspectorJob", null);
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
}

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

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

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

@ -1,5 +1,6 @@
package com.yihu.wlyy.service.app.prenatalInspector;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.device.entity.DevicePatientHealthIndex;
@ -723,10 +724,10 @@ public class PrenatalInspectorPreCardService extends BaseService {
     *
     * @param prenatalId
     */
    public JSONObject getPrenatalStatus(Long prenatalId) throws Exception {
    public JSONObject getPrenatalStatusBak(Long prenatalId) throws Exception {
        JSONObject json = new JSONObject();
        try {
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            PrenatalInspectorPlan plan = prenatalInspectorPlanDao.findOne(prenatalId);
            Date planTime = plan.getInspectionTime();
            Boolean flag = getSendStatus(prenatalId);
@ -793,6 +794,83 @@ public class PrenatalInspectorPreCardService extends BaseService {
        return json;
    }
    /**
     * 根据待产检ID查询最近一条待产检计划状态
     *
     * @param prenatalId
     */
    public JSONObject getPrenatalStatus(Long prenatalId) throws Exception {
        JSONObject json = new JSONObject();
        try {
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            PrenatalInspectorPlan plan = prenatalInspectorPlanDao.findOne(prenatalId);
            Date planTime = plan.getInspectionTime();
            String pregnancyNo = plan.getInspectionCode();
            String patient = plan.getPatient();
            Boolean flag = getSendStatus(prenatalId);
            Long days = DateUtil.getDays(new Date(), planTime);
            Date begin = DateUtil.getPreDays(planTime,-14);
            Date end = DateUtil.getPreDays(planTime,14);
            //有产检code
            if (StringUtils.isNotEmpty(pregnancyNo) && (pregnancyNo != null)){
                Boolean examStatus = getExamStatus(patient,pregnancyNo,begin,end);
                if (examStatus){
                    json.put("renatalStatus", "4");
                }else {
                    if (days > 7) {
                        json.put("renatalStatus", "3");
                        json.put("sendStatus", flag == true ? "1" : "0");
                    }else{
                        PrenatalInspectorRecord record = recordDao.findByRelationAndType(prenatalId.toString(), 0);
                        if (record == null) {
                            json.put("renatalStatus", "1");
                            if (days < -7) {
                                json.put("reason", "未到提醒时间(" + format.format(DateUtil.getPreDays(plan.getInspectionTime(), -7)) + " 08:00)");
                            }else {
                                json.put("reason", "提醒时间(" + format.format(DateUtil.getPreDays(plan.getInspectionTime(), -7)) + " 08:00)");
                            }
                        } else {
                            PrenatalInspectorRecord docRecord = recordDao.findByRelationAndType(prenatalId.toString(), 1);
                            json.put("renatalStatus", "2");
                            json.put("sendStatus", flag == true ? "1" : "0");
                            if (docRecord == null) {
                                json.put("sendTime", format.format(record.getSendTime()));
                            } else {
                                json.put("sendTime", format.format(docRecord.getSendTime()));
                            }
                        }
                    }
                }
            }else {
                PrenatalInspectorRecord record = recordDao.findByRelationAndType(prenatalId.toString(), 0);
                if (record == null) {
                    json.put("renatalStatus", "1");
                    if (days < -7) {
                        json.put("reason", "未到提醒时间(" + format.format(DateUtil.getPreDays(plan.getInspectionTime(), -7)) + " 08:00)");
                    }else {
                        json.put("reason", "提醒时间(" + format.format(DateUtil.getPreDays(plan.getInspectionTime(), -7)) + " 08:00)");
                    }
                } else {
                    PrenatalInspectorRecord docRecord = recordDao.findByRelationAndType(prenatalId.toString(), 1);
                    json.put("renatalStatus", "2");
                    json.put("sendStatus", flag == true ? "1" : "0");
                    if (docRecord == null) {
                        json.put("sendTime", format.format(record.getSendTime()));
                    } else {
                        json.put("sendTime", format.format(docRecord.getSendTime()));
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        json.put("prenatalId", prenatalId);
        return json;
    }
    /**
     * 提醒居民(每24小时可提醒一次)
     *
@ -902,4 +980,32 @@ public class PrenatalInspectorPreCardService extends BaseService {
        return flag;
    }
    /**
     * 查询待产检计划产检时间在该时间段内是否有过真实产检
     * @param patient 居民code
     * @param pregnancyNo 产检号
     * @param begin  起始时间
     * @param end  截止时间
     * @return
     * @throws Exception
     */
    public Boolean getExamStatus(String patient,String pregnancyNo,Date begin,Date end) throws Exception {
        Boolean flag = false;
        try {
                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                JSONArray natals = reExamRecode(patient,pregnancyNo);
                for (Object natal : natals) {
                    JSONObject examRecord = JSON.parseObject(natal.toString());
                    String exam_time = examRecord.getString("EXAM_TIME");
                    Date examTime = format.parse(exam_time);
                    if ((examTime.getTime()<= end.getTime()) && (examTime.getTime() >= begin.getTime())){
                        return true;
                    }
                }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return flag;
    }
}

+ 19 - 58
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java

@ -397,55 +397,7 @@ public class PrescriptionService extends BaseService {
        return statusObj;
    }
    /**
     * 长处方统计-点击柱状图获取详情
     * @param interval
     * @param date
     * @param disease
     * @param type
     * @return
     */
    public List<Map<String,Object>> getPrescriptionTotalDetailTime(int interval,String date,String disease,String type){
        //如果是日就是按一天,周就是从本周一到本周日,月就是本月第一天到本月最后一天
        String startTime = "";
        String endTime = "";
        if (interval==1){
            startTime = date+" 00:00:00";
            endTime = " 23:59:59";
        }else if (interval==2){
            startTime = DateUtil.getMondayOfThisDate(DateUtil.strToDate(date));
            endTime = DateUtil.getSundayOfThisDate(DateUtil.strToDate(date));
            startTime += " 00:00:00";
            endTime += "23:59:59";
        }else if (interval==3){
            startTime = DateUtil.getFristDayOfMonthThisDate(DateUtil.strToDate(date+"-01"));
            endTime = DateUtil.getLastDayOfMonthThisDate(DateUtil.strToDate(date+"-01"));
            startTime += " 00:00:00";
            endTime += " 23:59:59";
        }
        String sql = "SELECT * FROM wlyy_prescription p ";
        if(StringUtils.isNotBlank(disease)){
            sql += " JOIN wlyy_prescription_diagnosis d ON  d.prescription_code = p.code WHERE d.health_problem ='"+disease+"' ";
        }else{
            sql +=" WHERE 1=1 ";
        }
        if ("2".equals(type)){//已完成
            sql += " AND p.`status` = "+PrescriptionLog.PrescriptionLogStatus.finish.getValue() ;
        }else if ("3".equals(type)){//居民取消
            sql += " AND p.`status` = "+PrescriptionLog.PrescriptionLogStatus.patient_canel.getValue() ;
        }else if ("4".equals(type)){//审核不通过
            sql += " AND p.`status` = "+PrescriptionLog.PrescriptionLogStatus.no_reviewed.getValue() ;
        }else if ("5".equals(type)){//进行中
            sql += " AND  p.`status` < " + PrescriptionLog.PrescriptionLogStatus.finish.getValue() +
                    " AND p.`status`>= " + PrescriptionLog.PrescriptionLogStatus.revieweding.getValue() ;
        }else if ("6".equals(type)){//其他原因取消
            sql += " AND p.`status` <= "+PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue() ;
        }
        sql += " AND p.create_time <= ? " +
                " AND p.create_time >= ? ";
        List<Map<String,Object>> resultList = jdbcTemplate.queryForList(sql,new Object[]{endTime,startTime});
        return resultList;
    }
    /**
     * 长处方统计--长处方记录筛选
@ -458,9 +410,11 @@ public class PrescriptionService extends BaseService {
     * @param endTime
     * @return
     */
    public List<Map<String,Object>> getPrescriptionByCondition(String level, String area, String disease, String status, String type, String startTime,String endTime){
    public List<Map<String,Object>> getPrescriptionByCondition(String level, String area, String disease, String status, String type, String startTime,String endTime,int pageNo, int pageSize){
        String sql = "SELECT * FROM wlyy_prescription p ";
        String sql = "SELECT p.code,p.patient_name,p.doctor_name,p.hospital_name,p.dispensary_type,p.status," +
                "p.create_time,GROUP_CONCAT(d.health_problem) AS health_problem, GROUP_CONCAT(d.health_problem_name) AS health_problem_name " +
                "FROM wlyy_prescription p LEFT JOIN wlyy_prescription_diagnosis d ON p.code = d.prescription_code";
        //判断疾病
        if(StringUtils.isNotBlank(disease)){
            if ("1".equals(disease)){
@ -468,9 +422,9 @@ public class PrescriptionService extends BaseService {
            }else if ("2".equals(disease)){
                disease = tnb;
            }
            sql += " JOIN wlyy_prescription_diagnosis d ON  d.prescription_code = p.code WHERE d.health_problem ='"+disease+"' ";
            sql += " WHERE d.health_problem ='"+disease+"' ";
        }else{
            sql +=" WHERE 1=1 ";
            sql +="  WHERE 1=1 ";
        }
        //判断状态
        if ("2".equals(status)){//已完成
@ -508,14 +462,17 @@ public class PrescriptionService extends BaseService {
            sql += "AND p.hospital = '"+area+"' ";
        }
        List<Map<String,Object>> resultList = new ArrayList<>();
        int start = (pageNo-1)*pageSize;
        if (StringUtils.isNotBlank(startTime) && StringUtils.isNotBlank(endTime)){
            startTime += " 00:00:00";
            endTime += " 23:59:59";
            sql += " AND p.create_time <= ? " +
                    " AND p.create_time >= ? ";
            resultList = jdbcTemplate.queryForList(sql,new Object[]{endTime,startTime});
            sql +=" GROUP BY p.code ORDER  BY p.create_time DESC limit ?,?";
            resultList = jdbcTemplate.queryForList(sql,new Object[]{endTime,startTime,start,pageSize});
        }else{
            resultList = jdbcTemplate.queryForList(sql);
            sql +=" GROUP BY p.code ORDER  BY p.create_time DESC limit ?,?";
            resultList = jdbcTemplate.queryForList(sql,new Object[]{start,pageSize});
        }
        return resultList;
    }
@ -525,13 +482,17 @@ public class PrescriptionService extends BaseService {
     * @param keyWord
     * @return
     */
    public List<Map<String,Object>> getPrescriptionByKeyWord(String keyWord){
        String sql = "SELECT * FROM wlyy_prescription p where 1=1";
    public List<Map<String,Object>> getPrescriptionByKeyWord(String keyWord,int pageNo,int pageSize){
        String sql = "SELECT p.code,p.patient_name,p.doctor_name,p.hospital_name,p.dispensary_type,p.status," +
                "p.create_time,GROUP_CONCAT(d.health_problem) AS health_problem, GROUP_CONCAT(d.health_problem_name) AS health_problem_name " +
                "FROM wlyy_prescription p LEFT JOIN wlyy_prescription_diagnosis d ON p.code = d.prescription_code WHERE 1=1 " ;
        //判断关键字
        if (StringUtils.isNotBlank(keyWord)){
            sql += " AND (p.patient_name like '%"+keyWord+"%' or p.doctor_name like '%"+keyWord+"%')";
        }
        List<Map<String,Object>> resultList = jdbcTemplate.queryForList(sql);
        sql += " GROUP BY p.code ORDER  BY p.create_time DESC limit ?,?";
        int start = (pageNo-1)*pageSize;
        List<Map<String,Object>> resultList = jdbcTemplate.queryForList(sql,new Object[]{start,pageSize});
        return resultList;
    }

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

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

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

@ -3170,8 +3170,22 @@ public class StatisticsService extends BaseService {
    }
    public JSONArray getDoctorTeamFolList(String startDate, String endDate, String teamCode, String sort, String sortType) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        //如果是本月第一天则开始时间为上个月最后一天的下午五点
        Calendar cal = Calendar.getInstance();
        cal.setTime(DateUtil.strToDate(startDate,"yyyy-MM-dd"));
        boolean flag = DateUtil.checkFristDayOfDateMonth(cal);
        if (flag){
            startDate = DateUtil.getNextDay(startDate,-1)+" 17:00:00";
        }else{
            startDate = startDate + " 00:00:00";
        }
        //如果开始时间是当月的最后一天,则到当天的下午五点
        String endStr = DateUtil.getLastDayOfMonthThisDate(DateUtil.strToDate(startDate,"yyyy-MM-dd"));
        if (endStr.equals(endDate)){
            endDate = endDate + " 17:00:00";
        }else{
            endDate = endDate + " 00:00:00";
        }
        String totalSQL = "SELECT " +
                " IFNULL(c.followupCount,0) AS followupCount, " +
                " d.`code` AS doctorCode, " +
@ -3500,8 +3514,22 @@ public class StatisticsService extends BaseService {
    }
    public JSONArray getTeamDoctorResList(String teamCode, String startDate, String endDate, String sort, String sortType) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        //如果是本月第一天则开始时间为上个月最后一天的下午五点
        Calendar cal = Calendar.getInstance();
        cal.setTime(DateUtil.strToDate(startDate,"yyyy-MM-dd"));
        boolean flag = DateUtil.checkFristDayOfDateMonth(cal);
        if (flag){
            startDate = DateUtil.getNextDay(startDate,-1)+" 17:00:00";
        }else{
            startDate = startDate + " 00:00:00";
        }
        //如果开始时间是当月的最后一天,则到当天的下午五点
        String endStr = DateUtil.getLastDayOfMonthThisDate(DateUtil.strToDate(startDate,"yyyy-MM-dd"));
        if (endStr.equals(endDate)){
            endDate = endDate + " 17:00:00";
        }else{
            endDate = endDate + " 00:00:00";
        }
        String totalSql = "SELECT " +
                " IFNULL(c.reservationCount,0) AS reservationCount, " +
                " d.`code` AS doctorCode, " +
@ -3725,8 +3753,22 @@ public class StatisticsService extends BaseService {
    }
    public JSONArray getTeamGuidList(String teamCode, String startDate, String endDate, String sort, String sortType) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        //如果是本月第一天则开始时间为上个月最后一天的下午五点
        Calendar cal = Calendar.getInstance();
        cal.setTime(DateUtil.strToDate(startDate,"yyyy-MM-dd"));
        boolean flag = DateUtil.checkFristDayOfDateMonth(cal);
        if (flag){
            startDate = DateUtil.getNextDay(startDate,-1)+" 17:00:00";
        }else{
            startDate = startDate + " 00:00:00";
        }
        //如果开始时间是当月的最后一天,则到当天的下午五点
        String endStr = DateUtil.getLastDayOfMonthThisDate(DateUtil.strToDate(startDate,"yyyy-MM-dd"));
        if (endStr.equals(endDate)){
            endDate = endDate + " 17:00:00";
        }else{
            endDate = endDate + " 00:00:00";
        }
        String totalSql = "SELECT " +
                " IFNULL(c.guidanceCount,0) AS guidanceCount, " +
                " d.`code` AS doctorCode, " +
@ -3944,8 +3986,22 @@ public class StatisticsService extends BaseService {
    }
    public JSONArray getTeamEduList(String teamCode, String startDate, String endDate, String sort, String sortType) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        //如果是本月第一天则开始时间为上个月最后一天的下午五点
        Calendar cal = Calendar.getInstance();
        cal.setTime(DateUtil.strToDate(startDate,"yyyy-MM-dd"));
        boolean flag = DateUtil.checkFristDayOfDateMonth(cal);
        if (flag){
           startDate = DateUtil.getNextDay(startDate,-1)+" 17:00:00";
        }else{
            startDate = startDate + " 00:00:00";
        }
        //如果开始时间是当月的最后一天,则到当天的下午五点
        String endStr = DateUtil.getLastDayOfMonthThisDate(DateUtil.strToDate(startDate,"yyyy-MM-dd"));
        if (endStr.equals(endDate)){
            endDate = endDate + " 17:00:00";
        }else{
            endDate = endDate + " 00:00:00";
        }
        String totalSql = "SELECT " +
                " IFNULL(c.articleCount,0) AS articleCount, " +
                " IFNULL(c.batchno,0) AS batchno, " +
@ -5106,7 +5162,8 @@ public class StatisticsService extends BaseService {
        List<Map<String,Object>> rs =new ArrayList<>();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String sql ="";
        Calendar dd = Calendar.getInstance();//定义日期实例
        //定义日期实例
        Calendar dd = Calendar.getInstance();
        Date endDate = new Date();
        dd.setTime(endDate);
@ -5143,7 +5200,7 @@ public class StatisticsService extends BaseService {
            endTime = DateUtil.dateToStr(endDate, "YYYY-MM-dd HH:mm:ss");
        }else if (interval==3){
            sql = "SELECT count(1) AS count,LEFT(p.create_time,7) AS date  FROM wlyy_prescription p ";
            //String monthNumber = dd.get(Calendar.MONTH);
            //dd.setTime(startDate);
            for (int i = 1; i < 7; i++) {
                Map<String, Object> mc = new HashedMap();
                SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM");
@ -5153,6 +5210,15 @@ public class StatisticsService extends BaseService {
                dd.add(Calendar.MONTH, -1);
                rs.add(mc);
            }
            Collections.sort(rs, new Comparator<Map<String, Object>>() {
                public int compare(Map<String, Object> o1, Map<String, Object> o2) {
                    String date1 = String.valueOf(o1.get("date"));
                    String date2 = String.valueOf(o2.get("date"));
                    int flag = date1.compareTo(date2);
                    return flag;
                }
            });
            startTime = DateUtil.dateToStr(dd.getTime(), "YYYY-MM-dd HH:mm:ss");
            endTime = DateUtil.dateToStr(new Date(), "YYYY-MM-dd HH:mm:ss");
        }

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

@ -2377,48 +2377,65 @@ public class StatisticsESService {
        Integer interval = Integer.parseInt(type) + 1;
        List<SaveModel> articleCountList = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate,endDate,teamCode,Integer.valueOf(SaveModel.teamLevel),"59",SaveModel.timeLevel_ZL,String.valueOf(interval));
        List<SaveModel> batchNoCountList = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate,endDate,teamCode,Integer.valueOf(SaveModel.teamLevel),"71",SaveModel.timeLevel_ZL,String.valueOf(interval));
        List<Map<String, Object>> list = new ArrayList<>();
        if(articleCountList!=null){
            //循环人数集合
            for (SaveModel one1:articleCountList){
                String date = "";
                if(one1.getQuotaDate()!=null){
                    date=dateFormat.format(one1.getQuotaDate());
                }
                if (one1.getResult2().intValue()!=0){
                    Map<String,Object> map = new HashedMap();
                    map.put("articleCount",one1.getResult2().intValue());
                    //查看批次集合里是否有同时间的数据
                    for (SaveModel one2:batchNoCountList) {
                        if (one2.getQuotaDate()!=null && dateFormat.format(one2.getQuotaDate()).equals(date)){
                            map.put("batchCount",one2.getResult2().intValue());
                        }
                    }
                    if ("0".equals(type)) {
                        map.put("dateNo",date);
                    } else {
                        map.put("weekOfMonth", DateUtil.getWeekOfMonth(date));
        //List<Map<String, Object>> list = new ArrayList<>();
        Map<String,Object> articleMap = new HashedMap();
        Map<String,Object> batchMap = new HashedMap();
        //把list转换成 map
        if (articleCountList!=null && articleCountList.size()>0){
            articleCountList.stream().forEach(one1->{
                articleMap.put(dateFormat.format(one1.getQuotaDate()),one1);
            });
        }
        if (batchNoCountList!=null && batchNoCountList.size()>0){
            batchNoCountList.stream().forEach(one2->{
                batchMap.put(dateFormat.format(one2.getQuotaDate()),one2);
            });
        }
        //获取结果集
        List<Map<String, Object>> resultList = DateUtil.findDateASWeeks(dateFormat.parse(startDate),dateFormat.parse(endDate));
        String MondayWeekDateStr = DateUtil.getMondayOfThisDate(dateFormat.parse(startDate));
        Date MondayWeekDate = DateUtil.strToDate(MondayWeekDateStr,"yyyy-MM-dd");
        if (dateFormat.parse(startDate).after(MondayWeekDate)){
            //开始时间不是当周的周一,则加入本周周一的时间
            Map<String,Object> dateMap = new HashedMap();
            dateMap.put("date",MondayWeekDateStr);
            dateMap.put("count", 0.0D);
            resultList.add(0,dateMap);
        }
        if (resultList!=null && resultList.size()>0){
            for (Map<String, Object> reMap : resultList) {
                //设置时间
                if ("0".equals(type)) {
                    reMap.put("dateNo",dateFormat.format(reMap.get("date")));
                } else {
                    if (dateFormat.parse(String.valueOf(reMap.get("date"))).before(dateFormat.parse(startDate))){
                        reMap.put("weekOfMonth", 1);
                    }else{
                        reMap.put("weekOfMonth", DateUtil.getWeekOfMonth(String.valueOf(reMap.get("date"))));
                    }
                    list.add(map);
                }
                //放置新增发送人数和批次
                SaveModel one1 = (SaveModel) articleMap.get(reMap.get("date"));
                SaveModel one2 = (SaveModel) batchMap.get(reMap.get("date"));
                if (one1!=null){
                    reMap.put("articleCount",one1.getResult2().intValue());
                }else{
                    //循环批次
                    for (SaveModel one2:batchNoCountList) {
                        if (one2.getResult2().intValue()!=0 && one2.getQuotaDate()!=null && dateFormat.format(one2.getQuotaDate()).equals(date)){
                            Map<String,Object> map = new HashedMap();
                            map.put("articleCount",0);
                            map.put("batchCount",one2.getResult2().intValue());
                            if ("0".equals(type)) {
                                map.put("dateNo",dateFormat.format(date));
                            } else {
                                map.put("weekOfMonth", DateUtil.getWeekOfMonth(date));
                            }
                            list.add(map);
                        }
                    }
                    reMap.put("articleCount",0);
                }
                if (one2!=null){
                    reMap.put("batchCount",one2.getResult2().intValue());
                }else{
                    reMap.put("batchCount",0);
                }
                //去除多余的key
                reMap.remove("count");
                reMap.remove("avg");
                reMap.remove("date");
            }
        }
        return new JSONArray(list);
        return new JSONArray(resultList);
    }
    public JSONObject getRenewPercentAndChangePercent(String index, Integer level, String area, String year, String lowCode) {
@ -2940,16 +2957,19 @@ public class StatisticsESService {
            throw new RuntimeException("未找到团队信息");
        }
        Long id = admin.getId();
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, id + "", Integer.valueOf(SaveModel.teamLevel), "1", SaveModel.timeLevel_ZL, String.valueOf(Integer.valueOf(type) + 1));
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, id + "", Integer.valueOf(SaveModel.teamLevel), SaveModel.timeLevel_ZL, SaveModel.timeLevel_ZL, String.valueOf(Integer.valueOf(type) + 1));
        List<Map<String, Object>> rs = new ArrayList<>();
        for (SaveModel saveModel : list) {
            if(saveModel.getResult2().intValue()!=0){
                Map<String, Object> map = new HashMap<>();
            Map<String, Object> map = new HashMap<>();
            //map.put("applyDate", dateFormat.format(saveModel.getQuotaDate()));
            if ("0".equals(type)) {
                map.put("applyDate", dateFormat.format(saveModel.getQuotaDate()));
                map.put("signCount", saveModel.getResult2().longValue());
                rs.add(map);
            } else {
                map.put("weekOfMonth", DateUtil.getWeekOfMonth(saveModel.getQuotaDate()));
            }
            map.put("signCount", saveModel.getResult2().longValue());
            rs.add(map);
        }
        JSONArray rsJs = new JSONArray(rs);
        return rsJs;
@ -2970,12 +2990,17 @@ public class StatisticsESService {
            throw new RuntimeException("未找到团队信息");
        }
        Long id = admin.getId();
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, id + "", Integer.parseInt(SaveModel.teamLevel), "42", SaveModel.timeLevel_ZL, String.valueOf(Integer.parseInt(type) + 1));
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, id + "", Integer.parseInt(SaveModel.teamLevel), "42", SaveModel.timeLevel_ZL, String.valueOf(Integer.parseInt(type) + 2));
        List<Map<String, Object>> rs = new ArrayList<>();
        for (SaveModel saveModel : list) {
            if (saveModel.getResult2().intValue()!=0){
                Map<String, Object> map = new HashMap<>();
                map.put("applyDate", dateFormat.format(saveModel.getQuotaDate()));
                //map.put("applyDate", dateFormat.format(saveModel.getQuotaDate()));
                if ("0".equals(type)) {
                    map.put("applyDate", dateFormat.format(saveModel.getQuotaDate()));
                } else {
                    map.put("weekOfMonth", DateUtil.getWeekOfMonth(saveModel.getQuotaDate()));
                }
                map.put("signCount", saveModel.getResult2().longValue());
                rs.add(map);
            }
@ -3052,7 +3077,7 @@ public class StatisticsESService {
                if ("0".equals(type)) {
                    map.put("dateNo", dateFormat.format(one.getQuotaDate()));
                } else {
                    map.put("weekNo", dateFormat.format(one.getQuotaDate()));
                    map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                }
                map.put("avgCount", avgCountStr);
                rs.add(map);
@ -3136,7 +3161,11 @@ public class StatisticsESService {
                if ("0".equals(type)) {
                    map.put("dateNo", dateFormat.format(one.getQuotaDate()));
                } else {
                    map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                    if (one.getQuotaDate().before(dateFormat.parse(startDate))){
                        map.put("weekOfMonth", 1);
                    }else{
                        map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                    }
                }
                map.put("followupCount", one.getResult2().intValue());
                totalList.add(map);
@ -3150,7 +3179,11 @@ public class StatisticsESService {
                if ("0".equals(type)) {
                    map.put("dateNo", dateFormat.format(one.getQuotaDate()));
                } else {
                    map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                    if (one.getQuotaDate().before(dateFormat.parse(startDate))){
                        map.put("weekOfMonth", 1);
                    }else{
                        map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                    }
                }
                map.put("planCount", one.getResult2().intValue());
                planList.add(map);
@ -3181,16 +3214,21 @@ public class StatisticsESService {
        Map<String, Object> map = null;
        List<Map<String, Object>> totalList = new ArrayList<>();
        for (SaveModel one : list) {
            if (one.getResult2().intValue()!=0){
                map = new HashMap<>();
                if ("0".equals(type)) {
                    map.put("dateNo", dateFormat.format(one.getQuotaDate()));
                } else {
            /*if (one.getResult2().intValue()!=0){
            }*/
            map = new HashMap<>();
            if ("0".equals(type)) {
                map.put("dateNo", dateFormat.format(one.getQuotaDate()));
            } else {
                if (one.getQuotaDate().before(dateFormat.parse(startDate))){
                    map.put("weekOfMonth","1");
                }else{
                    map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                }
                map.put("reservationCount", one.getResult2().longValue());
                totalList.add(map);
            }
            map.put("reservationCount", one.getResult2().longValue());
            totalList.add(map);
        }
        return new JSONArray(totalList);
    }
@ -3360,16 +3398,21 @@ public class StatisticsESService {
        Map<String, Object> map = null;
        List<Map<String, Object>> totalList = new ArrayList<>();
        for (SaveModel one : list) {
            if (one.getResult2().intValue()!=0){
                map = new HashMap<>();
                if ("0".equals(type)) {
                    map.put("dateNo", dateFormat.format(one.getQuotaDate()));
                } else {
           /* if (one.getResult2().intValue()!=0){
            }*/
            map = new HashMap<>();
            if ("0".equals(type)) {
                map.put("dateNo", dateFormat.format(one.getQuotaDate()));
            } else {
                if (one.getQuotaDate().before(dateFormat.parse(startDate))){
                    map.put("weekOfMonth", 1);
                }else{
                    map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                }
                map.put("guidanceCount", one.getResult2().longValue());
                totalList.add(map);
            }
            map.put("guidanceCount", one.getResult2().longValue());
            totalList.add(map);
        }
        return new JSONArray(totalList);
    }
@ -3398,7 +3441,11 @@ public class StatisticsESService {
            if ("0".equals(type)) {
                map.put("dateNo", dateFormat.format(one.getQuotaDate()));
            } else {
                map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                if (one.getQuotaDate().before(dateFormat.parse(startDate))){
                    map.put("weekOfMonth", 1);
                }else{
                    map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                }
            }
            map.put("inCount", one.getResult2().longValue());
            inList.add(map);
@ -3412,7 +3459,11 @@ public class StatisticsESService {
            if ("0".equals(type)) {
                map.put("dateNo", dateFormat.format(one.getQuotaDate()));
            } else {
                map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                if (one.getQuotaDate().before(dateFormat.parse(startDate))){
                    map.put("weekOfMonth", 1);
                }else{
                    map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                }
            }
            map.put("outCount", one.getResult2().longValue());
            outList.add(map);
@ -3946,7 +3997,7 @@ public class StatisticsESService {
        if (interval==2){
            rs = DateUtil.findDateASWeeks(startDate,endDate);
            String MondayWeekDateStr = DateUtil.getMondayOfThisDate(startDate);
            Date MondayWeekDate = dateFormat3.parse(MondayWeekDateStr);
            Date MondayWeekDate = dateFormat.parse(MondayWeekDateStr);
            if (startDate.after(MondayWeekDate)){
                //开始时间不是当周的周一,则加入本周周一的时间
                Map<String,Object> dateMap = new HashedMap();
@ -3967,6 +4018,15 @@ public class StatisticsESService {
                dd.add(Calendar.MONTH, -1);
                rs.add(mc);
            }
            Collections.sort(rs, new Comparator<Map<String, Object>>() {
                public int compare(Map<String, Object> o1, Map<String, Object> o2) {
                    String date1 = String.valueOf(o1.get("date"));
                    String date2 = String.valueOf(o2.get("date"));
                    int flag = date1.compareTo(date2);
                    return flag;
                }
            });
            startTime = DateUtil.dateToStr(dd.getTime(), "YYYY-MM-dd HH:mm:ss");
            endTime = DateUtil.dateToStr(new Date(), "YYYY-MM-dd HH:mm:ss");
        }

+ 33 - 10
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/QrcodeService.java

@ -11,6 +11,7 @@ import com.yihu.wlyy.util.HttpUtil;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -37,6 +38,8 @@ public class QrcodeService extends BaseService {
    private TownDao townDao;
    @Autowired
    private HttpUtil HttpUtil;
    @Value("${server.server_url}")
    private String server_url;
    /**
     * 所有医生二维码生成
@ -263,8 +266,7 @@ public class QrcodeService extends BaseService {
                    doctorLevel = "全科医生";
                } else if (doctor.getLevel() == 3) {
                    doctorLevel = "健康管理师";
                }
                else{
                } else {
                    doctorLevel = "未知";
                }
@ -433,9 +435,9 @@ public class QrcodeService extends BaseService {
    /**
     * 从微信生成二维码并下载到本地
     *
     * @param content 场景值
     * @param content  场景值
     * @param fileName 二维码文件名
     * @param path 生成二维码路径
     * @param path     生成二维码路径
     * @param token
     * @throws IOException
     */
@ -501,26 +503,44 @@ public class QrcodeService extends BaseService {
    }
    /**
     * 从微信生成二维码(供第三方调用)
     * 从微信生成永久二维码(供第三方调用)
     * 文件不存在才会新建
     *
     * @param content
     * @param fileName
     * @param path
     * @param token
     * @throws IOException
     * @return 返回服务器地址
     * @throws Exception
     */
    public String getQrcodeFromWeiXin(String content,String token) throws Exception {
    public String getQrcodeFromWeiXin(String content, String fileName, String path, String token) throws Exception {
        try {
            String token_url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + token;
            String params = "{\"action_name\": \"QR_LIMIT_STR_SCENE\", \"action_info\": {\"scene\": {\"scene_str\": \"" + content + "\"}}}";
            String result = HttpUtil.sendPost(token_url, params);
            if (!StringUtils.isEmpty(result)) {
                String absPath = "qrcode" + File.separator + fileName + ".png";
                JSONObject json = new JSONObject(result);
                if (json.has("ticket")) {
                    String file = path + File.separator + absPath;
                    // 保存路径
                    File pathFile = new File(path);
                    // 保存文件
                    File outputFile = new File(file);
                    // 路径不存在则创建
                    if (!pathFile.exists()) {
                        pathFile.mkdir();
                    }
                    // 文件已存在则返回已存在的路径
                    if (outputFile.exists()) {
                        return server_url + absPath;
                    }
                    // 请求输入流
                    InputStream inputStream = null;
                    // 二维码图片输出流
                    StringBuffer tStringBuffer = new StringBuffer();
                    FileOutputStream outputStream = new FileOutputStream(file);
                    // 下载二维码图片
                    URL urlGet = new URL("https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket="
                            + URLEncoder.encode(json.get("ticket").toString(), "UTF-8"));
@ -532,14 +552,17 @@ public class QrcodeService extends BaseService {
                    int len = 0;
                    while ((len = inputStream.read(data)) != -1) {
                        tStringBuffer.append(data);
                        outputStream.write(data, 0, len);
                    }
                    if (inputStream != null) {
                        inputStream.close();
                    }
                    if (outputStream != null) {
                        outputStream.close();
                    }
                    return tStringBuffer.toString();
                    return server_url + absPath;
                } else {
                    throw new Exception("请求微信生成二维码失败!");
                }

+ 41 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/RoleService.java

@ -68,7 +68,21 @@ public class RoleService extends TokenService {
    public List<Map<String, String>> getUserRoleAndArea(String user) {
        List<Map<String, String>> re = new ArrayList<>();
        List<DoctorRole> roleList = doctorRoleDao.findUserRole(user);
//        for(DoctorRole one:roleList){
//            int level = roleConverse(one.getCode());
//            tempList = temp.get(level);
//            if(tempList==null){
//                tempList=new ArrayList<>();
//            }
//            tempList.add(one.get("roleCode")+"");
//            temp.put(level,tempList);
//        }
        int resultLevel = 5;
        for (DoctorRole one : roleList) {
            if(resultLevel>roleConverse(one.getCode())){
                resultLevel=roleConverse(one.getCode());
            }
        }
        if (roleList != null && roleList.size() > 0) {
            //遍历角色
            for (DoctorRole role : roleList) {
@ -128,10 +142,36 @@ public class RoleService extends TokenService {
                    areaString = areaString.substring(0, areaString.length() - 1);
                }
                map.put("areas", areaString);
                map.put("level",roleConverse(role.getCode())+"");
                if(resultLevel==roleConverse(role.getCode())){
                    map.put("isManage", "1");
                }else{
                    map.put("isManage", "0");
                }
                re.add(map);
            }
        }
        return re;
    }
    /**
     * 角色code转成角色级别
     * @param roleCode 角色code
     * @return 1、省级,2、市级,3、区级,4、机构
     */
    public Integer roleConverse(String roleCode){
        if(roleCode.length()==6){
            if("0".equals(roleCode.substring(3,4))){
                return 1;
            }else if("00".equals(roleCode.substring(4))){
                return 2;
            }else{
                return 3;
            }
        }else{
            return 3;
        }
    }
}

+ 12 - 11
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.service.jimeiJkEdu;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPObject;
import com.yihu.edu.entity.RoleWithAuthorityCheck;
import com.yihu.es.entity.HealthEduArticlePatient;
import com.yihu.es.entity.RoleVo;
@ -101,7 +102,7 @@ public class JMJkEduArticleService extends BaseService {
        com.alibaba.fastjson.JSONObject article = null;
        Doctor doctor = null;
        for (HealthEduArticlePatient one : esList) {
            article = thirdJkEduArticleService.getArticalById(one.getArticleId());
            article = thirdJkEduArticleService.getArticalById(one.getArticleId(),"");
            if (result.get(one.getArticleId()) != null) {
                heapm = result.get(one.getArticleId());
@ -289,7 +290,7 @@ public class JMJkEduArticleService extends BaseService {
        //通过文章id 获取文章详情
        JSONObject article = thirdJkEduArticleService.getArticalById(articleId);
        JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
        healthEduArticlePatient.setArticleId(article.get("articleId") + "");
        healthEduArticlePatient.setAttachedTitle(article.get("articleTitle") + "");
@ -362,7 +363,7 @@ public class JMJkEduArticleService extends BaseService {
//    }
    public JSONObject pushArticleConfirm(String articleId, String labelUnit, String labelSex, String labelServe, String labelDisease, String labelHealth,String userCode) throws Exception {
        JSONObject article = thirdJkEduArticleService.getArticalById(articleId);
        JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
        Set<String> patientSet = new HashSet<>();
        initPatient(patientSet, labelUnit, labelSex, labelServe, labelDisease, labelHealth,userCode);
        long num = patientSet.size();
@ -597,7 +598,7 @@ public class JMJkEduArticleService extends BaseService {
    }
    public JSONObject pushArticleConfirm(String articleId,String labelType, String condition, String groupType,Long teamId,String doctorCode) throws Exception{
        JSONObject article = thirdJkEduArticleService.getArticalById(articleId);
        JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
        Set<String> patientSet = new HashSet<>();
        initPatients(patientSet,labelType,condition,groupType,teamId,doctorCode);
        long num = patientSet.size();
@ -731,7 +732,7 @@ public class JMJkEduArticleService extends BaseService {
        List<HealthEduArticlePatientModel> result = new ArrayList<>();
        Doctor doctor = null;
        for (HealthEduArticlePatient one : esList) {
            article = thirdJkEduArticleService.getArticalById(one.getArticleId());
            article = thirdJkEduArticleService.getArticalById(one.getArticleId(),"");
            heapm = new HealthEduArticlePatientModel();
            heapm.setSendName(one.getSendName());
            heapm.setSendCode(one.getDoctorCode());
@ -778,7 +779,7 @@ public class JMJkEduArticleService extends BaseService {
     */
    public void saveArticle(String userCode,String articleTitle,String articleType,Integer	articlelevel,String	secondLevelCategoryId,String image,
                            String	secondLevelCategoryName,String firstLevelCategoryId,String firstLevelCategoryName,String content,String operatorRoleCode,
                            String opertorRoleLevel,Integer userScope) throws Exception {
                            String opertorRoleLevel,Integer userScope,String articleId) throws Exception {
        image = commonUtil.copyTempImage(image);
        Integer isAuthentication = 0;
@ -792,7 +793,7 @@ public class JMJkEduArticleService extends BaseService {
        }
        thirdJkEduArticleService.saveArticle(userCode,articleTitle,articleType,articlelevel,secondLevelCategoryId,image,
                secondLevelCategoryName,firstLevelCategoryId,firstLevelCategoryName,content,operatorRoleCode,opertorRoleLevel,
                userScope,isAuthentication);
                userScope,isAuthentication,articleId);
    }
    /**
@ -808,18 +809,18 @@ public class JMJkEduArticleService extends BaseService {
     * @param currentUserRoleLevel
     * @throws Exception
     */
    public JSONArray queryArticlePcList(String firstLevelCategoryId,String secondLevelCategoryId,String insertTimeStart,String insertTimeEnd,String articlelevel,String articleTitle,
                                   String userCode,String currentUserRole,String currentUserRoleLevel,String isAuthentication,boolean isMyArticle) throws Exception{
    public JSONObject queryArticlePcList(String firstLevelCategoryId, String secondLevelCategoryId, String insertTimeStart, String insertTimeEnd, String articlelevel, String articleTitle,
                                          String userCode, String currentUserRole, String currentUserRoleLevel, String isAuthentication, Boolean isMyArticle, Integer page, Integer pageSize) throws Exception{
//        Doctor doctor = doctorDao.findByCode(userCode);
//        boolean isManage = false;
//        if(doctor.getLevel()==10){
//            isManage = true;
//        }
        if(!isMyArticle){
        if(isMyArticle==null||(isMyArticle!=null&&!isMyArticle)){
            userCode = null;
        }
        return thirdJkEduArticleService.queryArticlePcList(firstLevelCategoryId,secondLevelCategoryId,insertTimeStart,insertTimeEnd,articlelevel,
                articleTitle,userCode,isAuthentication,currentUserRole,currentUserRoleLevel);
                articleTitle,userCode,isAuthentication,currentUserRole,currentUserRoleLevel,page,pageSize);
    }
    /**

+ 12 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jkEduArticle/ThirdJkEduArticleService.java

@ -334,12 +334,13 @@ public class ThirdJkEduArticleService extends BaseService {
     * @param articleId 文章id
     * @return
     */
    public JSONObject getArticalById(String articleId) throws Exception {
    public JSONObject getArticalById(String articleId,String userId) throws Exception {
        JSONObject re = new JSONObject();
        JSONObject json = null;
        try {
            JSONObject param = new JSONObject();
            param.put("articleId", articleId);
            param.put("userId", userId);
            String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getArticalById, param.toString(), "1"));
            json = JSON.parseObject(response);
        } catch (Exception e) {
@ -375,7 +376,7 @@ public class ThirdJkEduArticleService extends BaseService {
     */
    public void saveArticle(String userCode,String articleTitle,String articleType,Integer	articlelevel,String	secondLevelCategoryId,String newUrl,
                                 String	secondLevelCategoryName,String firstLevelCategoryId,String firstLevelCategoryName,String content,
                                 String operatorRoleCode,String opertorRoleLevel,Integer userScope,Integer isAuthentication) throws Exception {
                                 String operatorRoleCode,String opertorRoleLevel,Integer userScope,Integer isAuthentication,String articleId) throws Exception {
        String response = "";
        JSONObject json = null;
@ -388,6 +389,7 @@ public class ThirdJkEduArticleService extends BaseService {
            String	orgId = doctor.getHospital();//组织
            String	userName = doctor.getName();//登录名称
            JSONObject param = new JSONObject();
            param.put("articleId", articleId);
            param.put("userCode", userCode);
            param.put("orgName", orgName);
            param.put("deptName", deptName);
@ -439,8 +441,8 @@ public class ThirdJkEduArticleService extends BaseService {
     * @return
     * @throws Exception
     */
    public JSONArray queryArticlePcList(String firstLevelCategoryId,String secondLevelCategoryId,String insertTimeStart,String insertTimeEnd,String articlelevel,
                                        String articleTitle,String userCode,String isAuthentication,String currentUserRole,String currentUserRoleLevel) throws Exception {
    public JSONObject queryArticlePcList(String firstLevelCategoryId,String secondLevelCategoryId,String insertTimeStart,String insertTimeEnd,String articlelevel,
                                        String articleTitle,String userCode,String isAuthentication,String currentUserRole,String currentUserRoleLevel,Integer page,Integer pageSize) throws Exception {
        String response = "";
        JSONObject json = null;
@ -456,13 +458,15 @@ public class ThirdJkEduArticleService extends BaseService {
            param.put("isAuthentication", isAuthentication);
            param.put("currentUserRole", currentUserRole);
            param.put("currentUserRoleLevel", currentUserRoleLevel);
            param.put("page", page+"");
            param.put("pageSize", pageSize+"");
            response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(queryArticlePcList, param.toString(), "1"));
            json = JSON.parseObject(response);
        } catch (Exception e) {
            e.printStackTrace();
        }
        if ("10000".equals(json.getString("Code"))) {
            return json.getJSONArray("Result");
            return json;
        } else {
            throw new Exception(json.getString("Message"));
        }
@ -503,12 +507,14 @@ public class ThirdJkEduArticleService extends BaseService {
     * @param categoryLevel 是    获取类别:1、一级类别 2、二级类别
     * @return
     */
    public JSONArray getCategoryList(String categoryLevel) throws Exception {
    public JSONArray getCategoryList(Integer categoryLevel,String firstlevelId,String secondLevelId) throws Exception {
        JSONArray re = new JSONArray();
        JSONObject json = null;
        try {
            JSONObject param = new JSONObject();
            param.put("categoryLevel", categoryLevel);
            param.put("firstlevelId", firstlevelId);
            param.put("secondLevelId", secondLevelId);
//            param.put("userId", userId);
            String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getCategoryList, param.toString(), "1"));
            json = JSON.parseObject(response);

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/ylz/ThirdMessageService.java

@ -97,7 +97,7 @@ public class ThirdMessageService extends BaseService {
            model.put("keyword5", medicalTime);
            if (StringUtils.isNotEmpty(openId) && !"undefined".equals(openId)) {
                pushMsgTask.putAgentWxMsg(patient.getCode(), 18, model);
                pushMsgTask.putAgentWxMsg(patient.getCode(), 21, model);
            }

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

@ -718,11 +718,8 @@ public class OnePayService {
                //保存到患者表
                Patient p = patientDao.findByCode(patient);
//                if(!"undefined".equals(openid)&&StringUtils.isNotBlank(openid)){
//                    p.setOpenid(openid);
//                }
//            增加绑定电子社保卡信息
                if (p.getSicardStatus()!=null && p.getSicardStatus()!=1){
                if (p.getSicardTime() == null){
                    p.setSicardTime(new Date());
                }
                patientDao.save(p);

+ 28 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java

@ -61,6 +61,8 @@ public class PushMsgTask {
    private String template_doctor_survey;
    @Value("${wechat.message.template_doctor_audit}")
    private String template_doctor_audit;//审核结果通知
    @Value("${wechat.message.template_physical_examination}")
    private String template_physical_examination;//体检提醒
    @Value("${wechat.message.template_doctor_service}")
    private String template_doctor_service;//服务结果通知
    @Value("${pushMes.method}")
@ -225,7 +227,7 @@ public class PushMsgTask {
     * 发送微信模板消息
     *
     * @param type 1:签约成功  2:签约失败  3:咨询回复通知  4:健康指导提醒  5:解约申请通知  6:预约挂号成功通知  7:预约取消通知 8 缴费提醒 9 健康教育  10 签约医生变更(信息变更通知)
     *             18 产检提醒和产检就诊提醒 19:续方审核结果通知(0.不通过 1.通过 2。调整处方并通过) 20:服务结果通知 11.代办事项通知
     *             18 产检提醒和产检就诊提醒 19:续方审核结果通知(0.不通过 1.通过 2。调整处方并通过) 20:服务结果通知 11.代办事项通知 21体检提醒
     * @param json 当type==1||type==2时:{"first":"消息主题",”doctor":"医生code","doctorName":"医生名","date":"签约时间","content":"签约内容","remark":"消息备注"}
     *             type==3时:{"first":"消息主题","consult":"医生咨询编号","consultcontent":"咨询内容","replycontent":"回复内容","doctorName":"医生名","remark":"消息备注"}
     *             type==4时:{"first":"消息主题","date":"指导时间","orgName":"指导机构","doctorName":"指导医生名","content":"指导内容","remark":"消息备注"}
@ -668,6 +670,31 @@ public class PushMsgTask {
                keyword3.setColor("#000000");
                keyword3.setValue(json.getString("keyword3"));
                m.put("keyword3", keyword3);
            }else if (type == 21) {
                if (json.has("url")) {
                    temp.setUrl(url + json.getString("url"));
                }
                temp.setTemplate_id(template_physical_examination);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
                keyword1.setValue(json.getString("keyword1"));
                m.put("keyword1", keyword1);
                WechatTemplateData keyword2 = new WechatTemplateData();
                keyword2.setColor("#000000");
                keyword2.setValue(json.getString("keyword2"));
                m.put("keyword2", keyword2);
                WechatTemplateData keyword3 = new WechatTemplateData();
                keyword3.setColor("#000000");
                keyword3.setValue(json.getString("keyword3"));
                m.put("keyword3", keyword3);
                WechatTemplateData keyword4 = new WechatTemplateData();
                keyword4.setColor("#000000");
                keyword4.setValue(json.getString("keyword4"));
                m.put("keyword4", keyword4);
                WechatTemplateData keyword5 = new WechatTemplateData();
                keyword5.setColor("#000000");
                keyword5.setValue(json.getString("keyword5"));
                m.put("keyword5", keyword5);
            }
            temp.setData(m);

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/DateUtil.java

@ -1121,8 +1121,8 @@ public class DateUtil {
	}
	public static int getWeekOfMonth(String dateString){
		Date date = strToDate(dateString);
		return getWeekOfMonth(date);
	}

+ 53 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/BaseController.java

@ -46,7 +46,8 @@ public class BaseController {
            }
            JSONObject json = new JSONObject(userAgent);
            return json.getString("uid");
//            return "xh1D2017031502222";// wjw00000001000e6badcfa163e424589
//            return "wjw00000001000e6badcfa163e424525";// wjw00000001000e6badcfa163e424589
        } catch (Exception e) {
            return null;
        }
@ -179,6 +180,57 @@ public class BaseController {
        }
    }
    /**
     * 获取当前用户的角色code
     * @return
     */
    public String getCurrentRoleCode(){
        try {
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = new JSONObject(userAgent);
            return json.getJSONObject("currentUserRole").getString("code");
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 获取当前用户的角色级别
     * @return
     */
    public String getCurrentRoleLevel(){
        try {
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = new JSONObject(userAgent);
            return json.getJSONObject("currentUserRole").getString("level");
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 获取当前用户的角色是否是管理员
     * @return
     */
    public String getCurrentRoleIsManange(){
        try {
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = new JSONObject(userAgent);
            return json.getJSONObject("currentUserRole").getString("isManange");
        } catch (Exception e) {
            return null;
        }
    }
    public void error(Exception e) {
        logger.error(DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss")+":"+getClass().getName() + ":", e.getMessage());
        e.printStackTrace();

+ 7 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/LoginController.java

@ -247,6 +247,13 @@ public class LoginController extends BaseController {
                    //获取医生角色和区域权限
                    List<Map<String, String>> roleMap = roleService.getUserRoleAndArea(doctor.getCode());
                    map.put("userRole", roleMap);
                    //医生当前登录的角色
                    for(Map<String, String> one:roleMap){
                        if("1".equals(one.get("isManage"))){
                            map.put("currentUserRole", one);
                            continue;
                        }
                    }
                    if ("10" .equals(doctor.getLevel()) && roleMap.size() == 0) {
                        errorMessage = "改用户没有管理员权限";
                        loginLog.setErrorMessage(errorMessage);

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

@ -512,7 +512,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
    }
    private void getPatientByGroup(String labelCode, String labelType, Long teamCode, Set<String> patientSet, int page, int pagesize) throws Exception {
        JSONArray result = signPatientLabelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page, pagesize, false, "");
        JSONArray result = signPatientLabelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page, pagesize, false, "",false);
        for (Object o : result) {
            JSONObject json = (JSONObject) o;
            String patient = (String) json.get("code");

+ 66 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEdu/DoctorJMJkEduArticleController.java

@ -1,11 +1,10 @@
package com.yihu.wlyy.web.doctor.jimeiJkEdu;
import com.alibaba.fastjson.JSONObject;
import com.yihu.es.entity.HealthEduArticlePatient;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.service.call.CustomerService;
import com.yihu.wlyy.service.jimeiJkEdu.JMJkEduArticleService;
import com.yihu.wlyy.service.third.jw.JwSmjkService;
import com.yihu.wlyy.service.third.jkEduArticle.ThirdJkEduArticleService;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.third.gateway.service.GcEduArticleService;
import com.yihu.wlyy.web.third.gateway.vo.HealthEduArticlePatientModel;
@ -40,7 +39,8 @@ public class DoctorJMJkEduArticleController extends BaseController {
    @Autowired
    private JMJkEduArticleService jmJkEduArticleService;
    @Autowired
    private GcEduArticleService gcEduArticleService;
    private ThirdJkEduArticleService thirdJkEduArticleService;
    
    @Autowired
    private JmsTemplate jmsTemplate;
    @Value("${activemq.queue.healtHarticleQueue}")
@ -234,6 +234,68 @@ public class DoctorJMJkEduArticleController extends BaseController {
            return new BaseResultModel(BaseResultModel.statusEm.opera_error.getCode(), BaseResultModel.statusEm.opera_error.getMessage() + ":" + e.getMessage());
        }
    }
    
    @RequestMapping(value = "getArticalById",method = RequestMethod.GET)
    @ApiOperation("获取文章详情")
    public String getArticalById(@ApiParam(name = "articleId", value = "文章id",defaultValue = "1")
                                 @RequestParam(value = "articleId", required = true) String articleId){
        try {
            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticalById(articleId,getUID());
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败!");
        }
    }
    
    /**
     * 医生端端文章列表
     * @param firstLevelCategoryId
     * @param secondLevelCategoryId
     * @param insertTimeStart
     * @param insertTimeEnd
     * @param articlelevel
     * @param articleTitle
     * @return
     */
    @RequestMapping(value = "queryArticlePcList", method = RequestMethod.GET)
    @ApiOperation("医生端文章列表")
    public  String queryArticlePcList(@ApiParam(name = "firstLevelCategoryId", value = "文章一级分类")
                                      @RequestParam(value = "firstLevelCategoryId", required = false) String firstLevelCategoryId,
                                      @ApiParam(name = "secondLevelCategoryId", value = "文章二级分类")
                                      @RequestParam(value = "secondLevelCategoryId", required = false) String secondLevelCategoryId,
                                      @ApiParam(name = "insertTimeStart", value = "新增文章开始时间")
                                      @RequestParam(value = "insertTimeStart", required = false) String insertTimeStart,
                                      @ApiParam(name = "insertTimeEnd", value = "新增文章结束时间")
                                      @RequestParam(value = "insertTimeEnd", required = false) String insertTimeEnd,
                                      @ApiParam(name = "articlelevel", value = "文章级别")
                                      @RequestParam(value = "articlelevel", required = false) String articlelevel,
                                      @ApiParam(name = "articleTitle", value = "文章标题关键字")
                                      @RequestParam(value = "articleTitle", required = false) String articleTitle,
//                                      @ApiParam(name = "currentUserRole", value = "当前登录的角色")
//                                      @RequestParam(value = "currentUserRole", required = true) String currentUserRole,
//                                      @ApiParam(name = "currentUserRoleLevel", value = "当前登录的角色级别")
//                                      @RequestParam(value = "currentUserRoleLevel", required = true )String currentUserRoleLevel,
                                      @ApiParam(name = "isAuthentication", value = "是否认证")
                                      @RequestParam(value = "isAuthentication", required = false) String isAuthentication,
                                      @ApiParam(name = "isMyArticle", value = "是否过滤我的文章")
                                      @RequestParam(value = "isMyArticle", required = false) Boolean isMyArticle,
                                      @ApiParam(name = "page", value = "当前页")
                                      @RequestParam(value = "page", required = true) Integer page,
                                      @ApiParam(name = "pageSize", value = "分页数")
                                      @RequestParam(value = "pageSize", required = true) Integer pageSize){
        try {
            
            
            JSONObject response = jmJkEduArticleService.queryArticlePcList(firstLevelCategoryId,secondLevelCategoryId,insertTimeStart,insertTimeEnd,articlelevel,articleTitle,
                    getUID(),getCurrentRoleCode(),getCurrentRoleLevel(),isAuthentication,isMyArticle,page,pageSize);
            
            return write(200,"查询成功!","data",response);
        } catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败!");
        }
    }
    /*************************************************************************医生角色end***************************************************************************************************/

+ 32 - 23
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEduPC/DoctorJMJkEduArticlePCController.java

@ -1,8 +1,8 @@
package com.yihu.wlyy.web.doctor.jimeiJkEduPC;
import com.alibaba.fastjson.JSONArray;
import com.yihu.wlyy.aop.ObserverRequired;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.service.jimeiJkEdu.JMJkEduArticleService;
import com.yihu.wlyy.service.third.jkEduArticle.ThirdJkEduArticleService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -21,10 +21,14 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
    @Autowired
    private JMJkEduArticleService jmJkEduArticleService;
    @Autowired
    private ThirdJkEduArticleService thirdJkEduArticleService;
    @RequestMapping(value = "saveArticle", method = RequestMethod.POST)
    @ApiOperation("添加文章")
    public  String saveArticle(@ApiParam(name = "articleTitle", value = "文章标题")
    public  String saveArticle(@ApiParam(name = "articleId", value = "文章Id")
                               @RequestParam(value = "articleId", required = false) String articleId,
                               @ApiParam(name = "articleTitle", value = "文章标题")
                               @RequestParam(value = "articleTitle", required = true) String articleTitle,
                               @ApiParam(name = "articleType", value = "文章类型")
                               @RequestParam(value = "articleType", required = true) String articleType,
@ -42,16 +46,16 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
                               @RequestParam(value = "content", required = true) String content,
                               @ApiParam(name = "imageUrl", value = "文章封面图片地址")
                               @RequestParam(value = "imageUrl", required = true) String imageUrl,
                               @ApiParam(name = "operatorRoleCode", value = "操作人角色code")
                               @RequestParam(value = "operatorRoleCode", required = true) String operatorRoleCode,
                               @ApiParam(name = "opertorRoleLevel", value = "操作人角色级别")
                               @RequestParam(value = "opertorRoleLevel", required = true) String opertorRoleLevel,
//                               @ApiParam(name = "operatorRoleCode", value = "操作人角色code")
//                               @RequestParam(value = "operatorRoleCode", required = true) String operatorRoleCode,
//                               @ApiParam(name = "opertorRoleLevel", value = "操作人角色级别")
//                               @RequestParam(value = "opertorRoleLevel", required = true) String opertorRoleLevel,
                               @ApiParam(name = "userScope", value = "使用范围(1、全市使用,2、全区使用,3、全社区使用)")
                               @RequestParam(value = "userScope", required = true) Integer userScope){
        try {
            jmJkEduArticleService.saveArticle(getUID(),articleTitle,articleType,articlelevel,secondLevelCategoryId,imageUrl,
                    secondLevelCategoryName,firstLevelCategoryId,firstLevelCategoryName,content,operatorRoleCode,opertorRoleLevel,userScope);
                    secondLevelCategoryName,firstLevelCategoryId,firstLevelCategoryName,content,getCurrentRoleCode(),getCurrentRoleLevel(),userScope,articleId);
            return success("添加成功!");
        }catch (Exception e){
            e.printStackTrace();
@ -67,8 +71,6 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
     * @param insertTimeEnd
     * @param articlelevel
     * @param articleTitle
     * @param currentUserRole
     * @param currentUserRoleLevel
     * @return
     */
    @RequestMapping(value = "queryArticlePcList", method = RequestMethod.GET)
@ -85,18 +87,24 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
                                      @RequestParam(value = "articlelevel", required = false) String articlelevel,
                                      @ApiParam(name = "articleTitle", value = "文章标题关键字")
                                      @RequestParam(value = "articleTitle", required = false) String articleTitle,
                                      @ApiParam(name = "currentUserRole", value = "当前登录的角色")
                                      @RequestParam(value = "currentUserRole", required = true) String currentUserRole,
                                      @ApiParam(name = "currentUserRoleLevel", value = "当前登录的角色级别")
                                      @RequestParam(value = "currentUserRoleLevel", required = true )String currentUserRoleLevel,
                                      @ApiParam(name = "isAuthentication", value = "是否有权限")
//                                      @ApiParam(name = "currentUserRole", value = "当前登录的角色")
//                                      @RequestParam(value = "currentUserRole", required = true) String currentUserRole,
//                                      @ApiParam(name = "currentUserRoleLevel", value = "当前登录的角色级别")
//                                      @RequestParam(value = "currentUserRoleLevel", required = true )String currentUserRoleLevel,
                                      @ApiParam(name = "isAuthentication", value = "是否认证")
                                      @RequestParam(value = "isAuthentication", required = false) String isAuthentication,
                                      @ApiParam(name = "isMyArticle", value = "是否过滤我的文章")
                                      @RequestParam(value = "isMyArticle", required = false) Boolean isMyArticle){
                                      @RequestParam(value = "isMyArticle", required = false) Boolean isMyArticle,
                                      @ApiParam(name = "iDisplayStart", value = "当前页")
                                      @RequestParam(value = "iDisplayStart", required = true) Integer page,
                                      @ApiParam(name = "iDisplayLength", value = "是否过滤我的文章")
                                      @RequestParam(value = "iDisplayLength", required = true) Integer pageSize){
        try {
            JSONArray response = jmJkEduArticleService.queryArticlePcList(firstLevelCategoryId,secondLevelCategoryId,insertTimeStart,insertTimeEnd,articlelevel,articleTitle,
                    getUID(),currentUserRole,currentUserRoleLevel,isAuthentication,isMyArticle);
            JSONObject response = jmJkEduArticleService.queryArticlePcList(firstLevelCategoryId,secondLevelCategoryId,insertTimeStart,insertTimeEnd,articlelevel,articleTitle,
                    getUID(),getCurrentRoleCode(),getCurrentRoleLevel(),isAuthentication,isMyArticle,page,pageSize);
            return write(200,"查询成功!","data",response);
        } catch (Exception e){
            e.printStackTrace();
@ -106,10 +114,11 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
    @RequestMapping(value = "saveOrUpdateArticleQR", method = RequestMethod.POST)
    @ApiOperation("保存或更新认证标识")
    public  String saveOrUpdateArticleQR(@ApiParam(name = "currentRoleLevel", value = "当前登录角色的级别")
                                         @RequestParam(value = "currentRoleLevel", required = true) String currentRoleLevel,
                                         @ApiParam(name = "currentRoleCode", value = "当前登录角色的code")
                                         @RequestParam(value = "currentRoleCode", required = true) String currentRoleCode,
    public  String saveOrUpdateArticleQR(
//                                        @ApiParam(name = "currentRoleLevel", value = "当前登录角色的级别")
//                                         @RequestParam(value = "currentRoleLevel", required = true) String currentRoleLevel,
//                                         @ApiParam(name = "currentRoleCode", value = "当前登录角色的code")
//                                         @RequestParam(value = "currentRoleCode", required = true) String currentRoleCode,
                                         @ApiParam(name = "position", value = "位置")
                                         @RequestParam(value = "position", required = false) Integer position,
                                         @ApiParam(name = "imgUrl", value = "二维码图片地址")
@ -118,7 +127,7 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
                                         @RequestParam(value = "id", required = false) Integer id){
        try{
            jmJkEduArticleService.saveOrUpdateArticleQR(currentRoleLevel,currentRoleCode,position,imgUrl,getUID(),id);
            jmJkEduArticleService.saveOrUpdateArticleQR(getCurrentRoleLevel(),getCurrentRoleCode(),position,imgUrl,getUID(),id);
            return success("保存成功!");
        } catch (Exception e){
            e.printStackTrace();

+ 8 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java

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

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

@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
 */
@RestController
@RequestMapping(value = "/doctor/prenatalnspector", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "居民端-产检")
@Api(description = "医生端-产检")
public class PrenatalController extends BaseController{
    @Autowired

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

@ -620,31 +620,6 @@ public class PrescriptionInfoController extends BaseController {
        }
    }
    /**
     *长处方统计-点击柱状图获取详情
     * @Author zhangdan
     * @param interval
     * @param date
     * @param disease
     * @param type
     * @return
     */
    @RequestMapping(value = "/getPrescriptionTotalDetailTime", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("长处方统计-点击柱状图获取详情")
    public String getPrescriptionTotalDetailTime(
            @RequestParam(required = true)int interval,
            @RequestParam(required = true)String date,
            @ApiParam(name="disease", value="疾病类型") @RequestParam(required = false)String disease,
            @ApiParam(name="type", value="类型1.总量,2.已完成,3.居民取消,4.审核不通过,5.进行中,6.其他原因取消") @RequestParam(required = true)String type){
        try{
            return write(200, "查询成功", "data", prescriptionService.getPrescriptionTotalDetailTime(interval,date,disease,type));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
    /**
     * 长处方统计--长处方记录筛选
@ -667,7 +642,9 @@ public class PrescriptionInfoController extends BaseController {
            @RequestParam(required = false,defaultValue = "1")String status,
            @RequestParam(required = false)String type,
            @RequestParam(required = false)String startTime,
            @RequestParam(required = false)String endTime){
            @RequestParam(required = false)String endTime,
            @RequestParam(required = true,defaultValue = "1")String pageNo,
            @RequestParam(required = false)String pageSize){
        try{
            if (StringUtils.isNotBlank(startTime)){
                if (StringUtils.isNotBlank(endTime)){
@ -678,7 +655,10 @@ public class PrescriptionInfoController extends BaseController {
                    }
                }
            }
            return write(200, "查询成功", "data", prescriptionService.getPrescriptionByCondition(level,area,disease,status,type,startTime,endTime));
            if (StringUtils.isBlank(pageSize)){
                pageSize="10";
            }
            return write(200, "查询成功", "data", prescriptionService.getPrescriptionByCondition(level,area,disease,status,type,startTime,endTime,Integer.valueOf(pageNo),Integer.valueOf(pageSize)));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -694,9 +674,14 @@ public class PrescriptionInfoController extends BaseController {
    @RequestMapping(value = "/getPrescriptionByKeyWord", method = RequestMethod.GET)
    @ResponseBody
    public String getPrescriptionByKeyWord(
            @RequestParam(required = true)String keyWord){
            @RequestParam(required = true)String keyWord,
            @RequestParam(required = true,defaultValue = "1")String pageNo,
            @RequestParam(required = false)String pageSize){
        try{
            return write(200, "查询成功", "data", prescriptionService.getPrescriptionByKeyWord(keyWord));
            if (StringUtils.isBlank(pageSize)){
                pageSize="10";
            }
            return write(200, "查询成功", "data", prescriptionService.getPrescriptionByKeyWord(keyWord,Integer.valueOf(pageNo),Integer.valueOf(pageSize)));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -704,10 +689,11 @@ public class PrescriptionInfoController extends BaseController {
    }
    /**
     * 长处方统计--点击查看详情
     * 长处方统计--点击查看详情(弃用)
     * @param code
     * @return
     */
    @Deprecated
    @RequestMapping(value = "/getPrescriptionByCode", method = RequestMethod.GET)
    @ResponseBody
    public String getPrescriptionByCode(@RequestParam(required = true)String code){

+ 52 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/HealthEduArticleController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.patient.health;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.education.HealthEduArticle;
import com.yihu.wlyy.entity.education.HealthEduArticleOpHistory;
@ -54,6 +55,9 @@ public class HealthEduArticleController extends BaseController {
    private DoctorService doctorService;
    @Autowired
    private ThirdJkEduArticleService healthEducationArticleService;
    
    @Autowired
    private ThirdJkEduArticleService thirdJkEduArticleService;
    /**
     * 查询文章列表
@ -263,5 +267,53 @@ public class HealthEduArticleController extends BaseController {
            return error(-1,"查询失败!");
        }
    }
    
    @RequestMapping(value = "saveArticleCollection",method = RequestMethod.POST)
    @ApiOperation("收藏文章")
    @ObserverRequired
    public String saveArticleCollection(@ApiParam(name = "articleId", value = "文章id")
                                        @RequestParam(value = "articleId", required = true) String articleId,
                                        @ApiParam(name = "articleCategoryId", value = "文章类别ID")
                                        @RequestParam(value = "articleCategoryId", required = false,defaultValue = "1") String articleCategoryId,
                                        @ApiParam(name = "articleCategoryName", value = "文章类别名称")
                                        @RequestParam(value = "articleCategoryName", required = false) String articleCategoryName){
        try {
            thirdJkEduArticleService.saveArticleCollection(articleId,articleCategoryId,articleCategoryName,getRepUID(),2);
//            thirdJkEduArticleService.saveArticleCollection(articleId,articleCategoryId,articleCategoryName,"0de7295862dd11e69faffa163e8aee56",1);
            
            return success("收藏成功!");
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"收藏失败!");
        }
    }
    
    @RequestMapping(value = "cancelArticleCollection",method = RequestMethod.POST)
    @ApiOperation("取消收藏文章")
    @ObserverRequired
    public String cancelArticleCollection(@ApiParam(name = "articleId", value = "文章id",defaultValue = "1")
                                          @RequestParam(value = "articleId", required = true) String articleId){
        try {
            thirdJkEduArticleService.cancelArticleCollection(articleId,getRepUID(),2);
//            thirdJkEduArticleService.cancelArticleCollection(articleId,"0de7295862dd11e69faffa163e8aee56",1);
            return success("取消成功!");
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"取消失败!");
        }
    }
    
    @RequestMapping(value = "getArticalById",method = RequestMethod.GET)
    @ApiOperation("获取文章详情")
    public String getArticalById(@ApiParam(name = "articleId", value = "文章id",defaultValue = "1")
                                 @RequestParam(value = "articleId", required = true) String articleId){
        try {
            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticalById(articleId,getRepUID());
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败!");
        }
    }
}

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

@ -96,10 +96,11 @@ public class GcLableController extends BaseController {
            @ApiParam(name = "teamCode", value = "所属团队", required = true) @RequestParam(value = "teamCode", required = true) Long teamCode,
            @ApiParam(name = "page", value = "当前页(1开始)", required = true) @RequestParam(value = "page", required = true, defaultValue = "1") Integer page,
            @ApiParam(name = "pageSize", value = "每页大小", required = true) @RequestParam(value = "pageSize", required = true, defaultValue = "10") Integer pageSize,
            @ApiParam(name = "isSlowDisease", value = "是否是慢病管理", required = true) @RequestParam(value="isSlowDisease",required = false,defaultValue = "false") boolean isSlowDisease
            @ApiParam(name = "isSlowDisease", value = "是否是慢病管理", required = true) @RequestParam(value="isSlowDisease",required = false,defaultValue = "false") boolean isSlowDisease,
            @ApiParam(name = "isFollowWeChat", value = "是否过滤微信关注居民", required = false) @RequestParam(value="isFollowWeChat",required = false,defaultValue = "false") boolean isFollowWeChat
    ) {
        try {
            JSONArray result = signPatientLabelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page-1, pageSize, isSlowDisease, "");
            JSONArray result = signPatientLabelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page-1, pageSize, isSlowDisease, "",isFollowWeChat);
            List<PatientModel> patientLabelModels = new ArrayList<>();
            for (int i = 0; i < result.length(); i++) {
                JSONObject jo = result.getJSONObject(i);

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/service/GcEduArticleService.java

@ -250,7 +250,7 @@ public class GcEduArticleService {
        //通过文章id 获取文章详情
        JSONObject article = healthEducationArticleService.getArticalById(articleId);
        JSONObject article = healthEducationArticleService.getArticalById(articleId,"");
        healthEduArticlePatient.setArticleId(article.get("articleId") + "");
        healthEduArticlePatient.setAttachedTitle(article.get("articleTitle") + "");

+ 62 - 33
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkEduArticle/ThirdJkEduArticleController.java

@ -1,34 +1,20 @@
package com.yihu.wlyy.web.third.jkEduArticle;
import com.alibaba.fastjson.JSONArray;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.service.third.jkEduArticle.ThirdJkEduArticleService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.third.gateway.service.GcEduArticleService;
import com.yihu.wlyy.web.third.gateway.vo.HealthEduArticlePatientModel;
import com.yihu.wlyy.web.third.gateway.vo.base.BaseResultModel;
import com.yihu.wlyy.web.third.gateway.vo.base.ResultPageListModel;
import com.yihu.wlyy.wechat.util.WeiXinTempMsgSendUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.elasticsearch.common.collect.HppcMaps;
import org.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
import javax.jms.TextMessage;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
 * 调用福州健教接口
@ -46,10 +32,6 @@ public class ThirdJkEduArticleController extends BaseController {
    private String articleBaseUrl;
    @Autowired
    private ThirdJkEduArticleService thirdJkEduArticleService;
    @Autowired
    private GcEduArticleService gcEduArticleService;
    @Autowired
    private JmsTemplate jmsTemplate;
    /**********************************福州健康文章接口********************************************/
@ -106,7 +88,7 @@ public class ThirdJkEduArticleController extends BaseController {
    public String getArticalById(@ApiParam(name = "articleId", value = "文章id",defaultValue = "1")
                                 @RequestParam(value = "articleId", required = true) String articleId){
        try {
            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticalById(articleId);
            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticalById(articleId,"");
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
@ -193,7 +175,7 @@ public class ThirdJkEduArticleController extends BaseController {
    /*************************************************** Category *****************************************************/
    @RequestMapping(value = "addCategory",method = RequestMethod.GET)
    @RequestMapping(value = "addCategory",method = RequestMethod.POST)
    @ApiOperation("添加二级分类-仅向市级管理员开放编辑权限")
    public String addCategory(@ApiParam(name = "categoryName", value = "文章分类名称")
                                           @RequestParam(value = "categoryName", required = true) String categoryName,
@ -202,12 +184,13 @@ public class ThirdJkEduArticleController extends BaseController {
                                           @ApiParam(name = "firstlevelId", value = "一级类别ID")
                                           @RequestParam(value = "firstlevelId", required = true ) String firstlevelId,
                                           @ApiParam(name = "secondLevelId", value = "二级类别ID")
                                           @RequestParam(value = "secondLevelId", required = true ) String secondLevelId,
                                           @ApiParam(name = "currentRoleCode", value = "当前登录角色")
                                           @RequestParam(value = "currentRoleCode", required = true ) String currentRoleCode){
                                           @RequestParam(value = "secondLevelId", required = false ) String secondLevelId
//                                           @ApiParam(name = "currentRoleCode", value = "当前登录角色")
//                                           @RequestParam(value = "currentRoleCode", required = true ) String currentRoleCode
    ){
        try {
            thirdJkEduArticleService.addCategory(categoryName,categoryLevel,firstlevelId,secondLevelId,getUID(),currentRoleCode);
            thirdJkEduArticleService.addCategory(categoryName,categoryLevel,firstlevelId,secondLevelId,getUID(),getCurrentRoleCode());
            return success("添加成功!");
        }catch (Exception e){
            e.printStackTrace();
@ -222,12 +205,12 @@ public class ThirdJkEduArticleController extends BaseController {
                              @ApiParam(name = "categoryName", value = "文章分类名称")
                              @RequestParam(value = "categoryName", required = true ) String categoryName,
                              @ApiParam(name = "categoryState", value = "类别状态1、正常、2删除")
                              @RequestParam(value = "categoryState", required = true ) Integer categoryState,
                              @ApiParam(name = "currentRoleCode", value = "当前登录角色")
                              @RequestParam(value = "currentRoleCode", required = true ) String currentRoleCode){
                              @RequestParam(value = "categoryState", required = false ) Integer categoryState){
//                              @ApiParam(name = "currentRoleCode", value = "当前登录角色")
//                              @RequestParam(value = "currentRoleCode", required = true ) String currentRoleCode){
        try {
            thirdJkEduArticleService.updateCategory(categoryId,categoryName,categoryState,getUID(),currentRoleCode);
            thirdJkEduArticleService.updateCategory(categoryId,categoryName,categoryState,getUID(),getCurrentRoleCode());
            return success("更新成功!");
        }catch (Exception e){
            e.printStackTrace();
@ -237,10 +220,44 @@ public class ThirdJkEduArticleController extends BaseController {
    @RequestMapping(value = "getCategoryList",method = RequestMethod.GET)
    @ApiOperation("获取文章类别")
    public String getCategoryList(@ApiParam(name = "categoryLevel", value = "获取类别:1、一级类别 2、二级类别",defaultValue = "1")
                                  @RequestParam(value = "categoryLevel", required = false) String categoryLevel){
    public String getCategoryList(@ApiParam(name = "categoryLevel", value = "获取类别:1、一级类别 2、二级类别")
                                  @RequestParam(value = "categoryLevel", required = false) Integer categoryLevel,
                                  @ApiParam(name = "firstlevelId", value = "一级类别Id")
                                  @RequestParam(value = "firstlevelId", required = false) String firstlevelId,
                                  @ApiParam(name = "secondLevelId", value = "二级类别Id")
                                  @RequestParam(value = "secondLevelId", required = false) String secondLevelId){
        try {
            com.alibaba.fastjson.JSONArray response = thirdJkEduArticleService.getCategoryList(categoryLevel,firstlevelId,secondLevelId);
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败!");
        }
    }
    
    @RequestMapping(value = "getCategoryByName",method = RequestMethod.GET)
    @ApiOperation("根据一级类别名称获取二级分类下得所有分类")
    public String getCategoryList(@ApiParam(name = "name", value = "类别名称")
                                  @RequestParam(value = "name", required = true) String name){
        try {
            com.alibaba.fastjson.JSONArray response = thirdJkEduArticleService.getCategoryList(categoryLevel);
            com.alibaba.fastjson.JSONArray response = thirdJkEduArticleService.getCategoryList(1,"","");
            if(response.size() > 0){
                String cid = "";
                for (int i = 0; i < response.size(); i++) {
                    String cname = response.getJSONObject(i).getString("categoryname");
                    if(StringUtils.isNotBlank(cname) && name.equals(cname)){
                        cid = response.getJSONObject(i).getString("categoryid");
                        break;
                    }
                }
                if(StringUtils.isNotBlank(cid)){
                    response = thirdJkEduArticleService.getCategoryList(2,cid,"");
                }else{
                    response = new JSONArray();
                }
            }else{
                response = new JSONArray();
            }
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
@ -262,4 +279,16 @@ public class ThirdJkEduArticleController extends BaseController {
            return error(-1,"查询失败!");
        }
    }
    @RequestMapping(value = "getArticleQRCode",method = RequestMethod.GET)
    @ApiOperation("获取认证标识")
    public String getArticleQRCode(){
        try {
            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticleQRCode(getCurrentRoleLevel(), getCurrentRoleCode());
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败!");
        }
    }
}

+ 3 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/controller/doctor/EduLableController.java

@ -96,10 +96,11 @@ public class EduLableController extends BaseController {
            @ApiParam(name = "teamCode", value = "所属团队", required = true) @RequestParam(value = "teamCode", required = true) Long teamCode,
            @ApiParam(name = "page", value = "当前页(1开始)", required = true) @RequestParam(value = "page", required = true, defaultValue = "1") Integer page,
            @ApiParam(name = "pageSize", value = "每页大小", required = true) @RequestParam(value = "pageSize", required = true, defaultValue = "10") Integer pageSize,
            @ApiParam(name = "isSlowDisease", value = "是否是慢病管理", required = true) @RequestParam(value="isSlowDisease",required = false,defaultValue = "false") boolean isSlowDisease
            @ApiParam(name = "isSlowDisease", value = "是否是慢病管理", required = true) @RequestParam(value="isSlowDisease",required = false,defaultValue = "false") boolean isSlowDisease,
            @ApiParam(name = "isFollowWeChat", value = "是否过滤微信关注居民", required = true) @RequestParam(value="isFollowWeChat",required = false,defaultValue = "false") boolean isFollowWeChat
    ) {
        try {
            JSONArray result = signPatientLabelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page-1, pageSize, isSlowDisease, "");
            JSONArray result = signPatientLabelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page-1, pageSize, isSlowDisease, "",isFollowWeChat);
            List<PatientModel> patientLabelModels = new ArrayList<>();
            for (int i = 0; i < result.length(); i++) {
                JSONObject jo = result.getJSONObject(i);

+ 127 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/ylzpay/ThirdOnepayController.java

@ -0,0 +1,127 @@
package com.yihu.wlyy.web.third.ylzpay;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.organization.HospitalMapping;
import com.yihu.wlyy.entity.ylz.PayConfigura;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.repository.ylz.PayConfiguraDao;
import com.yihu.wlyy.service.third.ylz.PayLogService;
import com.yihu.wlyy.service.weixin.wxpay.model.Charge;
import com.yihu.wlyy.service.weixin.wxpay.service.OnePayService;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.web.WeixinBaseController;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.exception.PayException;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
import io.swagger.annotations.Api;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StreamUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
/**
 * Created by Reece on 2017/8/30/030.
 *
 * 供易联众支付类相关业务调用
 */
@RestController
@RequestMapping(value = "/onepay")
@Api(description = "供易联众家庭签约支付调用")
public class ThirdOnepayController extends WeixinBaseController {
    private static final Logger LOGGER = LoggerFactory.getLogger(ThirdOnepayController.class);
    @Autowired
    private OnePayService pay;
    @Autowired
    PayLogService logService;
    @Autowired
    private PayConfiguraDao configuraDao;
    @Autowired
    private HospitalMappingDao mappingDao;
    @Autowired
    ObjectMapper objectMapper;
    /**
     * 支付真正完成,异步回调返回支付参数 后台做数据操作
     *
     * @param request
     * @param response
     * @throws IOException
     * @throws PayException
     */
    @RequestMapping(value = "/receiveNotify")
    public void receiveNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, PayException {
        SimpleDateFormat formatDate = new SimpleDateFormat("yyyyMMddHHmmss");
        PayConfigura config = configuraDao.findWorkConfigura();
        Boolean isSuccess = false;
        String error = "";
        String responses = "";
        response.setContentType("text/html;charset=utf-8");
        InputStream inputStream = request.getInputStream();
        String params = StreamUtils.copyToString(inputStream, Charset.forName("UTF-8"));
        try {
            JSONObject json = new JSONObject(params);
            String appId = json.getString("appId");
            HospitalMapping hospital = mappingDao.findByAppId(appId);
            String appSecret = hospital.getAppSecret();
            LOGGER.info("回调参数:{}", params);
            if (StringUtil.isEmpty(params)) {
                response.getWriter().write("empty");
                return;
            }
            // 参数转换
            ResponseParams<?> encryptRes = JSON.parseObject(params, ResponseParams.class);
            OnepayDefaultClient client = new OnepayDefaultClient("", appId, appSecret, encryptRes.getSignType(), encryptRes.getEncryptType());
            LOGGER.info("解密前:{}", JSON.toJSONString(encryptRes));
            ResponseParams<?> decryptRes = client.decryptNotifyResponse(encryptRes);
            LOGGER.info("解密后:{}", JSON.toJSONString(decryptRes));
            boolean isDecrypt = ("-1".equals(decryptRes.getRespCode()) ? false : true); // 是否解密失败
            if (!isDecrypt) {
                response.getWriter().write("DECRYPT FAILURE");
            } else {
                boolean isVerify = client.verifyResponseSign(decryptRes);
                LOGGER.info("验签结果:{}", isVerify);
                if (!isVerify) {
                    response.getWriter().write("FAILURE");
                } else {
//					业务逻辑代码
                    isSuccess = true;
                    responses = JSON.toJSONString(decryptRes);
                    JSONObject requestParam = new JSONObject(responses);//业务出参
                    JSONObject responseParam = requestParam.getJSONObject("param");
                    Charge chargeView = objectMapper.readValue(responseParam.toString(), Charge.class);
                    pay.saveToWlyyCharge(chargeView);
                    response.getWriter().write("SUCCESS");
                }
            }
        } 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);
    }
}

+ 2 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/ylzpay/ThirdQrcodeController.java

@ -28,8 +28,6 @@ import java.io.File;
@Api(description = "供第三方微信类相关业务调用")
public class ThirdQrcodeController extends WeixinBaseController {
    @Value("${server.server_url}")
    private String server_url;
    @Autowired
    private QrcodeService qrcodeService;
@ -46,9 +44,9 @@ public class ThirdQrcodeController extends WeixinBaseController {
    public String getQrcode(@ApiParam(name = "scene", defaultValue = "") @RequestParam(value = "scene", required = true) String scene) throws Exception {
        try {
            String content = "wechat_" + scene;
            String path = server_url + File.separator + "qrcode";
            String path = ThirdQrcodeController.class.getResource("/").getPath().replace("/WEB-INF/classes/", "");
            // 通过微信接口生成医生二维码
            String result = qrcodeService.makeQrcodeFromWeiXin(content, content.replaceAll("\r\n", ""), path, getAccessToken());
            String result = qrcodeService.getQrcodeFromWeiXin(content, content.replaceAll("\r\n", ""), path, getAccessToken());
            return write(200, "生成二维码成功!", "data", result);
        } catch (Exception e) {
            e.printStackTrace();

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

@ -61,7 +61,7 @@ import java.util.*;
 * Created by hzp on 2017/05/23.
 */
@Controller
@RequestMapping(value = "/onepay", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@RequestMapping(value = "/patient", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "统一支付服务")
public class OnePayController extends WeixinBaseController {

+ 17 - 14
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java

@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@ -299,16 +300,17 @@ public class WeiXinEventProcess {
        if (StringUtils.isNotEmpty(eventKey) && (("wechat_ehc").equals(eventKey)) ||
                eventKey.startsWith("qrscene_wechat_ehc")) {
            System.out.println("第三方ehr关注推送事件");
            JSONObject json = new JSONObject();
            json.put("first", "first");
            json.put("remark", "remark");
            json.put("keyword1", "keyword1");
            json.put("keyword2", "keyword2");
            json.put("url", "www.baidu.com");
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
            json.put("first", "尊敬的用户,您已成功注册居民电子健康卡");
            json.put("remark", "请点击领取使用");
            json.put("keyword1", "电子健康卡注册");
            json.put("keyword2", "线下自助机");
            json.put("keyword3", format.format(new Date()));
            json.put("url", "grzx/html/my-health-card.html");
            //跳转路径问题,如果是第三方不加本地服务器名称(要改push公用方法)
            json.put("openId", message.get("FromUserName"));
            json.put("type", 11);
            json.put("type", 20);
            //模板消息json串
            result = json.toString();
        } else {
@ -540,16 +542,17 @@ public class WeiXinEventProcess {
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        } else if (StringUtils.isNotEmpty(eventKey) && (("wechat_ehc").equals(eventKey)) ||
                eventKey.startsWith("qrscene_wechat_ehc")) {
            System.out.println("第三方ehr扫描推送事件");
            JSONObject json = new JSONObject();
            json.put("first", "first");
            json.put("remark", "remark");
            json.put("keyword1", "keyword1");
            json.put("keyword2", "keyword2");
            json.put("url", "www.baidu.com");
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
            json.put("first", "尊敬的用户,您已成功注册居民电子健康卡");
            json.put("remark", "请点击领取使用");
            json.put("keyword1", "电子健康卡注册");
            json.put("keyword2", "线下自助机");
            json.put("keyword3", format.format(new Date()));
            json.put("url", "grzx/html/my-health-card.html");
            //跳转路径问题,如果是第三方不加本地服务器名称(要改push公用方法)
            json.put("openId", message.get("FromUserName"));
            json.put("type", 11);
            json.put("type", 20);
            //模板消息json串
            result = json.toString();
        }

+ 2 - 0
patient-co/patient-co-wlyy/src/main/resources/application-dev.yml

@ -64,6 +64,8 @@ wechat:
   template_doctor_audit:  OFyLUeBW3r9trWw-i6pbB1sPSTD4J2recCv_mc-gKxA
   #服务结果通知
   template_doctor_service:  ezr5RlX0nvh7bGU9aVsGDMJbjKDp1uMKP-AGGYXwI5g
   #体检报告提醒
   template_physical_examination:  jTsvKU3iFw0yiJi5ESyFGDTmFSVcWlMot3yHier39Vc
yihu:
  yihu_OpenPlatform_url: http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/

+ 2 - 0
patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml

@ -64,6 +64,8 @@ wechat:
    template_doctor_audit:  lCtOgJgL1tBJbAytqN7cn-FgCH_Usg99FENEy2TrC08
    #服务结果通知
    template_doctor_service: i34rq3xFLnpf_VN2Jor9n2YlQqJMM7oXyYvuctriISw
    #体检报告提醒
    template_physical_examination:  tlsPJlgA90-I73j2QudyMG7C-LmrMn1lC4_UnJPyWSM
yihu:

+ 2 - 0
patient-co/patient-co-wlyy/src/main/resources/application-local.yml

@ -64,6 +64,8 @@ wechat:
     template_doctor_audit:  egrX5Larpkv8opQW67_hwsZoT0OHwwUpE1v7HeU_Jnw
     #服务结果通知
     template_doctor_service:  xhi1LEudiZwJfZylOHuZNo8EiA73GtSshPQv5XOt9Lk
     #体检报告提醒
     template_physical_examination:  jTsvKU3iFw0yiJi5ESyFGDTmFSVcWlMot3yHier39Vc
yihu:

+ 2 - 0
patient-co/patient-co-wlyy/src/main/resources/application-localtest.yml

@ -64,6 +64,8 @@ wechat:
    template_doctor_audit:  lCtOgJgL1tBJbAytqN7cn-FgCH_Usg99FENEy2TrC08
    #服务结果通知
    template_doctor_service: i34rq3xFLnpf_VN2Jor9n2YlQqJMM7oXyYvuctriISw
    #体检报告提醒
    template_physical_examination:  tlsPJlgA90-I73j2QudyMG7C-LmrMn1lC4_UnJPyWSM
yihu:

+ 2 - 0
patient-co/patient-co-wlyy/src/main/resources/application-prod.yml

@ -63,6 +63,8 @@ wechat:
   template_doctor_audit:  egrX5Larpkv8opQW67_hwsZoT0OHwwUpE1v7HeU_Jnw
   #服务结果通知
   template_doctor_service:  xhi1LEudiZwJfZylOHuZNo8EiA73GtSshPQv5XOt9Lk
   #体检报告提醒
   template_physical_examination:  jTsvKU3iFw0yiJi5ESyFGDTmFSVcWlMot3yHier39Vc
yihu:

+ 2 - 0
patient-co/patient-co-wlyy/src/main/resources/application-test.yml

@ -63,6 +63,8 @@ wechat:
   template_doctor_audit:  lCtOgJgL1tBJbAytqN7cn-FgCH_Usg99FENEy2TrC08
   #服务结果通知
   template_doctor_service:  i34rq3xFLnpf_VN2Jor9n2YlQqJMM7oXyYvuctriISw
   #体检报告提醒
   template_physical_examination:  tlsPJlgA90-I73j2QudyMG7C-LmrMn1lC4_UnJPyWSM
yihu:
  yihu_OpenPlatform_url: http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/