123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- package com.yihu.ehr.service;
- import com.yihu.ehr.dbhelper.common.DBList;
- import com.yihu.ehr.dbhelper.common.DBQuery;
- import com.yihu.ehr.dbhelper.common.QueryCondition;
- import com.yihu.ehr.dbhelper.common.QueryEntity;
- import com.yihu.ehr.dbhelper.common.enums.Logical;
- import com.yihu.ehr.dbhelper.common.enums.Operation;
- import com.yihu.ehr.dbhelper.jdbc.DBHelper;
- import com.yihu.ehr.framework.model.DataGridResult;
- import com.yihu.ehr.framework.model.Result;
- import com.yihu.ehr.service.intf.IDatacollectManager;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import java.util.UUID;
- /**
- * 采集管理
- * Created by HZP on 2016/02/26.
- */
- @Service("datacollectManager")
- public class DatacollectManager implements IDatacollectManager {
- DBQuery query = new DBQuery();
- DBHelper db = new DBHelper();
- /*
- 获取数据集
- */
- @Override
- public DataGridResult getDataset(String name) throws Exception
- {
- String sql = "select * from adapter_dataset where org_dataset_id is not null";
- if(name!=null&&name.length()>0)
- {
- sql += " and (org_dataset_code like '%"+name+"%' or org_dataset_name like '%"+name+"%')";
- }
- DBList list = query.queryBySql(sql);
- return DataGridResult.fromDBList(list);
- }
- /*
- 获取数据元
- */
- @Override
- public DataGridResult getMetadata(String name,String adapterDatasetId,int page,int size) throws Exception
- {
- String sql = "select a.*,b.definition,b.type,b.format from adapter_metadata a left join org_metadata b on a.org_metadata_id = b.id where a.org_metadata_id is not null";
- if(adapterDatasetId!=null&& adapterDatasetId.length()>0)
- {
- sql += " and a.adapter_dataset_id = '"+adapterDatasetId+"'";
- }
- if(name!=null&&name.length()>0)
- {
- sql += " and (a.org_metadata_code like '%"+name+"%' or a.org_metadata_name like '%"+name+"%')";
- }
- DBList list = query.queryBySql(sql,page,size);
- return DataGridResult.fromDBList(list);
- }
- /*
- 获取跟踪数据
- */
- @Override
- public DataGridResult getJobLog(String patientId,String eventNo,String status,int page,int size) throws Exception
- {
- String sql = "select * from task_track where 1=1";
- if(patientId!=null&& patientId.length()>0)
- {
- sql += " and patient_id = '"+patientId+"'";
- }
- if(eventNo!=null&& eventNo.length()>0)
- {
- sql += " and event_no = '"+eventNo+"'";
- }
- if(status!=null&& status.length()>0)
- {
- sql += " and status = '"+status+"'";
- }
- DBList list = query.queryBySql(sql,page,size);
- return DataGridResult.fromDBList(list);
- }
- /*
- 获取补采数据
- */
- @Override
- public DataGridResult getJobRepeat(int page,int size) throws Exception
- {
- String sql = "select * from crawler_supply where 1=1 and start_time is not null and end_time is not null";
- DBList list = query.queryBySql(sql,page,size);
- return DataGridResult.fromDBList(list);
- }
- /*
- 新增补采
- */
- @Override
- @Transactional
- public Result addJobRepeat(String startTime,String endTime) throws Exception
- {
- String sql = "insert into crawler_supply (id,start_time,end_time,status) values ('"+ UUID.randomUUID() +"','"+startTime+"','"+endTime+"','0')";
- if(db.execute(sql))
- {
- return Result.success("保存成功!");
- }
- else{
- return Result.error(db.errorMessage);
- }
- }
- /*
- 删除补采
- */
- @Override
- @Transactional
- public Result deleteJobRepeat(String id) throws Exception
- {
- String sql = "delete from crawler_supply where id = '"+id+"'";
- if(db.execute(sql))
- {
- return Result.success("删除成功!");
- }
- else{
- return Result.error(db.errorMessage);
- }
- }
- }
|