oracle资料库
shell脚本命令
MySQL资料
Linux 安装mariadb
MySQL安装部署四种安装方式
Linux操作系统彻底删除MySQL——详细步骤
windows 下安装Mysql
MySQL常用命令
sqlite
Oracle
运行情况查询汇总
通过命令行导出AWR报告
alert日志存放位置
归档日志查看与清理
oracle数据库体系结构
SPFILE的搜索顺序
备份还原
RMAN备份
数据泵备份
EXP/IMP
数据库自动任务
oracle部署安装
Linux下安装oracle11G
windows下安装数据库
数据库维护篇
SGA/PGA修改
单独BUG参数修改
常用参数修改命令
数据库异常情况典型
用户密码管理
TNS详解及常见错误码
SQL语句
练习题
练习二
oracle 数据库去重复
多行字段拼接成一列 (listagg函数)
判断是否为数字
数据库空间管理
lob字段压缩
碎片整理
临时表空间
临时表空间管理
Oracle服务脱机迁移手册
windows 磁盘空间不足 转移数据文件
常用函数
发现患者是否有特殊字符
获取汉字首拼
通过关键词截取病历数据
转入转出文书记录获取数据
blob转varchar
触发器
阻断休眠
性别被置空
姓名无故更新
健康检测脚本
数据闪回
Redis
Redis可视化工具
Toad使用技巧
本文档使用 MrDoc 发布
-
+
首页
转入转出文书记录获取数据
```sql CREATE OR REPLACE FUNCTION ZHUAN_KE_SPP(FiledType in varchar2,strPatientID in varchar2,strVisitId in number, strFileUqniqueId in varchar2) RETURN VARCHAR2 IS CURSOR Cur_ZhuanKe IS select rownum counter,z.* from (SELECT A.Dept_Code,A.Caption_Date_Time,a.creator_id,a.file_unique_id,a.mr_code FROM jhmr_file_index A WHERE A.Patient_Id=strPatientID and a.visit_id=strVisitId And A.Mr_Class='EMR10.00.06' order by A.Caption_Date_Time asc) z; i_counter varchar2(20); cur_mr_code varchar2(20); cur_Caption_Date_Time date; cur_dept varchar2(20); re_name varchar2(200); zrke varchar2(20); zrsj date;--转入时间 zcke varchar2(20); zcsj date; --转出时间 BEGIN FOR C_R IN Cur_ZhuanKe LOOP if(c_r.file_unique_id=strFileUqniqueId) then i_counter:=c_r.counter; cur_mr_code:= c_r.mr_code; cur_dept:=c_r.Dept_Code; cur_Caption_Date_Time:=c_r.Caption_Date_Time; end if; end LOOp; if(cur_mr_code='EMR10.00.06_1') then --转出 zcke:=cur_dept; zcsj:=cur_Caption_Date_Time; FOR C_R IN Cur_ZhuanKe LOOP if(c_r.counter=(i_counter+1)) then zrke:= c_r.Dept_Code; zrsj:=c_r.caption_date_time; end if; end LOOp; end if; if(cur_mr_code='EMR10.00.06_2') then --转入 zrke:=cur_dept; zrsj:=cur_Caption_Date_Time; FOR C_R IN Cur_ZhuanKe LOOP if(c_r.counter=(i_counter-1)) then zcke:= c_r.Dept_Code; zcsj:=c_r.caption_date_time; end if; end LOOp; end if; if(zrke is null) then select t.dept_admission_to into zrke from pat_visit t where t.patient_id=strPatientID and t.visit_id=strVisitId; select t.admission_date_time into zrsj from pat_visit t where t.patient_id=strPatientID and t.visit_id=strVisitId; end if; if(zcke is null) then select t.dept_discharge_from into zcke from pat_visit t where t.patient_id=strPatientID and t.visit_id=strVisitId; select t.discharge_date_time into zcsj from pat_visit t where t.patient_id=strPatientID and t.visit_id=strVisitId; end if; if(FiledType='转出科室代码') then re_name :=zcke; end if; if(FiledType='转入科室代码') then re_name :=zrke; end if; if(FiledType='转出科室名称') then select t.dept_name into re_name from dept_dict t where t.dept_code =zcke; end if; if(FiledType='转入科室名称') then select t.dept_name into re_name from dept_dict t where t.dept_code =zrke; end if; if(FiledType='转入时间') then re_name :=to_char(zrsj,'yyyy-MM-dd HH24:MI:ss'); end if; if(FiledType='转出时间') then re_name :=to_char(zcsj,'yyyy-MM-dd HH24:MI:ss'); end if; RETURN re_name; END ZHUAN_KE_SPP; ```
孙端己
2024年7月24日 17:29
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
Markdown文件
分享
链接
类型
密码
更新密码