Prechádzať zdrojové kódy

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

# Conflicts:
#	common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java
wangzhinan 7 rokov pred
rodič
commit
1bfb91a129
13 zmenil súbory, kde vykonal 275 pridanie a 50 odobranie
  1. 11 7
      common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyScreenResult.java
  2. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java
  3. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/specialist/PatientDiseaseServerDao.java
  4. 6 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/specialist/SpecialDiseaseDao.java
  5. 21 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java
  6. 11 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java
  7. 56 25
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/survey/SurveyScreenResultService.java
  8. 70 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistService.java
  9. 21 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientInfoController.java
  10. 20 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/DoctorSurveyScreenResultController.java
  11. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/ManagerQuestionnaireController.java
  12. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/specialist/PatientSpecialistController.java
  13. 55 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/survey/PatientQuestionnaireController.java

+ 11 - 7
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/survey/SurveyScreenResult.java

@ -35,19 +35,19 @@ public class SurveyScreenResult extends IdEntity implements Serializable{
    //筛查结果设置中相关code
    private String screenResultCode;
    //筛查结果分值
    private int screenResultScore;
    private Integer screenResultScore;
    //筛查结果
    private String screenResult;
    //是否高危预警(0不是  1是)
    private int isDanger;
    private Integer isDanger;
    //是否预约(0未预约 1已预约)
    private int order;
    private Integer order;
    //是否跟踪(0未跟踪 1已跟踪)
    private int following;
    private Integer following;
    //是否进行健康教育(0没有  1有)
    private int isEducate;
    private Integer isEducate;
    //是否完成(0未完成 1已完成)
    private int over;
    private Integer over;
    //预约记录code
    private String reservationCode;
    //创建时间
@ -70,7 +70,7 @@ public class SurveyScreenResult extends IdEntity implements Serializable{
    public SurveyScreenResult() {
    }
    public SurveyScreenResult(String code, String templateCode, String templateTitle, int disease, String doctor, String patientCode, String openId, String patientName, int screenResultScore, String screenResult, int isDanger, int order, int following, int over, String reservationCode, Date czrq, int isAgain, String parentCode, String originCode, String adviceCode, String otherAdvice) {
    public SurveyScreenResult(String code, String templateCode, String templateTitle, int disease, String doctor, String patientCode, String openId, String patientName, String screenResultCode, Integer screenResultScore, String screenResult, Integer isDanger, Integer order, Integer following, Integer isEducate, Integer over, String reservationCode, Date czrq, int isAgain, String parentCode, String originCode, String adviceCode, String otherAdvice, int source, Date updateTime) {
        this.code = code;
        this.templateCode = templateCode;
        this.templateTitle = templateTitle;
@ -79,11 +79,13 @@ public class SurveyScreenResult extends IdEntity implements Serializable{
        this.patientCode = patientCode;
        this.openId = openId;
        this.patientName = patientName;
        this.screenResultCode = screenResultCode;
        this.screenResultScore = screenResultScore;
        this.screenResult = screenResult;
        this.isDanger = isDanger;
        this.order = order;
        this.following = following;
        this.isEducate = isEducate;
        this.over = over;
        this.reservationCode = reservationCode;
        this.czrq = czrq;
@ -92,6 +94,8 @@ public class SurveyScreenResult extends IdEntity implements Serializable{
        this.originCode = originCode;
        this.adviceCode = adviceCode;
        this.otherAdvice = otherAdvice;
        this.source = source;
        this.updateTime = updateTime;
    }
    @Column(name = "code")

+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java

@ -30,7 +30,7 @@ public class Message extends IdEntity {
	/** type
	 *  消息类型(1.是家庭签约信息  2.体征消息  3分配健管师 4.随访提醒 5.咨询回复提醒,6.续方咨询待审核提醒,7.续方消息待取药
	 *  8.续方支付成功后团队长分配健管师,9线下调整完成,10意见反馈 11账号申诉,12.协同服务 13.孕检提醒 14.文章提交审核消息  15、健康文章审核结果
	 *  16.专科医生申请签约消息,17、家庭医生转诊预约消息
	 *  16.专科医生申请签约消息
	 *  101患者申请取消签约、102患者同意取消签约、103患者拒绝取消签约、104患者填写了血糖记录、105患者填写了血压记录、106患者填写了体重记录、
	 *  107患者填写了腰围记录、108患者填写了运动记录、109患者填写了用药记录、110患者填写了饮食记录、111患者提交了问卷随访、112请求添加好友消息、
	 *  113入群消息、114群解散消息、115踢出群消息、116新的网络咨询、117网络咨询追问、

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/specialist/PatientDiseaseServerDao.java

@ -13,4 +13,5 @@ public interface PatientDiseaseServerDao extends
        PagingAndSortingRepository<PatientDiseaseServer, Long>,
        JpaSpecificationExecutor<PatientDiseaseServer> {
    List<PatientDiseaseServer> findByPatientAndDel(String patient,String del);
    List<PatientDiseaseServer> findBySpecialistRelationCodeAndDel(String code,String del);
}

+ 6 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/specialist/SpecialDiseaseDao.java

@ -2,14 +2,17 @@ package com.yihu.wlyy.repository.specialist;
import com.yihu.wlyy.entity.specialist.SpecialDisease;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2018/7/4.
 */
public interface SpecialDiseaseDao extends
        PagingAndSortingRepository<SpecialDisease, Long>,
        JpaSpecificationExecutor<SpecialDisease> {
public interface SpecialDiseaseDao extends PagingAndSortingRepository<SpecialDisease, Long>, JpaSpecificationExecutor<SpecialDisease> {
    SpecialDisease findByCode(String code);
    List<SpecialDisease> findByDel(String del);
}

+ 21 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java

@ -1811,4 +1811,25 @@ public class PatientInfoService extends BaseService {
        }
        return patientList;
    }
    public List<Map<String,Object>> getPatientSignByDoctor(int pageNo,int pageSize,String keyWord,String doctor)throws Exception{
        int start = (pageNo-1)*pageSize;
        String sql = "SELECT `name`,patient,mobile,idcard,openid FROM wlyy_sign_family WHERE `status`>0 AND (doctor='"+doctor+"' OR doctor_health='"+doctor+"')";
        if (StringUtils.isNotEmpty(keyWord)){
            sql += " and name LIKE '%"+keyWord+"%'";
        }
        sql += " limit ?,?";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql,new Object[]{start,pageSize});
        for (Map<String,Object> map : list){
            String idcard = String.valueOf(map.get("idcard"));
            map.put("sex",IdCardUtil.getSexForIdcard(idcard));
            map.put("age",IdCardUtil.getAgeForIdcard(idcard));
            /*String healthSql ="SELECT value1,value2 FROM device.wlyy_patient_health_index WHERE user='"+String.valueOf(map.get("patient"))+"' AND type=3 ORDER BY record_date DESC LIMIT 1";
            List<Map<String,Object>> healthMapList = jdbcTemplate.queryForList(healthSql);
            if (healthMapList!=null && healthMapList.size()>0){
                map.putAll(healthMapList.get(0));
            }*/
        }
        return list;
    }
}

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

@ -20,6 +20,7 @@ import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.health.PatientHealthIndexService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.service.specialist.SpecialistService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.IdCardUtil;
import org.apache.commons.collections.map.HashedMap;
@ -81,6 +82,8 @@ public class SignPatientLabelInfoService extends BaseService {
    TrackPatientDao trackPatientDao;
    @Autowired
    PatientHealthIndexService patientHealthIndexService;
    @Autowired
    SpecialistService specialistService;
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
@ -263,6 +266,14 @@ public class SignPatientLabelInfoService extends BaseService {
                json.put("isTrack","0");
            }
        }
        //1.4.9  是否专科医生服务
        JSONArray jsonArray =specialistService.findPatientSignSpecialist(patient);
        if(jsonArray!=null&&jsonArray.length()>0){
            json.put("isSpecialist",1);
        }else{
            json.put("isSpecialist",0);
        }
        return json;
    }

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

@ -3,8 +3,10 @@ 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.repository.doctor.*;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.survey.ManagerQuestionnaireService;
import com.yihu.wlyy.util.IdCardUtil;
@ -48,6 +50,8 @@ public class SurveyScreenResultService extends BaseService {
    private DoctorDao doctorDao;
    @Autowired
    private SurveyAdviceDao surveyAdviceDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    private Logger logger = LoggerFactory.getLogger(this.getClass());
@ -67,8 +71,8 @@ public class SurveyScreenResultService extends BaseService {
     */
    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.doctor='"+doctor+"'";
        String countSql = "SELECT count(*) num FROM wlyy_survey_screen_result ssr WHERE 1=1 AND ssr.over = 1 and ssr.doctor='"+doctor+"'";
        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;
        }
@ -80,7 +84,7 @@ public class SurveyScreenResultService extends BaseService {
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("1",dealType)){
            //已预约
            sql += " AND ssr.`order` = 1";
            sql += " AND ssr.order = 1";
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("2",dealType)){
            //已跟踪
@ -88,11 +92,17 @@ public class SurveyScreenResultService extends BaseService {
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("3",dealType)){
            //已接诊
            sql += " AND ssr.reservtion_code is not null";
            sql += " AND ssr.order = 2";
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("4",dealType)){
            //待处理
            sql +=" AND ssr.`order` = 0 AND ssr.following= 0";
        }
        Map<String,Object> map = jdbcTemplate.queryForMap(countSql);
        List<Map<String,Object>> maps = jdbcTemplate.queryForList(sql);
        sql += " 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;
    }
@ -138,7 +148,6 @@ public class SurveyScreenResultService extends BaseService {
                    JSONArray options = question.getJSONArray("options");
                    for (int j = 0; j < options.length(); j++) {
                        JSONObject option = new JSONObject(options.get(j).toString());
                        String code = getCode();
                        int score = Integer.parseInt(option.getString("score"));
                        totalScore += score;
                    }
@ -161,7 +170,7 @@ public class SurveyScreenResultService extends BaseService {
        surveyScreenResult.setSource(source);
        //是来自再次评估
        if (isAgain==1){
            surveyScreenResult.setPatientName(lastCode);
            surveyScreenResult.setParentCode(lastCode);
            surveyScreenResult.setOriginCode(originCode);
        }else {
            //来自第一次筛查评分
@ -172,8 +181,20 @@ public class SurveyScreenResultService extends BaseService {
            surveyScreenResult.setTemplateTitle(surveyTemplates.getTitle());
            surveyScreenResult.setDisease(surveyTemplates.getDiseaseType());
        }
        surveyScreenResult.setDoctor(doctor);
        surveyScreenResult.setParentCode(patientCode);
        //来自医生发放和自我评估不一样来源
        if (source==1){
            surveyScreenResult.setDoctor(doctor);
        }else {
            SignFamily signFamily = signFamilyDao.findByPatient(patientCode);
            if (signFamily!=null && StringUtils.isNotEmpty(signFamily.getDoctor())){
                surveyScreenResult.setDoctor(signFamily.getDoctor());
            }
            if (signFamily!=null && StringUtils.isNotEmpty(signFamily.getDoctorHealth())){
                surveyScreenResult.setDoctor(signFamily.getDoctorHealth());
            }
        }
        surveyScreenResult.setPatientCode(patientCode);
        if (patient!=null){
            surveyScreenResult.setPatientName(patient.getName());
            surveyScreenResult.setOpenId(patient.getOpenid());
@ -204,26 +225,27 @@ public class SurveyScreenResultService extends BaseService {
            json.put("message","没有改筛查结果!");
            return json;
        }
        String idcard = String.valueOf(infoMap.get("idcard"));
        /*String idcard = String.valueOf(infoMap.get("idcard"));
        infoMap.put("sex",IdCardUtil.getSexForIdcard(idcard));
        infoMap.put("age",IdCardUtil.getAgeForIdcard(idcard));
        infoMap.put("age",IdCardUtil.getAgeForIdcard(idcard));*/
        String templateCode = String.valueOf(infoMap.get("template_code"));
        String doctorCode = String.valueOf(infoMap.get("doctor"));
        String surveyScreenResultCode = String.valueOf(infoMap.get("code"));
        //String doctorCode = String.valueOf(infoMap.get("doctor"));
        String patientCode = String.valueOf(infoMap.get("patient_code"));
        Doctor doctor = doctorDao.findByCode(doctorCode);
       /* Doctor doctor = doctorDao.findByCode(doctorCode);
        if (doctor!=null){
            infoMap.put("doctorName",doctor.getName());
        }
        }*/
        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";
        Map<String,Object> healthMap = jdbcTemplate.queryForMap(healthSql);
        json.put("health",healthMap);
        /*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){
            json.put("health",healthMapList.get(0));
        }*/
        //题目和答案
        List<SurveyTemplateQuestions> questionList = surveyTemplateQuestionsDao.findById(templateCode);
        String sql = "SELECT soa.*,sto.score 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[]{surveyScreenResultCode,patientCode,templateCode});
        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);
@ -236,13 +258,17 @@ public class SurveyScreenResultService extends BaseService {
            json.put(surveyTemplateQuestions.getSort()+"",map);
        }
        //结果
        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=?";
        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("order")));
        if (order==1){
        if (order>0){
            //已转诊
            //@TODO
            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){
            String adviceCodes = String.valueOf(infoMap.get("advice_code"));
@ -260,8 +286,9 @@ public class SurveyScreenResultService extends BaseService {
    }
    public List<SurveyTemplateAdvice> getTemplateAdviceList(String templateCode){
        return surveyTemplateAdviceDao.getByTemplateCode(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{
@ -294,7 +321,7 @@ public class SurveyScreenResultService extends BaseService {
            mapList.add(sMap);
        }
        map.put("screenList",mapList);
        String sql = "SELECT a.* FROM (SELECT * FROM wlyy_survey_screen_result ORDER BY czrq DESC) a WHERE a.patient_code='"+patientCode+"' GROUP BY a.template_code";
        String sql = "SELECT a.* FROM (SELECT * FROM wlyy_survey_screen_result WHERE patient_code='"+patientCode+"' ORDER BY czrq DESC) a  GROUP BY a.template_code";
        List<SurveyScreenResult> surveyScreenResultList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SurveyScreenResult.class));
        map.put("result",surveyScreenResultList);
        return map;
@ -357,4 +384,8 @@ public class SurveyScreenResultService extends BaseService {
        return  resultMap;
    }
    public void getSpecialDoctorScreenList(String doctor,int type,int pageNo,int pageSize){
    }
}

+ 70 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistService.java

@ -6,6 +6,7 @@ import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabel;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.specialist.PatientDiseaseServer;
import com.yihu.wlyy.entity.specialist.SpecialDisease;
import com.yihu.wlyy.entity.specialist.TeamDiseaseRelation;
@ -73,6 +74,8 @@ public class SpecialistService extends BaseService {
    private SpecialDiseaseDao specialDiseaseDao;
    @Autowired
    private MessageDao messageDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    public String setPatientLabelInfo(List<SignPatientLabelInfo> list) {
        if (list != null && list.size() > 0) {
@ -480,6 +483,17 @@ public class SpecialistService extends BaseService {
                message.setOver("1");//未处理
                message.setRelationCode(rs.getString("obj"));
                message.setDel("1");
                JSONObject dataJson = new JSONObject();
                dataJson.put("doctor",d.getCode());
                dataJson.put("doctorName",d.getName());
                dataJson.put("hospital",d.getHospital());
                dataJson.put("hospitalName",d.getHospitalName());
                dataJson.put("dept",d.getDept());
                dataJson.put("deptName",d.getDeptName());
                message.setReason(dataJson.toString());
                message.setState(1);
                messageDao.save(message);
@ -489,14 +503,20 @@ public class SpecialistService extends BaseService {
                mes.put("data", "");
                return mes;
            } else if ("doctor_exist".equals(rs.getString("message"))) {
                JSONObject obj = rs.getJSONObject("obj");
                mes.put("code", -1);
                mes.put("mes", "医生与患者已经签约");
                mes.put("data", rs.getJSONObject("obj").toString());
                String relationCode =  obj.getString("relationCode");
                obj.put("server",patientDiseaseServerDao.findBySpecialistRelationCodeAndDel(relationCode,"1"));
                mes.put("data", obj.toString());
                return mes;
            } else if ("team_exist".equals(rs.getString("message"))) {
                JSONObject obj = rs.getJSONObject("obj");
                mes.put("code", -2);
                mes.put("mes", "团队与患者已经签约");
                mes.put("data", rs.getJSONObject("obj").toString());
                String relationCode =  obj.getString("relationCode");
                obj.put("server",patientDiseaseServerDao.findBySpecialistRelationCodeAndDel(relationCode,"1"));
                mes.put("data", obj.toString());
                return mes;
            } else {
                logger.info(response.getContent());
@ -523,6 +543,42 @@ public class SpecialistService extends BaseService {
                m.setRead(0);
                messageDao.save(m);
            }
            JSONObject josn =  rs.getJSONObject("obj");
            SignFamily sign =  signFamilyDao.findByPatient(josn.getString("patient"));
            Patient p = patientDao.findByCode(josn.getString("patient"));
            Doctor d = doctorDao.findByCode(josn.getString("doctor"));
            // 添加签约申请消息
            Message message = new Message();
            message.setCzrq(new Date());
            message.setCreateTime(new Date());
            message.setContent("您有一个居民开通共管服务!");
            message.setRead(1);//设置未读
            message.setReceiver(sign.getDoctor());//设置接受医生的code
            message.setSender(p.getCode());//设置发送的用户
            message.setSenderName(p.getName());
            message.setCode(getCode());
            message.setTitle("专科医生共管通知");
            message.setType(18);//家庭签约取消信息
            message.setReadonly(0);//是否只读消息
            message.setSex(p.getSex());
            message.setOver("1");//未处理
            message.setRelationCode(relationCode);
            message.setDel("1");
            message.setState(1);
            JSONObject dataJson = new JSONObject();
            dataJson.put("doctor",d.getCode());
            dataJson.put("doctorName",d.getName());
            dataJson.put("hospital",d.getHospital());
            dataJson.put("hospitalName",d.getHospitalName());
            dataJson.put("dept",d.getDept());
            dataJson.put("deptName",d.getDeptName());
            message.setReason(dataJson.toString());
            messageDao.save(message);
            return "1";
        }
        return "0";
@ -531,10 +587,13 @@ public class SpecialistService extends BaseService {
    public JSONObject findPatientSigninfo(String code) throws Exception {
        Map<String, Object> param = new HashedMap();
        param.put("code", code);
        HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/agreeSpecialistTeam", param);
        HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/findPatientSigninfo", param);
        JSONObject rs = new JSONObject(response.getContent());
        if ("succes".equals(rs.getString("message"))) {
            return rs.getJSONObject("obj");
            JSONObject json = rs.getJSONObject("obj");
            List<PatientDiseaseServer> patientDiseaseServers =  patientDiseaseServerDao.findBySpecialistRelationCodeAndDel(code,"1");
            json.put("diseaseServer",patientDiseaseServers);
            return json;
        }
        return null;
    }
@ -545,7 +604,13 @@ public class SpecialistService extends BaseService {
        HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/findPatientTeamList", param);
        JSONObject rs = new JSONObject(response.getContent());
        if ("succes".equals(rs.getString("message"))) {
            return rs.getJSONArray("obj");
            JSONArray jr = rs.getJSONArray("obj");
            for(int i=0;i<rs.getJSONArray("obj").length();i++){
                JSONObject j = jr.getJSONObject(i);
                String relationCode =  j.getString("relationCode");
                j.put("server",patientDiseaseServerDao.findBySpecialistRelationCodeAndDel(relationCode,"1"));
            }
            return jr;
        }
        return null;
    }

+ 21 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientInfoController.java

@ -569,4 +569,25 @@ public class PatientInfoController extends BaseController {
            return error( -1, "查询失败!");
        }
    }
    @RequestMapping(value = "/getPatientSignByDoctor",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("查询医生的签约居民")
    public String getPatientSignByDoctor(@ApiParam(value = "关键搜索词", name = "keyWord") @RequestParam(value = "keyWord",required = false,defaultValue = "")String keyWord,
                                         @ApiParam(name="pageNo",value="第几页",defaultValue = "1") @RequestParam(value="pageNo",required = true) String pageNo,
                                         @ApiParam(name="pageSize",value="",defaultValue = "10") @RequestParam(value="pageSize",required = true) String pageSize){
        if (StringUtils.isBlank(pageSize)) {
            pageSize = "10";
        }
        if (pageNo.equals("0")){
            pageNo = "1";
        }
        try {
            return  write(200,"查找成功!","data",patientInfoService.getPatientSignByDoctor(Integer.parseInt(pageNo),Integer.parseInt(pageSize),keyWord,getUID()));
        } catch (Exception e) {
            error(e);
            return error( -1, "查询失败!");
        }
    }
}

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

@ -1,6 +1,7 @@
package com.yihu.wlyy.web.doctor.survey;
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.task.PushMsgTask;
@ -40,6 +41,8 @@ public class DoctorSurveyScreenResultController extends BaseController {
    private WechatTemplateConfigDao templateConfigDao;
    @Autowired
    private SurveyScreenResultService surveyScreenResultService;
    @Autowired
    private SpecialDiseaseDao specialDiseaseDao;
    private Logger logger = LoggerFactory.getLogger(this.getClass());
@ -54,14 +57,14 @@ public class DoctorSurveyScreenResultController extends BaseController {
     * @return
     */
    @RequestMapping(value = "getResultList", method = RequestMethod.GET)
    @ApiOperation(value = "获取问卷列表")
    @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已接诊)")@RequestParam(value = "dealType",required = false) String dealType,
                                @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") String isDanger){
                                @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));
        } catch (Exception e) {
@ -70,6 +73,18 @@ public class DoctorSurveyScreenResultController extends BaseController {
        }
    }
    @RequestMapping(value = "getSpecialDisease", method = RequestMethod.GET)
    @ApiOperation(value = "获取专科疾病类型")
    @ResponseBody
    public String getSpecialDisease(){
        try {
            return write(200, "查询成功!", "data", specialDiseaseDao.findByDel("1"));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }
    /**
     * 获取筛查问卷列表
@ -137,10 +152,10 @@ public class DoctorSurveyScreenResultController extends BaseController {
    public String updateAfterEducate(@ApiParam(value = "筛查记录code")@RequestParam(value = "code") String code) {
        try {
            surveyScreenResultService.updateColume("is_educate",1,code);
            return write(200, "发送健康教育成功!");
            return write(200, "更新健康教育成功!");
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "发送健康教育失败!");
            return write(-1, "更新健康教育失败!");
        }
    }

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

@ -569,7 +569,7 @@ public class ManagerQuestionnaireController extends WeixinBaseController {
    public String saveAnswer( @RequestParam String jsonData,
                              @ApiParam(value = "居民code")@RequestParam(value = "patientCode")String patientCode,
                              @ApiParam(value = "问卷标签")@RequestParam(value = "labelType")int labelType,
                              @ApiParam(value = "筛查来(labelType=5时要填),0是第一次筛查 1是再次评估")@RequestParam(value = "isAgain")int isAgain,
                              @ApiParam(value = "筛查入口(labelType=5时要填),0是第一次筛查 1是再次评估")@RequestParam(value = "isAgain")int isAgain,
                              @ApiParam(value = "来源(1医生发放 2居民自我评估)")@RequestParam(value = "source")int source) {
        try {

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/specialist/PatientSpecialistController.java

@ -63,7 +63,7 @@ public class PatientSpecialistController extends BaseController{
        }
    }
    @RequestMapping(value = "/signSpecialist", method = RequestMethod.GET)
    @RequestMapping(value = "/signSpecialist", method = RequestMethod.POST)
    @ApiOperation(value = "居民提交专科医生团队签约申请")
    public String signSpecialist(@ApiParam(name = "patient", value = "患者code") @RequestParam(required = true)String patient,
                                 @ApiParam(name = "doctor", value = "医生code") @RequestParam(required = true)String doctor,

+ 55 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/survey/PatientQuestionnaireController.java

@ -8,6 +8,7 @@ import com.yihu.wlyy.rest.model.common.SimpleResult;
import com.yihu.wlyy.service.app.survey.SurveyScreenResultService;
import com.yihu.wlyy.service.questionnaire.QuestionnaireService;
import com.yihu.wlyy.service.questionnaire.QuestionnaireUsersService;
import com.yihu.wlyy.service.survey.ManagerQuestionnaireService;
import com.yihu.wlyy.service.survey.PatientQuestionnaireService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
@ -44,6 +45,8 @@ public class    PatientQuestionnaireController extends BaseController {
    private QuestionnaireUsersDao questionnaireUsersDao;
    @Autowired
    private SurveyScreenResultService surveyScreenResultService;
    @Autowired
    private ManagerQuestionnaireService managerQuestionnaireService;
    @RequestMapping(value = "getSurveySummary", method = RequestMethod.GET)
    @ApiOperation(value = "居民端获取问卷概述")
@ -106,7 +109,7 @@ public class    PatientQuestionnaireController extends BaseController {
                                @ApiParam(value = "显示记录数")@RequestParam(value = "pageSize") int pageSize,
                                @ApiParam(value = "问卷类型标签")@RequestParam(value = "labelType") int labelType) {
        try {
            return write(200, "获取成功!", "data", surveyScreenResultService.patientGetList(pageNo,pageSize,labelType,getUID()));
            return write(200, "获取成功!", "data", surveyScreenResultService.patientGetList(pageNo,pageSize,labelType,getRepUID()));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "获取失败!");
@ -120,10 +123,60 @@ public class    PatientQuestionnaireController extends BaseController {
                                         @ApiParam(value = "显示记录数")@RequestParam(value = "pageSize") int pageSize,
                                         @ApiParam(value = "问卷code")@RequestParam(value = "templateCode") String templateCode) {
        try {
            return write(200, "获取成功!", "data", surveyScreenResultService.getResultByTemplateCode(pageNo,pageSize,templateCode,getUID()));
            return write(200, "获取成功!", "data", surveyScreenResultService.getResultByTemplateCode(pageNo,pageSize,templateCode,getRepUID()));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "获取失败!");
        }
    }
    @RequestMapping(value = "getScreenResultDetail", method = RequestMethod.GET)
    @ApiOperation(value = "查看筛查结果记录详情")
    @ResponseBody
    public String getScreenResultDetail(@ApiParam(value = "筛查结果唯一code")@RequestParam(value = "code") String code) {
        try {
            return write(200, "获取成功!", "data", surveyScreenResultService.getScreenResultDetail(code));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "获取失败!");
        }
    }
    @RequestMapping(value = "/getAllQuestions",method = RequestMethod.GET)
    @ApiOperation(value = "获取所有问卷题目")
    @ResponseBody
    public String getAllQuestions(@ApiParam(name = "surveyTemplateCode",value = "问卷模板code")@RequestParam(value = "surveyTemplateCode",required = true)String surveyTemplateCode){
        try {
            JSONObject jsonObject = managerQuestionnaireService.getAllQuestions(surveyTemplateCode);
            return write(200, "查询成功!", "data", jsonObject);
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "saveScreenAnswer", method = RequestMethod.POST)
    @ApiOperation(value = "保存用户答案")
    @ResponseBody
    public String saveAnswer( @RequestParam String jsonData,
                              @ApiParam(value = "居民code")@RequestParam(value = "patientCode")String patientCode,
                              @ApiParam(value = "问卷标签")@RequestParam(value = "labelType")int labelType,
                              @ApiParam(value = "筛查入口(labelType=5时要填),0是第一次筛查 1是再次评估")@RequestParam(value = "isAgain")int isAgain,
                              @ApiParam(value = "来源(1医生发放 2居民自我评估)")@RequestParam(value = "source")int source) {
        try {
            JSONObject json = new JSONObject(jsonData);
            //如果是评分筛查还要保存最后记录
            String screenResultcode = "";
            if (labelType==5){
                screenResultcode = surveyScreenResultService.saveScreenResult(patientCode,getUID(),isAgain,source,json);
            }
            managerQuestionnaireService.saveAnswer(patientCode, screenResultcode,json);
            return write(200, "保存成功!");
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "保存失败!");
        }
    }
}