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

ORDV06C.m

Go to the documentation of this file.
ORDV06C ;ISP/RFR - OE/RR REPORT EXTRACTS ;08/22/2017  13:39
 ;;3.0;ORDER ENTRY RESULTS REPORTING;**377**;Dec 17, 1997;Build 582
 Q
RXHIRISK(ROOT,ORDFN,OREXT,ORALPHA,OROMEGA,ORDTRANG,ORREMOTE,ORMAX,ISFHIE) ;Medications with
 ;Reproductive Risk Report
 Q:'$L(OREXT)
 N GO
 S GO=$P(OREXT,";",7)_U_$P(OREXT,";",8)
 Q:'$L($T(@GO))
 D FORMAT
 Q
GETDATA ;RETRIEVE ALL NECESSARY DATA FOR REPORT
 N ORBEG,OREND,ORREMIND,INDEX,PARAM,RETURN,OCINAME,ORIEN,NODE
 K ^TMP("ORPS",$J)
 S ORBEG=$S($G(ORALPHA):ORALPHA,1:$$DT^ORWPS("T")),OREND=$S($G(OROMEGA)>0:OROMEGA,1:$$DT^ORWPS("T"))
 S ORREMIND="VA-WH POTENTIALLY UNSAFE MEDICATIONS REPORT - COHORT",ORREMIND("PRINT")="WH POTENTIALLY UNSAFE MEDS REPORT"
 D MAINDF^PXRM(DFN,ORREMIND,0,ORBEG)
 S ORREMIND("IEN")=+$O(^TMP("PXRHM",$J,0))
 I $P($G(^TMP("PXRHM",$J,ORREMIND("IEN"),ORREMIND("PRINT"))),U)'="DUE NOW" G GEXIT
 S PARAM("SUB")="ORWHRMR",PARAM("DFN")=DFN
 S PARAM("ROC DISPLAY GROUPS","PHARMACY")="",NODE="GROUPS"
 I '(($P(ORBEG,".")=$P(OREND,"."))&($P(ORBEG,".")=$$DT^ORWPS("T"))) D
 .S PARAM("ROC","VA-WH HIRISK IMAGING AGENTS GROUP")="",PARAM("ROC","VA-WH HIRISK MEDICATIONS (EXTREME RISK) GROUP")=""
 .S PARAM("ROC","VA-WH HIRISK MEDICATIONS (LACTATION LEVEL 1) GROUP")="",PARAM("ROC","VA-WH HIRISK MEDICATIONS (LACTATION LEVEL 2) GROUP")=""
 .S PARAM("ROC","VA-WH HIRISK MEDICATIONS (MOD/HIGH RISK DURING PREGNANCY) GROUP")=""
 .S PARAM("ROC RETURN TYPE","GROUPS")="",PARAM("ROC ORDERED WITHIN")=""
 .S PARAM("ROC STATUS","*")=""
 .S PARAM("ROC DISPLAY GROUPS","PHARMACY","START")=ORBEG,PARAM("ROC DISPLAY GROUPS","PHARMACY","STOP")=OREND
 I $P(ORBEG,".")=$P(OREND,"."),$P(ORBEG,".")=$$DT^ORWPS("T") D
 .S PARAM("ROC","ALL")="" ;,PARAM("ROC EVAL DATES")=DT
 .S PARAM("ROC STATUS","HOLD")="",PARAM("ROC STATUS","FLAGGED")="",PARAM("ROC STATUS","PENDING")=""
 .S PARAM("ROC STATUS","ACTIVE")="",PARAM("ROC STATUS","DELAYED")="",PARAM("ROC STATUS","RENEWED")=""
 .S PARAM("ROC RETURN TYPE","GROUPS")="",PARAM("ROC RETURN TYPE","RULES")=""
 D EN^PXRMGEV(.RETURN,.PARAM)
 I $P(@RETURN@(0),U)<1 G GEXIT
 S ORIEN=0 F  S ORIEN=$O(^TMP($J,"ORWHRMR",ORIEN)) Q:'+ORIEN  D
 .N PSIFN
 .S PSIFN=$G(^OR(100,ORIEN,4)) Q:'+PSIFN
 .S INDEX=1+$G(INDEX),OCINAME=""
 .F  S OCINAME=$O(^TMP($J,"ORWHRMR",ORIEN,NODE,OCINAME)) Q:OCINAME=""  I $E(OCINAME,1,13)="VA-WH HIRISK " D
 ..I $D(PARAM("ROC RETURN TYPE","RULES")),'$D(^TMP($J,"ORWHRMR",ORIEN,"RULES")) Q
 ..I '$D(^TMP("ORPS",$J,INDEX)) D
 ...N TYPE,NODE,TO
 ...S TYPE=$P($G(^OR(100,ORIEN,0)),U,12),TO=$P($G(^ORD(100.98,+$P($G(^OR(100,ORIEN,0)),U,11),0)),U)
 ...I TYPE="O",TO["CLINIC" S TYPE="I"
 ...S:TYPE="O" PSIFN=$TR(PSIFN,"S","P")_$S(PSIFN?1.N:"R",1:"")
 ...S PSIFN=PSIFN_";"_TYPE
 ...D OEL^PSOORRL(DFN,PSIFN)  ;DBIA 2400
 ...I '$D(^TMP("PS",$J)) Q
 ...S TYPE=$S(TYPE="O":"OP",1:"UD")
 ...I TYPE="OP",PSIFN["N" S TYPE="NV"
 ...I ($O(^TMP("PS",$J,"A",0))>0)!($O(^TMP("PS",$J,"B",0))>0) S TYPE="IV"
 ...S NODE=$G(^TMP("PS",$J,0))
 ...S ^TMP("ORPS",$J,INDEX)=TYPE_U_PSIFN_U_$P(NODE,U)_U_$P(NODE,U,3)_U_$P(NODE,U,5,6)_U_$P(NODE,U,12)
 ...S:TYPE="NV" $P(^TMP("ORPS",$J,INDEX),U,5)=$P($G(^OR(100,ORIEN,0)),U,8)
 ...I $P(^TMP("ORPS",$J,INDEX),U,6)="PENDING" S $P(^(INDEX),U,5)=""
 ..Q:'$D(^TMP("ORPS",$J,INDEX))
 ..I OCINAME'["(LACT" S $P(^TMP("ORPS",$J,INDEX),U,8)="*"
 ..I OCINAME["(LACT" S $P(^TMP("ORPS",$J,INDEX),U,9)="*"
GEXIT ;CLEAN-UP FOR GETDATA
 K ^TMP("PXRHM",$J),^TMP("PS",$J),^TMP($J,"ORWHRMR")
 Q
FORMAT ;FORMAT DATA FOR RETURN TO CPRS
 K ^TMP("ORPS",$J)
 D @GO
 N ORSITE,J,RT,X,ORITM
 S ORSITE=$$SITE^VASITE,ORSITE=$P(ORSITE,"^",2)_";"_$P(ORSITE,"^",3)
 S ORITM=0 F  S ORITM=$O(^TMP("ORPS",$J,ORITM)) Q:'+ORITM  D
 .S ^TMP("ORDATA",$J,ORITM,"WP",1)="1^"_ORSITE ;Station ID
 .S ^TMP("ORDATA",$J,ORITM,"WP",2)="2^"_$P(^TMP("ORPS",$J,ORITM),U,3) ;Medication Name
 .S ^TMP("ORDATA",$J,ORITM,"WP",3)="3^"_$P(^TMP("ORPS",$J,ORITM),U,6) ;Status
 .S ^TMP("ORDATA",$J,ORITM,"WP",4)="4^"_$S($P($P(^TMP("ORPS",$J,ORITM),U,2),";",2)="I":"IN",1:"OUT") ;In/OutPatient
 .S ^TMP("ORDATA",$J,ORITM,"WP",5)="5^"_$S($P(^TMP("ORPS",$J,ORITM),U)="NV":"NonVAMed",1:"RX") ;Type: RX or NonVA Med
 .S ^TMP("ORDATA",$J,ORITM,"WP",6)="6^"_$P(^TMP("ORPS",$J,ORITM),U,8) ;Teratogenic
 .S ^TMP("ORDATA",$J,ORITM,"WP",7)="7^"_$P(^TMP("ORPS",$J,ORITM),U,9) ;Lactation
 .S ^TMP("ORDATA",$J,ORITM,"WP",8)="8^"_$$DATE^ORDVU($P(^TMP("ORPS",$J,ORITM),U,5)) ;Start Date
 .S ^TMP("ORDATA",$J,ORITM,"WP",9)="9^"_$$DATE^ORDVU($P(^TMP("ORPS",$J,ORITM),U,4)) ;Stop Date
 .S ^TMP("ORDATA",$J,ORITM,"WP",10)="10^"_$$DATE^ORDVU($P(^TMP("ORPS",$J,ORITM),U,7)) ;Last Fill Date
 .D DETAIL^ORWPS(.RT,DFN,$P(^TMP("ORPS",$J,ORITM),U,2))
 .S J=0 F  S J=$O(^TMP("ORXPND",$J,J)) Q:'J  S X=^(J,0),^TMP("ORDATA",$J,ORITM,"WP",11,J)="11^"_X ;Details from Order
 .K ^TMP("ORXPND",$J)
 .S ^TMP("ORDATA",$J,ORITM,"WP",12)="12^[+] " ;flag for detail
 K ^TMP("ORPS",$J)
 S ROOT=$NA(^TMP("ORDATA",$J))
 Q