|
@ -35,6 +35,7 @@ import javax.xml.transform.TransformerFactory;
|
|
|
import javax.xml.transform.dom.DOMSource;
|
|
|
import javax.xml.transform.stream.StreamResult;
|
|
|
import java.io.*;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.UUID;
|
|
@ -62,8 +63,6 @@ public class CDADataSetRelationshipManager extends SQLGeneralDAO {
|
|
|
|
|
|
/**
|
|
|
* 根据关系ID删除关联关系
|
|
|
*
|
|
|
* @param ids
|
|
|
*/
|
|
|
public boolean deleteRelationshipById(String version, String[] ids) {
|
|
|
delete(BaseCDADataSetRelationship.class,ids, StandardVersion.CDADatasetTable, version);
|
|
@ -72,9 +71,6 @@ public class CDADataSetRelationshipManager extends SQLGeneralDAO {
|
|
|
|
|
|
/**
|
|
|
* 同时删除多个时 CDA ID用逗号隔开
|
|
|
*
|
|
|
* @param versionCode
|
|
|
* @param ids
|
|
|
*/
|
|
|
public boolean deleteDocument(String[] ids,String dataType,String versionCode) throws IOException {
|
|
|
deleteRelationshipByCdaIds(versionCode,ids);
|
|
@ -84,9 +80,6 @@ public class CDADataSetRelationshipManager extends SQLGeneralDAO {
|
|
|
|
|
|
/**
|
|
|
* 根据CDAID删除CDA数据集关联关系
|
|
|
*
|
|
|
* @param version
|
|
|
* @param cdaIds
|
|
|
*/
|
|
|
public void deleteRelationshipByCdaIds(String version, String[] cdaIds) throws IOException {
|
|
|
List<BaseCDADataSetRelationship> ls = cdaDocumentService.searchPageData(BaseCDADataSetRelationship.class,StandardVersion.CDADatasetTable,version,"cdaId=" + String.join(",", cdaIds),null,null,null);
|
|
@ -99,7 +92,6 @@ public class CDADataSetRelationshipManager extends SQLGeneralDAO {
|
|
|
} else {
|
|
|
ids += "," + cdaDataSetRelationship.getId();
|
|
|
}
|
|
|
//ids += cdaDataSetRelationship.getId();
|
|
|
}
|
|
|
|
|
|
deleteByField("id",ids.split(","),StandardVersion.CDADatasetTable,version);
|
|
@ -107,13 +99,6 @@ public class CDADataSetRelationshipManager extends SQLGeneralDAO {
|
|
|
|
|
|
/**
|
|
|
* 根据CDAID获取关联关系
|
|
|
*
|
|
|
* @param entityClass
|
|
|
* @param filters
|
|
|
* @param sorts
|
|
|
* @param size
|
|
|
* @param page
|
|
|
* @return
|
|
|
*/
|
|
|
public List getCDADataSetRelationships(Class entityClass,String version, String filters, String sorts, Integer size, Integer page) {
|
|
|
|
|
@ -269,10 +254,7 @@ public class CDADataSetRelationshipManager extends SQLGeneralDAO {
|
|
|
cdaDocument.setSchema(filePath);
|
|
|
cdaDocument.setVersionCode(versionCode);
|
|
|
Result result = cdaDocumentService.modify(versionCode, cdaDocument);
|
|
|
if(result.isSuccessFlg()){
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|
|
|
return result.isSuccessFlg();
|
|
|
}
|
|
|
|
|
|
public CDADocument saveCdaInfo(String cdaDocumentJsonData) throws Exception {
|
|
@ -329,20 +311,12 @@ public class CDADataSetRelationshipManager extends SQLGeneralDAO {
|
|
|
" 1 = 1 " +
|
|
|
"AND scdsr.cda_id = '" + cdaId + "' " +
|
|
|
"AND scdsr.dataset_id = sds.id";
|
|
|
RowMapper rowMapper = (RowMapper) BeanPropertyRowMapper.newInstance(MCdaDataSet.class);
|
|
|
return this.jdbcTemplate.query(sql, rowMapper);
|
|
|
return this.jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(MCdaDataSet.class));
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据CDA Id 和 版本编码 生成CDA文档
|
|
|
* @param cdaId
|
|
|
* @param versionCode
|
|
|
* @return
|
|
|
* @throws TransformerException
|
|
|
* @throws ParserConfigurationException
|
|
|
* @throws FileNotFoundException
|
|
|
* @throws UnsupportedEncodingException
|
|
|
*/
|
|
|
public boolean createCDASchemaFile(String cdaId, String versionCode) throws Exception {
|
|
|
List<CDADataSetRelationship> relationshipsList = getCDADataSetRelationshipByCDAId(CDADataSetRelationship.class,versionCode,cdaId);
|
|
@ -377,11 +351,11 @@ public class CDADataSetRelationshipManager extends SQLGeneralDAO {
|
|
|
//获取数据元
|
|
|
List<StdMetaDataModel> metaDatas = metaDataService.searchVersionData(StdMetaDataModel.class,StandardVersion.MetaDataTable,versionCode,"dataSetId="+dataSet.getId());
|
|
|
|
|
|
for (int j = 0; j < metaDatas.size(); j++) {
|
|
|
for (StdMetaDataModel metaData : metaDatas) {
|
|
|
Element rowEle = doc.createElement("xs:element");
|
|
|
rowEle.setAttribute("code", metaDatas.get(j).getCode());
|
|
|
rowEle.setAttribute("code", metaData.getCode());
|
|
|
|
|
|
String strColumnType = StringUtils.isEmpty(metaDatas.get(j).getColumnType()) ? "VARCHAR" : metaDatas.get(j).getColumnType();
|
|
|
String strColumnType = StringUtils.isEmpty(metaData.getColumnType()) ? "VARCHAR" : metaData.getColumnType();
|
|
|
|
|
|
rowEle.setAttribute("type", "xs:" + strColumnType);
|
|
|
rowSet.appendChild(rowEle);
|
|
@ -400,7 +374,7 @@ public class CDADataSetRelationshipManager extends SQLGeneralDAO {
|
|
|
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
|
|
|
transformer.setOutputProperty(OutputKeys.INDENT, "yes");//设置文档的换行与缩进
|
|
|
|
|
|
OutputStreamWriter pw = new OutputStreamWriter(new FileOutputStream(fileName), "UTF-8");
|
|
|
OutputStreamWriter pw = new OutputStreamWriter(new FileOutputStream(fileName), StandardCharsets.UTF_8);
|
|
|
StreamResult result = new StreamResult(pw);
|
|
|
transformer.transform(source, result);
|
|
|
}
|