Bläddra i källkod

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

yeshijie 7 år sedan
förälder
incheckning
3afa2305cf
43 ändrade filer med 1156 tillägg och 327 borttagningar
  1. 29 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/imm/ChildImmuneVaccin.java
  2. 0 4
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/customer/QuestionnaireController.java
  3. 0 4
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/customer/ScreenResultController.java
  4. 4 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerQuestionnaireController.java
  5. 4 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/ScreenResultController.java
  6. 53 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/doctor/DoctorQuestionnaireController.java
  7. 10 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageSynergyWorkorderDO.java
  8. 7 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkOrderDao.java
  9. 7 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkorderServicerDao.java
  10. 69 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/QuestionnaireManagerService.java
  11. 3 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java
  12. 1 1
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/device_create_js.jsp
  13. 20 5
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/JMController.java
  14. 3 2
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/WlyySignApplication.java
  15. 2 11
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/controller/FamilyLianqianController.java
  16. 2 3
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/dao/FamilyDao.java
  17. 2 4
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/entity/FamilyLianQian.java
  18. 2 13
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/FamilyLianQianService.java
  19. 10 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/event/ApplicationEvent.java
  20. 28 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/ChildImmuneVaccinJob.java
  21. 31 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/imm/ChildImmuneVaccinDao.java
  22. 163 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/imm/ChildVaccinImmuneService.java
  23. 56 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/third/jw/ImmuneService.java
  24. 1 0
      patient-co/patient-co-wlyy-job/src/main/resources/application-devtest.yml
  25. 3 0
      patient-co/patient-co-wlyy-job/src/main/resources/system.properties
  26. 19 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/imm/ChildImmuneVaccinDao.java
  27. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java
  28. 209 178
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/survey/SurveyScreenResultService.java
  29. 132 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildFamilyImmuneService.java
  30. 1 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java
  31. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistScreenResultService.java
  32. 113 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java
  33. 18 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/ImmuneService.java
  34. 4 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java
  35. 24 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/imm/DoctorImmController.java
  36. 22 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/DoctorSurveyScreenResultController.java
  37. 27 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/ManagerQuestionnaireController.java
  38. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/GcTokenController.java
  39. 10 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/vo/GcTokenModel.java
  40. 3 0
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml
  41. 3 1
      patient-co/patient-co-wlyy/src/main/resources/application-prod.yml
  42. 51 75
      patient-co/patient-co-wlyy/src/main/resources/wechat/weixin_menu_haicang.txt
  43. 4 1
      patient-co/patient-co-wlyy/src/main/resources/wechat/weixin_menu_jimei.txt

+ 29 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/imm/ChildImmuneVaccin.java

@ -25,10 +25,13 @@ public class ChildImmuneVaccin extends IdEntity {
	private String ymkcsm;                  //疫苗库存说明(库存充足,可以预约/库存不足,不能预约)
	private String ymbm;                    //疫苗编码
	private String jzzc;                    //接种针次
	private Date jzrq;						  //接种日期
	private Integer isOut;					  //是否超过接种日期7天(0是 1不是)
	private Integer alert_tag;              //0待提醒,1已提醒
	private Date alert_time;                //提醒时间
	private Date create_time;               //创建时间
	private Date update_time;               //创建时间
	private Integer del;					  //0正常 1作废
	
	public String getCode() {
		return code;
@ -109,7 +112,24 @@ public class ChildImmuneVaccin extends IdEntity {
	public void setJzzc(String jzzc) {
		this.jzzc = jzzc;
	}
	
	public Date getJzrq() {
		return jzrq;
	}
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public void setJzrq(Date jzrq) {
		this.jzrq = jzrq;
	}
	public Integer getIsOut() {
		return isOut;
	}
	public void setIsOut(Integer isOut) {
		this.isOut = isOut;
	}
	public Integer getAlert_tag() {
		return alert_tag;
	}
@ -143,4 +163,12 @@ public class ChildImmuneVaccin extends IdEntity {
	public void setAlert_time(Date alert_time) {
		this.alert_time = alert_time;
	}
	public Integer getDel() {
		return del;
	}
	public void setDel(Integer del) {
		this.del = del;
	}
}

+ 0 - 4
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/customer/QuestionnaireController.java

@ -1,4 +0,0 @@
package com.yihu.wlyy.controller.common.customer;
public class QuestionnaireController {
}

+ 0 - 4
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/customer/ScreenResultController.java

@ -1,4 +0,0 @@
package com.yihu.wlyy.controller.common.customer;
public class ScreenResultController {
}

+ 4 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerQuestionnaireController.java

@ -0,0 +1,4 @@
package com.yihu.wlyy.controller.synergy.customer;
public class CustomerQuestionnaireController {
}

+ 4 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/ScreenResultController.java

@ -0,0 +1,4 @@
package com.yihu.wlyy.controller.synergy.customer;
public class ScreenResultController {
}

+ 53 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/doctor/DoctorQuestionnaireController.java

@ -0,0 +1,53 @@
package com.yihu.wlyy.controller.synergy.doctor;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
import com.yihu.wlyy.service.synergy.QuestionnaireManagerService;
import com.yihu.wlyy.service.synergy.SynergyManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
 * 管理端问卷调查
 * Created by humingfen on 2018/9/27.
 */
@Controller
@RequestMapping(value = "/doctor")
@Api(description = "医生端-派发协同服务")
public class DoctorQuestionnaireController extends BaseController {
    @Autowired
    ObjectMapper objectMapper;
    @Autowired
    private QuestionnaireManagerService questionnaireService;
    @Autowired
    private SynergyManageService synergyManageService;
    @RequestMapping(value = "/createWorkOrder", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "派发协同服务")
    public String addCallRecord(@ApiParam(name="jsonData",value="协同服务json字符串")
                                    @RequestParam(required = true)String jsonData,
                                @ApiParam(name="patientInfo",value="居民信息json字符串")
                                    @RequestParam(required = true)String patientInfo){
        try {
            ManageSynergyWorkorderDO manageSynergyWorkorderDO = objectMapper.readValue(jsonData, ManageSynergyWorkorderDO.class);
            List<ManageSynergyWorkorderServicerDO>  manageSynergyWorkorderServicerDOS = objectMapper.readValue(patientInfo, new TypeReference<List<ManageSynergyWorkorderServicerDO>>(){});
            return write(200,"保存成功","data",questionnaireService.createWorkOrder(manageSynergyWorkorderDO, manageSynergyWorkorderServicerDOS));
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
        }
    }
}

+ 10 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageSynergyWorkorderDO.java

@ -27,6 +27,7 @@ public class ManageSynergyWorkorderDO extends IdEntity {
    private Integer del;//逻辑删除(0、有效,1、删除)
    private String content;//服务内容
    private String relationCode;//根据type关联业务code
    private String relationCodeName;//关联业务名称
    private String returnedRemark;//退回操作备注说明
    private String dealResultRemark;//处理结果
    private String dealResultAccessory;//处理结果附件
@ -150,6 +151,15 @@ public class ManageSynergyWorkorderDO extends IdEntity {
        this.relationCode = relationCode;
    }
    @Column(name = "relation_code_name")
    public String getRelationCodeName() {
        return relationCodeName;
    }
    public void setRelationCodeName(String relationCodeName) {
        this.relationCodeName = relationCodeName;
    }
    @Column(name = "returned_remark")
    public String getReturnedRemark() {
        return returnedRemark;

+ 7 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkOrderDao.java

@ -0,0 +1,7 @@
package com.yihu.wlyy.repository.synergy;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface ManageSynergyWorkOrderDao extends PagingAndSortingRepository<ManageSynergyWorkorderDO, Long> {
}

+ 7 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkorderServicerDao.java

@ -0,0 +1,7 @@
package com.yihu.wlyy.repository.synergy;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface ManageSynergyWorkorderServicerDao extends PagingAndSortingRepository<ManageSynergyWorkorderServicerDO, Long> {
}

+ 69 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/QuestionnaireManagerService.java

@ -0,0 +1,69 @@
package com.yihu.wlyy.service.synergy;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkOrderDao;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderServicerDao;
import com.yihu.wlyy.util.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
 * Created by humingfen on 2018/09/27.
 */
@Service
public class QuestionnaireManagerService extends BaseJpaService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ManageSynergyWorkOrderDao workOrderDao;
    @Autowired
    private ManageSynergyWorkorderServicerDao workorderServicerDao;
    /**
     * 创建协同服务
     * @param workorderDO
     * @param workorderServicerDOS
     * @return
     */
    public boolean createWorkOrder(ManageSynergyWorkorderDO workorderDO, List<ManageSynergyWorkorderServicerDO> workorderServicerDOS) {
        String servicer = null;
        int size = workorderServicerDOS.size();
        int len = 0;
        if(size > 5){
            len = 5;
        }else {
            len = size;
        }
        //获取服务对象最多五个人
        for(int i = 0; i < len; i++){
            servicer += workorderServicerDOS.get(i).getServicePatientName() + ",";
        }
        servicer = servicer.substring(0, servicer.length()-1);
        //保存协同服务工单
        workorderDO.setCode(getCode());
        workorderDO.setStatus(1);
        workorderDO.setCreateTime(new Date());
        workorderDO.setDel(1);
        workorderDO.setServicerCount(size);
        workorderDO.setServicerKey(servicer);
        workOrderDao.save(workorderDO);
        //保存协同服务工单的服务对象
        for(ManageSynergyWorkorderServicerDO servicerDO : workorderServicerDOS){
            servicerDO.setCode(getCode());
            servicerDO.setWorkorderType(workorderDO.getType());
            servicerDO.setWorkorderCode(workorderDO.getCode());
            servicerDO.setStatus(1);
            servicerDO.setCreateTime(new Date());
            workorderServicerDao.save(servicerDO);
        }
        return true;
    }
}

+ 3 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java

@ -1,7 +1,10 @@
package com.yihu.wlyy.service.synergy;
import org.springframework.stereotype.Service;
/**
 * Created by 刘文彬 on 2018/9/27.
 */
@Service
public class SynergyManageService {
}

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/device_create_js.jsp

@ -117,7 +117,7 @@
						//厂家代码
						values.manufacturerId = $("#sel_manufacturer").ligerComboBox("getValue");
						values.deviceModel = $("#inp_deviceModel").ligerComboBox("getValue");
						if (!validator.validate()) {
							return;
						}

+ 20 - 5
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/JMController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.service.controller;
import com.google.gson.JsonObject;
import com.yihu.wlyy.service.common.model.Result;
import com.yihu.wlyy.service.entity.PatientReservation;
import com.yihu.wlyy.service.service.JMService;
@ -8,6 +9,7 @@ import com.yihu.wlyy.service.service.guahao.GuahaoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ -312,8 +314,12 @@ public class JMController {
	{
		try {
			String data = jmService.findMyVaccin(deptNum,etmykh);
			return Result.success("查询儿童可预约疫苗成功!",data);
			JSONObject jsonObject = new JSONObject(data);
			if (jsonObject.getInt("msgCode")==800){
				return Result.success("查询儿童可预约疫苗成功!",data);
			}else {
				return Result.error(jsonObject.getString("msg"));
			}
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
@ -327,8 +333,12 @@ public class JMController {
	{
		try {
			String data = jmService.findDept(etmykh);
			return Result.success("获取接种门诊成功!",data);
			JSONObject jsonObject = new JSONObject(data);
			if (jsonObject.getInt("msgCode")==800){
				return Result.success("获取接种门诊成功!",data);
			}else {
				return Result.error(jsonObject.getString("msg"));
			}
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
@ -342,8 +352,13 @@ public class JMController {
	{
		try {
			String data = jmService.findWzymBymykh(etmykh);
			JSONObject jsonObject = new JSONObject(data);
			if (jsonObject.getInt("msgCode")==800){
				return Result.success("获取接种记录成功!",data);
			}else{
				return Result.error(jsonObject.getString("msg"));
			}
			return Result.success("获取接种记录成功!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());

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

@ -1,5 +1,6 @@
package com.yihu.wlyy.sign;
import com.yihu.wlyy.sign.common.thread.*;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
@ -14,7 +15,7 @@ public class WlyySignApplication extends SpringBootServletInitializer {
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        /*//加载机构签约修改
        //加载机构签约修改
        Thread loadThread = new Thread(new LoadThread());
        loadThread.start();
@ -47,7 +48,7 @@ public class WlyySignApplication extends SpringBootServletInitializer {
        //加载续签数据
        Thread loadRenewSignThread = new Thread(new LoadRenewSignThread());
        loadRenewSignThread.start();*/
        loadRenewSignThread.start();
        return application.sources(WlyySignApplication.class);
    }

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

@ -2,18 +2,9 @@ package com.yihu.wlyy.sign.controller;/**
 * Created by nature of king on 2018/8/10.
 */
import com.yihu.wlyy.sign.common.model.Result;
import com.yihu.wlyy.sign.service.FamilyLianQianService;
import com.zoe.phip.ssp.sdk.ApiException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * @author wangzhinan
@ -25,7 +16,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
@Api(description = "家庭成员信息")
public class FamilyLianqianController {
    @Autowired
    /*@Autowired
    private FamilyLianQianService service;
    @RequestMapping(value = "select",method = RequestMethod.POST)
@ -51,5 +42,5 @@ public class FamilyLianqianController {
                return Result.error(ex.getMessage());
            }
        }
    }
    }*/
}

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

@ -4,7 +4,6 @@ package com.yihu.wlyy.sign.dao;/**
import com.yihu.wlyy.sign.entity.FamilyLianQian;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
@ -13,6 +12,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 * @desc 家庭成员
 **/
public interface FamilyDao extends PagingAndSortingRepository<FamilyLianQian, Long>, JpaSpecificationExecutor<FamilyLianQian> {
    @Query("from FamilyLianQian a  where a.idcard = ?1 ")
    FamilyLianQian findByIdCard(String idcard);
   /* @Query("from FamilyLianQian a  where a.idcard = ?1 ")
    FamilyLianQian findByIdCard(String idcard);*/
}

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

@ -4,8 +4,6 @@ package com.yihu.wlyy.sign.entity;/**
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
@ -18,7 +16,7 @@ import java.io.Serializable;
@Entity
@Table(name = "tbl_lianqian_family")
public class FamilyLianQian extends IdEntity implements Serializable {
    @Column(name = "address_code")
   /* @Column(name = "address_code")
    private String addressCode;//地址
    @Column(name = "relaholder")
    private String relaholder;//关系
@ -198,5 +196,5 @@ public class FamilyLianQian extends IdEntity implements Serializable {
    public void setAddress(String address) {
        this.address = address;
    }
    }*/
}

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

@ -2,20 +2,9 @@ package com.yihu.wlyy.sign.service;/**
 * Created by nature of king on 2018/8/9.
 */
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.sign.dao.*;
import com.yihu.wlyy.sign.entity.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
@ -26,7 +15,7 @@ import java.util.List;
@Service
@Transactional
public class FamilyLianQianService {
    private Logger logger = LoggerFactory.getLogger(FamilyLianQianService.class);
   /* private Logger logger = LoggerFactory.getLogger(FamilyLianQianService.class);
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
@ -146,5 +135,5 @@ public class FamilyLianQianService {
            e.printStackTrace();
            return null;
        }
    }
    }*/
}

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

@ -282,6 +282,16 @@ public class ApplicationEvent implements ApplicationListener<ContextRefreshedEve
                logger.info("NoticeJob  job exist");
            }
            //获取儿童可预约疫苗,每天凌晨1点执行一次
            if (!quartzHelper.isExistJob("child_immune_vaccin_job")) {
                String trigger = SystemConf.getInstance().getSystemProperties().getProperty("child_immune_vaccin_job");
                quartzHelper.addJob(ChildImmuneVaccinJob.class, trigger, "child_immune_vaccin_job", new HashMap<String, Object>());
                logger.info("child_immune_vaccin_job  job success");
            } else {
                logger.info("child_immune_vaccin_job  job exist");
            }
        } catch (Exception e) {
            logger.info("sign end job start failed");
        }

+ 28 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/ChildImmuneVaccinJob.java

@ -0,0 +1,28 @@
package com.yihu.wlyy.job;
import com.yihu.wlyy.service.imm.ChildVaccinImmuneService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
public class ChildImmuneVaccinJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(ChildImmuneVaccinJob.class);
    @Autowired
    private ChildVaccinImmuneService childVaccinImmuneService;
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        logger.info("START========每天获取儿童可预约疫苗JOB========");
        try {
            childVaccinImmuneService.getChildImmuneVaccinEveryDay();
            logger.info("END========每天获取儿童可预约疫苗JOB========");
        }catch (Exception e){
            e.printStackTrace();
            logger.info("END===ERROE===每天获取儿童可预约疫苗JOB,message:"+e.getMessage());
        }
    }
}

+ 31 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/imm/ChildImmuneVaccinDao.java

@ -0,0 +1,31 @@
package com.yihu.wlyy.repository.imm;
import com.yihu.wlyy.entity.imm.ChildImmuneVaccin;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author zhangdan
 * @date 2018/9/27 09:38
 */
public interface ChildImmuneVaccinDao extends PagingAndSortingRepository<ChildImmuneVaccin, Long>,
		JpaSpecificationExecutor<ChildImmuneVaccin> {
	List<ChildImmuneVaccin> findByBarcode(String barcode);
	@Modifying
	@Query("update ChildImmuneVaccin  c set c.del=1 where c.code=?1")
	int updateDelByCode(String code);
	@Modifying
	@Query("update ChildImmuneVaccin  c set c.isOut=0 where c.code=?1")
	int updateIsOutByCode(String code);
	@Modifying
	@Query("update ChildImmuneVaccin  c set c.alert_tag=0 where c.code=?1")
	int updateAlertTagByCode(String code);
}

+ 163 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/imm/ChildVaccinImmuneService.java

@ -0,0 +1,163 @@
package com.yihu.wlyy.service.imm;
import com.yihu.wlyy.entity.imm.ChildFamilyImmune;
import com.yihu.wlyy.entity.imm.ChildImmuneVaccin;
import com.yihu.wlyy.entity.imm.ChildInfo;
import com.yihu.wlyy.repository.imm.ChildImmuneVaccinDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.third.jw.ImmuneService;
import com.yihu.wlyy.util.DateUtil;
import org.apache.commons.lang.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
/**
 * 免疫关系业务层
 * @author zhangdan
 * @date 2018/9/27 20:01
 */
@Service
public class ChildVaccinImmuneService extends BaseService {
	
	@Autowired
	private JdbcTemplate jdbcTemplate;
	@Autowired
	private ChildImmuneVaccinDao childImmuneVaccinDao;
	@Autowired
	private ImmuneService immuneService;
	
	@Transactional(rollbackFor = Exception.class)
	public int getChildImmuneVaccinEveryDay()throws Exception{
		int result = 0;
		try {
			String sql ="SELECT" +
					" DISTINCT ci.`code`," +
					" ci.idcard," +
					" ci.`name`," +
					" ci.ssc," +
					" ci.barcode" +
					" FROM" +
					" wlyy_child_family_immune fi" +
					" LEFT JOIN wlyy_child_info ci ON fi.child_code = ci.`code`" +
					" WHERE" +
					" fi.del = 0";
			List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
			for (Map<String,Object> map : list){
				String barcode = String.valueOf(map.get("barcode"));
				System.out.println("===============barcode=============="+barcode);
				String deptStr = immuneService.findDept(barcode);
				if (StringUtils.isNotBlank(deptStr)){
					JSONObject jsonObject = new JSONObject(deptStr);
					if (jsonObject.getInt("status")==200) {
						JSONObject json = new JSONObject(jsonObject.getString("data"));
						JSONArray jsonArray = json.getJSONArray("body");
						for (int i = 0;i<jsonArray.length();i++){
							String deptNum  = jsonArray.getJSONObject(i).getString("deptNum");
							String vaccinStr = immuneService.findMyVaccin(barcode,deptNum);
							JSONObject vaccinJson = new JSONObject(vaccinStr);
							if (vaccinJson.getInt("status")==200) {
								JSONObject vaccinJson2 = new JSONObject(vaccinJson.getString("data"));
								JSONArray vaccinJsonJSONArray = vaccinJson2.getJSONArray("body");
								List<ChildImmuneVaccin> vaccinList = childImmuneVaccinDao.findByBarcode(barcode);
								//原来有的则不用新增,原来有的但是在返回回来的数据没有的话删除数据
								for (ChildImmuneVaccin childImmuneVaccin : vaccinList){
									int count = 0;
									for (int j=0;j<vaccinJsonJSONArray.length();j++){
										String ymbm = vaccinJsonJSONArray.getJSONObject(j).getString("ymBm");
										String jzzc = vaccinJsonJSONArray.getJSONObject(j).getString("jzZc");
										if (childImmuneVaccin.getYmbm().equals(ymbm) && childImmuneVaccin.getJzzc().equals(jzzc)){
											count++;
										}
									}
									//原来有的疫苗要判断是否有超过预约时间的7天,并且看提醒是否超过7天,超过7天可以重新提醒
									if (count>0 && childImmuneVaccin.getIsOut()==1){
										if (DateUtil.getPreDays(childImmuneVaccin.getJzrq(),7).before(new Date())){
											//过了预约时间7天,更新为isOut=0,则不能预约了
											childImmuneVaccinDao.updateIsOutByCode(childImmuneVaccin.getCode());
										}else {
											//判断是否过了7天提醒时间
											if (childImmuneVaccin.getAlert_tag()==1 && DateUtil.getPreDays(childImmuneVaccin.getAlert_time(),7).before(new Date())){
												childImmuneVaccinDao.updateAlertTagByCode(childImmuneVaccin.getCode());
											}
										}
									}
									if (count==0){
										result+= childImmuneVaccinDao.updateDelByCode(childImmuneVaccin.getCode());
									}
								}
								//如果本地没有就是新增的
								List<ChildImmuneVaccin> vaccins = new ArrayList<>();
								for (int j=0;j<vaccinJsonJSONArray.length();j++){
									String ymbm = vaccinJsonJSONArray.getJSONObject(j).getString("ymBm");
									String jzzc = vaccinJsonJSONArray.getJSONObject(j).getString("jzZc");
									int count = 0;
									for (ChildImmuneVaccin childImmuneVaccin : vaccinList){
										if (childImmuneVaccin.getYmbm().equals(ymbm) && childImmuneVaccin.getJzzc().equals(jzzc)){
											count++;
										}
									}
									if (count==0){
										ChildImmuneVaccin childImmuneVaccin = new ChildImmuneVaccin();
										childImmuneVaccin.setCode(UUID.randomUUID().toString().replaceAll("-", ""));
										childImmuneVaccin.setName(String.valueOf(map.get("name")));
										childImmuneVaccin.setIdcard(String.valueOf(map.get("idcard")));
										childImmuneVaccin.setSsc(String.valueOf(map.get("ssc")));
										childImmuneVaccin.setBarcode(barcode);
										childImmuneVaccin.setYmkc(vaccinJsonJSONArray.getJSONObject(j).getString("ymkc"));
										childImmuneVaccin.setYmmc(vaccinJsonJSONArray.getJSONObject(j).getString("ymmc"));
										childImmuneVaccin.setYmkcsm(vaccinJsonJSONArray.getJSONObject(j).getString("ymkcsm"));
										childImmuneVaccin.setYmbm(ymbm);
										childImmuneVaccin.setJzzc(jzzc);
										childImmuneVaccin.setJzrq(DateUtil.strToDate(vaccinJsonJSONArray.getJSONObject(j).getString("jzRq"),DateUtil.YYYY_MM_DD));
										childImmuneVaccin.setAlert_tag(0);
										childImmuneVaccin.setDel(0);
										childImmuneVaccin.setCreate_time(new Date());
										if (DateUtil.getPreDays(DateUtil.strToDate(vaccinJsonJSONArray.getJSONObject(j).getString("jzRq")),7).before(new Date())){
											//过了预约时间7天,更新为isOut=0,则不能预约了
											childImmuneVaccin.setIsOut(0);
										}else {
											childImmuneVaccin.setIsOut(1);
										}
										vaccins.add(childImmuneVaccin);
										result++;
									}
								}
								childImmuneVaccinDao.save(vaccins);
							/*for (int j=0;j<vaccinJsonJSONArray.length();j++){
								String ymbm = vaccinJsonJSONArray.getJSONObject(j).getString("ymBm");
								String jzzc = vaccinJsonJSONArray.getJSONObject(j).getString("jzZc");
								if (childImmuneVaccinDao.findByBarcodeAndYmbmAndJzzc(barcode,ymbm,jzzc)==null){
									ChildImmuneVaccin childImmuneVaccin = new ChildImmuneVaccin();
									childImmuneVaccin.setCode(getUUID());
									childImmuneVaccin.setName(String.valueOf(map.get("name")));
									childImmuneVaccin.setIdcard(String.valueOf(map.get("idcard")));
									childImmuneVaccin.setSsc(String.valueOf(map.get("ssc")));
									childImmuneVaccin.setBarcode(barcode);
									childImmuneVaccin.setYmkc(vaccinJsonJSONArray.getJSONObject(j).getString("ymkc"));
									childImmuneVaccin.setYmmc(vaccinJsonJSONArray.getJSONObject(j).getString("ymmc"));
									childImmuneVaccin.setYmkcsm(vaccinJsonJSONArray.getJSONObject(j).getString("ymkcsm"));
									childImmuneVaccin.setYmbm(ymbm);
									childImmuneVaccin.setJzzc(jzzc);
									childImmuneVaccin.setAlert_tag(0);
									childImmuneVaccin.setCreate_time(new Date());
								}
							}*/
							}
						}
					}
				}
			}
		}catch (Exception e){
			e.printStackTrace();
		}
		return result;
	}
}

+ 56 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/third/jw/ImmuneService.java

@ -0,0 +1,56 @@
package com.yihu.wlyy.service.third.jw;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.*;
/**
 * 免疫接种预约挂号
 * @author zhangdan
 * @date 2018/9/27 19:43
 */
@Service
public class ImmuneService {
	private static final Logger logger = LoggerFactory.getLogger(ImmuneService.class);
	//基卫服务地址
	@Value("${sign.check_upload}")
	private String jwUrl;
	@Autowired
	private HttpClientUtil httpClientUtil;
	public String findMyVaccin(String barcode,String deptNum) throws Exception{
		String url = jwUrl + "/third/jm/imm/findMyVaccin";
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("deptNum", deptNum));
		params.add(new BasicNameValuePair("etmykh", barcode));
		String response = httpClientUtil.post(url, params, "UTF-8");
		return response;
	}
	public String findDept(String barcode) throws Exception{
		String url = jwUrl + "/third/jm/imm/findDept";
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("etmykh", barcode));
		String response = httpClientUtil.post(url, params, "UTF-8");
		return response;
	}
}

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

@ -89,6 +89,7 @@ images:
sign:
  check_upload: http://172.19.103.88:8011/wlyy_service
  zysoft: http://59.61.92.90:8072/wlyy_sign
  #check_upload: http://localhost:8011/
quartz:
  name: schedulerFactoryBean_test_dev

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

@ -137,6 +137,9 @@ patient_confirm_receipt_job=00 0 8,12,18,21 * * ?
# 病患者医疗保险号同步JOB (每天6点执行一次)
patient_medicare_number_job=0 0 6 * * ?
# 获取儿童可预约疫苗,每天凌晨1点执行一次
child_immune_vaccin_job=0 0 1 * * ?
#统一支付平台支付成功后页面跳转地址
return_url={server}/wx/html/qygl/html/pay_result.html
#统一支付平台支付接口地址

+ 19 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/imm/ChildImmuneVaccinDao.java

@ -2,9 +2,12 @@ package com.yihu.wlyy.repository.imm;
import com.yihu.wlyy.entity.imm.ChildImmuneVaccin;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author huangwenjie
 * @date 2018/6/21 09:38
@ -13,4 +16,20 @@ public interface ChildImmuneVaccinDao extends PagingAndSortingRepository<ChildIm
		JpaSpecificationExecutor<ChildImmuneVaccin> {
	@Query("select p from ChildImmuneVaccin p where p.barcode=?1")
	ChildImmuneVaccin getChildImmuneVaccinByBarcode(String barcode);
	List<ChildImmuneVaccin> findByBarcodeAndYmbmAndJzzc(String barcode,String ymbm,String jzzc);
	List<ChildImmuneVaccin> findByBarcode(String barcode);
	@Modifying
	@Query("update ChildImmuneVaccin  c set c.del=1 where c.code=?1")
	int updateDelByCode(String code);
	@Modifying
	@Query("update ChildImmuneVaccin  c set c.isOut=0 where c.code=?1")
	int updateIsOutByCode(String code);
	@Modifying
	@Query("update ChildImmuneVaccin  c set c.alert_tag=0 where c.code=?1")
	int updateAlertTagByCode(String code);
}

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

@ -357,6 +357,7 @@ public class FamilyMemberService extends BaseService {
            result.put("name", StringUtils.isEmpty(p.getName()) ? "" : p.getName());
            result.put("code", StringUtils.isEmpty(p.getCode()) ? "" : p.getCode());
            result.put("photo", StringUtils.isEmpty(p.getPhoto()) ? "" : p.getPhoto());
            result.put("sex",p.getSex());
        }
        return result;
@ -952,7 +953,7 @@ public class FamilyMemberService extends BaseService {
    }
    public String getFamilyMesListSql(String code) {
        StringBuffer sql = new StringBuffer("SELECT t.*,p.idcard,p.mobile,p.photo FROM wlyy_patient_family_temp t,wlyy_patient p WHERE t.patient = p.code AND t.dealer ='" + code+"'");
        StringBuffer sql = new StringBuffer("SELECT t.*,p.idcard,p.mobile,p.photo,p.sex FROM wlyy_patient_family_temp t,wlyy_patient p WHERE t.patient = p.code AND t.dealer ='" + code+"'");
        return sql.toString();
    }

+ 209 - 178
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/survey/SurveyScreenResultService.java

@ -3,18 +3,17 @@ package com.yihu.wlyy.service.app.survey;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.survey.*;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
import com.yihu.wlyy.repository.dict.SystemDictDao;
import com.yihu.wlyy.repository.doctor.*;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.survey.ManagerQuestionnaireService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.IdCardUtil;
import com.yihu.wlyy.util.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpUtils;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.apache.commons.collections.map.HashedMap;
@ -25,6 +24,7 @@ import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -39,6 +39,9 @@ import java.util.*;
@Service
@Transactional
public class SurveyScreenResultService extends BaseService {
    @Value("${customerService.url}")
    private String customerUrl;
    @Autowired
    SurveyStatisticsDao surveyStatisticsDao;
    @Autowired
@ -52,28 +55,18 @@ public class SurveyScreenResultService extends BaseService {
    @Autowired
    private SurveyTemplateResultDao surveyTemplateResultDao;
    @Autowired
    private SurveyTemplateAdviceDao surveyTemplateAdviceDao;
    @Autowired
    private SurveyTemplateQuestionsDao surveyTemplateQuestionsDao;
    @Autowired
    private SurveyOptionAnswersDao surveyOptionAnswersDao;
    @Autowired
    private DoctorDao doctorDao;
    @Autowired
    private SurveyAdviceDao surveyAdviceDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private ManagerQuestionnaireService managerQuestionnaireService;
    @Autowired
    private SurveyDao surveyDao;
    @Autowired
    private SurveyQuestionsDao surveyQuestionsDao;
    @Autowired
    private SurveyLabelInfoDao surveyLabelInfoDao;
    @Autowired
    private SurveyQuestionsOptionsDao surveyQuestionsOptionsDao;
    @Autowired
    private SurveyUserDao surveyUserDao;
    @Autowired
    private SurveyFilterDao surveyFilterDao;
@ -82,12 +75,6 @@ public class SurveyScreenResultService extends BaseService {
    @Autowired
    private SurveyQuestionnaireDao surveyQuestionnaireDao;
    @Autowired
    private SurveyTemplateOptionsDao surveyTemplateOptionsDao;
    @Autowired
    private SurveyAnswersDao surveyAnswersDao;
    @Autowired
    private SystemDictDao systemDictDao;
    @Autowired
    private SurveyDimensionDao surveyDimensionDao;
    @Autowired
    private SurveyDimensionDetailDao surveyDimensionDetailDao;
@ -99,6 +86,8 @@ public class SurveyScreenResultService extends BaseService {
    private PushMsgTask pushMsgTask;
    @Autowired
    private WechatTemplateConfigDao templateConfigDao;
    @Autowired
    private DoctorService doctorService;
    private Logger logger = LoggerFactory.getLogger(this.getClass());
@ -106,6 +95,7 @@ public class SurveyScreenResultService extends BaseService {
    /**
     * 筛查记录结果列表
     *
     * @param pageNo
     * @param pageSize
     * @param doctor
@ -116,78 +106,80 @@ public class SurveyScreenResultService extends BaseService {
     * @return
     * @throws Exception
     */
    public Map<String,Object> getResultList(int pageNo, int pageSize,String doctor,String diseaseType,String dealType,String isDanger,String patientName) throws Exception {
        int start = (pageNo-1)*pageSize;
        String sql = "SELECT ssr.* FROM wlyy_survey_screen_result ssr WHERE 1=1 AND ssr.over = 1 and ssr.source=1 and ssr.doctor='"+doctor+"'";
    public Map<String, Object> getResultList(int pageNo, int pageSize, String doctor, String diseaseType, String dealType, String isDanger, String patientName) throws Exception {
        int start = (pageNo - 1) * pageSize;
        String sql = "SELECT ssr.* FROM wlyy_survey_screen_result ssr WHERE 1=1 AND ssr.over = 1 and ssr.source=1 and ssr.doctor='" + doctor + "'";
        //String countSql = "SELECT count(*) num FROM wlyy_survey_screen_result ssr WHERE 1=1 AND ssr.over = 1 and ssr.doctor='"+doctor+"'";
        if (StringUtils.isNotEmpty(isDanger)){
            sql += " AND ssr.is_danger= "+isDanger;
        if (StringUtils.isNotEmpty(isDanger)) {
            sql += " AND ssr.is_danger= " + isDanger;
        }
        if (StringUtils.isNotEmpty(diseaseType)){
            sql += " AND ssr.disease="+diseaseType;
        if (StringUtils.isNotEmpty(diseaseType)) {
            sql += " AND ssr.disease=" + diseaseType;
        }
        if (StringUtils.isNotEmpty(patientName)){
            sql += " AND ssr.patient_name like '%"+patientName+"%'";
        if (StringUtils.isNotEmpty(patientName)) {
            sql += " AND ssr.patient_name like '%" + patientName + "%'";
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("1",dealType)){
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("1", dealType)) {
            //已预约
            sql += " AND ssr.is_order = 1";
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("2",dealType)){
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("2", dealType)) {
            //已跟踪
            sql += " AND ssr.following= 1";
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("3",dealType)){
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("3", dealType)) {
            //已接诊
            sql += " AND ssr.is_order = 2";
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("4",dealType)){
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("4", dealType)) {
            //待处理
            sql +=" AND ssr.is_order = 0 AND ssr.following= 0";
            sql += " AND ssr.is_order = 0 AND ssr.following= 0";
        }
        List<Map<String,Object>> maps = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
        sql += " order by ssr.czrq desc limit "+start+","+pageSize;
        List<SurveyScreenResult> surveyScreenResultList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SurveyScreenResult.class));
        Map<String,Object> map = new HashedMap();
        map.put("num",maps.size());
        map.put("data",surveyScreenResultList);
        sql += " order by ssr.czrq desc limit " + start + "," + pageSize;
        List<SurveyScreenResult> surveyScreenResultList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(SurveyScreenResult.class));
        Map<String, Object> map = new HashedMap();
        map.put("num", maps.size());
        map.put("data", surveyScreenResultList);
        return map;
    }
    /**
     * 筛查模板列表
     *
     * @param pageNo
     * @param pageSize
     * @param labelType
     * @return
     */
    public List<SurveyTemplates> getScreenList(int pageNo,int pageSize,int labelType,String title){
        int start = (pageNo-1)*pageSize;
    public List<SurveyTemplates> getScreenList(int pageNo, int pageSize, int labelType, String title) {
        int start = (pageNo - 1) * pageSize;
        String sql = "SELECT st.* FROM wlyy_survey_templates st LEFT JOIN wlyy_survey_label_info sli ON st.`code`= sli.relation_code" +
                " WHERE st.del = 1 and sli.label="+labelType+"";
        if (StringUtils.isNotEmpty(title)){
            sql += " and st.title like '%"+title+"%'";
                " WHERE st.del = 1 and sli.label=" + labelType + "";
        if (StringUtils.isNotEmpty(title)) {
            sql += " and st.title like '%" + title + "%'";
        }
        sql += " order by st.create_time desc limit "+start+","+pageSize;
        List<SurveyTemplates> surveyTemplatesList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SurveyTemplates.class));
        sql += " order by st.create_time desc limit " + start + "," + pageSize;
        List<SurveyTemplates> surveyTemplatesList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(SurveyTemplates.class));
        return surveyTemplatesList;
    }
    /**
     * 保存筛查结果
     *
     * @param patientCode
     * @param doctor
     * @param source
     * @param jsonData
     */
    public String saveScreenResultAndAnswer(String patientCode,String doctor,int isAgain,int source, JSONObject jsonData)throws Exception{
    public String saveScreenResultAndAnswer(String patientCode, String doctor, int isAgain, int source, JSONObject jsonData) throws Exception {
        System.out.println("********保存筛查结果--jsonData********* " + jsonData);
        String surveyCode = jsonData.get("surveyCode").toString();
        SurveyTemplates surveyTemplates = surveyTemplatesDao.findById(surveyCode);
        Patient patient = patientDao.findByCode(patientCode);
        SurveyScreenResult surveyScreenResult =  new SurveyScreenResult();
        SurveyScreenResult surveyScreenResult = new SurveyScreenResult();
        //解析json保存各种答案--获取一维数组
        JSONArray questions = jsonData.getJSONArray("questions");
        int totalScore = 0;
@ -222,12 +214,12 @@ public class SurveyScreenResultService extends BaseService {
            }
        }
        //查询该筛查的结果设置
        SurveyTemplateResult surveyTemplateResult = surveyTemplateResultDao.getByTemplateCodeAndLowScoreAndHighScore(surveyCode,totalScore);
        SurveyTemplateResult surveyTemplateResult = surveyTemplateResultDao.getByTemplateCodeAndLowScoreAndHighScore(surveyCode, totalScore);
        //更新上一条数据为不可再次评估
        List<SurveyScreenResult> surveyScreenResultList = surveyScreenResultDao.findNewOneByTemplateCode(surveyCode,patientCode);
        List<SurveyScreenResult> surveyScreenResultList = surveyScreenResultDao.findNewOneByTemplateCode(surveyCode, patientCode);
        String lastCode = "";
        String originCode = "";
        if (surveyScreenResultList!=null && surveyScreenResultList.size()>0){
        if (surveyScreenResultList != null && surveyScreenResultList.size() > 0) {
            lastCode = surveyScreenResultList.get(0).getCode();
            originCode = surveyScreenResultList.get(0).getOriginCode();
            surveyScreenResultDao.updateNoAgain(lastCode);
@ -236,20 +228,20 @@ public class SurveyScreenResultService extends BaseService {
        surveyScreenResult.setCode(code);
        surveyScreenResult.setSource(source);
        //是来自再次评估
        if (isAgain==1){
        if (isAgain == 1) {
            surveyScreenResult.setParentCode(lastCode);
            surveyScreenResult.setOriginCode(originCode);
        }else {
        } else {
            //来自第一次筛查评分
            surveyScreenResult.setOriginCode(code);
        }
        if (surveyTemplates!=null){
        if (surveyTemplates != null) {
            surveyScreenResult.setTemplateCode(surveyTemplates.getCode());
            surveyScreenResult.setTemplateTitle(surveyTemplates.getTitle());
            surveyScreenResult.setDisease(surveyTemplates.getDiseaseType());
        }
        //来自医生发放和自我评估不一样来源
        if (source==1){
        if (source == 1) {
            surveyScreenResult.setDoctor(doctor);
        }/*else {
            SignFamily signFamily = signFamilyDao.findByPatient(patientCode);
@ -262,7 +254,7 @@ public class SurveyScreenResultService extends BaseService {
        }*/
        surveyScreenResult.setPatientCode(patientCode);
        if (patient!=null){
        if (patient != null) {
            surveyScreenResult.setPatientName(patient.getName());
            surveyScreenResult.setOpenId(patient.getOpenid());
        }
@ -273,38 +265,38 @@ public class SurveyScreenResultService extends BaseService {
        surveyScreenResult.setIsAgain(1);
        surveyScreenResult.setIsEducate(0);
        surveyScreenResult.setScreenResultScore(totalScore);
        if (surveyTemplateResult!=null){
        if (surveyTemplateResult != null) {
            surveyScreenResult.setScreenResultCode(surveyTemplateResult.getCode());
            surveyScreenResult.setIsDanger(surveyTemplateResult.getWarning());
            surveyScreenResult.setScreenResult(surveyTemplateResult.getResult());
        }
        surveyScreenResultDao.save(surveyScreenResult);
        managerQuestionnaireService.saveAnswer(patientCode,code,jsonData);
        managerQuestionnaireService.saveAnswer(patientCode, code, jsonData);
        return code;
    }
    public JSONObject getScreenResultDetail(String code)throws Exception{
    public JSONObject getScreenResultDetail(String code) throws Exception {
        JSONObject json = new JSONObject();
        //登记信息
        String infoSql = "SELECT ssr.*,p.idcard FROM wlyy_survey_screen_result ssr LEFT JOIN wlyy_patient p ON ssr.patient_code=p.code where ssr.code ='"+code+"'";
        Map<String,Object> infoMap = jdbcTemplate.queryForMap(infoSql);
        if (infoMap==null || infoMap.size()==0){
            json.put(code,-1);
            json.put("message","没有改筛查结果!");
        String infoSql = "SELECT ssr.*,p.idcard FROM wlyy_survey_screen_result ssr LEFT JOIN wlyy_patient p ON ssr.patient_code=p.code where ssr.code ='" + code + "'";
        Map<String, Object> infoMap = jdbcTemplate.queryForMap(infoSql);
        if (infoMap == null || infoMap.size() == 0) {
            json.put(code, -1);
            json.put("message", "没有改筛查结果!");
            return json;
        }
        String idcard = String.valueOf(infoMap.get("idcard"));
        infoMap.put("sex",IdCardUtil.getSexForIdcard_new(idcard));
        infoMap.put("age",IdCardUtil.getAgeForIdcard(idcard));
        infoMap.put("sex", IdCardUtil.getSexForIdcard_new(idcard));
        infoMap.put("age", IdCardUtil.getAgeForIdcard(idcard));
        String templateCode = String.valueOf(infoMap.get("template_code"));
        String doctorCode = String.valueOf(infoMap.get("doctor"));
        String patientCode = String.valueOf(infoMap.get("patient_code"));
        Doctor doctor = doctorDao.findByCode(doctorCode);
        if (doctor!=null){
            infoMap.put("level",doctor.getLevel());
            infoMap.put("doctorName",doctor.getName());
        if (doctor != null) {
            infoMap.put("level", doctor.getLevel());
            infoMap.put("doctorName", doctor.getName());
        }
        json.put("info",infoMap);
        json.put("info", infoMap);
        /*String healthSql ="SELECT value1,value2 FROM device.wlyy_patient_health_index WHERE user='"+patientCode+"' AND type=3 ORDER BY record_date DESC LIMIT 1";
        List<Map<String,Object>> healthMapList = jdbcTemplate.queryForList(healthSql);
        if (healthMapList!=null && healthMapList.size()>0){
@ -313,170 +305,171 @@ public class SurveyScreenResultService extends BaseService {
        //题目和答案
        List<SurveyTemplateQuestions> questionList = surveyTemplateQuestionsDao.findById(templateCode);
        Map<String,Object> answerMap = new HashMap<>();
        Map<String, Object> answerMap = new HashMap<>();
        String sql = "SELECT soa.*,sto.score,sto.content FROM wlyy_survey_option_answers soa LEFT JOIN wlyy_survey_template_options sto ON soa.options_code= sto.code WHERE soa.screen_result_code=? AND soa.patient=? AND soa.survey_code=?";
        List<Map<String,Object>> optionAnswersList = jdbcTemplate.queryForList(sql,new Object[]{code,patientCode,templateCode});
        for (SurveyTemplateQuestions surveyTemplateQuestions : questionList){
            Map<String,Object> map = new HashMap<>();
            map.put("question",surveyTemplateQuestions);
        List<Map<String, Object>> optionAnswersList = jdbcTemplate.queryForList(sql, new Object[]{code, patientCode, templateCode});
        for (SurveyTemplateQuestions surveyTemplateQuestions : questionList) {
            Map<String, Object> map = new HashMap<>();
            map.put("question", surveyTemplateQuestions);
            String qusCode = surveyTemplateQuestions.getCode();
            for (Map<String,Object> option : optionAnswersList){
                if (option.get("question_code").equals(qusCode)){
                    map.put("option",option);
            for (Map<String, Object> option : optionAnswersList) {
                if (option.get("question_code").equals(qusCode)) {
                    map.put("option", option);
                }
            }
            answerMap.put(surveyTemplateQuestions.getSort()+"",map);
            answerMap.put(surveyTemplateQuestions.getSort() + "", map);
        }
        json.put("answer",answerMap);
        json.put("answer", answerMap);
        //结果
        String reultSql ="SELECT ssr.screen_result_score,ssr.screen_result,str.advice FROM wlyy_survey_screen_result ssr LEFT JOIN wlyy_survey_template_result str ON ssr.screen_result_code = str.code WHERE ssr.code='"+code+"'";
        Map<String,Object> resultMap = jdbcTemplate.queryForMap(reultSql);
        String reultSql = "SELECT ssr.screen_result_score,ssr.screen_result,str.advice FROM wlyy_survey_screen_result ssr LEFT JOIN wlyy_survey_template_result str ON ssr.screen_result_code = str.code WHERE ssr.code='" + code + "'";
        Map<String, Object> resultMap = jdbcTemplate.queryForMap(reultSql);
        int following = Integer.parseInt(String.valueOf(infoMap.get("following")));
        int order = Integer.parseInt(String.valueOf(infoMap.get("is_order")));
        if (order>0){
        if (order > 0) {
            //已转诊
            String doctorSql ="SELECT pr.doctor_name FROM wlyy_survey_screen_result ssr LEFT JOIN wlyy_patient_reservation pr ON ssr.reservation_code= pr.`code` where ssr.`code`='"+code+"'";
            List<String> list= jdbcTemplate.queryForList(doctorSql,String.class);
            if (list!=null && list.size()>0){
                json.put("specialDoctorName",list.get(0));
            String doctorSql = "SELECT pr.doctor_name FROM wlyy_survey_screen_result ssr LEFT JOIN wlyy_patient_reservation pr ON ssr.reservation_code= pr.`code` where ssr.`code`='" + code + "'";
            List<String> list = jdbcTemplate.queryForList(doctorSql, String.class);
            if (list != null && list.size() > 0) {
                json.put("specialDoctorName", list.get(0));
            }
        }else if (following==1){
        } else if (following == 1) {
            String adviceCodes = String.valueOf(infoMap.get("advice_code"));
            List<SurveyAdvice> surveyAdviceList = new ArrayList<>();
            if (StringUtils.isNotEmpty(adviceCodes)){
            if (StringUtils.isNotEmpty(adviceCodes)) {
                String[] advicesStr = adviceCodes.split(",");
                for (String adviceCode : advicesStr){
                for (String adviceCode : advicesStr) {
                    surveyAdviceList.add(surveyAdviceDao.getByCode(adviceCode));
                }
            }
            resultMap.put("doctorAdvice",surveyAdviceList);
            resultMap.put("doctorOtherAdvice",infoMap.get("other_advice"));
            resultMap.put("doctorAdvice", surveyAdviceList);
            resultMap.put("doctorOtherAdvice", infoMap.get("other_advice"));
        }
        json.put("result",resultMap);
        json.put("result", resultMap);
        return json;
    }
    public List<Map<String,Object>> getTemplateAdviceList(String templateCode){
        String sql ="SELECT st.template_code,sa.code adviceCode,sa.advice FROM wlyy_survey_template_advice st LEFT JOIN wlyy_survey_advice sa ON st.advice_code=sa.`code` WHERE st.template_code='"+templateCode+"'";
    public List<Map<String, Object>> getTemplateAdviceList(String templateCode) {
        String sql = "SELECT st.template_code,sa.code adviceCode,sa.advice FROM wlyy_survey_template_advice st LEFT JOIN wlyy_survey_advice sa ON st.advice_code=sa.`code` WHERE st.template_code='" + templateCode + "'";
        return jdbcTemplate.queryForList(sql);
    }
    public void updateAfterFollowing(String code,String adviceCodes,String otherAdvice)throws Exception{
        String sql ="UPDATE wlyy_survey_screen_result SET following=1,advice_code=?";
        if (StringUtils.isNotEmpty(otherAdvice)){
    public void updateAfterFollowing(String code, String adviceCodes, String otherAdvice) throws Exception {
        String sql = "UPDATE wlyy_survey_screen_result SET following=1,advice_code=?";
        if (StringUtils.isNotEmpty(otherAdvice)) {
            sql += " ,other_advice=?";
        }
        sql +=" where code=?";
        if (StringUtils.isNotEmpty(otherAdvice)){
            jdbcTemplate.update(sql,new Object[]{adviceCodes,otherAdvice,code});
        }else {
            jdbcTemplate.update(sql,new Object[]{adviceCodes,code});
        sql += " where code=?";
        if (StringUtils.isNotEmpty(otherAdvice)) {
            jdbcTemplate.update(sql, new Object[]{adviceCodes, otherAdvice, code});
        } else {
            jdbcTemplate.update(sql, new Object[]{adviceCodes, code});
        }
    }
    public void updateColume(String colume,Object value,String code){
        String sql ="UPDATE wlyy_survey_screen_result SET "+colume+"=? where code=?";
        jdbcTemplate.update(sql,new Object[]{value,code});
    public void updateColume(String colume, Object value, String code) {
        String sql = "UPDATE wlyy_survey_screen_result SET " + colume + "=? where code=?";
        jdbcTemplate.update(sql, new Object[]{value, code});
    }
    public Map<String,Object> patientGetList(int pageNo,int pageSize,int labelType,String patientCode){
        Map<String,Object> map = new HashedMap();
        List<SurveyTemplates> templates = getScreenList(pageNo,pageSize,labelType,null);
        List<Map<String,Object>> mapList = new ArrayList<>();
        for (SurveyTemplates surveyTemplates : templates){
            Map<String,Object> sMap = new HashedMap();
            sMap.put("surveyTemplate",surveyTemplates);
            int count =  surveyScreenResultDao.getByPatientCodeAndTemplateCode(patientCode,surveyTemplates.getCode(),2).size();
            sMap.put("myRecordCount",count);
    public Map<String, Object> patientGetList(int pageNo, int pageSize, int labelType, String patientCode) {
        Map<String, Object> map = new HashedMap();
        List<SurveyTemplates> templates = getScreenList(pageNo, pageSize, labelType, null);
        List<Map<String, Object>> mapList = new ArrayList<>();
        for (SurveyTemplates surveyTemplates : templates) {
            Map<String, Object> sMap = new HashedMap();
            sMap.put("surveyTemplate", surveyTemplates);
            int count = surveyScreenResultDao.getByPatientCodeAndTemplateCode(patientCode, surveyTemplates.getCode(), 2).size();
            sMap.put("myRecordCount", count);
            mapList.add(sMap);
        }
        map.put("screenList",mapList);
        map.put("screenList", mapList);
        return map;
    }
    public List<SurveyScreenResult> patientGetResult(String patientCode){
        Map<String,Object> map = new HashedMap();
        String sql = "SELECT a.* FROM (SELECT * FROM wlyy_survey_screen_result WHERE source=2 and patient_code='"+patientCode+"' ORDER BY czrq DESC) a  GROUP BY a.template_code";
        List<SurveyScreenResult> surveyScreenResultList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SurveyScreenResult.class));
    public List<SurveyScreenResult> patientGetResult(String patientCode) {
        Map<String, Object> map = new HashedMap();
        String sql = "SELECT a.* FROM (SELECT * FROM wlyy_survey_screen_result WHERE source=2 and patient_code='" + patientCode + "' ORDER BY czrq DESC) a  GROUP BY a.template_code";
        List<SurveyScreenResult> surveyScreenResultList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(SurveyScreenResult.class));
        return surveyScreenResultList;
    }
    public List<Map<String,Object>> getResultByTemplateCode(int pageNo,int pageSize,String templateCode,String patientCode){
        int start = (pageNo-1)*pageSize;
        String sql ="SELECT st.*,ssr.code screenCode,ssr.screen_result,ssr.screen_result_score,ssr.czrq as screenCzrq,ssr.is_again FROM wlyy_survey_templates st LEFT JOIN wlyy_survey_screen_result ssr ON st.code = ssr.template_code WHERE ssr.source=2 and st.`code`='"+templateCode+"' AND ssr.patient_code='"+patientCode+"' order by ssr.czrq limit ?,?";
        return jdbcTemplate.queryForList(sql,new Object[]{start,pageSize});
    public List<Map<String, Object>> getResultByTemplateCode(int pageNo, int pageSize, String templateCode, String patientCode) {
        int start = (pageNo - 1) * pageSize;
        String sql = "SELECT st.*,ssr.code screenCode,ssr.screen_result,ssr.screen_result_score,ssr.czrq as screenCzrq,ssr.is_again FROM wlyy_survey_templates st LEFT JOIN wlyy_survey_screen_result ssr ON st.code = ssr.template_code WHERE ssr.source=2 and st.`code`='" + templateCode + "' AND ssr.patient_code='" + patientCode + "' order by ssr.czrq limit ?,?";
        return jdbcTemplate.queryForList(sql, new Object[]{start, pageSize});
    }
    public Map<String,Object> screenStatics(String doctor){
        Map<String,Object> resultMap = new HashedMap();
        String userSql = "SELECT DISTINCT(template_code) FROM wlyy_survey_screen_result WHERE doctor = '"+doctor+"' and source=1";
        List<String> userList = jdbcTemplate.queryForList(userSql,String.class);
    public Map<String, Object> screenStatics(String doctor) {
        Map<String, Object> resultMap = new HashedMap();
        String userSql = "SELECT DISTINCT(template_code) FROM wlyy_survey_screen_result WHERE doctor = '" + doctor + "' and source=1";
        List<String> userList = jdbcTemplate.queryForList(userSql, String.class);
        //使用筛查表数量
        resultMap.put("useTemplateCount",userList.size());
        String sql = "SELECT * FROM wlyy_survey_screen_result WHERE doctor='"+doctor+"' and source=1";
        List<SurveyScreenResult> surveyScreenResultList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SurveyScreenResult.class));
        resultMap.put("useTemplateCount", userList.size());
        String sql = "SELECT * FROM wlyy_survey_screen_result WHERE doctor='" + doctor + "' and source=1";
        List<SurveyScreenResult> surveyScreenResultList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(SurveyScreenResult.class));
        //下发问卷数量
        resultMap.put("grantCount",surveyScreenResultList.size());
        resultMap.put("grantCount", surveyScreenResultList.size());
        int overCount = 0;
        int warnCount = 0;
        int followCount = 0;
        int orderCount = 0 ;
        int orderCount = 0;
        int againCount = 0;
        int eduCount = 0;
        for (SurveyScreenResult surveyScreenResult : surveyScreenResultList){
            if (surveyScreenResult.getOver()==1){
        for (SurveyScreenResult surveyScreenResult : surveyScreenResultList) {
            if (surveyScreenResult.getOver() == 1) {
                overCount++;
            }
            if (surveyScreenResult.getIsDanger()==1){
            if (surveyScreenResult.getIsDanger() == 1) {
                warnCount++;
            }
            if (surveyScreenResult.getFollowing()==1){
            if (surveyScreenResult.getFollowing() == 1) {
                followCount++;
            }
            if (surveyScreenResult.getIsOrder()>0){
            if (surveyScreenResult.getIsOrder() > 0) {
                orderCount++;
            }
            if (StringUtils.isNotEmpty(surveyScreenResult.getParentCode())){
            if (StringUtils.isNotEmpty(surveyScreenResult.getParentCode())) {
                againCount++;
            }
            if (surveyScreenResult.getIsEducate()==1){
            if (surveyScreenResult.getIsEducate() == 1) {
                eduCount++;
            }
        }
        //筛查记录
        resultMap.put("overCount",overCount);
        resultMap.put("overCount", overCount);
        //疑似高危
        resultMap.put("dangetCount",warnCount);
        resultMap.put("dangetCount", warnCount);
        //健康跟踪
        resultMap.put("followCount",followCount);
        resultMap.put("followCount", followCount);
        //已跟踪
        resultMap.put("orderCount",orderCount);
        resultMap.put("orderCount", orderCount);
        //再次评估
        resultMap.put("againCount",againCount);
        resultMap.put("againCount", againCount);
        //健康教育
        resultMap.put("eduCount",eduCount);
        return  resultMap;
        resultMap.put("eduCount", eduCount);
        return resultMap;
    }
    public int getAmountByDoctor(String json,String doctorCode) {
        return getCountByDoctor(json,doctorCode).size();
    public int getAmountByDoctor(String json, String doctorCode) {
        return getCountByDoctor(json, doctorCode).size();
    }
    public List<String> getCountByDoctor(String json,String doctorCode) {
    public List<String> getCountByDoctor(String json, String doctorCode) {
//        1.服务 2.健康 3疾病
        JSONObject jsonObject = new JSONObject(json);
        String sql = "";
        String sex = jsonObject.get("sex").toString();
        String str = "SELECT DISTINCT lb.patient FROM wlyy_sign_patient_label_info lb,(SELECT DISTINCT ff.patient FROM wlyy_sign_family_server s, " +
                " (SELECT f.`code`,f.patient FROM wlyy_sign_family f,wlyy_patient p WHERE p.CODE=f.patient and (f.doctor='"+doctorCode+"' OR  f.doctor_health='"+doctorCode+"')";
                " (SELECT f.`code`,f.patient FROM wlyy_sign_family f,wlyy_patient p WHERE p.CODE=f.patient and (f.doctor='" + doctorCode + "' OR  f.doctor_health='" + doctorCode + "')";
        if (!"0".equals(sex)) {
            str += " AND p.sex=  " + sex +
                    " AND f.STATUS>0 AND p.`openid` IS NOT NULL AND p.`openid`!='')ff WHERE ff.CODE=s.sign_code ";
                    " AND f.STATUS>0 AND f.expenses_status = 1 AND p.`openid` IS NOT NULL AND p.`openid`!='')ff WHERE ff.CODE=s.sign_code ";
        } else {
            str += " AND f.STATUS>0 AND p.`openid`IS NOT NULL AND p.`openid`!='')ff WHERE ff.CODE=s.sign_code ";
            str += " AND f.STATUS>0 AND f.expenses_status = 1 AND p.`openid`IS NOT NULL AND p.`openid`!='')ff WHERE ff.CODE=s.sign_code ";
        }
        JSONArray service = jsonObject.getJSONArray("service");
        String ser = "";
@ -532,17 +525,17 @@ public class SurveyScreenResultService extends BaseService {
            dis += " OR ";
        }
        if (StringUtils.isNotEmpty(dis)) {
            disSql= " (lb.label_type =3 AND ( " + dis.substring(0, dis.lastIndexOf("OR")) + " )  )";
            disSql = " (lb.label_type =3 AND ( " + dis.substring(0, dis.lastIndexOf("OR")) + " )  )";
        }
        if (StringUtils.isEmpty(heal) && StringUtils.isEmpty(dis)) {
            sql = str;
        } else if (StringUtils.isEmpty(heal) && StringUtils.isNotEmpty(dis)) {
            sql = str + " AND " +disSql;
            sql = str + " AND " + disSql;
        } else if (StringUtils.isNotEmpty(heal) && StringUtils.isEmpty(dis)) {
            sql = str + " AND " +healSql;
            sql = str + " AND " + healSql;
        } else if (StringUtils.isNotEmpty(heal) && StringUtils.isNotEmpty(dis)) {
            sql = str + " AND ( " + disSql +" OR " +healSql +" ) ";
            sql = str + " AND ( " + disSql + " OR " + healSql + " ) ";
        }
        System.out.println("=====query sql =======>>>>" + sql);
@ -699,7 +692,7 @@ public class SurveyScreenResultService extends BaseService {
        countJson.put("disease", diseaList);
        countJson.put("healthCondition", healthList);
        countJson.put("service", servList);
        List<String> codes = getCountByDoctor(countJson.toString(),doctor);
        List<String> codes = getCountByDoctor(countJson.toString(), doctor);
        int amount = codes.size();
        for (String code : codes) {
//            String code = patient.get("patient").toString();
@ -749,7 +742,7 @@ public class SurveyScreenResultService extends BaseService {
                }
//            });
            }*/
            WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey","scwj");
            WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey", "scwj");
            String remark = templateConfig.getRemark();
            String keyword1 = templateConfig.getKeyword1();
            String wxTemplateCode = templateCode;
@ -760,20 +753,20 @@ public class SurveyScreenResultService extends BaseService {
                        String name = null;
                        String openId = null;
                        String first = null;
                        String screenCode =null;
                        String screenCode = null;
                        try {
                            screenCode = saveAfterBatchScreen(c,openId,name,doctor,wxTemplateCode);
                            screenCode = saveAfterBatchScreen(c, openId, name, doctor, wxTemplateCode);
                            p = patientDao.findByCode(c);
                            name = p.getName();
                            openId = p.getOpenid();
                            json.put("keyword1", keyword1);
                            json.put("keyword2", sdf.format(new Date()));
                            json.put("survey", wxTemplateCode+"_"+doctor);
                            json.put("survey", wxTemplateCode + "_" + doctor);
                            json.put("toUser", c);
                            json.put("url","jkpg/html/wx-template-message.html?survey="+wxTemplateCode+"&doctor="+doctor+"&toUser="+c+"&toName="+name+"&screenCode="+screenCode);
                            json.put("url", "jkpg/html/wx-template-message.html?survey=" + wxTemplateCode + "&doctor=" + doctor + "&toUser=" + c + "&toName=" + name + "&screenCode=" + screenCode);
//                          String first = name + ",您好!为了给您提供更好的家庭医生健康服务,现有一份问卷需要您填写。";
                            first = templateConfig.getFirst();
                            first = first.replace("key1",(name==null?"":name));
                            first = first.replace("key1", (name == null ? "" : name));
                            json.put("first", first);
                            json.put("remark", remark);
                        } catch (JSONException e) {
@ -785,7 +778,7 @@ public class SurveyScreenResultService extends BaseService {
                            logger.error("json =======>" + json);
//                            PushMsgTask.getInstance().putWxMsg(accessToken, 11, openId, name, json);
                            pushMsgTask.sendWeixinMessage(accessToken, 11, openId, name, json);
                        }else {
                        } else {
                            //发送代理人
                            JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode(), p.getOpenid());
                            if (jsonArray != null && jsonArray.length() > 0) {
@ -795,7 +788,7 @@ public class SurveyScreenResultService extends BaseService {
                                    if (StringUtils.isNotBlank(member.getOpenid())) {
                                        json.remove("toUser");
                                        json.put("toUser", member.getCode());
                                        json.put("url","jkpg/html/wx-template-message.html?survey="+wxTemplateCode+"&doctor="+doctor+"&toUser="+member.getCode()+"&toName="+member.getName()+"&screenCode="+screenCode);
                                        json.put("url", "jkpg/html/wx-template-message.html?survey=" + wxTemplateCode + "&doctor=" + doctor + "&toUser=" + member.getCode() + "&toName=" + member.getName() + "&screenCode=" + screenCode);
                                        json.remove("first");
                                        try {
                                            json.put("keyword1", keyword1);
@ -1028,23 +1021,23 @@ public class SurveyScreenResultService extends BaseService {
        return surveyCode;
    }
    public String saveAfterBatchScreen(String patientCode,String openId,String patientName,String doctorCode,String surveyCode){
        SurveyScreenResult surveyScreenResult =  new SurveyScreenResult();
    public String saveAfterBatchScreen(String patientCode, String openId, String patientName, String doctorCode, String surveyCode) {
        SurveyScreenResult surveyScreenResult = new SurveyScreenResult();
        SurveyTemplates surveyTemplates = surveyTemplatesDao.findById(surveyCode);
        Patient patient = patientDao.findByCode(patientCode);
        String code = getCode();
        surveyScreenResult.setCode(code);
        if (surveyTemplates!=null){
        if (surveyTemplates != null) {
            surveyScreenResult.setTemplateCode(surveyTemplates.getCode());
            surveyScreenResult.setTemplateTitle(surveyTemplates.getTitle());
            surveyScreenResult.setDisease(surveyTemplates.getDiseaseType());
        }
        surveyScreenResult.setDoctor(doctorCode);
        surveyScreenResult.setPatientCode(patientCode);
        if (patient!=null){
        if (patient != null) {
            surveyScreenResult.setPatientName(patient.getName());
            surveyScreenResult.setOpenId(patient.getOpenid());
        }else {
        } else {
            surveyScreenResult.setOpenId(openId);
            surveyScreenResult.setPatientName(patientName);
        }
@ -1063,10 +1056,10 @@ public class SurveyScreenResultService extends BaseService {
    }
    public String updateScreenAndSaveAnswer(String patientCode,String screenCode, JSONObject jsonData)throws Exception{
    public String updateScreenAndSaveAnswer(String patientCode, String screenCode, JSONObject jsonData) throws Exception {
        System.out.println("********保存筛查结果--jsonData********* " + jsonData);
        String surveyCode = jsonData.get("surveyCode").toString();
        SurveyScreenResult surveyScreenResult =  surveyScreenResultDao.getSurveyScreenResultByCode(screenCode);
        SurveyScreenResult surveyScreenResult = surveyScreenResultDao.getSurveyScreenResultByCode(screenCode);
        //解析json保存各种答案--获取一维数组
        JSONArray questions = jsonData.getJSONArray("questions");
        int totalScore = 0;
@ -1088,7 +1081,7 @@ public class SurveyScreenResultService extends BaseService {
            }
        }
        //查询该筛查的结果设置
        SurveyTemplateResult surveyTemplateResult = surveyTemplateResultDao.getByTemplateCodeAndLowScoreAndHighScore(surveyCode,totalScore);
        SurveyTemplateResult surveyTemplateResult = surveyTemplateResultDao.getByTemplateCodeAndLowScoreAndHighScore(surveyCode, totalScore);
       /* surveyScreenResult.setOver(1);
        surveyScreenResult.setCzrq(new Date());
        surveyScreenResult.setScreenResultScore(totalScore);
@ -1097,11 +1090,49 @@ public class SurveyScreenResultService extends BaseService {
            surveyScreenResult.setIsDanger(surveyTemplateResult.getWarning());
            surveyScreenResult.setScreenResult(surveyTemplateResult.getResult());
        }*/
       String sql ="UPDATE wlyy_survey_screen_result SET over=1,czrq=?,screen_result_code=?,screen_result=?,screen_result_score=?,is_danger=? WHERE code=?";
       jdbcTemplate.update(sql,new Object[]{new Date(),surveyTemplateResult.getCode(),surveyTemplateResult.getResult(),totalScore,surveyTemplateResult.getWarning(),screenCode});
        String sql = "UPDATE wlyy_survey_screen_result SET over=1,czrq=?,screen_result_code=?,screen_result=?,screen_result_score=?,is_danger=? WHERE code=?";
        jdbcTemplate.update(sql, new Object[]{new Date(), surveyTemplateResult.getCode(), surveyTemplateResult.getResult(), totalScore, surveyTemplateResult.getWarning(), screenCode});
        //surveyScreenResultDao.updateScreenAndSaveAnswer(new Date(),totalScore,surveyTemplateResult.getCode(),surveyTemplateResult.getResult(),surveyTemplateResult.getWarning(),screenCode);
        managerQuestionnaireService.saveAnswer(patientCode,surveyScreenResult.getCode(),jsonData);
        managerQuestionnaireService.saveAnswer(patientCode, surveyScreenResult.getCode(), jsonData);
        return screenCode;
    }
    //获取筛查居民信息
    public List<Map<String, Object>> initPatient(String doctor, String labelType, String serverType, Long teamCode) {
        String sql = "SELECT DISTINCT p.`code` as service_patient_code, p.`name` as service_patient_name, t1.ssc,t1.idcard,t1.mobile,t1.hospital,t1.hospital_name,h.town,h.town_name " +
                "FROM  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 = " + labelType + " and t2.status=1 " +
                "RIGHT JOIN wlyy_sign_family_server s on s.sign_code = t1.code and s.server_type in (" + serverType + ") " +
                "LEFT JOIN dm_hospital h on t1.hospital = h.`code` " +
                "WHERE ( t1.doctor = ? OR t1.doctor_health = ?) AND t1. STATUS > 0  and t1.expenses_status = 1 AND t1.admin_team_code = ? " +
                "AND p.openid IS NOT NULL AND p.openid <>'' ";
        Object[] args = new Object[]{doctor, doctor, teamCode};
        List<Map<String, Object>> patientInfo = jdbcTemplate.queryForList(sql, args);
        return patientInfo;
    }
    /**
     * 调用集美客服派发问卷协同服务接口
     *
     * @param jsonData
     * @param patientInfo
     * @param doctor
     * @return
     * @throws Exception
     */
    public String createWorkOrder(String jsonData, List<Map<String, Object>> patientInfo, String doctor) throws Exception {
        JSONObject object = new JSONObject(jsonData);
        Doctor d = doctorService.findDoctorByCode(doctor);
        object.put("createUser", d.getCode());
        object.put("createUserName", d.getName());
        object.put("createUserType", 1);
        Map<String, Object> param = new HashedMap();
        param.put("patientInfo", patientInfo.toString());
        param.put("jsonData", object.toString());
        HttpResponse response = null;
        response = HttpUtils.doPost(customerUrl + "wlyy-manage/createWorkOrder", param);
        JSONObject rs = new JSONObject(response.getContent());
        return rs.getString("message");
    }
}

+ 132 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildFamilyImmuneService.java

@ -7,6 +7,8 @@ import com.yihu.wlyy.repository.imm.ChildFamilyImmuneDao;
import com.yihu.wlyy.repository.imm.ChildImmuneVaccinDao;
import com.yihu.wlyy.repository.imm.ChildInfoDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.third.guahao.ImmuneService;
import com.yihu.wlyy.util.DateUtil;
import org.apache.commons.lang.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -15,10 +17,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
/**
 * 家人免疫关系业务层
@ -36,6 +35,8 @@ public class ChildFamilyImmuneService extends BaseService {
	JdbcTemplate jdbcTemplate;
	@Autowired
	private ChildImmuneVaccinDao childImmuneVaccinDao;
	@Autowired
	private ImmuneService immuneService;
	
	/**
	 * 绑定家庭成员免疫关系
@ -122,4 +123,131 @@ public class ChildFamilyImmuneService extends BaseService {
	public ChildImmuneVaccin getChildImmuneVaccinByBarcode(String barcode){
		return childImmuneVaccinDao.getChildImmuneVaccinByBarcode(barcode);
	}
	@Transactional(rollbackFor = Exception.class)
	public int getChildImmuneVaccinEveryDay()throws Exception{
		int result = 0;
		try {
			String sql ="SELECT" +
					" DISTINCT ci.`code`," +
					" ci.idcard," +
					" ci.`name`," +
					" ci.ssc," +
					" ci.barcode" +
					" FROM" +
					" wlyy_child_family_immune fi" +
					" LEFT JOIN wlyy_child_info ci ON fi.child_code = ci.`code`" +
					" WHERE" +
					" fi.del = 0";
			List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
			for (Map<String,Object> map : list){
				String barcode = String.valueOf(map.get("barcode"));
				System.out.println("===============barcode=============="+barcode);
				String deptStr = immuneService.findDept(barcode);
				if (StringUtils.isNotBlank(deptStr)){
					JSONObject jsonObject = new JSONObject(deptStr);
					if (jsonObject.getInt("status")==200) {
						JSONObject json = new JSONObject(jsonObject.getString("data"));
						JSONArray jsonArray = json.getJSONArray("body");
						for (int i = 0;i<jsonArray.length();i++){
							String deptNum  = jsonArray.getJSONObject(i).getString("deptNum");
							String vaccinStr = immuneService.findMyVaccin(barcode,deptNum);
							JSONObject vaccinJson = new JSONObject(vaccinStr);
							if (vaccinJson.getInt("status")==200) {
								JSONObject vaccinJson2 = new JSONObject(vaccinJson.getString("data"));
								JSONArray vaccinJsonJSONArray = vaccinJson2.getJSONArray("body");
								List<ChildImmuneVaccin> vaccinList = childImmuneVaccinDao.findByBarcode(barcode);
								//原来有的则不用新增,原来有的但是在返回回来的数据没有的话删除数据
								for (ChildImmuneVaccin childImmuneVaccin : vaccinList){
									int count = 0;
									for (int j=0;j<vaccinJsonJSONArray.length();j++){
										String ymbm = vaccinJsonJSONArray.getJSONObject(j).getString("ymBm");
										String jzzc = vaccinJsonJSONArray.getJSONObject(j).getString("jzZc");
										if (childImmuneVaccin.getYmbm().equals(ymbm) && childImmuneVaccin.getJzzc().equals(jzzc)){
											count++;
										}
									}
									//原来有的疫苗要判断是否有超过预约时间的7天,并且看提醒是否超过7天,超过7天可以重新提醒
									if (count>0 && childImmuneVaccin.getIsOut()==1){
										if (DateUtil.getPreDays(childImmuneVaccin.getJzrq(),7).before(new Date())){
											//过了预约时间7天,更新为isOut=0,则不能预约了
											childImmuneVaccinDao.updateIsOutByCode(childImmuneVaccin.getCode());
										}else {
											//判断是否过了7天提醒时间
											if (childImmuneVaccin.getAlert_tag()==1 && DateUtil.getPreDays(childImmuneVaccin.getAlert_time(),7).before(new Date())){
												childImmuneVaccinDao.updateAlertTagByCode(childImmuneVaccin.getCode());
											}
										}
									}
									if (count==0){
										result+= childImmuneVaccinDao.updateDelByCode(childImmuneVaccin.getCode());
									}
								}
								//如果本地没有就是新增的
								List<ChildImmuneVaccin> vaccins = new ArrayList<>();
								for (int j=0;j<vaccinJsonJSONArray.length();j++){
									String ymbm = vaccinJsonJSONArray.getJSONObject(j).getString("ymBm");
									String jzzc = vaccinJsonJSONArray.getJSONObject(j).getString("jzZc");
									int count = 0;
									for (ChildImmuneVaccin childImmuneVaccin : vaccinList){
										if (childImmuneVaccin.getYmbm().equals(ymbm) && childImmuneVaccin.getJzzc().equals(jzzc)){
											count++;
										}
									}
									if (count==0){
										ChildImmuneVaccin childImmuneVaccin = new ChildImmuneVaccin();
										childImmuneVaccin.setCode(getUUID());
										childImmuneVaccin.setName(String.valueOf(map.get("name")));
										childImmuneVaccin.setIdcard(String.valueOf(map.get("idcard")));
										childImmuneVaccin.setSsc(String.valueOf(map.get("ssc")));
										childImmuneVaccin.setBarcode(barcode);
										childImmuneVaccin.setYmkc(vaccinJsonJSONArray.getJSONObject(j).getString("ymkc"));
										childImmuneVaccin.setYmmc(vaccinJsonJSONArray.getJSONObject(j).getString("ymmc"));
										childImmuneVaccin.setYmkcsm(vaccinJsonJSONArray.getJSONObject(j).getString("ymkcsm"));
										childImmuneVaccin.setYmbm(ymbm);
										childImmuneVaccin.setJzzc(jzzc);
										childImmuneVaccin.setJzrq(DateUtil.strToDate(vaccinJsonJSONArray.getJSONObject(j).getString("jzRq"),DateUtil.YYYY_MM_DD));
										childImmuneVaccin.setAlert_tag(0);
										childImmuneVaccin.setDel(0);
										childImmuneVaccin.setCreate_time(new Date());
										if (DateUtil.getPreDays(DateUtil.strToDate(vaccinJsonJSONArray.getJSONObject(j).getString("jzRq")),7).before(new Date())){
											//过了预约时间7天,更新为isOut=0,则不能预约了
											childImmuneVaccin.setIsOut(0);
										}else {
											childImmuneVaccin.setIsOut(1);
										}
										vaccins.add(childImmuneVaccin);
										result++;
									}
								}
								childImmuneVaccinDao.save(vaccins);
							/*for (int j=0;j<vaccinJsonJSONArray.length();j++){
								String ymbm = vaccinJsonJSONArray.getJSONObject(j).getString("ymBm");
								String jzzc = vaccinJsonJSONArray.getJSONObject(j).getString("jzZc");
								if (childImmuneVaccinDao.findByBarcodeAndYmbmAndJzzc(barcode,ymbm,jzzc)==null){
									ChildImmuneVaccin childImmuneVaccin = new ChildImmuneVaccin();
									childImmuneVaccin.setCode(getUUID());
									childImmuneVaccin.setName(String.valueOf(map.get("name")));
									childImmuneVaccin.setIdcard(String.valueOf(map.get("idcard")));
									childImmuneVaccin.setSsc(String.valueOf(map.get("ssc")));
									childImmuneVaccin.setBarcode(barcode);
									childImmuneVaccin.setYmkc(vaccinJsonJSONArray.getJSONObject(j).getString("ymkc"));
									childImmuneVaccin.setYmmc(vaccinJsonJSONArray.getJSONObject(j).getString("ymmc"));
									childImmuneVaccin.setYmkcsm(vaccinJsonJSONArray.getJSONObject(j).getString("ymkcsm"));
									childImmuneVaccin.setYmbm(ymbm);
									childImmuneVaccin.setJzzc(jzzc);
									childImmuneVaccin.setAlert_tag(0);
									childImmuneVaccin.setCreate_time(new Date());
								}
							}*/
							}
						}
					}
				}
			}
		}catch (Exception e){
			e.printStackTrace();
		}
		return result;
	}
}

+ 1 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -41,7 +41,6 @@ import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.annotation.Transient;
import org.springframework.data.domain.PageRequest;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
@ -516,7 +515,7 @@ public class JMJkEduArticleService extends BaseService {
        //全选的时候前端传0,后台要去数据库再查询一次
        String tableSql = " select p.code from wlyy_sign_family w ,wlyy_admin_team t, dm_hospital h  ";
        String whereSql = " where w.status>0  and w.admin_team_code=t.id and t.org_code=h.code ";
        String whereSql = " where w.status>0 and w.expenses_status=1 and w.admin_team_code=t.id and t.org_code=h.code ";
        //通过登录的角色区域权限 限制所属患者条件
@ -594,7 +593,6 @@ public class JMJkEduArticleService extends BaseService {
            }
            groupPatient = jdbcTemplate.queryForList(sql, String.class);
        }else{
            groupPatient = jdbcTemplate.queryForList(tableSql + whereSql, String.class);
        }
        patientSet.addAll(groupPatient);

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistScreenResultService.java

@ -82,7 +82,7 @@ public class SpecialistScreenResultService extends BaseService {
        param.put("pageSize", size);
        HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/getScreenResult", param);
        JSONObject rs = new JSONObject(response.getContent());
        if ("succes".equals(rs.getString("message"))) {
        if ("success".equals(rs.getString("message"))) {
            return  rs.getJSONArray("detailModelList");
        }
        return null;
@ -95,7 +95,7 @@ public class SpecialistScreenResultService extends BaseService {
        param.put("doctor", doctor);
        HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/getScreenCount", param);
        JSONObject rs = new JSONObject(response.getContent());
        if ("succes".equals(rs.getString("message"))) {
        if ("success".equals(rs.getString("message"))) {
            jsonObject =  rs.getJSONObject("obj");
            return  jsonObject;
        }

+ 113 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java

@ -10,10 +10,13 @@ import com.yihu.wlyy.repository.doctor.*;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.survey.SurveyScreenResultService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpUtils;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONException;
@ -21,6 +24,7 @@ import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
@ -39,6 +43,9 @@ import java.util.*;
@Transactional
public class ManagerQuestionnaireService extends BaseService {
    @Value("${customerService.url}")
    private String customerUrl;
    @Autowired
    private SurveyDao surveyDao;
    @Autowired
@ -88,7 +95,7 @@ public class ManagerQuestionnaireService extends BaseService {
    @Autowired
    private WechatTemplateConfigDao templateConfigDao;
    @Autowired
    private SurveyScreenResultService surveyScreenResultService;
    private DoctorService doctorService;
    private Logger logger = LoggerFactory.getLogger(this.getClass());
@ -1809,4 +1816,108 @@ public class ManagerQuestionnaireService extends BaseService {
        //更改调查对象表答题状态为已答
        //surveyUserDao.modifyStatus(surveyCode, patient);
    }
    //查询出推送居民
    public List<Map<String, Object>> initPatient(String labelUnitType, String labelSexType, String labelServerType, String labelDiseaseType, String labelHealthType, String currentUserRole, String currentUserRoleLevel) {
        String tableSql = " select p.code as service_patient_code ,w.`name` as service_patient_name,w.ssc,w.idcard,w.mobile,w.hospital,w.hospital_name,h.town,h.town_name from wlyy_sign_family w ,wlyy_admin_team t, dm_hospital h  ";
        String whereSql = " where w.status>0 and w.expenses_status=1 and w.admin_team_code=t.id and t.org_code=h.code ";
        //通过登录的角色区域权限 限制所属患者条件
        if (StringUtils.isNotBlank(labelUnitType)) {
            switch (currentUserRoleLevel) {
                case "1": {
                    whereSql += " and h.city in (" + labelUnitType + ")";
                    break;
                }
                case "2": {
                    whereSql += " and h.town in (" + labelUnitType + ")";
                    break;
                }
                case "3": {
                    whereSql += " and h.code in (" + labelUnitType + ")";
                    break;
                }
            }
        } else {
            switch (currentUserRoleLevel) {
                case "1": {
                    whereSql += " and h.province = '" + currentUserRole + "'";
                    break;
                }
                case "2": {
                    whereSql += " and h.city = '" + currentUserRole + "'";
                    break;
                }
                case "3": {
                    whereSql += " and h.town = '" + currentUserRole + "'";
                    break;
                }
                case "4": {
                    whereSql += " and h.code = '" + currentUserRole + "'";
                    break;
                }
            }
        }
        if (StringUtils.isNotBlank(labelServerType)) {
            tableSql += " , wlyy_sign_family_server s   ";
            whereSql += " and s.server_type in (" + labelServerType + " ) and w.code= s.sign_code";
        }
        tableSql += " , wlyy_patient p  ";
        whereSql += " and p.code=w.patient AND p.openid IS NOT NULL and p.openid <>'' ";
        if (StringUtils.isNotBlank(labelSexType)) {
            whereSql += " and p.sex in (" + labelSexType + ") ";
        }
        List<Map<String, Object>> groupPatient = null;
        if (StringUtils.isNotBlank(labelHealthType) || StringUtils.isNotBlank(labelDiseaseType)) {
            String sql = "SELECT DISTINCT s.patient as service_patient_code, f.`name` as service_patient_name, f.ssc,f.idcard,f.mobile,f.hospital,f.hospital_name,h.town,h.town_name  FROM ( SELECT t.patient," +
                    " GROUP_CONCAT(',',t.label_type,t.label,',') label FROM " +
                    " wlyy_sign_patient_label_info t WHERE t.patient IN (" +
                    tableSql + whereSql + ") AND t. STATUS = 1 GROUP BY t.patient ) s LEFT JOIN wlyy_sign_family f on s.patient=f.patient LEFT JOIN dm_hospital h on f.hospital=h.`code` where 1=1 ";
            if (StringUtils.isNotBlank(labelHealthType)) {
                String[] aa = labelHealthType.split(",");
                String bb = "";
                for (String a : aa) {
                    bb += " OR s.label LIKE '%,2" + a + ",%'";
                }
                sql += " AND ( " + bb.substring(3) + " )";
            }
            if (StringUtils.isNotBlank(labelDiseaseType)) {
                String[] aa = labelDiseaseType.split(",");
                String bb = "";
                for (String a : aa) {
                    bb += " OR s.label LIKE '%,3" + a + ",%'";
                }
                sql += " AND ( " + bb.substring(3) + " )";
            }
            sql += "and f.status>0 and f.expenses_status=1";
            groupPatient = jdbcTemplate.queryForList(sql);
        } else {
            groupPatient = jdbcTemplate.queryForList(tableSql + whereSql);
        }
        return groupPatient;
    }
    /**
     * 调用集美客服派发问卷协同服务接口
     * @param jsonData
     * @param patientInfo
     * @param doctor
     * @return
     * @throws Exception
     */
    public String createWorkOrder(String jsonData, List<Map<String, Object>> patientInfo, String doctor) throws Exception{
        JSONObject object = new JSONObject(jsonData);
        Doctor d = doctorService.findDoctorByCode(doctor);
        object.put("createUser", d.getCode());
        object.put("createUserName", d.getName());
        object.put("createUserType", 1);
        Map<String, Object> param = new HashedMap();
        param.put("patientInfo", patientInfo.toString());
        param.put("jsonData", object.toString());
        HttpResponse response = null;
        response = HttpUtils.doPost(customerUrl + "wlyy-manage/createWorkOrder", param);
        JSONObject rs = new JSONObject(response.getContent());
        return rs.getString("message");
    }
}

+ 18 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/ImmuneService.java

@ -767,13 +767,28 @@ public class ImmuneService {
	 * @return
	 * @throws Exception
	 */
	public String findWzymBymykh(String barcode) throws Exception{
		String url = jwUrl + "/third/jm/imm/findWzymBymykh";
	public String findYzymBymykh(String barcode) throws Exception{
		String url = jwUrl + "/third/jm/imm/findYzymBymykh";
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("barCode", barcode));
		params.add(new BasicNameValuePair("etmykh", barcode));
		String response = httpClientUtil.post(url, params, "UTF-8");
		return response;
	}
	public String findMyVaccin(String barcode,String deptNum) throws Exception{
		String url = jwUrl + "/third/jm/imm/findMyVaccin";
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("deptNum", deptNum));
		params.add(new BasicNameValuePair("etmykh", barcode));
		String response = httpClientUtil.post(url, params, "UTF-8");
		return response;
	}
	public String findDept(String barcode) throws Exception{
		String url = jwUrl + "/third/jm/imm/findDept";
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("etmykh", barcode));
		String response = httpClientUtil.post(url, params, "UTF-8");
		return response;
	}
}

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

@ -339,6 +339,8 @@ public class WechatController extends WeixinBaseController {
            if (!"undefined".equals(openid) && StringUtils.isNotBlank(openid)) {
                patient.setOpenid(openid);
                patient.setOpenidTime(new Date());
            }else{
            }
//            if (!org.springframework.util.StringUtils.isEmpty(openid)) {
//                patient.setOpenid(openid);
@ -424,8 +426,8 @@ public class WechatController extends WeixinBaseController {
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return error(-1, errorMessage);
                } else if (StringUtils.isEmpty(openid)) {
                    errorMessage = "无效的OpenID!";
                } else if (StringUtils.isEmpty(openid)||"undefined".equals(openid)||openid.length()<10) {
                    errorMessage = "获取验证信息失败!";
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return error(-1, errorMessage);

+ 24 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/imm/DoctorImmController.java

@ -162,7 +162,7 @@ public class DoctorImmController extends BaseController {
		}
	}
	@RequestMapping(value = "/imm/findWzymBymykh", method = RequestMethod.GET)
	@RequestMapping(value = "/imm/findYzymBymykh", method = RequestMethod.GET)
	@ResponseBody
	@ObserverRequired
	@ApiOperation("计免:获取计划免疫接种记录")
@ -170,12 +170,32 @@ public class DoctorImmController extends BaseController {
								  @RequestParam(value = "barCode", required = true) String barCode){
		try{
			String re = immuneService.findWzymBymykh(barCode);
			return write(200, "查询成功","data",re);
			String re = immuneService.findYzymBymykh(barCode);
			JSONObject jsonObject = new JSONObject(re);
			if (jsonObject.getInt("status")==200){
				JSONObject json = new JSONObject(jsonObject.getString("data"));
				return write(200, "查询成功","data",json.getJSONArray("body"));
			}else {
				return error(-1,jsonObject.getString("error")+"--"+jsonObject.getString("message") );
			}
		}catch (Exception e){
			error(e);
			return error(-1, e.getMessage());
		}
	}
	@RequestMapping(value = "/imm/getChildImmuneVaccinEveryDay", method = RequestMethod.GET)
	@ResponseBody
	@ObserverRequired
	@ApiOperation("每天获取可预约疫苗test")
	public String getChildImmuneVaccinEveryDay (){
		try{
			int res = childFamilyImmuneService.getChildImmuneVaccinEveryDay();
			return write(200,"获取成功!","data",res);
		}catch (Exception e){
			error(e);
			return error(-1, e.getMessage());
		}
	}
	
}

+ 22 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/DoctorSurveyScreenResultController.java

@ -6,7 +6,6 @@ import com.yihu.wlyy.repository.specialist.SpecialDiseaseDao;
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
import com.yihu.wlyy.service.app.survey.SurveyScreenResultService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.WeixinBaseController;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
@ -23,6 +22,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
 * 医生端-疾病筛查
 * Created by zhangdan on 2018/7/2.
@ -227,4 +229,23 @@ public class DoctorSurveyScreenResultController extends WeixinBaseController {
        }
    }
    @RequestMapping(value = "/createWorkOrder",method = RequestMethod.POST)
    @ApiOperation(value = "创建协同服务")
    public String getAllQuestions(@ApiParam(name = "jsonData",value = "协同服务json字符串")
                                  @RequestParam(value = "jsonData",required = true)String jsonData,
                                  @ApiParam(name = "labelType", value = "疾病类型", defaultValue = "3")
                                  @RequestParam(value = "labelType", required = true) String labelType,
                                  @ApiParam(name = "serverType",value = "多个条件以逗号分割")
                                  @RequestParam(value = "serverType", required = true) String serverType,
                                  @ApiParam(name = "teamCode",value = "行政团队id")
                                  @RequestParam(value = "teamCode", required = true) Long teamCode){
        try {
            List<Map<String, Object>> patientInfo = surveyScreenResultService.initPatient(getUID(), labelType, serverType, teamCode);
            return write(200, "查询成功!", "data", surveyScreenResultService.createWorkOrder(jsonData, patientInfo, getUID()));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }
}

+ 27 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/ManagerQuestionnaireController.java

@ -586,4 +586,31 @@ public class ManagerQuestionnaireController extends WeixinBaseController {
        }
    }
    @RequestMapping(value = "/createWorkOrder",method = RequestMethod.POST)
    @ApiOperation(value = "创建协同服务")
    public String getAllQuestions(@ApiParam(name = "jsonData",value = "协同服务json字符串")
                                      @RequestParam(value = "jsonData",required = true)String jsonData,
                                  @ApiParam(name = "labelUnitType", value = "标签类型  1:下属单位,多个用逗号分隔", required = false)
                                      @RequestParam(value = "labelUnitType", required = false, defaultValue = "") String labelUnitType,
                                  @ApiParam(name = "labelSexType", value = "标签类型  2:性别,多个用逗号分隔", required = false)
                                      @RequestParam(value = "labelSexType", required = false, defaultValue = "") String labelSexType,
                                  @ApiParam(name = "labelServerType", value = "标签类型  3:服务类型,多个用逗号分隔", required = false)
                                      @RequestParam(value = "labelServerType", required = false, defaultValue = "") String labelServerType,
                                  @ApiParam(name = "labelDiseaseType", value = "标签类型  4:疾病类型,多个用逗号分隔", required = false)
                                      @RequestParam(value = "labelDiseaseType", required = false, defaultValue = "") String labelDiseaseType,
                                  @ApiParam(name = "labelHealthType", value = "标签类型  5:健康情况,多个用逗号分隔", required = false)
                                      @RequestParam(value = "labelHealthType", required = false, defaultValue = "") String labelHealthType,
                                  @ApiParam(name = "currentUserRole", value = "当前登录的角色code", required = false)
                                      @RequestParam(value = "currentUserRole", required = false) String currentUserRole,
                                  @ApiParam(name = "currentUserRoleLevel", value = "当前登录的角色级别", required = false)
                                      @RequestParam(value = "currentUserRoleLevel", required = false) String currentUserRoleLevel) {
        try {
            List<Map<String, Object>> patientInfo = managerQuestionnaireService.initPatient(labelUnitType, labelSexType, labelServerType, labelDiseaseType, labelHealthType, currentUserRole, currentUserRoleLevel);
            return write(200, "查询成功!", "data", managerQuestionnaireService.createWorkOrder(jsonData, patientInfo, getUID()));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }
}

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/GcTokenController.java

@ -6,6 +6,7 @@ import com.yihu.wlyy.entity.gateway.GcToken;
import com.yihu.wlyy.repository.gateway.GcHttpLogDao;
import com.yihu.wlyy.service.gateway.GcClientDetailsService;
import com.yihu.wlyy.service.gateway.GcTokenService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.NetworkUtil;
import com.yihu.wlyy.web.third.gateway.vo.GcClientDetailsModel;
import com.yihu.wlyy.web.third.gateway.vo.GcTokenModel;
@ -78,6 +79,7 @@ public class GcTokenController {
            }
            GcTokenModel gcTokenModel = new GcTokenModel();
            BeanUtils.copyProperties(gcToken, gcTokenModel);
            gcTokenModel.setOutTime(gcToken.getOutTime().getTime());
            return new ResultOneModel(gcTokenModel);
        } catch (Exception e) {
            saveHttpLog(ip, new JSONObject(request.getParameterMap()).toString(), "", "", request.getRequestURI(), 0, BaseResultModel.statusEm.login_system_error.getMessage());

+ 10 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/vo/GcTokenModel.java

@ -15,7 +15,7 @@ public class GcTokenModel {
    @ApiModelProperty(value = "创建时间", required = false, access = "response")
    private Date createTime;
    @ApiModelProperty(value = "过期时间", required = false, access = "response")
    private Date outTime;
    private Long outTime;
    public String getAccesstoken() {
        return accesstoken;
@ -33,11 +33,19 @@ public class GcTokenModel {
        this.createTime = createTime;
    }
    public Date getOutTime() {
    /*public Date getOutTime() {
        return outTime;
    }
    public void setOutTime(Date outTime) {
        this.outTime = outTime;
    }*/
    public Long getOutTime() {
        return outTime;
    }
    public void setOutTime(Long outTime) {
        this.outTime = outTime;
    }
}

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

@ -50,6 +50,9 @@ healthBank:
#康复计划配置
rehabilitation:
  url: http://localhost:10055/svr-wlyy-rehabilitation/
#集美客服配置
customerService:
  url: http://172.19.103.72:8080/customer-service/
#小程序
applets:

+ 3 - 1
patient-co/patient-co-wlyy/src/main/resources/application-prod.yml

@ -47,7 +47,9 @@ healthBank:
#康复计划配置
rehabilitation:
  url: http://localhost:10055/svr-rehabilitation/
#集美客服配置
customerService:
  url: http://172.19.103.72:8080/customer-service/
#小程序
applets:
  appId: wx0e663ce069b5170c

+ 51 - 75
patient-co/patient-co-wlyy/src/main/resources/wechat/weixin_menu_haicang.txt

@ -2,95 +2,71 @@
"button":[
   {
	  "name":"家庭医生",
	  "sub_button":[
	      {
            "type":"view",
            "name":"健康评估",
            "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjkpg%2fhtml%2fjkpg.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
          },
		  {
			"type":"view",
			"name":"签约管理",
			"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fqygl%2fhtml%2fsigning_management.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		  },
		  {
			"type":"view",
			"name":"医生咨询",
			"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fyszx%2fhtml%2fdoctor-consultation.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		  },
		  {
			"type":"view",
			"name":"医生指导",
			"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fyszd%2fhtml%2fdoctor-guidance.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		  },
		  {
            "type":"view",
            "name":"健教文库",
            "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjkjy%2fhtml%2farticle_list.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
          }
	  ]
	  "type":"view",
      "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fhome%2fhtml%2findex.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
   },
   {
	  "name":"健康管理",
	  "name":"快捷服务",
	  "sub_button":[
		 {
			  "type":"view",
			  "name":"预约挂号",
			  "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fwdyy%2fhtml%2fappointment-register.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		 },
         		"type":"view",
         		"name":"预约挂号",
         		"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fwdyy%2fhtml%2fappointment-register.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
		 {
            	"type":"view",
         	    "name":"医生咨询",
         		"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fyszx%2fhtml%2fdoctor-consultation.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
		 {
               "type":"view",
               "name":"健康记录",
               "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjkjl%2fhtml%2fhealth-record.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
                "type":"view",
               	"name":"健康评估",
               	"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjkpg%2fhtml%2fjkpg.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
         {
                "type":"view",
                "name":"康复管理",
                "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fkfgl%2fhtml%2frecover_manage.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
		{
			"type":"click",
			"name":"健康档案",
			"key":"jiankangdangan"
		},
         {
            "type":"view",
            "name":"慢病管理",
            "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjbsq%2fhtml%2fslow-disease-manage.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
                  },
        {
            "type":"click",
            "name":"妇幼保健",
            "key":"fuyoubaojian"
        }
                "type":"view",
                "name":"慢病管理",
                "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjbsq%2fhtml%2fslow-disease-manage.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         }
	  ]
   },
   {
	  "name":"我的",
	  "sub_button":[
		{
           "type":"view",
           "name":"电子健康卡",
           "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fgrzx%2fhtml%2fmy-health-card.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
        },
		{
		   "type":"view",
		   "name":"我的资料",
		   "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fgrzx%2fhtml%2fmy-detail.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		},
        {
           "type":"view",
           "name":"我的家庭",
           "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjtgx%2fhtml%2ffamily.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
        },
		{
		   "type":"view",
		   "name":"我的设备",
		   "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fwdsb%2fhtml%2fmy-equipments.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		},
		{
		   "type":"view",
		   "name":"健康银行",
		   "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjkjf%2fhtml%2findex.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
		}
		 {
                "type":"view",
                "name":"电子健康卡",
                "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fgrzx%2fhtml%2fmy-health-card.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
         {
        		"type":"view",
        		"name":"我的资料",
        		"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fgrzx%2fhtml%2fmy-detail.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
		 {
        	    "type":"view",
        	    "name":"健康银行",
        	    "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fjkjf%2fhtml%2funopened.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         },
         {
                "type":"click",
                "name":"用户指南",
                "key":"caozuoshuoming"
         },
         {
               	"type":"view",
                "name":"意见反馈",
                "url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=appId&redirect_uri=server_url%2fwx%2fhtml%2fwdyy%2fhtml%2fmy-appointment.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
         }
	 ]
  }],
  }
],
    "matchrule":{
      "tag_id":"104"
      }

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

@ -66,5 +66,8 @@
         }
	 ]
  }
]
],
     "matchrule":{
       "tag_id":"101"
       }
}