瀏覽代碼

Merge branch 'dev' of zd_123/patient-co-management into dev

trick9191 7 年之前
父節點
當前提交
40324ae9f1

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

@ -41,7 +41,7 @@ public class SurveyScreenResult extends IdEntity implements Serializable{
    //是否高危预警(0不是  1是)
    private Integer isDanger;
    //是否预约(0未预约 1已预约)
    private Integer order;
    private Integer isOrder;
    //是否跟踪(0未跟踪 1已跟踪)
    private Integer following;
    //是否进行健康教育(0没有  1有)
@ -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, 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) {
    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 isOrder, 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;
@ -83,7 +83,7 @@ public class SurveyScreenResult extends IdEntity implements Serializable{
        this.screenResultScore = screenResultScore;
        this.screenResult = screenResult;
        this.isDanger = isDanger;
        this.order = order;
        this.isOrder = isOrder;
        this.following = following;
        this.isEducate = isEducate;
        this.over = over;
@ -207,12 +207,12 @@ public class SurveyScreenResult extends IdEntity implements Serializable{
    }
    @Column(name = "is_order")
    public int getOrder() {
        return order;
    public Integer getIsOrder() {
        return isOrder;
    }
    public void setOrder(int order) {
        this.order = order;
    public void setIsOrder(Integer isOrder) {
        this.isOrder = isOrder;
    }
    @Column(name = "following")

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

@ -18,7 +18,7 @@ public interface SurveyScreenResultDao extends PagingAndSortingRepository<Survey
    @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("select a from  SurveyScreenResult a where a.parentCode=?1 and a.templateCode=?2")
    @Query("select a from  SurveyScreenResult a where a.patientCode=?1 and a.templateCode=?2")
    List<SurveyScreenResult> getByPatientCodeAndTemplateCode(String patientCode,String templateCode);
    @Modifying

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

@ -88,7 +88,7 @@ public class SurveyScreenResultService extends BaseService {
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("1",dealType)){
            //已预约
            sql += " AND ssr.order = 1";
            sql += " AND ssr.is_order = 1";
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("2",dealType)){
            //已跟踪
@ -96,11 +96,11 @@ public class SurveyScreenResultService extends BaseService {
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("3",dealType)){
            //已接诊
            sql += " AND ssr.order = 2";
            sql += " AND ssr.is_order = 2";
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("4",dealType)){
            //待处理
            sql +=" AND ssr.`order` = 0 AND ssr.following= 0";
            sql +=" AND ssr.is_order = 0 AND ssr.following= 0";
        }
        List<Map<String,Object>> maps = jdbcTemplate.queryForList(sql);
        sql += " limit "+start+","+pageSize;
@ -217,7 +217,7 @@ public class SurveyScreenResultService extends BaseService {
            surveyScreenResult.setPatientName(patient.getName());
            surveyScreenResult.setOpenId(patient.getOpenid());
        }
        surveyScreenResult.setOrder(0);
        surveyScreenResult.setIsOrder(0);
        surveyScreenResult.setFollowing(0);
        surveyScreenResult.setOver(1);
        surveyScreenResult.setCzrq(new Date());
@ -244,9 +244,9 @@ 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 patientCode = String.valueOf(infoMap.get("patient_code"));
@ -263,7 +263,8 @@ public class SurveyScreenResultService extends BaseService {
        //题目和答案
        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=?";
        Map<String,Object> answerMap = new HashMap<>();
        String sql = "SELECT soa.*,sto.score,sto.content FROM wlyy_survey_option_answers soa LEFT JOIN wlyy_survey_template_options sto ON soa.options_code= sto.code WHERE soa.screen_result_code=? AND soa.patient=? AND soa.survey_code=?";
        List<Map<String,Object>> optionAnswersList = jdbcTemplate.queryForList(sql,new Object[]{code,patientCode,templateCode});
        for (SurveyTemplateQuestions surveyTemplateQuestions : questionList){
            Map<String,Object> map = new HashMap<>();
@ -274,13 +275,14 @@ public class SurveyScreenResultService extends BaseService {
                    map.put("option",option);
                }
            }
            json.put(surveyTemplateQuestions.getSort()+"",map);
            answerMap.put(surveyTemplateQuestions.getSort()+"",map);
        }
        json.put("answer",answerMap);
        //结果
        String reultSql ="SELECT ssr.screen_result_score,ssr.screen_result,str.advice FROM wlyy_survey_screen_result ssr LEFT JOIN wlyy_survey_template_result str ON ssr.screen_result_code = str.code WHERE ssr.code='"+code+"'";
        Map<String,Object> resultMap = jdbcTemplate.queryForMap(reultSql);
        int following = Integer.parseInt(String.valueOf(infoMap.get("following")));
        int order = Integer.parseInt(String.valueOf(infoMap.get("order")));
        int order = Integer.parseInt(String.valueOf(infoMap.get("is_order")));
        if (order>0){
            //已转诊
            String doctorSql ="SELECT pr.doctor_name FROM wlyy_survey_screen_result ssr LEFT JOIN wlyy_patient_reservation pr ON ssr.reservation_code= pr.`code` where ssr.`code`='"+code+"'";
@ -298,7 +300,8 @@ public class SurveyScreenResultService extends BaseService {
                    surveyAdviceList.add(surveyAdviceDao.getByCode(adviceCode));
                }
            }
            resultMap.put("advice",surveyAdviceList);
            resultMap.put("doctorAdvice",surveyAdviceList);
            resultMap.put("doctorOtherAdvice",infoMap.get("other_advice"));
        }
        json.put("result",resultMap);
        return json;
@ -342,12 +345,11 @@ public class SurveyScreenResultService extends BaseService {
        map.put("screenList",mapList);
        return map;
    }
    public Map<String,Object> patientGetResult(String patientCode){
    public List<SurveyScreenResult> patientGetResult(String patientCode){
        Map<String,Object> map = new HashedMap();
        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;
        return surveyScreenResultList;
    }
    public List<Map<String,Object>> getResultByTemplateCode(int pageNo,int pageSize,String templateCode,String patientCode){
@ -382,7 +384,7 @@ public class SurveyScreenResultService extends BaseService {
            if (surveyScreenResult.getFollowing()==1){
                followCount++;
            }
            if (surveyScreenResult.getOrder()==1){
            if (surveyScreenResult.getIsOrder()==1){
                orderCount++;
            }
            if (StringUtils.isNotEmpty(surveyScreenResult.getParentCode())){

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/device/PatientDeviceController.java

@ -439,8 +439,8 @@ public class PatientDeviceController extends BaseController {
                message.setDel("1");
                messageDao.save(message);
                //全部解绑后去判断就更新设备表中是否绑定字段
                deviceDetailService.unBindUpdateIsBinding(pd.getDeviceSn());
                patientDeviceLogService.savePatientDeviceLog(pd,pd.getDeviceSn(),2,2);
                deviceDetailService.unBindUpdateIsBinding(pd.getDeviceSn());
                return success("设备已删除!");
            } else {
                return error(-1, "不存在该设备!");