Browse Source

问卷修改

wangjun 4 years ago
parent
commit
632c06bb2c

+ 0 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyTemplateOptionDao.java

@ -15,5 +15,4 @@ public interface SurveyTemplateOptionDao extends PagingAndSortingRepository<Wlyy
    List<WlyySurveyTemplateOptionDO> findByQuestionCodeAndDelOrderBySortAsc(String questionCode,String templateCode,String del);
    List<WlyySurveyTemplateOptionDO> findByTemplateCodeAndDelOrderBySortAsc(String templateCode,String del);
    List<WlyySurveyTemplateOptionDO> findByQuestionCodeAndTemplateCodeaAnd(String questionCode,String templateCode);
}

+ 2 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyUserDao.java

@ -15,6 +15,6 @@ public interface SurveyUserDao extends PagingAndSortingRepository<WlyySurveyUser
    List<WlyySurveyUserDO> findBySurveyTempCodeAndStatus(String surveyTempCode,Integer status);
    @Query("from WlyySurveyUserDO c WHERE c.surveyTempCode = ?1 and c.patient =?2 and c.status =1 and c.createTime <= ?3")
    List<WlyySurveyUserDO> findBySurvey(String surveyTempCode,String patient,Date createTime);
    @Query("from WlyySurveyUserDO c WHERE c.surveyTempCode = ?1 and c.patient =?2 and c.status =1 ")
    List<WlyySurveyUserDO> findBySurvey(String surveyTempCode,String patient);
}

+ 6 - 4
business/base-service/src/main/java/com/yihu/jw/hospital/survey/service/SurveyService.java

@ -21,6 +21,7 @@ import com.yihu.jw.utils.EntityUtils;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.apache.xpath.operations.Bool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
@ -597,7 +598,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        if(result!=null&&result.size()>0){
            for(Map<String,Object> map:result){
                String tempId = (String)map.get("id");
                List<WlyySurveyUserDO> list = surveyUserDao.findBySurvey(tempId,patient, DateUtil.strToDate(DateUtil.dateToStr(new Date(),"yyyy-MM-dd")));
                List<WlyySurveyUserDO> list = surveyUserDao.findBySurvey(tempId,patient);
                if(list!=null&&list.size()>0){
                    map.put("isAnswer",true);
                }else{
@ -652,9 +653,9 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
            List<WlyySurveyUserAnswerDO> answerDOs = EntityUtils.jsonToList(suaJsons,WlyySurveyUserAnswerDO.class);
            for(WlyySurveyUserAnswerDO answerDO : answerDOs){
                answerDO.setSurverUserId(surveyUserDO.getId());
                WlyySurveyTemplateOptionDO surveyTemplateOptionDO = surveyTemplateOptionDao.findOne(answerDO.getTempOptionCode());
                /*WlyySurveyTemplateOptionDO surveyTemplateOptionDO = surveyTemplateOptionDao.findOne(answerDO.getTempOptionCode());
                answerDO.setTempQuestionCode(surveyTemplateOptionDO.getQuestionCode());
                answerDO.setTempOptionCode(surveyTemplateOptionDO.getCode());
                answerDO.setTempOptionCode(surveyTemplateOptionDO.getCode());*/
            }
            surveyUserAnswerDao.save(answerDOs);
            BasePatientBusinessDO basePatientBusinessDO = basePatientBusinessDao.findByDoctorPatientRelationCode(surveyUserDO.getPatient(),surveyUserDO.getSurveyTempCode(),surveyUserDO.getDoctor());
@ -674,7 +675,7 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        if(StringUtils.isNotBlank(surverUserId)){
            list = surveyUserAnswerDao.findBySurverUserId(surverUserId);
        }else{
            List<WlyySurveyUserDO> surveys = surveyUserDao.findBySurvey(tempId,patient, DateUtil.strToDate(DateUtil.dateToStr(new Date(),"yyyy-MM-dd")));
            List<WlyySurveyUserDO> surveys = surveyUserDao.findBySurvey(tempId,patient);
            System.out.println(surveys);
            if(surveys!=null&&surveys.size()>0){
                WlyySurveyUserDO wlyySurveyUserDO = surveys.get(0);
@ -927,4 +928,5 @@ public class SurveyService extends BaseJpaService<WlyySurveyQuestionDO, SurveyQu
        String response = HttpClientUtil.postBody(imAddr, params);
        return response;
    }
}