fixing bugs that affect RPMS Alerts

This commit is contained in:
george 2009-01-29 16:26:56 +00:00
parent 7bd9c61f1e
commit c522c523de
3 changed files with 117 additions and 6 deletions

View File

@ -68,6 +68,70 @@ GETNOLD(GRTN,GFILE,GIEN,GNN) ; GET FIELDS FOR ACCESS BY NAME
. . I $P(@GRTN@(C0CI),"^",3)="" K @GRTN@(C0CI) ; KILL THE NULL ENTRIES
Q
;
GETN(GRTN,GFILE,GREF,GNDX,GNN) ; GET BY NAME ; RETURN A FIELD VALUE MAP
; THE FOLLOWING COMMENTS ARE WRONG.. THIS ROUTINE STILL RETURNS AN RNF1
; FORMAT ARRAY @GRTN@("FIELD NAME")="FILE^FIELD#^VALUE" ;GPL
; GETN IS AN EXTRINSIC WHICH RETURNS THE NEXT IEN AFTER THE CURRENT GIEN
; GRTN, PASSED BY NAME, RETURNS A FIELD MAP AND A VALUE MAP
; .. FIELD MAP @GRTN@("F","FIELDNAME^FILE^FIELD#")=""
; ... ANY FIELD USED BY ANY RECORD PROCESSED IS IN THE FIELD MAP
; .. VALUE MAP @GRTN@("V","IEN","FIELDNAME")=VALUE
; .. GRTN IS NOT INITIALIZED, SO MULTIPLE CALLS ARE CUMULATIVE
; .. IF GNN="ALL" THEN ALL FIELDS FOR THE FILE ARE IN THE FIELD MAP
; .. EVEN IF GNN="ALL" ONLY POPULATED FIELDS ARE RETURNED IN THE VALUE MAP
; .. NUL FIELDS CAN BE DETERMINED BY CHECKING FIELD MAP - THIS SAVES SPACE
; IF GREF IS "" THE FIRST RECORD IS OBTAINED
; IF GNDX IS NULL, GREF IS AN IEN FOR THE FILE
; GNDX IS THE INDEX TO USE TO OBTAIN THE IEN
; GREF IS THE VALUE FOR THE INDEX
; GANN= NOT NULL - IF GANN IS "ALL" THEN EVEN NULL FIELDS WILL BE RETURNED
; OTHERWISE, ONLY POPULATED FIELDS ARE RETURNED IN GRTN
;
;
N GIEN,GF
S GF=$$FILEREF(GFILE) ;CLOSED FILE REFERENCE FOR FILE NUMBER GFILE
I ('$D(GNDX))!(GNDX="") S GIEN=GREF ; IF NO INDEX USED, GREF IS THE IEN
E D ; WE ARE USING AN INDEX
. ;N ZG
. S ZG=$Q(@GF@(GNDX,GREF)) ;ACCESS INDEX
. I ZG'="" D ;
. . I $QS(ZG,3)=GREF D ; IS GREF IN INDEX?
. . . S GIEN=$QS(ZG,4) ; PULL OUT THE IEN
. . E S GIEN="" ; NOT FOUND IN INDEX
. E S GIEN="" ;
;W "IEN: ",GIEN,!
;N C0CTMP,C0CI,C0CJ,C0CREF,C0CNAME
I $D(GNN) I GNN="ALL" S C0CNN=0 ; NOT NON-NULL (ALL FIELDS TO BE RETURNED)
E S C0CNN=1 ; NON-NULL IS TRUE (ONLY POPULATED FIELDS RETURNED)
S C0CREF=GIEN_"," ; OPEN ROOT REFERENCE INTO FILE
D CLEAN^DILF ; MAKE SURE WE ARE CLEANED UP
K C0CTMP
D GETS^DIQ(GFILE,C0CREF,"**","IE","C0CTMP")
D FIELDS(GRTN,GFILE) ;GET ALL THE FIELD NAMES FOR THE FILE
S @GRTN@(0)=GFILE_"^RNF1^"_GIEN_"^"_DT_"^"_$J_"^"_DUZ ; STRUCTURE SIGNATURE
S (C0CI,C0CJ)=""
F S C0CJ=$O(C0CTMP(C0CJ)) Q:C0CJ="" D ; FOR ALL SUBFILES
. S C0CREF=$O(C0CTMP(C0CJ,"")) ; RECORD REFERENCE
. F S C0CI=$O(C0CTMP(C0CJ,C0CREF,C0CI)) Q:C0CI="" D ; ARRAY OF FIELDS
. . ;W C0CJ," ",C0CI,!
. . S C0CNAME=$P(^DD(C0CJ,C0CI,0),"^",1) ;PULL THE FIELD NAME
. . S C0CVALUE=C0CTMP(C0CJ,C0CREF,C0CI,"E") ;
. . I C0CVALUE["C0CTMP" D ; WP FIELD
. . . N ZT,ZWP S ZWP=0 ;ITERATOR
. . . S ZWP=$O(C0CTMP(C0CJ,C0CREF,C0CI,ZWP)) ; INIT TO FIRST LINE
. . . S C0CVALUE=C0CTMP(C0CJ,C0CREF,C0CI,ZWP) ; INIT TO FIRST LINE
. . . F S ZWP=$O(C0CTMP(C0CJ,C0CREF,C0CI,ZWP)) Q:'ZWP D ;
. . . . S ZT=" "_C0CTMP(C0CJ,C0CREF,C0CI,ZWP) ;LINE OF WP
. . . . S ZT=$TR(ZT,"^""","|'") ;HACK TO GET RID OF ^ AND " IN TEXT "
. . . . S C0CVALUE=C0CVALUE_ZT ;
. . S $P(@GRTN@(C0CNAME),"^",3)=C0CVALUE ;RETURN VALUE IN P3
. . S $P(@GRTN@(C0CNAME,"I"),"^",3)=$G(C0CTMP(C0CJ,C0CREF,C0CI,"I"))
I C0CNN D ; IF ONLY NON-NULL VALUES ARE TO BE RETURNED
. S C0CI=""
. F S C0CI=$O(@GRTN@(C0CI)) Q:C0CI="" D ; GO THROUGH THE WHOLE ARRAY
. . I $P(@GRTN@(C0CI),"^",3)="" K @GRTN@(C0CI) ; KILL THE NULL ENTRIES
Q
;
GETN1(GRTN,GFILE,GREF,GNDX,GNN) ; NEW GET ;GPL ; RETURN A FIELD VALUE MAP
; THE FOLLOWING COMMENTS ARE WRONG.. THIS ROUTINE STILL RETURNS AN RNF1
; FORMAT ARRAY @GRTN@("FIELD NAME")="FILE^FIELD#^VALUE" ;GPL
@ -94,10 +158,12 @@ GETN1(GRTN,GFILE,GREF,GNDX,GNN) ; NEW GET ;GPL ; RETURN A FIELD VALUE MAP
E D ; WE ARE USING AN INDEX
. ;N ZG
. S ZG=$Q(@GF@(GNDX,GREF)) ;ACCESS INDEX
. I $QS(ZG,3)=GREF D ; IS GREF IN INDEX?
. . S GIEN=$QS(ZG,4) ; PULL OUT THE IEN
. E S GIEN="" ; NOT FOUND IN INDEX
W "IEN: ",GIEN,!
. I ZG'="" D ;
. . I $QS(ZG,3)=GREF D ; IS GREF IN INDEX?
. . . S GIEN=$QS(ZG,4) ; PULL OUT THE IEN
. . E S GIEN="" ; NOT FOUND IN INDEX
. E S GIEN="" ;
;W "IEN: ",GIEN,!
;N C0CTMP,C0CI,C0CJ,C0CREF,C0CNAME
I $D(GNN) I GNN="ALL" S C0CNN=0 ; NOT NON-NULL (ALL FIELDS TO BE RETURNED)
E S C0CNN=1 ; NON-NULL IS TRUE (ONLY POPULATED FIELDS RETURNED)

View File

@ -24,6 +24,11 @@ DISPLAY ; RUN THE PCC DISPLAY ROUTINE
D ^APCDDISP
Q
;
VTYPES ;
D GETN2^C0CRNF("G1",9999999.07)
ZWR G1
Q
;
VISITS(C0CDFN,C0CCNT) ;LIST VISIT DATES FOR PATIENT DFN
; C0CCNT IS A LIMIT ON HOW MANY VISITS TO DISPLAY ; DEFAULTS TO ALL
I '$D(C0CCNT) S C0CCNT=999999999
@ -89,4 +94,40 @@ GETTBL(C0CTBL) ; SCAN FOR AND DISPLAY PATIENTS IN A RIMTBL, PASSED BY VALUE
. K X R X
. I X="Q" S C0CQ=1 ; QUIT IF Q
Q
;
CMPDRG ; COMPARE THE DRUG FILE TO THE VA VUID MAPPING FILE FOR MATCHES
;
S C0CZI=0 ;
F S C0CZI=$O(^C0CDRUG("V",C0CZI)) Q:C0CZI="" D ;ALL DRUGS IN RPMS DRUG FILE
. S C0CZJ="" ; FOR EVERY FIELD AND SUBFIELD IN THE DRUG FILE
. ;W "C0CZI:",C0CZI
. F S C0CZJ=$O(^C0CDRUG("V",C0CZI,C0CZJ)) Q:C0CZJ="" D ;
. . ;W " C0CZJ:",C0CZJ
. . N C0CZN,C0CZV ;
. . S C0CZN=^C0CDRUG("V",C0CZI,C0CZJ,1) ; EVERY FIELD VALUE
. . ;W " C0CZN:",C0CZN,!
. . D GETN1^C0CRNF("C0CZV",176.112,C0CZN,"C") ;LOOK IN C XREF
. . I $D(C0CZV) D ;FOUND A MATCH
. . . S C0CVO="FOUND:^"_C0CZI_"^"_C0CZJ_"^"_C0CZN
. . . S C0CVO=C0CVO_"^RXNORM:^"_$$ZVALUE^C0CRNF("MEDIATION CODE","C0CZV")
. . . D PUSH^GPLXPATH("^C0CZRX",C0CVO)
. . . W C0CVO,!
Q
;
CMPDRG2 ; COMPARE THE DRUG FILE TO THE VA VUID MAPPING FILE FOR MATCHES
;
S C0CZI=0 ;
F S C0CZI=$O(^C0CDRUG("V",C0CZI)) Q:C0CZI="" D ;ALL DRUGS IN RPMS DRUG FILE
. S C0CZJ="" ; FOR EVERY FIELD AND SUBFIELD IN THE DRUG FILE
. W "C0CZI:",C0CZI
. F S C0CZJ=$O(^C0CDRUG("V",C0CZI,C0CZJ)) Q:C0CZJ="" D ;
. . W " C0CZJ:",C0CZJ
. . N C0CZN,C0CZV ;
. . S C0CZN=^C0CDRUG("V",C0CZI,C0CZJ,1) ; EVERY FIELD VALUE
. . W " C0CZN:",C0CZN,!
. . D GETN1^C0CRNF("C0CZV",176.112,C0CZN,"C") ;LOOK IN C XREF
. . I $D(C0CZV) D ;FOUND A MATCH
. . . W "FOUND: ",C0CZI," ",C0CZJ," ",C0CZN
. . . W " VUID:",$$ZVALUE^C0CRNF("VUID","C0CZV"),!
Q
;

View File

@ -69,18 +69,22 @@ EXTRACT(ALTXML,DFN,ALTOUTXML) ; EXTRACT ALERTS INTO PROVIDED XML TEMPLATE
. . S @ALTVMAP@("ALERTSOURCEID")="ACTORPROVIDER_"_ALTPROV
. E S @ALTVMAP@("ALERTSOURCEID")="" ; SOURCE NULL - SHOULD NOT HAPPEN
. W "RUNNING ALERTS, PROVIDER: ",@ALTVMAP@("ALERTSOURCEID"),!
. N ACGL1,ACGFI,ACIEN,ACVUID
. N ACGL1,ACGFI,ACIEN,ACVUID,ACNM,ACTMP
. S ACGL1=$P(@ALTG@(ALTTMP),U,9) ; ADDRESS OF THE REACTANT XX;GLB(YY.Z,
. S ACGFI=$$PRSGLB($P(ACGL1,";",2)) ; FILE NUMBER
. S ACIEN=$P(ACGL1,";",1) ; IEN OF REACTANT
. S ACVUID=$$GET1^DIQ(ACGFI,ACIEN,"VUID") ; VUID OF THE REACTANT
. S @ALTVMAP@("ALERTAGENTPRODUCTOBJECTID")="PRODUCT_"_ACIEN ; IE OF REACTANT
. S @ALTVMAP@("ALERTAGENTPRODUCTSOURCEID")="" ; WHERE DO WE GET THIS?
. S @ALTVMAP@("ALERTAGENTPRODUCTNAMETEXT")=$P(@ALTG@(ALTTMP),U,2) ; REACTANT
. S ACNM=$P(@ALTG@(ALTTMP),U,2) ; REACTANT
. S @ALTVMAP@("ALERTAGENTPRODUCTNAMETEXT")=ACNM
. S @ALTVMAP@("ALERTAGENTPRODUCTCODEVALUE")=ACVUID
. I ACVUID'="" D ; IF VUID IS NOT NULL
. . S @ALTVMAP@("ALERTAGENTPRODUCTCODESYSTEM")="VUID"
. E D ; IF REACTANT CODE VALUE IS NULL
. . I $G(DUZ("AG"))="I" D ; IF WE ARE RUNNING ON RPMS
. . . S ACTMP=$O(^C0CCODES(176.112,"C",ACNM,0)) ;
. . . W "RPMS NAME FOUND",ACNM," ",ACTMP,!
. . S @ALTVMAP@("ALERTAGENTPRODUCTCODESYSTEM")=""
. . S @ALTVMAP@("ALERTAGENTPRODUCTCODEVALUE")=""
. ; REACTIONS - THIS SHOULD BE MULTIPLE, IS SINGLE NOW