34 lines
923 B
Plaintext
34 lines
923 B
Plaintext
;IMICOS:Z_MPL:GET_PGS
|
|
|
|
; return LID|LPERIOD|ORDNB over PGS(PLZ + GEBURTSDATUM + SAMPLEID) als SHA512
|
|
; Search only since 30 days orders
|
|
; CALLER: z_get_pgs("665d720c5ddbfd5d7e73043e57b2558d449c8c6866d4aee8ecc986e1b8f200e46ac9598377565f06b3afca390840e9417ad62703c778871ef3a9cbb14653cd9a")
|
|
; RESULT: LA|M5I4|3455
|
|
|
|
$pgs = $in.p1
|
|
$pgs_return = ""
|
|
$back_days = 30
|
|
|
|
if($pgs != "")
|
|
|
|
$sql = "
|
|
select
|
|
concat('PK:', concat(concat(concat(concat(o.lid, '|'), o.lperiod), '|'), o.ordnb)) v
|
|
from ord o
|
|
inner join patd p on p.patidnb = o.ordpatidnb and p.zip is not null
|
|
where
|
|
o.recept_dt >= TO_DATE(current_date - %%$back_days%%%) and
|
|
lower(standard_hash(concat(concat(to_char(o.ordpatbirthdt, 'YYYY-MM-DD'), p.zip), o.sampleid), 'SHA512')) = '%%$pgs%%%'
|
|
"
|
|
|
|
$sql_res = sqlprint($sql, "LOCAL_DATA/NOCOMMIT")
|
|
|
|
if($sql_res != "")
|
|
$i95 = $sql_res
|
|
nextsubstr('PK:')
|
|
$pgs_return = $i95
|
|
endif
|
|
|
|
endif
|
|
|
|
return($pgs_return) |