Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BLRNLINK

BLRNLINK.m

Go to the documentation of this file.
BLRNLINK ; IHS/HQT/MJL - LAB HOOK FOR APCDALV (PCC) ; 22-Oct-2013 09:22 ; MKK
 ;;5.2;IHS LABORATORY;**1010,1011,1013,1024,1030,1033**;NOV 01, 1997
 ;
 ;; This routine makes use of the PCC MASTER CONTROL FILE
 ;; The flag field of this file for the lab package contains the
 ;; following:  1st piece - 0 = outpatient facility only
 ;;                         1 = outpatient/inpatient facility
 ;;
 ;; THE FOLLOWING ARE NOT USED IN BLR 5.2
 ;;             2nd piece - 0 = don't ask OP/IP prompt
 ;;                         1 = ask OP/IP prompt
 ;;             3rd piece - 0 = don't ask for ordering facility
 ;;                         1 = ask for ordering facility
 ;;             4th piece - 0 = don't pass clinic code
 ;;                         1 = pass clinic code
 ;; each piece is delimited by "~"
 ;
TSK ; entry point for background job
 ;
 ; D ENTRYAUD^BLRUTIL("TSK^BLRNLINK 0.0")
 ;
 Q:$P($G(^AUTTSITE(1,0)),U,8)'="Y"
 S BLRQUIET=$G(BLRQUIET)
START ;
 ; D ENTRYAUD^BLRUTIL("START^BLRNLINK 0.0")
 ;
 S BLRQSITE=$P($G(^AUTTSITE(1,0)),U)
 S APCDALVR("BLRLINK")=1
 S BLRDH=$P($G(^BLRSITE(BLRQSITE,0)),U,6)
 ; S:BLRDH="" BLRDH=+$H,$P(^BLRSITE(BLRQSITE,0),U,6)=BLRDH
 ;
 ; ----- BEGIN IHS/OIT/MKK - LR*5.2*1033 
 I $L(BLRQDH)'=5 D                        ; If BLRQDH an invalid number, reset it
 . D MAKEITSO^BLRUTIL6
 . S $P(^BLRSITE(BLRQSITE,0),U,6)=BLRDH
 ; ----- END IHS/OIT/MKK - LR*5.2*1033 
 ;
 S BLR200CV=$P($P($G(^DD(9000010.09,1202,0)),U,2),"'")["P200"
 S BLRLTP=+$P($G(^BLRSITE(BLRQSITE,21,BLRDH,0)),U,3)
 ;
 ; D ENTRYAUD^BLRUTIL("START^BLRNLINK 1.0","APCDALVR","DUZ")
 ;
 F  S BLRXPCC=$G(^BLRSITE(BLRQSITE,0)) D:BLRXPCC="" ERRMST S BLRLOG=$P(BLRXPCC,U,2),BLRSTOP=$P(BLRXPCC,U,9),BLRXPCC=$P(BLRXPCC,U,3) Q:'BLRXPCC!BLRSTOP  D  Q:BLRHCNT
 .S APCDALVR("BLRLINK")=1,BLRERR=0,BLRBUL=0,BLRPCC="",BLRLTA=+$P($G(^BLRSITE(BLRQSITE,21,BLRDH,0)),U,2) S:'BLRLTA BLRLTP=0
 .; D ENTRYAUD^BLRUTIL("START^BLRNLINK 1.1","APCDALVR")
 .I BLRLOG S BLRX=$G(^BLRSITE(BLRQSITE,20,BLRQDH,0)) I $P(BLRX,U,2)>$P(BLRX,U,3) S BLRHCNT=1  Q
 .I BLRLTP=BLRLTA S BLRHCNT=BLRHCNT+1  Q:BLRDH=+$H  S BLRHCNT=0,BLRDH=BLRDH+1,$P(^BLRSITE(BLRQSITE,0),U,6)=BLRDH,BLRLTP=0  Q
 .S BLRLTP=BLRLTP+1,BLRHCNT=0
 .S BLRLOGDA=$G(^BLRSITE(BLRQSITE,21,BLRDH,BLRLTP))
 .Q:BLRLOGDA=""   ;IF NO EVENT ENTRY THEN JUST PASS IT UP
 .S BLRDUZ2=$P($G(^BLRTXLOG(BLRLOGDA,0)),U,9)
 .S:BLRDUZ2="" BLRDUZ2=$G(DUZ(2))
 .;
 .S (BLRORLDN,BLRORLDA)=""
 .S BLRORLDZ=$P($G(^BLRTXLOG(BLRLOGDA,11)),U,6)
 .S:$G(BLRORLDZ)'="" BLRORLDN=$P($G(^SC(BLRORLDZ,0)),U)    ;'NAME'
 .S:$G(BLRORLDZ)'="" BLRORLDA=$P($G(^SC(BLRORLDZ,0)),U,2)  ;'ABBREVIATION'
 .S:$G(BLRORLDZ)'="" BLRORLDZ=$P($G(^SC(BLRORLDZ,0)),U,4)  ;'INSTITUTION' 
 .;
 .;IF A MANUAL ACCESSION IS DONE 'BLRFILE' COULD BE THE FOLLOWING                
 .;62.3      Lab Control Name 
 .;67        Referral Patient 
 .;67.1      Research 
 .;67.2      Sterilizer 
 .;67.3      Environmental 
 .; 
 .;IF BLRFILE IS NOT 2 (PATIENT) THEN DON'T SEND TO PCC 
 .;AND DON'T SEND ERROR MESSAGES
 .;
 .;CHECK IF 'INSTITUTION' FIELD IS POPULATED IN THE 'HOSPITAL LOCATION'
 .;CHECK FOR 'LAB LOG TO PCC' IS DONE IN BLRNFLTL IHS/ITSC/TPF 06/25/02
 .;I $G(BLRORLDZ),$P($G(^BLRSITE(BLRORLDZ,0)),U,3) D PROC
 .D PROC  ;IHS/ITSC/TPF 06/25/02
 .I $G(BLRORLDZ)="",($G(BLRFILE)=2) S BLRBUL=1,BLRPCC="No INSTITUTION entry in the HOSPITAL LOCATION file: "_$G(BLRORLDN),BLRERR=1
 .;
 .;CHECK IF 'ABBREVIATION' FIELD IS POPULATED IN THE 'HOSPITAL LOCATION'
 .;IF NOT SEND ERROR MESSAGE IHS/ITSC/TPF 06/25/02
 .I $G(BLRORLDA)="",($G(BLRFILE)=2) S BLRBUL=1,BLRPCC="No ABBREVIATION entry in the HOSPITAL LOCATION file: "_$G(BLRORLDN),BLRERR=1
 .D:BLRPCC'="" ERR
 .; D:BLRBUL BULTNS
 .D:BLRBUL BULTNS^BLRUTIL3   ; IHS/OIT/MKK - LR*5.2*1030
 .S $P(^BLRSITE(BLRQSITE,21,BLRDH,0),U,3)=BLRLTP
 .D CLNUP
 ;
 ; D ENTRYAUD^BLRUTIL("START^BLRNLINK 9.0")
 D EOJ
 Q
 ;
PROC ;
 D ENTRYAUD^BLRUTIL("PROC^BLRNLINK 0.0","APCDALVR")
 D ^BLRLINK1 Q:BLRERR
 D ENTRYAUD^BLRUTIL("PROC^BLRNLINK 2.0","APCDALVR")   ; IHS/OIT/MKK - LR*5.2*1033
 D ^BLRLINK2 Q:BLRERR
 D ENTRYAUD^BLRUTIL("PROC^BLRNLINK 3.0","APCDALVR")   ; IHS/OIT/MKK - LR*5.2*1033
 D ^BLRLINK3
 D ENTRYAUD^BLRUTIL("PROC^BLRNLINK 9.0","APCDALVR")
 Q
 ;
 ;ERROR IF NO 'BLR MASTER CONTROL' FILE
ERRMST ;
 ; D ENTRYAUD^BLRUTIL("ERRMST^BLRLINK 0.0")
 S BLRBUL=1,BLRPCC="No entry for site "_$P($G(^AUTTLOC(BLRQSITE,0)),U,2)_"(ien = "_$G(BLRQSITE)_") in 'BLR MASTER CONTROL' file.",BLRERR=1
 D:BLRPCC'="" ERR
 ; D:BLRBUL BULTNS
 D:BLRBUL BULTNS^BLRUTIL3    ; IHS/OIT/MKK - LR*5.2*1030
 K BLRBUL,BLRPCC
 Q
ERR ; update transaction log with PCC error message value (if transaction is a modification then any previous value needs to be removed)
 ; D ENTRYAUD^BLRUTIL("ERR^BLRNLINK 0.0")
 K DIE,DA,DR
 S DIE="^BLRTXLOG(",DA=BLRLOGDA,DR="106///^S X=BLRPCC"
 D ^DIE Q
 S BLRBUL=2,BLRPCC="Update to IHS transaction log to the PCC error flag field not done..REFILE"
 W:'BLRQUIET !,"Another user is editing this file entry....update to IHS transaction log to the PCC error flag field not done"
 Q
 ;
SETNUL ; update transaction log with PCC error message value (if transaction is a modification then any previous value needs to be removed)
 ; D ENTRYAUD^BLRUTIL("SETNUL^BLRLINK 0.0")
 K DIE,DA,DR
 S DIE="^BLRTXLOG(",DA=BLRLOGDA,DR="106////@"
 D ^DIE Q
 S BLRBUL=2,BLRPCC="PCC error flag field not nulled."
 W:'BLRQUIET !,"PCC error flag field not nulled"
 Q
 ;
CALLDIK ;EP - DELETE PCC VISIT AND UPDATE BLRTXLOG
 ; D ENTRYAUD^BLRUTIL("CALLDIK^BLRNLINK 0.0")
 I '$L(BLRVIEN) S BLRPCC="Lab deleted test...PCC entries already deleted" D ERR^BLRLINK Q
 N (BLRLOGDA,DA,DIK,DT,DUZ,U,DTIME,IO,IOSL,IOM,IOXY,IOST,XQDIC,XQPSM,XQY,XQYO,ZTQUEUED)
 S BLRBUL=2,BLRPCC="Lab deleted test...PCC entries deleted"
 D ^DIK,DTXVP
 Q
 ;
DTXVP ; update transaction log to delete PCC file and v ien when lab deletes the test,
 ; D ENTRYAUD^BLRUTIL("DTXVP^BLRNLINK 0.0")
 ; or if PCC entries are missing.
 K DIE,DA,DR
 S DIE="^BLRTXLOG(",DA=BLRLOGDA
 S DR="104////@;105////@;106///^S X=BLRPCC"
 D ^DIE Q
 S BLRPCC=BLRPCC_"PCC error flag field not set.",BLRBUL=2
 W:'BLRQUIET !,BLRPCC,!
 Q
 ;
DEBUG ;
 ; Used for debugging only -- called by ^BLRDBG
 ;
 S BLRERR=0,BLRPCC="",BLRQUIET=$G(BLRQUIET),BLR200CV=$P($P(^DD(9000010.09,1202,0),U,2),"'")["P200"
 D PROC,ERR:BLRPCC'="",CLNUP,EOJ
 Q
 ;
CLNUP ;
 ; D ENTRYAUD^BLRUTIL("CLNUP^BLRNLINK 0.0")
 K APCDALVR,BLR,BLRABNL,BLRACC,BLRANT,BLRANTN,BLRBILL,BLRBUL,BLRBTN,BLRCD,BLRCDT,BLRCLIN,BLRCLNAM,BLRCOM,BLRCOST,BLRCPT,BLRCPTST,BLRDFN,BLRDUZ,BLREPNM,BLRERR,BLREPRV,BLRERR,BLRFILE,BLRVFN
 K BLRIEN,BLRLINK,BLRLIT,BLRLOGDA,BLRMOD,BLRNAME,BLRNCOM,BLRNMSPC,BLRODT,BLROPNM,BLROPRV,BLRORD,BLRORDL,BLRORG,BLRORGN,BLRPAREN,BLRPATCD,BLRPCC,BLRPMSG,BLRPNAM,BLRPROG,BLRRES,BLRRFH,BLRVFILE,BLRVGL,BLRVFN
 K BLRORLDZ,BLRORDL1,BLRCOMPD,BLRCOLSP  ;IHS/DIR TUC/AAB 04/08/98
 K BLRRFL,BLRROOT,BLRSDI,BLRSITE,BLRSNAM,BLRSS,BLRSTAGE,BLRSTAT,BLRSTR,BLRTLAB,BLRTLOG,BLRTNAM,BLRTRAN,BLRTXT,BLRUNIT,BLRVADFN,BLRVAL,BLRVCAT,BLRVFLD,BLRVIEN,BLRVPRV,BLRVSIT,BLRVSUB,BLRXFLG
 Q
 ;
EOJ ;
 ; D ENTRYAUD^BLRUTIL("EOJ^BLRNLINK 0.0")
 I $D(ZTQUEUED) S ZTREQ="@"
 K APCDALVR,PCCVISIT,INDX,BLR200CV,BLRLOGDA,BLRORD,BLRI,BLRDFN,BLRVADFN,BLRRES,BLRUNIT,BLRACC,BLRSITE,BLRERR,BLRABNL,BLRVAL
 K BLRTLAB,BLRSS,BLRDFN,AUPNTALK,BLRNMSPC,BLRCDT,BLRCD,BLRCLIN,BLRPATCD,BLRORDL,BLREPRV,BLROPRV,BLREPNM,BLROPNM,BLRSNAM,BLRODT
 K BLRDUZ,BLRTNAME,BLRXFLG,BLRTRAN,BLRSDI,BLRMOD,BLRL,XMB,BLRPCC,BLRVIEN,BLRPAREN,BLRRFH,BLRRFL
 Q