Browse Source

疾病筛查;增加微信公众号菜单

zd_123 7 năm trước cách đây
mục cha
commit
86bffc1627

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SurveyScreenResultDao.java

@ -15,8 +15,8 @@ public interface SurveyScreenResultDao extends PagingAndSortingRepository<Survey
    @Query("select surveyScreenResult from SurveyScreenResult surveyScreenResult where surveyScreenResult.code=?1")
    SurveyScreenResult getSurveyScreenResultByCode(String code);
    @Query(nativeQuery = true, value = "SELECT * FROM `wlyy_survey_screen_result` WHERE template_code=?1 ORDER BY czrq DESC LIMIT 1")
    List<SurveyScreenResult> findNewOneByTemplateCode(String templateCode);
    @Query(nativeQuery = true, value = "SELECT * FROM `wlyy_survey_screen_result` WHERE template_code=?1 and patient_code = ?2 and source=1 ORDER BY czrq DESC LIMIT 1")
    List<SurveyScreenResult> findNewOneByTemplateCode(String templateCode,String patientCode);
    @Query("select a from  SurveyScreenResult a where a.patientCode=?1 and a.templateCode=?2")
    List<SurveyScreenResult> getByPatientCodeAndTemplateCode(String patientCode,String templateCode);

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

@ -181,7 +181,7 @@ public class SurveyScreenResultService extends BaseService {
        //查询该筛查的结果设置
        SurveyTemplateResult surveyTemplateResult = surveyTemplateResultDao.getByTemplateCodeAndLowScoreAndHighScore(surveyCode,totalScore);
        //更新上一条数据为不可再次评估
        List<SurveyScreenResult> surveyScreenResultList = surveyScreenResultDao.findNewOneByTemplateCode(surveyCode);
        List<SurveyScreenResult> surveyScreenResultList = surveyScreenResultDao.findNewOneByTemplateCode(surveyCode,patientCode);
        String lastCode = "";
        String originCode = "";
        if (surveyScreenResultList!=null && surveyScreenResultList.size()>0){
@ -251,7 +251,7 @@ public class SurveyScreenResultService extends BaseService {
            return json;
        }
        String idcard = String.valueOf(infoMap.get("idcard"));
        infoMap.put("sex",IdCardUtil.getSexForIdcard(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"));
@ -415,8 +415,94 @@ public class SurveyScreenResultService extends BaseService {
        return  resultMap;
    }
    public int getAmountByDoctor(String json,String doctorCode) {
        return getCountByDoctor(json,doctorCode).size();
    }
    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+"')";
    public void getSpecialDoctorScreenList(String doctor,int type,int pageNo,int pageSize){
        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 ";
        } else {
            str += " AND f.STATUS>0 AND p.`openid`IS NOT NULL AND p.`openid`!='')ff WHERE ff.CODE=s.sign_code ";
        }
        JSONArray service = jsonObject.getJSONArray("service");
        String ser = "";
        service:
        for (Object serv : service) {
            String type = serv.toString();
            switch (type) {
                case "0":
                    break service;
                default:
                    ser += " s.server_type= " + type;
                    break;
            }
            ser += " OR ";
        }
        if (StringUtils.isNotEmpty(ser)) {
            str += " AND ( " + ser.substring(0, ser.lastIndexOf("OR")) + " ) ";
        }
        str += " )tt WHERE lb.`status` = 1 AND lb.patient=tt.patient ";
        JSONArray healthCondition = jsonObject.getJSONArray("healthCondition");
        String healSql = "";
        String heal = "";
        health:
        for (Object health : healthCondition) {
            String type = health.toString();
            switch (type) {
                case "0":
                    break health;
                default:
                    heal += " lb.label= " + type;
                    break;
            }
            heal += " OR ";
        }
        if (StringUtils.isNotEmpty(heal)) {
            healSql = " (lb.label_type =2 AND ( " + heal.substring(0, heal.lastIndexOf("OR")) + " )  )";
        }
        JSONArray disease = jsonObject.getJSONArray("disease");
        String disSql = "";
        String dis = "";
        disea:
        for (Object disea : disease) {
            String type = disea.toString();
            switch (type) {
                case "0":
                    break disea;
                default:
                    dis += " lb.label= " + type;
                    break;
            }
            dis += " OR ";
        }
        if (StringUtils.isNotEmpty(dis)) {
            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;
        } else if (StringUtils.isNotEmpty(heal) && StringUtils.isEmpty(dis)) {
            sql = str + " AND " +healSql;
        } else if (StringUtils.isNotEmpty(heal) && StringUtils.isNotEmpty(dis)) {
            sql = str + " AND ( " + disSql +" OR " +healSql +" ) ";
        }
        System.out.println("=====query sql =======>>>>" + sql);
        List<String> patients = jdbcTemplate.queryForList(sql, String.class);
        return patients;
    }
}

+ 10 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java

@ -10,6 +10,7 @@ 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.task.PushMsgTask;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
@ -86,6 +87,8 @@ public class ManagerQuestionnaireService extends BaseService {
    private PushMsgTask pushMsgTask;
    @Autowired
    private WechatTemplateConfigDao templateConfigDao;
    @Autowired
    private SurveyScreenResultService surveyScreenResultService;
    private Logger logger = LoggerFactory.getLogger(this.getClass());
@ -97,6 +100,7 @@ public class ManagerQuestionnaireService extends BaseService {
        String surveyComment = jsonStr.getString("comment");
        String templateCode = null;
        String send = jsonStr.get("send").toString();
        String templateLabel = jsonStr.getString("label");
        int status = 1;
//        自主创建
        int useType = 1;
@ -238,7 +242,12 @@ public class ManagerQuestionnaireService extends BaseService {
        countJson.put("healthCondition", healthList);
        countJson.put("service", servList);
        List<String> codes = getCount(countJson.toString());
        int amount = codes.size();
        /*if (templateLabel.contains("5")){
            codes = surveyScreenResultService.getCountByDoctor(countJson.toString(),doctor);
        }else {
           codes = getCount(countJson.toString());
        };*/
       int amount = codes.size();
        for (String code : codes) {
//            String code = patient.get("patient").toString();
            SurveyUser user = new SurveyUser(surveyCode, code, 0, 1, new Date(), new Date());

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

@ -171,4 +171,27 @@ public class DoctorSurveyScreenResultController extends BaseController {
            return write(-1, "获取数据失败!");
        }
    }
    /**
     * 获取筛选条件数量
     *
     * @param json
     * @return
     */
    @RequestMapping(value = "getAmountByDoctor", method = RequestMethod.POST)
    @ApiOperation(value = "获取筛选条件数量(医生所签约)")
    @ResponseBody
    public String getAmountByDoctor(
            @ApiParam(value = "筛选条件",defaultValue = "{\"sex\":1,\"disease\":[2,5,6],\"healthCondition\":[0],\"service\":[1,3]}")
            @RequestParam String json) {
        try {
            int amount = surveyScreenResultService.getAmountByDoctor(json,getUID());
            return write(200, "查询成功!", "amount", amount);
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }
}

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

@ -3,6 +3,11 @@
   {
	  "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":"签约管理",

+ 5 - 0
patient-co/patient-co-wlyy/src/main/resources/wechat/weixin_menu_haicang.txt

@ -3,6 +3,11 @@
   {
	  "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":"签约管理",

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

@ -3,6 +3,11 @@
   {
	  "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":"签约管理",