merge into regist_person rp
using dual
on (rp.person_card = '10258968845')
when matched then
update
set corp_id = '2FC3BC773FE941CBAB8CEA31CC678595',
GROUP_ID = 'B51826A5B2494DD3BD3E5DBD4A089977',
PERSON_NAME = '李萍',
NAME_PYJM = 'LP',
PERSON_SEX = '女',
PERSON_AGE = '23',
PERSON_ADDRESS = '北京市总部基地',
PERSON_COUNTRY = '中国',
PERSON_NATION = '中国',
PERSON_PHNO = '12584785696',
PERSON_TEL = '10258968845',
PERSON_EMAIL = '[email protected]',
BIRTHDAY = to_date('1984-7-27', 'yyyy-mm-dd HH24:mi:ss'),
PERSON_POST = '',
PERSON_DEPT = '',
IS_MARRIAGE = '否'
when not matched then
insert
(PERSON_ID,
CORP_ID,
GROUP_ID,
PERSON_NO,
PERSON_NAME,
NAME_PYJM,
PERSON_SEX,
PERSON_AGE,
PERSON_CARD,
PERSON_ADDRESS,
PERSON_COUNTRY,
PERSON_NATION,
PERSON_PHNO,
PERSON_TEL,
PERSON_EMAIL,
BIRTHDAY,
PERSON_POST,
PERSON_DEPT,
IS_MARRIAGE)
values
('84f26837-46e9-4cd0-bc7d-3631c5f748cc',
'2FC3BC773FE941CBAB8CEA31CC678595',
'B51826A5B2494DD3BD3E5DBD4A089977',
'',
'李萍',
'LP',
'女',
'23',
'411223197503453000',
'北京市总部基地',
'中国',
'中国',
'12584785696',
'10258968845',
'[email protected]',
to_date('1984-7-27', 'yyyy-mm-dd HH24:mi:ss'),
'',
'',
'否')
根据身份证判断是否存在此人,存在则修改,不存在则添加
string sql = @" select kindname,emr_icd10kind.id,(sum(bb)+sum(cc)+sum(dd)+sum(ee)) as total, sum(aa) as zhiyu,sum(bb) as haozhuan,
sum(cc) as weiyu,sum(dd) as siwang,
sum(ee) as qita from emr_icd10kind
left join
(select icd10, decode(pa_leavehospital_nurcs,'治愈',count(pa_leavehospital_nurcs))aa,
decode(pa_leavehospital_nurcs,'好转',count(pa_leavehospital_nurcs)) bb,
decode(pa_leavehospital_nurcs,'未愈',count(pa_leavehospital_nurcs)) cc,
decode(pa_leavehospital_nurcs,'死亡',count(pa_leavehospital_nurcs)) dd,
decode(pa_leavehospital_nurcs,'其他',count(pa_leavehospital_nurcs)) ee
from PATIENTS_Statistics where Date_end >=to_date('" + dateBegin.ToString() + @"','yyyy-mm-dd hh24:mi:ss')
and Date_end <= to_date('" + dateEnd.ToString() + @"','yyyy-mm-dd hh24:mi:ss')
group by icd10,pa_leavehospital_nurcs) nn
on nn.icd10=emr_icd10kind.icdrange where emr_icd10kind.bigkindcode='D'
group by emr_icd10kind.id,kindname order by emr_icd10kind.id";
进行统计的一个示例
select * from(select rownum as rn,t.* from table t where rownum >0) where rn between 10 and 20