|
@ -10,10 +10,10 @@ import com.yihu.jw.entity.hospital.survey.WlyySurveyTemplateDO;
|
|
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleDao;
|
|
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleDao;
|
|
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleUserDao;
|
|
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleUserDao;
|
|
import com.yihu.jw.hospital.survey.dao.SurveyTemplateDao;
|
|
import com.yihu.jw.hospital.survey.dao.SurveyTemplateDao;
|
|
import com.yihu.jw.hospital.utils.HibenateUtils;
|
|
|
|
import com.yihu.jw.patient.dao.BasePatientBusinessDao;
|
|
import com.yihu.jw.patient.dao.BasePatientBusinessDao;
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -192,7 +192,7 @@ public class BasePatientBusinessService extends BaseJpaService<BasePatientBusine
|
|
wlyySurveyTemplateDO.setUsed(wlyySurveyTemplateDO.getUsed()+1);
|
|
wlyySurveyTemplateDO.setUsed(wlyySurveyTemplateDO.getUsed()+1);
|
|
}else if (used==0){
|
|
}else if (used==0){
|
|
knowledgeArticleUserDO.setUsed(0);
|
|
knowledgeArticleUserDO.setUsed(0);
|
|
wlyySurveyTemplateDO.setUsed(wlyySurveyTemplateDO.getUsed()-1);
|
|
|
|
|
|
wlyySurveyTemplateDO.setUsed(wlyySurveyTemplateDO.getUsed()==0?0:wlyySurveyTemplateDO.getUsed()-1);
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
if (used==1){
|
|
if (used==1){
|
|
@ -205,24 +205,81 @@ public class BasePatientBusinessService extends BaseJpaService<BasePatientBusine
|
|
knowledgeArticleUserDao.save(knowledgeArticleUserDO);
|
|
knowledgeArticleUserDao.save(knowledgeArticleUserDO);
|
|
surveyTemplateDao.save(wlyySurveyTemplateDO);
|
|
surveyTemplateDao.save(wlyySurveyTemplateDO);
|
|
}
|
|
}
|
|
public List<Map<String,Object>> getUsedList(Integer page,Integer pageSize){
|
|
|
|
|
|
public List<Map<String,Object>> getUsedList(String title,String doctor,Integer used,Integer page,Integer pageSize) {
|
|
StringBuffer sql = new StringBuffer();
|
|
StringBuffer sql = new StringBuffer();
|
|
sql.append("select a.id AS \"id\" ,a.title AS \"title\",a.template_comment AS \"template_comment\" ," +
|
|
sql.append("select a.id AS \"id\" ,a.title AS \"title\",a.template_comment AS \"template_comment\" ," +
|
|
" a.organization AS \"organization\",a.create_time AS \"create_time\" ," +
|
|
" a.organization AS \"organization\",a.create_time AS \"create_time\" ," +
|
|
"a.creater AS \"creater\"FROM wlyy_survey_template a " +
|
|
|
|
"JOIN wlyy_knowledge_article_user b on a.id = b.relation_code " +
|
|
|
|
"where 1=1");
|
|
|
|
sql.append(" and b.used = 1");
|
|
|
|
List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql.toString(),page,pageSize);
|
|
|
|
if (list.size()>0){
|
|
|
|
for (Map<String,Object> map :list){
|
|
|
|
String createTime= null==map.get("create_time")?"":map.get("create_time").toString();
|
|
|
|
map.put("create_time", DateUtil.dateToStrLong(DateUtil.strToDateLong(createTime)));
|
|
|
|
|
|
"a.creater AS \"creater\"FROM wlyy_survey_template a ");
|
|
|
|
//1为查询常用
|
|
|
|
if (null != used) {
|
|
|
|
if (1 == used) {
|
|
|
|
sql.append("JOIN wlyy_knowledge_article_user b on a.id = b.relation_code " +
|
|
|
|
"where 1=1");
|
|
|
|
sql.append(" and b.used = 1");
|
|
|
|
if (StringUtils.isNotEmpty(doctor)) {
|
|
|
|
sql.append(" and a.title like '%" + title + "%'");
|
|
|
|
|
|
|
|
}
|
|
|
|
if (StringUtils.isNotEmpty(doctor)) {
|
|
|
|
sql.append(" and a.creater = '" + doctor + "'");
|
|
|
|
|
|
|
|
}
|
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql.toString(), page, pageSize);
|
|
|
|
if (list.size() > 0) {
|
|
|
|
for (Map<String, Object> map : list) {
|
|
|
|
String createTime = null == map.get("create_time") ? "" : map.get("create_time").toString();
|
|
|
|
String creater = null == map.get("creater") ? "" : map.get("creater").toString();
|
|
|
|
map.put("create_time", DateUtil.dateToStrLong(DateUtil.strToDateLong(createTime)));
|
|
|
|
BaseDoctorDO doctorDO = doctorDao.findById(creater);
|
|
|
|
if (null!=doctor){
|
|
|
|
map.put("doctrName", doctorDO.getName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return list;
|
|
|
|
//0为查询模板
|
|
|
|
} else {
|
|
|
|
sql.append("where a.del = 1");
|
|
|
|
if (StringUtils.isNotEmpty(doctor)) {
|
|
|
|
sql.append(" and a.title like '%" + title + "%'");
|
|
|
|
}
|
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql.toString(), page, pageSize);
|
|
|
|
if (list.size() > 0) {
|
|
|
|
for (Map<String, Object> map : list) {
|
|
|
|
String createTime = null == map.get("create_time") ? "" : map.get("create_time").toString();
|
|
|
|
String creater = null == map.get("creater") ? "" : map.get("creater").toString();
|
|
|
|
map.put("create_time", DateUtil.dateToStrLong(DateUtil.strToDateLong(createTime)));
|
|
|
|
BaseDoctorDO doctorDO = doctorDao.findById(creater);
|
|
|
|
if (null!=doctor){
|
|
|
|
map.put("doctrName", doctorDO.getName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
//空位查我的问卷
|
|
|
|
} else {
|
|
|
|
sql.append("where a.del = 1");
|
|
|
|
if (StringUtils.isNotEmpty(doctor)) {
|
|
|
|
sql.append(" and a.creater = '" + doctor + "'");
|
|
}
|
|
}
|
|
|
|
if (StringUtils.isNotEmpty(doctor)) {
|
|
|
|
sql.append(" and a.title like '%" + title + "%'");
|
|
|
|
}
|
|
|
|
List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql.toString(), page, pageSize);
|
|
|
|
if (list.size() > 0) {
|
|
|
|
for (Map<String, Object> map : list) {
|
|
|
|
String createTime = null == map.get("create_time") ? "" : map.get("create_time").toString();
|
|
|
|
String creater = null == map.get("creater") ? "" : map.get("creater").toString();
|
|
|
|
map.put("create_time", DateUtil.dateToStrLong(DateUtil.strToDateLong(createTime)));
|
|
|
|
BaseDoctorDO doctorDO = doctorDao.findById(creater);
|
|
|
|
if (null!=doctor){
|
|
|
|
map.put("doctrName", doctorDO.getName());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return list;
|
|
}
|
|
}
|
|
return list;
|
|
|
|
}
|
|
}
|
|
/*public List<Map<String,Object>> mySurvey(String doctor,Integer page,Integer pageSize){
|
|
|
|
|
|
|
|
}*/
|
|
|
|
}
|
|
}
|