|
@ -11,9 +11,7 @@ import com.yihu.ehr.framework.model.Result;
|
|
import com.yihu.ehr.framework.util.operator.CollectionUtil;
|
|
import com.yihu.ehr.framework.util.operator.CollectionUtil;
|
|
import com.yihu.ehr.framework.util.operator.StringUtil;
|
|
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.framework.util.sql.SqlCreator;
|
|
|
|
import com.yihu.ehr.standard.model.adapter.AdapterSchemeModel;
|
|
import com.yihu.ehr.standard.model.adapter.AdapterSchemeModel;
|
|
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.service.bo.StandardVersion;
|
|
import com.yihu.ehr.standard.service.bo.StandardVersion;
|
|
import org.hibernate.Criteria;
|
|
import org.hibernate.Criteria;
|
|
@ -119,10 +117,10 @@ public class StandardVersionService extends SQLGeneralDAO {
|
|
}
|
|
}
|
|
|
|
|
|
public Boolean versionNameValidate(Integer standardId, String versionName) {
|
|
public Boolean versionNameValidate(Integer standardId, String versionName) {
|
|
Map<String, String> query = new HashMap<>();
|
|
|
|
|
|
Map<String, Object> query = new HashMap<>();
|
|
Map<String, String> order = new HashMap<>();
|
|
Map<String, String> order = new HashMap<>();
|
|
query.put("name", versionName);
|
|
query.put("name", versionName);
|
|
|
|
|
|
|
|
query.put("publishStatus", 1);
|
|
List<StandardVersionModel> list = getList(standardId, query, order, 1, 0);
|
|
List<StandardVersionModel> list = getList(standardId, query, order, 1, 0);
|
|
if (!CollectionUtil.isEmpty(list)) {
|
|
if (!CollectionUtil.isEmpty(list)) {
|
|
return true;
|
|
return true;
|
|
@ -230,7 +228,7 @@ public class StandardVersionService extends SQLGeneralDAO {
|
|
}
|
|
}
|
|
|
|
|
|
public StandardVersionModel getLastestVersion(Integer standardId) {
|
|
public StandardVersionModel getLastestVersion(Integer standardId) {
|
|
Map<String, String> query = new HashMap<>();
|
|
|
|
|
|
Map<String, Object> query = new HashMap<>();
|
|
Map<String, String> order = new HashMap<>();
|
|
Map<String, String> order = new HashMap<>();
|
|
order.put("publisher", Constants.DESC);
|
|
order.put("publisher", Constants.DESC);
|
|
|
|
|
|
@ -306,12 +304,15 @@ public class StandardVersionService extends SQLGeneralDAO {
|
|
buildVersionTables(baseVersion, newVersion, standardVersionModel.getStandardId());
|
|
buildVersionTables(baseVersion, newVersion, standardVersionModel.getStandardId());
|
|
}
|
|
}
|
|
|
|
|
|
private List<StandardVersionModel> getList(Integer standardId, Map<String, String> query, Map<String, String> order, Integer limit, Integer offset) {
|
|
|
|
|
|
private List<StandardVersionModel> getList(Integer standardId, Map<String, Object> query, Map<String, String> order, Integer limit, Integer offset) {
|
|
Session session = getCurrentSession();
|
|
Session session = getCurrentSession();
|
|
Criteria criteria = session.createCriteria(StandardVersionModel.class);
|
|
Criteria criteria = session.createCriteria(StandardVersionModel.class);
|
|
criteria.add(Restrictions.eq("standardId", standardId));
|
|
criteria.add(Restrictions.eq("standardId", standardId));
|
|
criteria.add(Restrictions.eq("publishStatus", 1));
|
|
|
|
|
|
|
|
|
|
if (query != null) {
|
|
|
|
for (String key : query.keySet()) {
|
|
|
|
criteria.add(Restrictions.eq(key, query.get(key)));
|
|
|
|
}
|
|
|
|
}
|
|
if (limit != null) {
|
|
if (limit != null) {
|
|
criteria.setMaxResults(limit);
|
|
criteria.setMaxResults(limit);
|
|
if (offset != null) {
|
|
if (offset != null) {
|