Преглед изворни кода

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

liuwenbin пре 6 година
родитељ
комит
d49b315827
17 измењених фајлова са 340 додато и 71 уклоњено
  1. 10 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyAnswers.java
  2. 4 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyQuestionnaireDao.java
  3. 25 5
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/QuestionnaireManageService.java
  4. 1 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java
  5. 6 4
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyWorkorderServicerLogService.java
  6. 2 0
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/JMController.java
  7. 4 2
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/JMService.java
  8. 2 2
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/AlertChildImmuneVaccinJob.java
  9. 7 2
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/imm/ChildVaccinImmuneService.java
  10. 168 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/survey/SurveyScreenResultService.java
  11. 8 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildFamilyImmuneService.java
  12. 4 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java
  13. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/ImmuneService.java
  14. 18 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandlingController.java
  15. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/imm/DoctorImmController.java
  16. 78 42
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/DoctorSurveyScreenResultController.java
  17. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/family/FamilyMemberController.java

+ 10 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyAnswers.java

@ -28,6 +28,8 @@ public class SurveyAnswers extends IdEntity implements Serializable {
//    用户openId
    private String openId;
    //调查问卷结果code
    private String questionResultCode;
    public SurveyAnswers() {
    }
@ -106,4 +108,12 @@ public class SurveyAnswers extends IdEntity implements Serializable {
    public void setOpenId(String openId) {
        this.openId = openId;
    }
    public String getQuestionResultCode() {
        return questionResultCode;
    }
    public void setQuestionResultCode(String questionResultCode) {
        this.questionResultCode = questionResultCode;
    }
}

+ 4 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyQuestionnaireDao.java

@ -9,6 +9,9 @@ import java.util.List;
public interface SurveyQuestionnaireDao extends PagingAndSortingRepository<SurveyQuestionnaire,Long>,JpaSpecificationExecutor<SurveyQuestionnaire> {
    @Query("select q from SurveyQuestionnaire q where q.surveyCode = ?1")
    @Query("select q from SurveyQuestionnaire q where q.surveyCode = ?1 and (q.questionType = 0 or q.questionType = 1) ")
    List<SurveyQuestionnaire> findBySurveyCode(String surveyCode);
    @Query("select q from SurveyQuestionnaire q where q.surveyCode = ?1 and q.questionType = 2 ")
    List<SurveyQuestionnaire> findEssayQuestionBySurveyCode(String surverCode);
}

+ 25 - 5
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/QuestionnaireManageService.java

@ -54,8 +54,8 @@ public class QuestionnaireManageService extends BaseJpaService {
        String servicer = "";
        int size = workorderServicerDOS.size();
        int len = 0;
        if(size > 5){
            len = 5;
        if(size > 3){
            len = 3;
        }else {
            len = size;
        }
@ -151,11 +151,11 @@ public class QuestionnaireManageService extends BaseJpaService {
        SurveyQuestionResult questionResult = questionResultDao.findByCode(code);
        String patient = questionResult.getPatientCode();
        String surverCode = questionResult.getSurveyCode();
        //获取模板问题
        //获取单选、多选问题
        List<SurveyQuestionnaire> questionList = surveyQuestionnaireDao.findBySurveyCode(surverCode);
        //查找选项和答案
        //查找单选、多选选项和答案
        Map<String, Object> answerMap = new HashMap<>();
        String sql = "SELECT soa.*, sqo.content FROM wlyy_survey_option_answers soa LEFT JOIN wlyy_survey_questionnaire_options sqo ON soa.options_code= sqo.code WHERE soa.screen_result_code = ? AND soa.patient=? AND soa.survey_code=?";
        String sql = "SELECT soa.*, sqo.content FROM wlyy_survey_option_answers soa LEFT JOIN wlyy_survey_questionnaire_options sqo ON soa.options_code= sqo.code AND soa.survey_code = sqo.survey_code AND sqo.del=1 WHERE soa.screen_result_code = ? AND soa.patient=? AND soa.survey_code=?";
        List<Map<String, Object>> optionAnswersList = jdbcTemplate.queryForList(sql, new Object[]{code, patient, surverCode});
        for (SurveyQuestionnaire question : questionList) {
            List<Map<String, Object>> optionList = new ArrayList<>();
@ -170,6 +170,26 @@ public class QuestionnaireManageService extends BaseJpaService {
            map.put("option", optionList);
            answerMap.put(question.getSort() + "", map);
        }
        //获取问答题列表
        List<SurveyQuestionnaire> essayQuestionList = surveyQuestionnaireDao.findEssayQuestionBySurveyCode(surverCode);
        String s = "SELECT a.*, q.title " +
                "FROM wlyy_survey_answers a  " +
                "LEFT JOIN wlyy_survey_questionnaire q ON a.question_code= q.code AND a.survey_code = q.survey_code AND q.del=1 AND q.question_type = 2 " +
                "WHERE a.question_result_code = ? AND a.patient= ? AND a.survey_code= ?";
        List<Map<String, Object>> questionAnswersList = jdbcTemplate.queryForList(s, new Object[]{code, patient, surverCode});
        for (SurveyQuestionnaire essayQuestion : essayQuestionList) {
            List<Map<String, Object>> list = new ArrayList<>();
            Map<String, Object> map = new HashMap<>();
            map.put("question", essayQuestion);
            String qusCode = essayQuestion.getCode();
            for (Map<String, Object> question : questionAnswersList) {
                if (question.get("question_code").equals(qusCode)) {
                    list.add(question);
                }
            }
            map.put("option", list);
            answerMap.put(essayQuestion.getSort() + "", map);
        }
        json.put("answer", answerMap);
        return json;
    }

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

@ -417,7 +417,7 @@ public class SynergyManageService extends BaseJpaService {
            //获取处理结果
            if(status == 3) {
                map.put("resultRemark", workorderDO.getDealResultRemark());
                map.put("completeTime", workorderDO.getCompleteTime());
                map.put("completeTime", sdf.format(workorderDO.getCompleteTime()));
                List<ManageSynergyAccessoryDO> accessoryList = accessoryList(workorderCode);
                map.put("accessoryList",accessoryList);//附件列表
            }

+ 6 - 4
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyWorkorderServicerLogService.java

@ -31,7 +31,7 @@ import java.util.Map;
 * @desc 协同服务处理操作日志
 **/
@Service
@Transactional
public class SynergyWorkorderServicerLogService extends BaseJpaService {
    @Autowired
    private ManageSynergyWorkorderServicerLogDao manageSynergyWorkorderServicerLogDao;
@ -53,6 +53,7 @@ public class SynergyWorkorderServicerLogService extends BaseJpaService {
     *
     * @param synergyWorkorderServicerLogDO
     */
    @Transactional
    public void create(ManageSynergyWorkorderServicerLogDO synergyWorkorderServicerLogDO,String userCode){
        synergyWorkorderServicerLogDO.setCreateTime(new Date());
        ManageSynergyWorkorderServicerLogDO workorderServicerLogDO = manageSynergyWorkorderServicerLogDao.save(synergyWorkorderServicerLogDO);
@ -62,10 +63,11 @@ public class SynergyWorkorderServicerLogService extends BaseJpaService {
        workorderServicerDO.setExecutorCode(user.getCode());
        workorderServicerDO.setExecutorName(user.getName());
        workorderServicerDO.setExecutorType(2);
        workorderServicerDao.save(workorderServicerDO);
        String sql = "select * from manage_synergy_workorder_servicer where workorder_code = '"+workorderServicerLogDO.getWorkorderCode()+"' and status IN(1,2)";
        workorderServicerDO.setCompleteTime(new Date());
        ManageSynergyWorkorderServicerDO workorderServicerDO1 = workorderServicerDao.save(workorderServicerDO);
        String sql = "select * from manage_synergy_workorder_servicer where workorder_code = '"+workorderServicerLogDO.getWorkorderCode()+"' and status IN(1,2) AND service_patient_code != '"+workorderServicerDO1.getServicePatientCode()+"'";
        List<ManageSynergyWorkorderServicerDO> workorderServicerDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ManageSynergyWorkorderServicerDO.class));
        if (workorderServicerDOS == null || workorderServicerDOS.size() == 0){
        if ((workorderServicerDOS == null || workorderServicerDOS.size() == 0)&&workorderServicerDO1.getStatus() ==3){
            ManageSynergyWorkorderDO workorderDO = manageSynergyWorkOrderDao.findByCode(workorderServicerLogDO.getWorkorderCode());
            workorderDO.setStatus(3);
            workorderDO.setCompleteTime(new Date());

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

@ -346,6 +346,7 @@ public class JMController {
	{
		try {
			String data = jmService.findWzymBymykh(etmykh);
			System.out.println(data);
			JSONObject jsonObject = new JSONObject(data);
			if (jsonObject.getInt("msgCode")==800){
				return Result.success("获取接种记录成功!",data);
@ -358,4 +359,5 @@ public class JMController {
			return Result.error(ex.getMessage());
		}
	}
}

+ 4 - 2
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/JMService.java

@ -412,10 +412,12 @@ public class JMService {
            //保存http日志
            logService.saveHttpLog(isSuccess,apistr,content,method,apistr, net.sf.json.JSONObject.fromObject(params).toString(),re,error);
            //保存token到reids
            //保存token到reids.
            if (isSuccess && apistr.equals(GET_TOKEN)){
                //System.out.println();
                redisTemplate.opsForValue().set(redis_key, com.alibaba.fastjson.JSON.parseObject(re).getString("body"),4,TimeUnit.HOURS);
                long tokenCreateTime = com.alibaba.fastjson.JSON.parseObject(re).getLongValue("createtime");
                redisTemplate.opsForValue().set(redis_key, com.alibaba.fastjson.JSON.parseObject(re).getString("body"));
                redisTemplate.expireAt(redis_key,DateUtil.getNextMin(new Date(tokenCreateTime),4*60));
            }
        }
        catch (Exception ex)

+ 2 - 2
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/AlertChildImmuneVaccinJob.java

@ -18,8 +18,8 @@ public class AlertChildImmuneVaccinJob implements Job {
    public void execute(JobExecutionContext context) throws JobExecutionException {
        logger.info("START========每天九点提醒居民待接种JOB========");
        try {
            int result = childVaccinImmuneService.alertBefore();
            logger.info("END========每天九点提醒居民待接种JOB========"+result);
            //int result = childVaccinImmuneService.alertBefore();
            //logger.info("END========每天九点提醒居民待接种JOB========"+result);
        }catch (Exception e){
            e.printStackTrace();
            logger.info("END===ERROE===每天九点提醒居民待接种JOB,message:"+e.getMessage());

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

@ -274,13 +274,18 @@ public class ChildVaccinImmuneService extends BaseService {
					" LEFT JOIN wlyy_patient p ON cfi.family_code = p.`code`" +
					" WHERE" +
					" cfi.child_code = '"+childCode+"'" +
					" AND cfi.del = 0 and (p.openid is not null or p.openid !='') AND p.`code`='0fab4dd67e074e16ac86db6b6c15233e'";
					" AND cfi.del = 0 and (p.openid is not null or p.openid !='') "
                     +" AND p.`code`='0fab4dd67e074e16ac86db6b6c15233e'"
                    ;
			List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
			if (list.size()==0){
				return -10000;
			}
			List<String> openIdList = new ArrayList<>();
			for (Map<String,Object> map : list){
                String familyCode = String.valueOf(map.get("code"));
                String openid = String.valueOf(map.get("openid"));
                String familyName = String.valueOf(map.get("name"));
				//如果父母亲都在就都发
				if (!openIdList.contains(String.valueOf(map.get("openid")))){
					if (StringUtils.isNotBlank(String.valueOf(map.get("openid")))){
@ -293,7 +298,7 @@ public class ChildVaccinImmuneService extends BaseService {
                            json.put("keyword2", temp.getKeyword2().replace("key1",DateUtil.dateToStr(new Date(), "yyyy-MM-dd")));
                            json.put("remark", temp.getRemark());
                            json.put("first", temp.getFirst().replace("key1",String.valueOf(map.get("name"))).replace("key2", childName).replace("key3",jzrq));
                            json.put("url",temp.getUrl().replace("key1",childCode));
                            json.put("url",temp.getUrl().replace("key1",childCode).replace("key2",familyCode).replace("key3",familyName).replace("key4",openid));
                            logger.info("weiTempJOSN:"+json.toString());
							pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11,String.valueOf(map.get("openid")) , String.valueOf(map.get("name")), json);
						}catch (Exception e){

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

@ -9,6 +9,7 @@ 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.common.account.DoctorService;
import com.yihu.wlyy.service.jimeiJkEdu.JMJkEduArticleService;
import com.yihu.wlyy.service.survey.ManagerQuestionnaireService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.IdCardUtil;
@ -88,6 +89,8 @@ public class SurveyScreenResultService extends BaseService {
    private WechatTemplateConfigDao templateConfigDao;
    @Autowired
    private DoctorService doctorService;
    @Autowired
    private JMJkEduArticleService jmJkEduArticleService;
    private Logger logger = LoggerFactory.getLogger(this.getClass());
@ -1105,9 +1108,10 @@ public class SurveyScreenResultService extends BaseService {
    //获取筛查居民信息
    public List<Map<String, Object>> initPatient(String doctor, String labelType, String serverType, Long teamCode) {
        String sql = "SELECT DISTINCT p.`code` as servicePatientCode, p.`name` as servicePatientName, t1.ssc,t1.idcard,t1.mobile,t1.hospital,t1.hospital_name as hospitalName, h.town,h.town_name as townName " +
                "FROM  wlyy_sign_family t1  LEFT JOIN wlyy_patient p on p. CODE = t1.patient   " +
                "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" +
                "RIGHT JOIN wlyy_sign_family_server s on s.sign_code = t1.code " +
                "LEFT JOIN dm_hospital h on t1.hospital = h.`code` " +
                "WHERE ( t1.doctor = ? OR t1.doctor_health = ?) AND t1. STATUS > 0  AND t1.admin_team_code = ? " ;
        if(StringUtils.isNotBlank(serverType)){
@ -1127,6 +1131,37 @@ public class SurveyScreenResultService extends BaseService {
     * @return
     * @throws Exception
     */
    public JSONObject createWorkOrder(String jsonData, String patientInfo, String doctor) throws Exception {
        JSONObject object = new JSONObject(jsonData);
//        JSONArray patientInfos = new JSONArray(patientInfo);
        Doctor d = doctorService.findDoctorByCode(doctor);
        //获取关联业务名称
        if(object.getInt("type") == 4){
            Survey survey = surveyDao.findById(object.getString("relationCode"));
            object.put("relationCodeName", survey.getTitle());
            object.put("createUserRole", 2);
        }else if(object.getInt("type") == 5){
            SurveyTemplates templates = surveyTemplatesDao.findById(object.getString("relationCode"));
            object.put("relationCodeName", templates.getTitle());
            object.put("createUserRole", 1);
            object.put("hospital", d.getHospital());
            object.put("hospitalName", d.getHospitalName());
        }
        object.put("createUser", d.getCode());
        object.put("createUserName", d.getName());
        object.put("createUserType", 1);
        Map<String, Object> param = new HashedMap();
        param.put("patientInfo", patientInfo);
        param.put("jsonData", object.toString());
        HttpResponse response = null;
        response = HttpUtils.doPost(customerUrl + "synergy/questionnaire/createWorkOrder", param);
        JSONObject rs = new JSONObject(response.getContent());
        if(rs.getInt("status") == 200) {
            return rs;
        }
        throw new Exception();
    }
    public JSONObject createWorkOrder(String jsonData, List<Map<String, Object>> patientInfo, String doctor) throws Exception {
        JSONObject object = new JSONObject(jsonData);
        JSONArray patientInfos = new JSONArray(patientInfo);
@ -1157,4 +1192,135 @@ public class SurveyScreenResultService extends BaseService {
        }
        throw new Exception();
    }
    public List<Map<String, Object>> initPatients(String userCode, String[] groups, String group, String labelType, Long teamCode, String patients, Set<String> patientSet) throws Exception {
        List<Map<String, Object>> patientInfos = new ArrayList<>();
        if (StringUtils.isNotBlank(group) && groups.length > 0) {
            //递归患者数据
            for (String g : groups) {
                List<Map<String, Object>> patientInfo = getPatientByGroup(userCode,g, labelType, teamCode, 0, 100);
                for (Map<String, Object> patient : patientInfo){
                    int size = patientSet.size();
                    patientSet.add((String) patient.get("servicePatientCode"));
                    if (patientSet.size() > size){
                        patientInfos.add(patient);
                    }
                }
            }
        }
        //查出patients的居民信息
        if(StringUtils.isNotBlank(patients)){
            String sql = "SELECT DISTINCT p.`code` as servicePatientCode, p.`name` as servicePatientName, s.ssc,s.idcard,s.mobile,s.hospital,s.hospital_name as hospitalName, h.town,h.town_name as townName  " +
                    "FROM     wlyy_patient p " +
                    "LEFT JOIN wlyy_sign_family s on p.`code` = s.patient AND s.`status`>0 " +
                    "LEFT JOIN dm_hospital h on s.hospital = h.`code` " +
                    "where   p.`code` in (" + patients + ")";
            patientInfos = jdbcTemplate.queryForList(sql);
        }
        return patientInfos;
    }
    private List<Map<String, Object>> getPatientByGroup(String userCode, String labelCode, String labelType, Long teamCode, int page, int pagesize) throws Exception {
        List<Map<String, Object>> result = getPatientByLabel(userCode, labelCode, labelType, teamCode, page, pagesize, false, "",false,null,null,null);
        if (result.size() == 100) {
            getPatientByGroup(userCode,labelCode, labelType, teamCode, page + 1, pagesize);
        }
        return result;
    }
    public List<Map<String, Object>> getPatientByLabel(String doctor, String labelCode, String labelType,
                                                       Long teamCode, int page, int pagesize, boolean isSlowDisease,
                                                       String diseaseCondition, boolean isFollowWeChat, String trackFlag, String sDate, String eDate) throws Exception {
        Doctor doc = doctorDao.findByCode(doctor);
        if (doc == null) {
            throw new Exception("doctor info can not find");
        }
        List<Map<String, Object>> signList = new ArrayList<>();
        int start = page * pagesize;
        String sql = "";
        Object[] args = null;
        if("1".equals(labelType)){
            sql ="  SELECT " +
                    "  DISTINCT p.`code` as servicePatientCode, p.`name` as servicePatientName, t1.ssc,t1.idcard,t1.mobile,t1.hospital,t1.hospital_name as hospitalName, h.town,h.town_name as townName  " +
                    "  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 = 3 and t2.status=1 " +
                    "   LEFT JOIN dm_hospital h on t1.hospital = h.`code`"+
                    "   RIGHT JOIN wlyy_sign_family_server s on s.sign_code = t1.code and s.server_type = '"+labelCode+"' "+
                    "  WHERE ( " +
                    "   t1.doctor = ? " +
                    "   OR t1.doctor_health = ? " +
                    "  ) " +
                    "  AND t1. STATUS > 0  AND t1.admin_team_code = ?";
            if(StringUtils.isNotBlank(diseaseCondition)){
                sql = sql + " AND p.disease_condition ="+diseaseCondition;
            }
            if(isFollowWeChat){
                sql += "  AND p.openid IS NOT NULL AND p.openid <>'' ";
            }
            args = new Object[]{doctor, doctor, teamCode};
        }else if("3".equals(labelType) && isSlowDisease){
            //慢病管理
            sql = "SELECT " +
                    "  DISTINCT t1.* " +
                    "  FROM  wlyy_sign_family t1 " +
                    "  LEFT JOIN wlyy_patient p on p.code = t1.patient  "+
                    "  RIGHT JOIN wlyy_sign_patient_label_info t2 on t2.patient = t1.patient ";
            if(StringUtils.isNotBlank(trackFlag) && "1".equals(trackFlag)){
                sql = sql +" JOIN wlyy_track_patient tp ON tp.patient_code = p.code";
            }
            sql = sql + " WHERE t2.label = ?";
            if(org.apache.commons.lang3.StringUtils.isNotBlank(diseaseCondition)) {
                sql = sql + " AND p.disease_condition = ? ";
            }
            sql = sql + "    AND t2.label_type = ? " +
                    "    AND t2.status = 1 " +
                    "    AND t1.patient = t2.patient " +
                    "    AND (t1.doctor = ? or t1.doctor_health = ?)" +
                    "    AND t1.status > 0 " +
                    "    AND t1.admin_team_code = ? ";
            if(isFollowWeChat){
                sql += "  AND p.openid IS NOT NULL AND p.openid <>'' ";
            }
            if(StringUtils.isNotBlank(trackFlag) && "1".equals(trackFlag)){
                sql = sql + " AND tp.del='1'  AND tp.doctor_code ='"+doctor+"' AND tp.team_code ="+teamCode;
                if(org.apache.commons.lang3.StringUtils.isNotBlank(sDate)&& org.apache.commons.lang3.StringUtils.isNotBlank(eDate)){
                    sql += " AND tp.create_time >='"+sDate+" 00:00:00' AND tp.create_time <='"+eDate+" 23:59:59' ";
                }
            }
            sql = sql + " order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,t1.openid DESC ,convert(t1.name using gbk) ";
            if(StringUtils.isNotBlank(diseaseCondition)) {
                args = new Object[]{labelCode, diseaseCondition, labelType, doctor, doctor, teamCode};
            }else{
                args = new Object[]{labelCode, labelType, doctor, doctor,  teamCode};
            }
        } else {
                sql = "SELECT " +
                        " DISTINCT p.`code` as servicePatientCode, p.`name` as servicePatientName, t1.ssc,t1.idcard,t1.mobile,t1.hospital,t1.hospital_name as hospitalName, h.town,h.town_name as townName " +
                        " FROM wlyy_sign_family t1 " +
                        " LEFT JOIN wlyy_sign_patient_label_info t2 on t1.patient = t2.patient " +
                        " LEFT JOIN wlyy_patient p on p.`code` = t1.patient " +
                        " LEFT JOIN dm_hospital h on t1.hospital = h.`code`"+
                        " WHERE " +
                        "    t2.label = ? " +
                        "    AND t2.label_type = ? " +
                        "    AND t2.status = 1 " +
                        "    AND t1.patient = t2.patient " +
                        "    AND (t1.doctor = ? or t1.doctor_health = ?)" +
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? "+
                        "    AND p.`status` =1 ";
                if(isFollowWeChat){
                    sql += "  AND p.openid IS NOT NULL AND p.openid <>'' ";
                }
                args = new Object[]{labelCode, labelType, doctor, doctor, teamCode};
        }
        sql += " limit " + start + "," + pagesize;
        signList = jdbcTemplate.queryForList(sql, args);
        return signList;
    }
}

+ 8 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildFamilyImmuneService.java

@ -241,19 +241,22 @@ public class ChildFamilyImmuneService extends BaseService {
			}
			List<String> openIdList = new ArrayList<>();
			for (Map<String,Object> map : list){
				String familyCode = String.valueOf(map.get("code"));
				String openid = String.valueOf(map.get("openid"));
				String familyName = String.valueOf(map.get("name"));
				//如果父母亲都在就都发
				if (!openIdList.contains(String.valueOf(map.get("openid")))){
					if ( StringUtils.isNotBlank(String.valueOf(map.get("openid")))){
				if (!openIdList.contains(openid)){
					if ( StringUtils.isNotBlank(openid)){
						boolean flag =true;
						try {
							WechatTemplateConfig temp = templateConfigDao.findByScene("template_doctor_survey", "ymjztx");
							JSONObject json = new JSONObject();
							json.put("toUser",String.valueOf(map.get("code")));
							json.put("toUser",familyCode);
							json.put("keyword1", temp.getKeyword1().replace("key1",vaccinName).replace("key2",jzzc));
							json.put("keyword2", temp.getKeyword2().replace("key1",DateUtil.dateToStr(new Date(), "yyyy-MM-dd")));
							json.put("remark", temp.getRemark());
							json.put("first", temp.getFirst().replace("key1",String.valueOf(map.get("name"))).replace("key2", childName).replace("key3",jzrq));
							json.put("url",temp.getUrl().replace("key1",childCode));
							json.put("first", temp.getFirst().replace("key1",familyName).replace("key2", childName).replace("key3",jzrq));
							json.put("url",temp.getUrl().replace("key1",childCode).replace("key2",familyCode).replace("key3",familyName).replace("key4",openid));
							logger.info("weiTempJOSN:"+json.toString());
							pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11,String.valueOf(map.get("openid")) , String.valueOf(map.get("name")), json);
						}catch (Exception e){

+ 4 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java

@ -1775,7 +1775,7 @@ public class ManagerQuestionnaireService extends BaseService {
        return  json;
    }
    public void saveAnswer(String patient,String screenResultCode, JSONObject jsonData) throws Exception {
    public void saveAnswer(String patient,String resultCode, JSONObject jsonData) throws Exception {
        System.out.println("********jsonData********* " + jsonData);
        //解析json保存各种答案
        String surveyCode = jsonData.get("surveyCode").toString();
@ -1805,7 +1805,7 @@ public class ManagerQuestionnaireService extends BaseService {
                        }
//                 保存到选择题答案表
                        SurveyOptionAnswers optionAnswer = new SurveyOptionAnswers(code, patient, surveyCode, qstCode, optionCode, comment, type, createTime);
                        optionAnswer.setScreenResultCode(screenResultCode);
                        optionAnswer.setScreenResultCode(resultCode);
                        surveyOptionAnswersDao.save(optionAnswer);
//                选择题修改统计表数量
                        surveyStatisticsDao.modifyAmount(surveyCode, qstCode, optionCode);
@ -1818,6 +1818,7 @@ public class ManagerQuestionnaireService extends BaseService {
//                    保存到问答题答案表
                    String code = getCode();
                    SurveyAnswers surveyAnswer = new SurveyAnswers(code, surveyCode, patient, qstCode, content, createTime);
                    surveyAnswer.setQuestionResultCode(resultCode);
                    surveyAnswersDao.save(surveyAnswer);
//                问答题保存到统计表(只负责更改数量不负责创建)
                    surveyStatisticsDao.modifyAmount(surveyCode, qstCode);
@ -1875,7 +1876,7 @@ public class ManagerQuestionnaireService extends BaseService {
        }
        tableSql += " , wlyy_patient p  ";
        whereSql += " and p.code=w.patient AND p.openid IS NOT NULL and p.openid <>'' ";
        whereSql += " and p.code=w.patient ";
        if (StringUtils.isNotBlank(labelSexType)) {
            whereSql += " and p.sex in (" + labelSexType + ") ";
        }

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

@ -771,6 +771,7 @@ public class ImmuneService {
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("etmykh", barcode));
		String response = httpClientUtil.post(url, params, "UTF-8");
		System.out.println("获取接种记录结果:"+response);
		return response;
	}

+ 18 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandlingController.java

@ -12,6 +12,7 @@ import io.swagger.annotations.ApiParam;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ -44,6 +45,10 @@ public class DataHandlingController extends BaseController {
    @Autowired
    private EduArticleService eduArticleService;
    @Autowired
    private StringRedisTemplate redisTemplate;
    private String redis_key ="imm:imm_token_key";
    /**
     * 生成签约表中的行政团队的code
     */
@ -417,4 +422,17 @@ public class DataHandlingController extends BaseController {
            return write(-1,"清洗数据失败!");
        }
    }
    @RequestMapping(value = "/imm/clearRedis",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("计免:清理redis")
    public String clearRedis(@RequestParam(value = "etmykh")String etmykh) {
        try {
            redisTemplate.delete(redis_key);
            return write(200,"操作成功!");
        } catch (Exception ex) {
            ex.printStackTrace();
            return error(-1,"操作失败!" );
        }
    }
}

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

@ -209,7 +209,7 @@ public class DoctorImmController extends BaseController {
			}
		}catch (Exception e){
			error(e);
			return error(-1, e.getMessage());
			return error(-1, "查询失败!");
		}
	}

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

@ -5,6 +5,7 @@ import com.yihu.wlyy.repository.patient.PatientDao;
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.service.jimeiJkEdu.JMJkEduArticleService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.web.WeixinBaseController;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
@ -12,14 +13,17 @@ import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
 * 医生端-疾病筛查
@ -44,11 +48,14 @@ public class DoctorSurveyScreenResultController extends WeixinBaseController {
    private SurveyScreenResultService surveyScreenResultService;
    @Autowired
    private SpecialDiseaseDao specialDiseaseDao;
    @Autowired
    private JMJkEduArticleService jmJkEduArticleService;
    private Logger logger = LoggerFactory.getLogger(this.getClass());
    /**
     * 获取筛查结果列表
     *
     * @param pageNo
     * @param pageSize
     * @param diseaseType
@ -60,14 +67,14 @@ public class DoctorSurveyScreenResultController extends WeixinBaseController {
    @RequestMapping(value = "getResultList", method = RequestMethod.GET)
    @ApiOperation(value = "获取筛查记录列表")
    @ResponseBody
    public String getResultList(@ApiParam(value = "当前页")@RequestParam(value = "pageNo") int pageNo,
                                @ApiParam(value = "显示记录数")@RequestParam(value = "pageSize") int pageSize,
                                @ApiParam(value = "疾病类型")@RequestParam(value = "diseaseType",required = false) String diseaseType,
                                @ApiParam(value = "处理方式(1已预约 2已跟踪 3已接诊 4待处理)")@RequestParam(value = "dealType",required = false) String dealType,
                                @ApiParam(value = "搜索居民的姓名")@RequestParam(value = "patientName",required = false) String patientName,
                                @ApiParam(value = "是否高危预警(0否 1是)")@RequestParam(value = "isDanger",required = false) String isDanger){
    public String getResultList(@ApiParam(value = "当前页") @RequestParam(value = "pageNo") int pageNo,
                                @ApiParam(value = "显示记录数") @RequestParam(value = "pageSize") int pageSize,
                                @ApiParam(value = "疾病类型") @RequestParam(value = "diseaseType", required = false) String diseaseType,
                                @ApiParam(value = "处理方式(1已预约 2已跟踪 3已接诊 4待处理)") @RequestParam(value = "dealType", required = false) String dealType,
                                @ApiParam(value = "搜索居民的姓名") @RequestParam(value = "patientName", required = false) String patientName,
                                @ApiParam(value = "是否高危预警(0否 1是)") @RequestParam(value = "isDanger", required = false) String isDanger) {
        try {
            return write(200, "查询成功!", "data", surveyScreenResultService.getResultList(pageNo,pageSize,getUID(),diseaseType,dealType,isDanger,patientName));
            return write(200, "查询成功!", "data", surveyScreenResultService.getResultList(pageNo, pageSize, getUID(), diseaseType, dealType, isDanger, patientName));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
@ -77,7 +84,7 @@ public class DoctorSurveyScreenResultController extends WeixinBaseController {
    @RequestMapping(value = "getSpecialDisease", method = RequestMethod.GET)
    @ApiOperation(value = "获取专科疾病类型")
    @ResponseBody
    public String getSpecialDisease(){
    public String getSpecialDisease() {
        try {
            return write(200, "查询成功!", "data", specialDiseaseDao.findByDel("1"));
        } catch (Exception e) {
@ -89,6 +96,7 @@ public class DoctorSurveyScreenResultController extends WeixinBaseController {
    /**
     * 获取筛查问卷列表
     *
     * @param pageNo
     * @param pageSize
     * @param labelType
@ -97,12 +105,12 @@ public class DoctorSurveyScreenResultController extends WeixinBaseController {
    @RequestMapping(value = "getScreenList", method = RequestMethod.POST)
    @ApiOperation(value = "根据问卷标签类型获取筛查问卷列表")
    @ResponseBody
    public String getScreenList(@ApiParam(value = "当前页")@RequestParam(value = "pageNo") int pageNo,
                                @ApiParam(value = "显示记录数")@RequestParam(value = "pageSize") int pageSize,
                                @ApiParam(value = "问卷类型标签")@RequestParam(value = "labelType") int labelType,
                                @ApiParam(value = "问卷题目")@RequestParam(value = "title",required = false) String title) {
    public String getScreenList(@ApiParam(value = "当前页") @RequestParam(value = "pageNo") int pageNo,
                                @ApiParam(value = "显示记录数") @RequestParam(value = "pageSize") int pageSize,
                                @ApiParam(value = "问卷类型标签") @RequestParam(value = "labelType") int labelType,
                                @ApiParam(value = "问卷题目") @RequestParam(value = "title", required = false) String title) {
        try {
            return write(200, "获取成功!", "data", surveyScreenResultService.getScreenList(pageNo,pageSize,labelType,title));
            return write(200, "获取成功!", "data", surveyScreenResultService.getScreenList(pageNo, pageSize, labelType, title));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "获取失败!");
@ -112,7 +120,7 @@ public class DoctorSurveyScreenResultController extends WeixinBaseController {
    @RequestMapping(value = "getScreenResultDetail", method = RequestMethod.GET)
    @ApiOperation(value = "查看筛查结果记录详情")
    @ResponseBody
    public String getScreenResultDetail(@ApiParam(value = "筛查结果唯一code")@RequestParam(value = "code") String code) {
    public String getScreenResultDetail(@ApiParam(value = "筛查结果唯一code") @RequestParam(value = "code") String code) {
        try {
            return write(200, "获取成功!", "data", surveyScreenResultService.getScreenResultDetail(code));
        } catch (Exception e) {
@ -124,7 +132,7 @@ public class DoctorSurveyScreenResultController extends WeixinBaseController {
    @RequestMapping(value = "getTemplateAdvice", method = RequestMethod.GET)
    @ApiOperation(value = "获取健康建议列表")
    @ResponseBody
    public String getTemplateAdvice(@ApiParam(value = "筛查模板code")@RequestParam(value = "templateCode") String templateCode) {
    public String getTemplateAdvice(@ApiParam(value = "筛查模板code") @RequestParam(value = "templateCode") String templateCode) {
        try {
            return write(200, "获取成功!", "data", surveyScreenResultService.getTemplateAdviceList(templateCode));
        } catch (Exception e) {
@ -136,14 +144,14 @@ public class DoctorSurveyScreenResultController extends WeixinBaseController {
    @RequestMapping(value = "updateAfterFollwoing", method = RequestMethod.POST)
    @ApiOperation(value = "医生跟踪")
    @ResponseBody
    public String updateAfterFollwoing(@ApiParam(value = "筛查记录code")@RequestParam(value = "code") String code,
                                    @ApiParam(value = "建议code,多个逗号隔开")@RequestParam(value = "adviceCodes") String advicCcodes,
                                    @ApiParam(value = "其他建议")@RequestParam(value = "otherAdvice",required = false) String otherAdvice) {
    public String updateAfterFollwoing(@ApiParam(value = "筛查记录code") @RequestParam(value = "code") String code,
                                       @ApiParam(value = "建议code,多个逗号隔开") @RequestParam(value = "adviceCodes") String advicCcodes,
                                       @ApiParam(value = "其他建议") @RequestParam(value = "otherAdvice", required = false) String otherAdvice) {
        try {
            if (otherAdvice.length()>200){
                return write(-1,"其他建议的字数不得超过200字");
            if (otherAdvice.length() > 200) {
                return write(-1, "其他建议的字数不得超过200字");
            }
            surveyScreenResultService.updateAfterFollowing(code,advicCcodes,otherAdvice);
            surveyScreenResultService.updateAfterFollowing(code, advicCcodes, otherAdvice);
            return write(200, "跟踪成功!");
        } catch (Exception e) {
            e.printStackTrace();
@ -154,9 +162,9 @@ public class DoctorSurveyScreenResultController extends WeixinBaseController {
    @RequestMapping(value = "updateAfterEducate", method = RequestMethod.POST)
    @ApiOperation(value = "医生筛查后进行健康教育")
    @ResponseBody
    public String updateAfterEducate(@ApiParam(value = "筛查记录code")@RequestParam(value = "code") String code) {
    public String updateAfterEducate(@ApiParam(value = "筛查记录code") @RequestParam(value = "code") String code) {
        try {
            surveyScreenResultService.updateColume("is_educate",1,code);
            surveyScreenResultService.updateColume("is_educate", 1, code);
            return write(200, "更新健康教育成功!");
        } catch (Exception e) {
            e.printStackTrace();
@ -169,7 +177,7 @@ public class DoctorSurveyScreenResultController extends WeixinBaseController {
    @ResponseBody
    public String screenStatics() {
        try {
            return write(200, "获取数据成功!","data",surveyScreenResultService.screenStatics(getUID()));
            return write(200, "获取数据成功!", "data", surveyScreenResultService.screenStatics(getUID()));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "获取数据失败!");
@ -186,10 +194,10 @@ public class DoctorSurveyScreenResultController extends WeixinBaseController {
    @ApiOperation(value = "获取筛选条件数量(医生所签约)")
    @ResponseBody
    public String getAmountByDoctor(
            @ApiParam(value = "筛选条件",defaultValue = "{\"sex\":1,\"disease\":[2,5,6],\"healthCondition\":[0],\"service\":[1,3]}")
            @ApiParam(value = "筛选条件", defaultValue = "{\"sex\":1,\"disease\":[2,5,6],\"healthCondition\":[0],\"service\":[1,3]}")
            @RequestParam String json) {
        try {
            int amount = surveyScreenResultService.getAmountByDoctor(json,getUID());
            int amount = surveyScreenResultService.getAmountByDoctor(json, getUID());
            return write(200, "查询成功!", "amount", amount);
        } catch (Exception e) {
            e.printStackTrace();
@ -225,14 +233,14 @@ public class DoctorSurveyScreenResultController extends WeixinBaseController {
        }
    }
    @RequestMapping(value = "/getCount",method = RequestMethod.POST)
    @RequestMapping(value = "/getCount", method = RequestMethod.POST)
    @ApiOperation(value = "确认疾病筛查推送人数")
    public String getCount(@ApiParam(name = "labelType", value = "疾病类型", defaultValue = "3")
                               @RequestParam(value = "labelType", required = false) String labelType,
                           @ApiParam(name = "serverType",value = "服务类型,多个条件以逗号分割")
                               @RequestParam(value = "serverType", required = false) String serverType,
                           @ApiParam(name = "teamCode",value = "行政团队id")
                               @RequestParam(value = "teamCode", required = true) Long teamCode){
                           @RequestParam(value = "labelType", required = false) String labelType,
                           @ApiParam(name = "serverType", value = "服务类型,多个条件以逗号分割")
                           @RequestParam(value = "serverType", required = false) 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", patientInfo.size());
@ -243,22 +251,50 @@ public class DoctorSurveyScreenResultController extends WeixinBaseController {
    }
    @RequestMapping(value = "/createWorkOrder",method = RequestMethod.POST)
    @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 = false) String labelType,
                                  @ApiParam(name = "serverType",value = "服务类型,多个条件以逗号分割")
                                  @RequestParam(value = "serverType", required = false) String serverType,
                                  @ApiParam(name = "teamCode",value = "行政团队id")
                                  @RequestParam(value = "teamCode", required = true) Long teamCode){
    public String getAllQuestions(@ApiParam(name = "jsonData", value = "协同服务json字符串")
                                  @RequestParam(value = "jsonData", required = true) String jsonData,
                                  @ApiParam(name = "patientInfo", value = "居民信息")
                                  @RequestParam(value = "patientInfo", required = true) String patientInfo) {
        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, "创建失败!");
        }
    }
    @RequestMapping(value = "doctorSendScreenToPatients", method = RequestMethod.GET)
    @ApiOperation("确认疾病筛查推送人数")
    public String doctorSendArticleToPatients(
            @RequestParam(value = "patient", required = false) String patient,
            @RequestParam(value = "group", required = false, defaultValue = "") String group,
            @RequestParam(value = "labelType", required = false) String labelType,
            @RequestParam(value = "teamCode", required = true) Long teamCode) {
        try {
            String[] patients = new String[]{};
            String[] groups = new String[]{};
            if (StringUtils.isEmpty(patient) && StringUtils.isEmpty(group)) {
                return new String("请至少选择一个患者!");
            } else {
                if (StringUtils.isNotBlank(group)) {
                    if (group.contains(",")) {
                        groups = group.split(",");
                    } else {
                        groups = new String[]{group};
                    }
                }
            }
            Set<String> patientSet = new HashSet<>(); //放入set中可以去重复
            List<Map<String, Object>> patientInfo = surveyScreenResultService.initPatients(getUID(), groups, group, labelType, teamCode, patient, patientSet);
            if (patientInfo.size() == 0) {
                return new String("请至少选择一个患者!");
            }
            return write(200, "查询成功!", "data", patientInfo);
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/family/FamilyMemberController.java

@ -582,7 +582,7 @@ public class FamilyMemberController extends WeixinBaseController {
            }
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());
            return error(-1, "查询失败!");
        }
    }
}