|
@ -1,25 +1,15 @@
|
|
|
package com.yihu.wlyy.service.survey;
|
|
|
|
|
|
import com.fasterxml.jackson.databind.JavaType;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.google.common.annotations.VisibleForTesting;
|
|
|
import com.mchange.v2.util.DoubleWeakHashMap;
|
|
|
import com.yihu.wlyy.entity.doctor.survey.*;
|
|
|
import com.yihu.wlyy.repository.doctor.*;
|
|
|
import com.yihu.wlyy.service.BaseService;
|
|
|
import com.yihu.wlyy.util.MapUtill;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@ -46,14 +36,14 @@ public class PatientQuestionnaireService extends BaseService {
|
|
|
public JSONObject getSurveySummary(String patient, String id) throws Exception {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
Survey survey = surveyDao.findById(id);
|
|
|
// int complete = surveyUserDao.findByPatient(patient, id);
|
|
|
int complete = surveyUserDao.findByPatient(patient, id);
|
|
|
String title = survey.getTitle();
|
|
|
String comment = survey.getSurveyComment();
|
|
|
int status = survey.getStatus();
|
|
|
jsonObject.put("title", title);
|
|
|
jsonObject.put("comment", comment);
|
|
|
jsonObject.put("status", status);
|
|
|
// jsonObject.put("complete", complete);
|
|
|
jsonObject.put("complete", complete == 0 ? 0 : 1);
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
@ -98,11 +88,9 @@ public class PatientQuestionnaireService extends BaseService {
|
|
|
int isRequired = question.getIsRequired();
|
|
|
int type = question.getQuestionType();
|
|
|
// int sorts = question.getSort();
|
|
|
switch (type)
|
|
|
|
|
|
{
|
|
|
switch (type) {
|
|
|
case 0:
|
|
|
List<SurveyQuestionnaireOptions> options = surveyQuestionnaireOptionsDao.findById(qstCode);
|
|
|
List<SurveyQuestionnaireOptions> options = surveyQuestionnaireOptionsDao.findByIdAndQstCode(id, qstCode);
|
|
|
for (SurveyQuestionnaireOptions option : options) {
|
|
|
String content = option.getContent();
|
|
|
// 可构造集合,返回选项特定值
|
|
@ -116,7 +104,7 @@ public class PatientQuestionnaireService extends BaseService {
|
|
|
jsonObject.put("options", options);
|
|
|
break;
|
|
|
case 1:
|
|
|
List<SurveyQuestionnaireOptions> optionss = surveyQuestionnaireOptionsDao.findById(qstCode);
|
|
|
List<SurveyQuestionnaireOptions> optionss = surveyQuestionnaireOptionsDao.findByIdAndQstCode(id, qstCode);
|
|
|
for (SurveyQuestionnaireOptions option : optionss) {
|
|
|
String content = option.getContent();
|
|
|
if (option.getQuestionCodeNext() != null) {
|
|
@ -126,8 +114,8 @@ public class PatientQuestionnaireService extends BaseService {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
int maxNum = question.getMaxNum();
|
|
|
int minNum = question.getMinNum();
|
|
|
Integer maxNum = question.getMaxNum();
|
|
|
Integer minNum = question.getMinNum();
|
|
|
jsonObject.put("maxNum", maxNum);
|
|
|
jsonObject.put("minNum", minNum);
|
|
|
jsonObject.put("options", optionss);
|
|
@ -275,6 +263,8 @@ public class PatientQuestionnaireService extends BaseService {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
// 更改调查对象表答题状态为已答
|
|
|
surveyUserDao.modifyStatus(surveyCode,patient);
|
|
|
}
|
|
|
|
|
|
}
|