同步报告流程
1.查询待同步人员名单
根据appsetting.config文件夹中:
ReportConfig ReportSql查询
查看报告当前时间节点
select keyvalue from tbl_dictionary where keyname =’MytijianReport’
查看时间间隔
appsetting.json:
ReportConfig.TimeSpan
{0}:keyvalue +(TimeSpan)为起始时间
{1}:keyvalue 为结束时间
最终语句(根据实际情况配置):
最新配置语句
select * from (select tjh000 from HM_YW_DJLS00 a where djbz00='6' and djrq00 between '{0}' and '{1}' order by djrq00 asc,djsj00 asc) group by tjh000
此配置已停用
~~select tjh000 from hm_yw_tjz000 where ( tjlxid in () and zswc00 = ‘1’ and zsrq00 between ‘{0}’and ‘{1}’ ) or ( tjlxid in () and zjwc00 = ‘1’ and zjrq00 between ‘{0}’and ‘{1}’)or ( tjlxid in () and fjwc00=’1’ and fjwcrq between ‘{0}’and ‘{1}’) ~~
zswc00:总审完成看总审日期
zjwc00:总检完成看总检日期
fjwc00:分科完成看分科日期
2.查询人员详细信息
最新配置语句
create or replace view mtjk_report_info as
select A.*,
( select f.reportTime from ( select to_date(substr(tx_superman.SF_PT_GetRQ00(1, DJRQ00, DJSJ00), 1, 30),'yyyy-MM-dd hh24:mi:ss') as reportTime ,d.tjh000 from HM_YW_DJLS00 d where djbz00='6'
order by djrq00 desc,djsj00 desc ) f where f.tjh000 =a.tjh000 and rownum <2 ) as reportTime,
to_date(zjrq00,'YYYY-MM-DD') as auditTime,
'D://TJPDFBG//'||TJH000||'//'||TJH000||'.pdf' as pdfurl
from HM_YW_TJZ000 A where zjwc00 = '1' and zjrq00 !='00000000';
此配置已停用
已经停用!!!!
create or replace view MTJK_REPORT_INFO as
--总审
select A.*,
a.TJH000 as reportNo, --体检号
to_date(zsrq00,'YYYY-MM-DD') as reportTime,
to_date(zsrq00,'YYYY-MM-DD') as auditTime,
'D://PDFBG//'||TJH000||'//'||TJH000||'_'||xm0000||'.pdf' as pdfurl,
ZS0000 as detail,
JY0000 as advice,
(select Ygxm00 from pt_ygbm00 where ygbh00=a.zjysid) as docName,
(select ygxm00 from pt_ygbm00 where ygbh00=a.zsys00) as auditDoc
from HM_YW_TJZ000 A where tjlxid in () and zswc00 = '1' and zsrq00 !='00000000'
union all
--总检
select A.*,
a.TJH000 as reportNo, --体检号
to_date(zjrq00,'YYYY-MM-DD') as reportTime,
to_date(zjrq00,'YYYY-MM-DD') as auditTime,
'D://PDFBG//'||TJH000||'//'||TJH000||'_'||xm0000||'.pdf' as pdfurl,
ZS0000 as detail,
JY0000 as advice,
(select Ygxm00 from pt_ygbm00 where ygbh00=a.zjysid) as docName,
(select ygxm00 from pt_ygbm00 where ygbh00=a.zsys00) as auditDoc
from HM_YW_TJZ000 A where tjlxid in () and zjwc00 = '1' and zjrq00 !='00000000'
union all
--分科
select A.*,
a.TJH000 as reportNo, --体检号
to_date(fjwcrq,'YYYY-MM-DD') as reportTime,
to_date(fjwcrq,'YYYY-MM-DD') as auditTime,
'D://PDFBG//'||TJH000||'//'||TJH000||'_'||xm0000||'.pdf' as pdfurl,
ZS0000 as detail,
JY0000 as advice,
(select Ygxm00 from pt_ygbm00 where ygbh00=a.zjysid) as docName,
(select ygxm00 from pt_ygbm00 where ygbh00=a.zsys00) as auditDoc
from HM_YW_TJZ000 A where tjlxid in () and fjwc00 = '1' and fjwcrq !='00000000'
select * from MTJK_REPORT_INFO where reportNo=''
pdfUrl:为pdf文件地址
appsetting.json:
ReportConfig.Type:
DATA,文字版本,则需要继续创建几个视图
URL,能够直接访问到的URL,会下载到本地
FILE,本地能够直接访问到的URL
FTP,ftp模式,配置ftp,会下载到本地
!!!天瑞B/S版本视图脚本
-- b/s版本一般不用到
create or replace view mtjk_report_info as
select a.pe_no as reportno,
b.user_name as name,
b.id_card_no as idCard,
to_date(b.birthday,'YYYY-MM-DD') as birthday,
b.pe_age as age,
b.sex as gender,
b.phone_no as mobile,
a.pe_date as examDate,
a.create_time as reportTime,
a.create_time as auditTime,
replace( a.pdf_report_url ,'http://192.168.0.24','http://miniwx.trhealth.net/whdyyy') as pdfurl
from pemi_report a left join pec_pebill b
on a.pe_no = b.pe_no;
3.上传PDF
上传成功后,会向tbl_report_record表中插入一条数据
status:1 则代表成功
reportTime: 本字段来源MTJK_REPORT_INFO中reporttime,
如果报告更新,会将MTJK_REPORT_INFO.reporttime 与 tbl_report_record.reportTime比较,如果不一致,会再次更新上传
文字报告
--报告科室结论
create view MTJK_REPORT_DEPARTMENT as
select * from (
select
A.TJH000 as reportNo, --体检号
A.BMBH00 as agentDepartmentId,--部门ID
C.BMMC00 name, --部门名称
A.KSXJ00 as result, --科室小结
to_date(A.KSSHRQ||' '||A.KSSHSJ,'YYYY-MM-DD HH24:MI:SS') as examTime, --科室审核时间
(select YGXM00 from PT_YGBM00 where YGBH00 = A.KSYS00) as docName, --科室医生
lpad(C.PXXH00,4,0) as orderBy
from HM_YW_TJFKJC A, PT_BMBM00 C
where A.BMBH00 = C.BMBH00 and A.kssh00=1 order by C.PXXH00 asc);
--报告项目详情
create view MTJK_REPORT_DETAIL as
select * from (
select
A.TJH000 as reportNo, --体检报告主键
A.BMBH00 as departmentId, --检查分科ID
(select BMMC00 from PT_BMBM00 where BMBH00 = A.BMBH00) as department,--体检科室名称
A.SQXMID as classId, --项目ID, FK=HM_ZD_TJSQXM.SQXMID
A.SQXMMC as className, --项目名称
E.KSXJ00 as classResult,
A.JCXMID as itemId, --检查项目ID
A.JCXMMC as itemName, --检查项目名称
nvl(A.jyjg00,replace(A.TZCMS0, B.ZDW000, '')) as itemResult,
'' as explain,
A.CKFW00 as reference, --参考范围
A.JGSM00 as itemTip, --结果说明
A.JCXMDW as unit, --检查项目单位
'' as pic_url,
lpad(D.PXXH00,4,0) ord_department,
lpad(C.XSXH00,4,0) ord_class,
lpad(B.XSXH00,4,0) ord_item,
nvl((select JCYSXM from HM_YW_TJYW00 where SFYWID = A.SFYWID),
(select ygxm00 from pt_ygbm00 where ygbh00=(select KSYS00 from HM_YW_TJFKJC where BMBH00 = A.BMBH00 and rownum = 1 ))) as docName,
to_date((select FKKSRQ from HM_YW_TJYW00 where SFYWID = A.SFYWID and FKKSRQ !=00000000 ),'YYYY-MM-DD') as examTime
from HM_YW_TJJCXM A, HM_ZD_JCXM00 B, HM_ZD_TJSQXM C, PT_BMBM00 D ,HM_YW_TJFKJC E
where A.JCXMID = B.JCXMID and A.SQXMID = C.SQXMID and A.BMBH00 = D.BMBH00 and A.TJH000 = E.TJH000 and A.BMBH00 =E.BMBH00+0
and not exists (select 1 from HM_YW_TJYW00 where TJH000 = A.TJH000 and SFYWID = A.SFYWID and TFNTBZ in ('1','2')))
ftp报告
配置文件
视图
url报告
NoCache报告
实时查询保