|
@ -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,14 +96,15 @@ 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;
|
|
|
|
|
|
sql += " order by ssr.czrq desc limit "+start+","+pageSize;
|
|
|
List<SurveyScreenResult> surveyScreenResultList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SurveyScreenResult.class));
|
|
|
Map<String,Object> map = new HashedMap();
|
|
|
map.put("num",maps.size());
|
|
@ -119,9 +120,14 @@ public class SurveyScreenResultService extends BaseService {
|
|
|
* @param labelType
|
|
|
* @return
|
|
|
*/
|
|
|
public List<SurveyTemplates> getScreenList(int pageNo,int pageSize,int labelType){
|
|
|
public List<SurveyTemplates> getScreenList(int pageNo,int pageSize,int labelType,String title){
|
|
|
int start = (pageNo-1)*pageSize;
|
|
|
String sql = "SELECT st.* FROM wlyy_survey_templates st LEFT JOIN wlyy_survey_label_info sli ON st.`code`= sli.relation_code WHERE st.del = 1 and sli.label="+labelType+" order by st.create_time desc limit "+start+","+pageSize;
|
|
|
String sql = "SELECT st.* FROM wlyy_survey_templates st LEFT JOIN wlyy_survey_label_info sli ON st.`code`= sli.relation_code" +
|
|
|
" WHERE st.del = 1 and sli.label="+labelType+"";
|
|
|
if (StringUtils.isNotEmpty(title)){
|
|
|
sql += " and st.title like '%"+title+"%'";
|
|
|
}
|
|
|
sql += " order by st.create_time desc limit "+start+","+pageSize;
|
|
|
List<SurveyTemplates> surveyTemplatesList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SurveyTemplates.class));
|
|
|
return surveyTemplatesList;
|
|
|
}
|
|
@ -217,7 +223,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 +250,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 +269,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 +281,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 +306,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;
|
|
@ -330,7 +339,7 @@ public class SurveyScreenResultService extends BaseService {
|
|
|
|
|
|
public Map<String,Object> patientGetList(int pageNo,int pageSize,int labelType,String patientCode){
|
|
|
Map<String,Object> map = new HashedMap();
|
|
|
List<SurveyTemplates> templates = getScreenList(pageNo,pageSize,labelType);
|
|
|
List<SurveyTemplates> templates = getScreenList(pageNo,pageSize,labelType,null);
|
|
|
List<Map<String,Object>> mapList = new ArrayList<>();
|
|
|
for (SurveyTemplates surveyTemplates : templates){
|
|
|
Map<String,Object> sMap = new HashedMap();
|
|
@ -342,12 +351,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 +390,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())){
|