0
点赞
收藏
分享

微信扫一扫

医院叫号系统 ORACLE VIEW 视图

爱做梦的老巫婆 2022-04-04 阅读 67

--过敏
CREATE OR REPLACE VIEW T_YH_997C_ALLERGY AS
SELECT a.入院病区id NURSE_UNIT_CODE,b.id Sensitive_ID,a.病人id PATIENT_ID,
nvl(b.药物名,'-') Sensitive_NAME FROM 病案主页 a,病人过敏记录 b
where a.病人id=b.病人id and a.主页id=b.主页id and b.记录来源=3;

create or replace view  VIEW_YH_997C_ALLERGY   as  select * from  T_YH_997C_ALLERGY
create or replace  synonym ZL_YAHUA.VIEW_YH_997C_ALLERGY  FOR zlhis.VIEW_YH_997C_ALLERGY
grant select on   VIEW_YH_997C_ALLERGY    to ZL_YAHUA;

--患者在院
CREATE OR REPLACE VIEW T_YH_997C_PATIENT_INFO AS 
select a.当前病区id NURSE_UNIT_CODE,a.病人id PATIENT_ID,a.住院号 INP_NO,a.入院科室id DEPT_ID,a.入院病床 BED_NO,
a.姓名 PAT_NAME,a.性别 SEX,c.出生日期 BIRTHDAY,d.名称 NURSE_LEVEL,a.入院日期 IN_TIME,'' IN_DEPT_STATUS,'' OUT_DEPT_STATUS,
a.当前病况 PATIENT_STATUS,a.病人类型 CHARGE_TYPE,e.帐户余额 COST_BALANCE,'' PREPAID,'' COST,a.住院医师 DOCTOR_NAME,a.责任护士 NURSE_NAME,
b.诊断描述 DIAGNOSIS,'' ALLERGY_DRUGS,'' DIET_TYPE,'' OPERATION_TIME,'' Escort,'' Isolation
from 病案主页 a,(select * from 病人诊断记录 where 记录来源=3 and 诊断类型=2  and 诊断次序=1) b,病人信息 c ,护理等级 d,保险帐户 e
where a.病人id=c.病人id and a.病人id=b.病人id and a.主页id=b.主页id and d.序号=a.护理等级id and e.病人ID=a.病人id 
and a.出院日期 is null

create or replace view  VIEW_YH_997C_PATIENT_INFO   as  select * from  T_YH_997C_PATIENT_INFO
create or replace  synonym ZL_YAHUA.VIEW_YH_997C_PATIENT_INFO  FOR zlhis.VIEW_YH_997C_PATIENT_INFO
grant select on   VIEW_YH_997C_PATIENT_INFO    to ZL_YAHUA;

--费用
create or replace view t_yh_997c_cost_record as
select c.当前病区id NURSE_UNIT_CODE,c.病人id PATIENT_ID,a.病人科室id DEPT_ID,a.id BILL_ID,a.登记时间 BILL_TIME,
a.标准单价 PRICE,nvl(a.付数,1)*nvl(a.数次,1) AMOUNT,a.实收金额 MONEY,b.名称 BILL_NAME
from 住院费用记录 a ,收费项目目录 b,病案主页 c
where a.收费细目id=b.id and a.记录状态<>0  and a.病人id=c.病人id and a.主页id=c.主页id;

create or replace view  VIEW_yh_997c_cost_record    as  select * from  t_yh_997c_cost_record 
create or replace  synonym ZL_YAHUA.VIEW_yh_997c_cost_record   FOR zlhis.VIEW_yh_997c_cost_record 
grant select on   VIEW_yh_997c_cost_record     to ZL_YAHUA;

--药品
create or replace view t_yh_997c_drug_record as
select d.当前病区id NURSE_UNIT_CODE,d.病人id PATIENT_ID,b.病人科室id DEPT_ID,c.名称 Medicinal_NAME,
a.id Medicinal_ID,a.审核日期 Medicinal_TIME,a.零售价 PRICE,nvl(b.付数,1)*nvl(b.数次,1) AMOUNT,
e.规格 Specifications,b.实收金额 MONEY
from 药品收发记录 a,住院费用记录 b, 收费项目目录 c,病案主页 d,药品目录 e
where a.单据 in ('8','9') and b.收费类别 in ('5','6','7')  --and a.审核日期>sysdate-1
and b.收费细目id=e.药品id and a.记录状态=1
and a.no=b.no and a.药品id=b.收费细目id and b.收费细目id=c.id and b.记录状态<>0 and b.病人id=d.病人id
and b.主页id=d.主页id;

create or replace view  VIEW_yh_997c_drug_record     as  select * from  t_yh_997c_drug_record 
create or replace  synonym ZL_YAHUA.VIEW_yh_997c_drug_record    FOR zlhis.VIEW_yh_997c_drug_record 
grant select on   VIEW_yh_997c_drug_record      to ZL_YAHUA;

--医嘱
create or replace view t_yh_997c_orders as
select c.当前病区id NURSE_UNIT_CODE,c.病人id PATIENT_ID,a.病人科室id DEPT_ID,a.id DA_ID,a.开嘱时间 DA_TIME,
b.名称 DA_TYPE,a.开嘱医生 DOCTOR_NAME,a.医嘱内容 DA_CONTENT from 病人医嘱记录 a,诊疗项目类别 b ,病案主页 c
where a.诊疗类别=b.编码 and a.病人id=c.病人id and a.主页id=c.主页id
and a.医嘱状态<>4;

create or replace view  VIEW_yh_997c_orders      as  select * from  t_yh_997c_orders 
create or replace  synonym ZL_YAHUA.VIEW_yh_997c_orders    FOR zlhis.VIEW_yh_997c_orders 
grant select on  VIEW_yh_997c_orders     to ZL_YAHUA;

--出院
create or replace view t_yh_997c_settle_info as
Select a.当前病区id NURSE_UNIT_CODE,a.病人id PATIENT_ID,a.出院病床 BED_NO,a.姓名 PAT_NAME,a.出院日期 OUT_TIME  From 病案主页 a Where a.出院日期 Is Not Null;

create or replace view  VIEW_yh_997c_settle_info      as  select * from  t_yh_997c_settle_info
create or replace  synonym ZL_YAHUA.VIEW_yh_997c_settle_info    FOR zlhis.VIEW_yh_997c_settle_info 
grant select on  VIEW_yh_997c_settle_info     to ZL_YAHUA;

举报

相关推荐

0 条评论