|
@ -15,8 +15,10 @@ import com.yihu.ehr.framework.util.operator.StringUtil;
|
|
import com.yihu.ehr.framework.util.sql.RequestParamTransformer;
|
|
import com.yihu.ehr.framework.util.sql.RequestParamTransformer;
|
|
import com.yihu.ehr.standard.model.standard.StandardModel;
|
|
import com.yihu.ehr.standard.model.standard.StandardModel;
|
|
import com.yihu.ehr.standard.model.standard.StandardVersionModel;
|
|
import com.yihu.ehr.standard.model.standard.StandardVersionModel;
|
|
|
|
import com.yihu.ehr.standard.model.standard.resultModel.StandardParamResultModel;
|
|
import com.yihu.ehr.standard.model.standard.resultModel.StandardResultDetailModel;
|
|
import com.yihu.ehr.standard.model.standard.resultModel.StandardResultDetailModel;
|
|
import com.yihu.ehr.system.model.SystemOrganization;
|
|
import com.yihu.ehr.system.model.SystemOrganization;
|
|
|
|
import com.yihu.ehr.system.model.SystemParam;
|
|
import org.hibernate.Criteria;
|
|
import org.hibernate.Criteria;
|
|
import org.hibernate.Query;
|
|
import org.hibernate.Query;
|
|
import org.hibernate.Session;
|
|
import org.hibernate.Session;
|
|
@ -130,9 +132,8 @@ public class StandardService extends SQLGeneralDAO {
|
|
existFlg = existStandardVersionValid(standardModel.getId());
|
|
existFlg = existStandardVersionValid(standardModel.getId());
|
|
if (!publishedFlg && !existFlg) {
|
|
if (!publishedFlg && !existFlg) {
|
|
deleteEntity(StandardModel.class, standardId);
|
|
deleteEntity(StandardModel.class, standardId);
|
|
return Result.error("删除标准失败");
|
|
|
|
|
|
return Result.success("删除标准成功");
|
|
}
|
|
}
|
|
return Result.error("删除标准成功");
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
@ -209,11 +210,18 @@ public class StandardService extends SQLGeneralDAO {
|
|
return Result.error("获取标准失败");
|
|
return Result.error("获取标准失败");
|
|
}
|
|
}
|
|
|
|
|
|
public String getSysParamList() {
|
|
|
|
String paramSql = "select s.param_value from system_param s where s.param_key = '"+ Constants.STANDARD +"'";
|
|
|
|
Query paramQuery = getCurrentSession().createSQLQuery(paramSql);
|
|
|
|
String code = (String) paramQuery.uniqueResult();
|
|
|
|
return code;
|
|
|
|
|
|
public StandardParamResultModel getStandardParam(String paramKey) {
|
|
|
|
Criteria criteria = getCurrentSession().createCriteria(SystemParam.class);
|
|
|
|
criteria.add(Restrictions.eq("paramKey", paramKey));
|
|
|
|
SystemParam systemParam = (SystemParam) criteria.uniqueResult();
|
|
|
|
if (systemParam != null) {
|
|
|
|
StandardParamResultModel standardParamResultModel = (StandardParamResultModel) StandardParamResultModel.success("获取参数成功");
|
|
|
|
standardParamResultModel.setCode(systemParam.getParamValue());
|
|
|
|
standardParamResultModel.setOrgCode(systemParam.getOrgId());
|
|
|
|
return standardParamResultModel;
|
|
|
|
} else {
|
|
|
|
return (StandardParamResultModel) StandardParamResultModel.error("获取参数失败");
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public List<StandardResultDetailModel> getStandardListFormat(List<SystemOrganization> publisherModelList,
|
|
public List<StandardResultDetailModel> getStandardListFormat(List<SystemOrganization> publisherModelList,
|
|
@ -325,21 +333,25 @@ public class StandardService extends SQLGeneralDAO {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
String code = getStandardParam(Constants.STANDARD).getCode();
|
|
|
|
String orgCode = getStandardParam(Constants.STANDARD).getOrgCode();
|
|
|
|
List<SystemOrganization> publisherModelList = new ArrayList<>();
|
|
|
|
|
|
String code = getSysParamList();
|
|
|
|
String publisherHql = "FROM SystemOrganization";
|
|
|
|
Query query = getCurrentSession().createQuery(publisherHql);
|
|
|
|
List<SystemOrganization> publisherModelList = query.list();
|
|
|
|
|
|
|
|
Session session = getCurrentSession();
|
|
|
|
Criteria criteria = session.createCriteria(StandardModel.class);
|
|
|
|
|
|
Criteria criteria = getCurrentSession().createCriteria(StandardModel.class);
|
|
if (type == 0) {
|
|
if (type == 0) {
|
|
criteria.add(Restrictions.eq("code", code));
|
|
criteria.add(Restrictions.eq("code", code));
|
|
|
|
String publisherHql = "FROM SystemOrganization WHERE code =:orgCode";
|
|
|
|
Query query = getCurrentSession().createQuery(publisherHql);
|
|
|
|
query.setParameter("orgCode", orgCode);
|
|
|
|
publisherModelList = query.list();
|
|
} else if (type == 1) {
|
|
} else if (type == 1) {
|
|
criteria.add(Restrictions.ne("code", code));
|
|
criteria.add(Restrictions.ne("code", code));
|
|
|
|
String publisherHql = "FROM SystemOrganization";
|
|
|
|
Query query = getCurrentSession().createQuery(publisherHql);
|
|
|
|
publisherModelList = query.list();
|
|
}
|
|
}
|
|
List<StandardModel> standardModelList = criteria.list();
|
|
|
|
|
|
|
|
|
|
List<StandardModel> standardModelList = criteria.list();
|
|
Map<String, String> codeToIdMap = new HashMap<>();
|
|
Map<String, String> codeToIdMap = new HashMap<>();
|
|
List<Integer> idList = new ArrayList<>();
|
|
List<Integer> idList = new ArrayList<>();
|
|
for (StandardModel standardModel : standardModelList) {
|
|
for (StandardModel standardModel : standardModelList) {
|
|
@ -350,7 +362,7 @@ public class StandardService extends SQLGeneralDAO {
|
|
}
|
|
}
|
|
|
|
|
|
String versionHql = "FROM StandardVersionModel WHERE standardId IN :idList";
|
|
String versionHql = "FROM StandardVersionModel WHERE standardId IN :idList";
|
|
query = getCurrentSession().createQuery(versionHql);
|
|
|
|
|
|
Query query = getCurrentSession().createQuery(versionHql);
|
|
query.setParameterList("idList", idList);
|
|
query.setParameterList("idList", idList);
|
|
List<StandardVersionModel> versionModelList = query.list();
|
|
List<StandardVersionModel> versionModelList = query.list();
|
|
|
|
|
|
@ -398,7 +410,7 @@ public class StandardService extends SQLGeneralDAO {
|
|
for (String key : query.keySet()) {
|
|
for (String key : query.keySet()) {
|
|
if (key.equals("type")) {
|
|
if (key.equals("type")) {
|
|
Integer type = Integer.parseInt(query.get(key));
|
|
Integer type = Integer.parseInt(query.get(key));
|
|
String code = getSysParamList();
|
|
|
|
|
|
String code = getStandardParam(Constants.STANDARD).getCode();
|
|
if (type == 0) {
|
|
if (type == 0) {
|
|
criteria.add(Restrictions.eq("code", code));
|
|
criteria.add(Restrictions.eq("code", code));
|
|
} else if (type == 1) {
|
|
} else if (type == 1) {
|