ORWCIRN ;SLC/DCM,REV - FUNCTIONS FOR GUI CIRN ACTIONS ;Feb 25, 2020@14:21:49
;;3.0;ORDER ENTRY/RESULTS REPORTING;**10,101,109,132,141,160,208,239,215,243,350,434,525**;Dec 17, 1997;Build 1
;
;Reference to STAT^HLCSLM supported by ICR ##3574
;
FACLIST(ORY,ORDFN) ; Return list of remote facilities for patient
;Check to see if CIRN PD/MPI installed
N X,ORSITES,I,IFN,LOCAL,CTR,HDRFLG,GOTNHIN,JLV
S X="MPIF001" X ^%ZOSF("TEST")
I '$T S ORY(0)="-1^CIRN MPI not installed." Q
S X="VAFCTFU1" X ^%ZOSF("TEST")
I '$T S ORY(0)="-1^Remote data view not installed." Q
S X=$$GET^XPAR("ALL","ORWRP CIRN REMOTE DATA ALLOW",1,"I")
I 'X S ORY(0)="-1^Remote access not allowed" Q
D TFL^VAFCTFU1(.ORY,ORDFN)
S (GOTNHIN,I)=0 F S I=$O(ORY(I)) Q:'I I $P(ORY(I),"^",5)="OTHER" D ;Screen out Type 'OTHER' locations
. I $P(ORY(I),"^")="200HD" Q ;HDR
. I $P(ORY(I),"^")="200NDD" Q ;DoD Correlated Patients
. S JLV="VistAWeb"
. I $L($T(JLV^ORWCIRN)) D JLV(.X) S JLV=$S($L(X):X,1:"VistAWeb")
. K ORY(I)
; set ORI array for Non-VA Data
D ;P525
. N ORXX
. I $P($G(ORY(1)),"^")=-1 Q:$P(ORY(1),"^",2)'="Could not find Treating Facilities" K ORY(1)
. S ORXX=$O(ORY(""),-1)+1
. D JLV(.X)
. S $P(ORY(ORXX),"^")="200N",$P(ORY(ORXX),"^",2)="Non-VA Data may be Available - Use "_$S($L(X):X,1:"VistAWeb")_" to Access"
S HDRFLG=0
I $$GET^XPAR("ALL","ORWRP CIRN SITES ALL",1,"I") D
. S (CTR,I)=0
. F S I=$O(ORY(I)) Q:'I S $P(ORY(I),"^",5)=1,CTR=CTR+1 D
.. I $P(ORY(I),"^")=200 S $P(ORY(I),"^",2)="DEPT. OF DEFENSE"
.. I $P(ORY(I),"^")="200HD" D
... I +$$GET^XPAR("ALL","ORWRP HDR ON",1,"I")=0 K ORY(I) S CTR=CTR-1 Q
... S HDRFLG=I ; Remove commented out code to enable HDR + 1 other site.
D GETLST^XPAR(.ORSITES,"ALL","ORWRP CIRN SITES","I")
S (CTR,I)=0,LOCAL=$P($$SITE^VASITE,"^",3)
F S I=$O(ORY(I)) Q:'I D
. I +ORY(I)=+LOCAL K ORY(I) Q
. S IFN=$$IEN^XUAF4(ORY(I)),CTR=CTR+1
. I IFN,$G(ORSITES(IFN)) S $P(ORY(I),"^",5)=1 D
.. I $P(ORY(I),"^")=200 S $P(ORY(I),"^",2)="DEPT. OF DEFENSE"
. I IFN,$G(ORSITES(IFN)),$P(ORY(I),"^")="200HD" D
.. I +$$GET^XPAR("ALL","ORWRP HDR ON",1,"I")=0 K ORY(I) S CTR=CTR-1 Q
.. S HDRFLG=I ; Remove commented out code to enable HDR + 1 other site.
I '$L($O(ORY(""))) S ORY(0)="-1^Only local data exists for this patient"
I $G(HDRFLG),CTR'>1 K ORY(HDRFLG) S ORY(0)="-1^Only HDR has data for this patient"
Q
RESTRICT(ORY,PATID) ;Check for sensitive patient
N DFN,ICN,SITE
I '$G(PATID) S ORY(1)="-1",ORY(2)="Invalid Patient ID" Q
S ICN=$P(PATID,";",2)
I 'ICN S ORY(1)="-1",ORY(2)="Invalid ICN" Q
S SITE=$$SITE^VASITE,SITE=$P(SITE,"^",2)_";"_$P(SITE,"^",3)
S DFN=+$$GETDFN^MPIF001(ICN)
I DFN<0 S ORY(1)="-1",ORY(2)="Patient not found on remote system ("_SITE_")" Q
D PTSEC^DGSEC4(.ORY,DFN)
Q
CHKLNK(ORY) ;Check for active HL7 TCP link on local system
S ORY=$$STAT^HLCSLM
Q
WEBADDR(ORY,PATID) ;Get VistaWeb Address
S ORY=$$GET^XPAR("ALL","ORWRP VISTAWEB ADDRESS",1,"I")
I ORY="" S ORY="https://vistaweb.domain.ext" Q
I ORY="https://vistaweb.domain.ext" Q
S ORY=ORY_"?q9gtw0="_$P($$SITE^VASITE,"^",3)_"&xqi4z="_PATID_"&yiicf="_DUZ
Q
AUTORDV(ORY) ;Get parameter value for ORWRP CIRN AUTOMATIC
S ORY=+$$GET^XPAR("ALL","ORWRP CIRN AUTOMATIC",1,"I")
Q
HDRON(ORY) ;Get parameter value for ORWRP HDR ON
S ORY=+$$GET^XPAR("ALL","ORWRP HDR ON",1,"I")
Q
JLV(ORY) ;Get parameter value for ORWRP LEGACY VIEWER LABEL
S ORY=$$GET^XPAR("ALL","ORWRP LEGACY VIEWER LABEL",1,"I")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORWCIRN 3508 printed Oct 16, 2024@18:35:37 Page 2
ORWCIRN ;SLC/DCM,REV - FUNCTIONS FOR GUI CIRN ACTIONS ;Feb 25, 2020@14:21:49
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**10,101,109,132,141,160,208,239,215,243,350,434,525**;Dec 17, 1997;Build 1
+2 ;
+3 ;Reference to STAT^HLCSLM supported by ICR ##3574
+4 ;
FACLIST(ORY,ORDFN) ; Return list of remote facilities for patient
+1 ;Check to see if CIRN PD/MPI installed
+2 NEW X,ORSITES,I,IFN,LOCAL,CTR,HDRFLG,GOTNHIN,JLV
+3 SET X="MPIF001"
XECUTE ^%ZOSF("TEST")
+4 IF '$TEST
SET ORY(0)="-1^CIRN MPI not installed."
QUIT
+5 SET X="VAFCTFU1"
XECUTE ^%ZOSF("TEST")
+6 IF '$TEST
SET ORY(0)="-1^Remote data view not installed."
QUIT
+7 SET X=$$GET^XPAR("ALL","ORWRP CIRN REMOTE DATA ALLOW",1,"I")
+8 IF 'X
SET ORY(0)="-1^Remote access not allowed"
QUIT
+9 DO TFL^VAFCTFU1(.ORY,ORDFN)
+10 ;Screen out Type 'OTHER' locations
SET (GOTNHIN,I)=0
FOR
SET I=$ORDER(ORY(I))
if 'I
QUIT
IF $PIECE(ORY(I),"^",5)="OTHER"
Begin DoDot:1
+11 ;HDR
IF $PIECE(ORY(I),"^")="200HD"
QUIT
+12 ;DoD Correlated Patients
IF $PIECE(ORY(I),"^")="200NDD"
QUIT
+13 SET JLV="VistAWeb"
+14 IF $LENGTH($TEXT(JLV^ORWCIRN))
DO JLV(.X)
SET JLV=$SELECT($LENGTH(X):X,1:"VistAWeb")
+15 KILL ORY(I)
End DoDot:1
+16 ; set ORI array for Non-VA Data
+17 ;P525
Begin DoDot:1
+18 NEW ORXX
+19 IF $PIECE($GET(ORY(1)),"^")=-1
if $PIECE(ORY(1),"^",2)'="Could not find Treating Facilities"
QUIT
KILL ORY(1)
+20 SET ORXX=$ORDER(ORY(""),-1)+1
+21 DO JLV(.X)
+22 SET $PIECE(ORY(ORXX),"^")="200N"
SET $PIECE(ORY(ORXX),"^",2)="Non-VA Data may be Available - Use "_$SELECT($LENGTH(X):X,1:"VistAWeb")_" to Access"
End DoDot:1
+23 SET HDRFLG=0
+24 IF $$GET^XPAR("ALL","ORWRP CIRN SITES ALL",1,"I")
Begin DoDot:1
+25 SET (CTR,I)=0
+26 FOR
SET I=$ORDER(ORY(I))
if 'I
QUIT
SET $PIECE(ORY(I),"^",5)=1
SET CTR=CTR+1
Begin DoDot:2
+27 IF $PIECE(ORY(I),"^")=200
SET $PIECE(ORY(I),"^",2)="DEPT. OF DEFENSE"
+28 IF $PIECE(ORY(I),"^")="200HD"
Begin DoDot:3
+29 IF +$$GET^XPAR("ALL","ORWRP HDR ON",1,"I")=0
KILL ORY(I)
SET CTR=CTR-1
QUIT
+30 ; Remove commented out code to enable HDR + 1 other site.
SET HDRFLG=I
End DoDot:3
End DoDot:2
End DoDot:1
+31 DO GETLST^XPAR(.ORSITES,"ALL","ORWRP CIRN SITES","I")
+32 SET (CTR,I)=0
SET LOCAL=$PIECE($$SITE^VASITE,"^",3)
+33 FOR
SET I=$ORDER(ORY(I))
if 'I
QUIT
Begin DoDot:1
+34 IF +ORY(I)=+LOCAL
KILL ORY(I)
QUIT
+35 SET IFN=$$IEN^XUAF4(ORY(I))
SET CTR=CTR+1
+36 IF IFN
IF $GET(ORSITES(IFN))
SET $PIECE(ORY(I),"^",5)=1
Begin DoDot:2
+37 IF $PIECE(ORY(I),"^")=200
SET $PIECE(ORY(I),"^",2)="DEPT. OF DEFENSE"
End DoDot:2
+38 IF IFN
IF $GET(ORSITES(IFN))
IF $PIECE(ORY(I),"^")="200HD"
Begin DoDot:2
+39 IF +$$GET^XPAR("ALL","ORWRP HDR ON",1,"I")=0
KILL ORY(I)
SET CTR=CTR-1
QUIT
+40 ; Remove commented out code to enable HDR + 1 other site.
SET HDRFLG=I
End DoDot:2
End DoDot:1
+41 IF '$LENGTH($ORDER(ORY("")))
SET ORY(0)="-1^Only local data exists for this patient"
+42 IF $GET(HDRFLG)
IF CTR'>1
KILL ORY(HDRFLG)
SET ORY(0)="-1^Only HDR has data for this patient"
+43 QUIT
RESTRICT(ORY,PATID) ;Check for sensitive patient
+1 NEW DFN,ICN,SITE
+2 IF '$GET(PATID)
SET ORY(1)="-1"
SET ORY(2)="Invalid Patient ID"
QUIT
+3 SET ICN=$PIECE(PATID,";",2)
+4 IF 'ICN
SET ORY(1)="-1"
SET ORY(2)="Invalid ICN"
QUIT
+5 SET SITE=$$SITE^VASITE
SET SITE=$PIECE(SITE,"^",2)_";"_$PIECE(SITE,"^",3)
+6 SET DFN=+$$GETDFN^MPIF001(ICN)
+7 IF DFN<0
SET ORY(1)="-1"
SET ORY(2)="Patient not found on remote system ("_SITE_")"
QUIT
+8 DO PTSEC^DGSEC4(.ORY,DFN)
+9 QUIT
CHKLNK(ORY) ;Check for active HL7 TCP link on local system
+1 SET ORY=$$STAT^HLCSLM
+2 QUIT
WEBADDR(ORY,PATID) ;Get VistaWeb Address
+1 SET ORY=$$GET^XPAR("ALL","ORWRP VISTAWEB ADDRESS",1,"I")
+2 IF ORY=""
SET ORY="https://vistaweb.domain.ext"
QUIT
+3 IF ORY="https://vistaweb.domain.ext"
QUIT
+4 SET ORY=ORY_"?q9gtw0="_$PIECE($$SITE^VASITE,"^",3)_"&xqi4z="_PATID_"&yiicf="_DUZ
+5 QUIT
AUTORDV(ORY) ;Get parameter value for ORWRP CIRN AUTOMATIC
+1 SET ORY=+$$GET^XPAR("ALL","ORWRP CIRN AUTOMATIC",1,"I")
+2 QUIT
HDRON(ORY) ;Get parameter value for ORWRP HDR ON
+1 SET ORY=+$$GET^XPAR("ALL","ORWRP HDR ON",1,"I")
+2 QUIT
JLV(ORY) ;Get parameter value for ORWRP LEGACY VIEWER LABEL
+1 SET ORY=$$GET^XPAR("ALL","ORWRP LEGACY VIEWER LABEL",1,"I")
+2 QUIT