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

BWUTL4.m

Go to the documentation of this file.
BWUTL4 ;IHS/ANMC/MWR - UTIL: DATE DEFAULTS, OTH VALUES;23-Jan-2009 10:35;DU
 ;;2.0;WOMEN'S HEALTH;**8,9,11**;MAY 16, 1996
 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
 ;;  UTILITY: DEFAULT "COMPLETE BY" DATES FOR NOTIFS AND PROCEDURES,
 ;;  STATUS TEXT, DIAG TEXT, NORMAL VALUE, COLP VALUE, MARGIN? VALUE.
 ;
 ;
NDELQ() ;EP
 ;---> FOR NOTIFICATIONS:
 ;---> COMPUTE DEFAULT "COMPLETE BY (DATE)" - DATE AT WHICH A
 ;---> NOTIFICATION BECOMES DELINQUENT.  CALLED BY BW NOTIF-EDITBLK-1.
 ;---> DEFAULT IS CREATED WHEN SCREEN IS FIRST LOADED.
 ;---> CODE HERE SETS X=EITHER 1: PRINT DATE (IF PRINTABLE), OR
 ;--->                         2: DATE NOTIFICATION OPENED, OR
 ;--->                         3: TODAY'S DATE
 ;---> THEN $$NDELQ1() IS CALLED TO ADD 30 DAYS UNTIL DELINQUENT.
 ;---> REQUIRED VARIABLE: DA (IEN OF NOTIFICATION).
 N X
 Q:'$D(DA) ""
 Q:'DA ""
 Q:'$D(^BWNOT(DA,0)) ""
 S X=$P(^BWNOT(DA,0),U,11)
 S:'X X=$P(^BWNOT(DA,0),U,2)
 S:'X X=DT
 Q $$NDELQ1
 ;
NDELQ1() ;EP
 ;---> FOR NOTIFICATIONS:
 ;---> COMPUTE "COMPLETE BY (DATE)".  CALLED BY UPDATE/EDIT OF
 ;---> "PRINT DATE:" IN BW NOTIF-EDITBLK-1.
 ;---> X1=EITHER NEW PRINT DATE, OR DATE NOTIF OPENED, OR TODAY.
 ;---> X2=30 DAYS ADDED TILL NOTIFICATION BECOMES DELINQUENT.
 ;---> REQUIRED VARIABLE: X=PRINT DATE, OR DATE OPENED, OR TODAY.
 N %H,X1,X2
 Q:'$D(X) ""
 Q:'X ""
 S X1=X,X2=30
 D C^%DTC
 Q X
 ;
PDELQ(DA,DUZ2) ;EP
 ;---> FOR PROCEDURES:
 ;---> COMPUTE DEFAULT "COMPLETE BY (DATE)" - DATE AT WHICH A
 ;---> PROCEDURE BECOMES DELINQUENT.  CALLED BY BW PROC-EDITBLK-1.
 ;---> DEFAULT IS CREATED WHEN SCREEN IS FIRST LOADED.
 ;---> CODE HERE FIRST RETRIEVES STORED DATE OF PROCEDURE, THEN CALLS
 ;---> $$DELQ1 TO COMPUTE "COMPLETE BY (DATE)".
 ;---> REQUIRED VARIABLE: DA (IEN OF PROCEDURE), DUZ2=DUZ(2).
 Q:'$G(DA)!('$G(DUZ2)) ""
 Q:'$D(^BWPCD(DA,0)) ""
 Q:'$P(^BWPCD(DA,0),U,12) ""
 Q $$PDELQ1(DA,$P(^BWPCD(DA,0),U,12),DUZ2)
 ;
PDELQ1(BWDA,BWDT,BWDUZ2) ;EP
 ;---> FOR PROCEDURES:
 ;---> COMPUTE "COMPLETE BY (BWDT)".  CALLED BY UPBWDT/EDIT OF
 ;---> "BWDT OF PROCEDURE" IN BW PROC-EDITBLK-1.
 ;---> X1=BWDT OF PROCEDURE, X2=DEFAULT NUMBER OF BWDAYS THE
 ;---> PROCEDURE IS ALLOWED TO REMAIN OPEN BEFORE BECOMING DELINQUENT.
 ;---> REQUIRED VARIABLE: BWDA=IEN OF PROCEDURE, BWDT=DATE OF PROCEDURE,
 ;--->                    BWDUZ2=DUZ(2).
 N %H,X,X1,X2
 Q:'$G(BWDA)!('$G(BWDT)) ""
 Q:'$D(^BWPCD(BWDA,0)) ""
 S X2=$P(^BWPCD(BWDA,0),U,4),X1=BWDT
 Q:'X2 ""
 Q:'$D(^BWSITE(BWDUZ2,X2)) ""
 S X2=$P(^BWSITE(BWDUZ2,X2),U,3)
 D C^%DTC
 Q X
 ;
STATUS() ;EP
 ;---> PROVIDES STATUS (OPEN, DELINQUENT, OR CLOSED).
 ;---> Y MUST EQUAL ZERO NODE OF NOTIFICATION.
 ;---> REQUIRED VARIABLE: Y=ZERO NODE OF PROCEDURE, DT=FFDATE
 Q:'$D(Y) "UNKNOWN"
 Q:$P(Y,U,14)="c" "CLOSED"
 Q:$P(Y,U,14)="n" "NEW"
 Q:$P(Y,U,14)="e" "ERROR"
 Q:$P(Y,U,13)]""&($P(Y,U,13)<DT) "DELINQ"
 Q "OPEN"
 ;
DIAG(IEN) ;EP
 ;---> RETURN TEXT OF RESULT/DIAGNOSIS.
 ;---> REQUIRED VARIABLE X=IEN IN BW RESULTS/DIAGNOSIS FILE 9002086.31.
 Q:'$G(IEN) "NOT ENTERED"
 Q:'$D(^BWDIAG(IEN,0)) "UNKNOWN POINTER"
 Q $P(^BWDIAG(IEN,0),U)
 ;
PRIOR() ;EP
 ;---> PROVIDE PRIORITY FOR THIS RESULT/DIAGNOSIS (DEFAULT=10).
 ;---> REQUIRED VARIABLE X=IEN IN BW RESULTS/DIAGNOSIS FILE.
 Q:'$D(X)!(X']"") 10
 Q:'$D(^BWDIAG(X,0)) 10
 Q:'$P(^BWDIAG(X,0),U,2) 10
 Q $P(^BWDIAG(X,0),U,2)
 ;
NORMAL(X) ;EP
 ;---> PROVIDE NORMAL/ABNORMAL FOR THIS RESULT/DIAGNOSIS.
 ;---> WILL RETURN 0 IF NORMAL, 1 IF ABNORMAL (DEFAULT=1),
 ;---> 2 IF NO RESULT (EITHER THE PROCEDURE HAS NO RESULT OR
 ;---> THE RESULT/DIAGNOSIS HAS "NO RESULT" FOR FIELD #.21).
 ;---> REQUIRED VARIABLE X=IEN IN BW RESULTS/DIAGNOSIS FILE.
 Q:'$D(X)!(X']"") 2
 Q:'$D(^BWDIAG(X,0)) 2
 Q:$P(^BWDIAG(X,0),U,21)="" 2
 Q $P(^BWDIAG(X,0),U,21)
 ;
COLP(DA) ;EP
 ;---> DETERMINE WHETHER OR NOT THE CURRENT PROCEDURE REQUIRES
 ;---> PAGE 2 OF PROCEDURE EDIT SCREENS FOR COLPOSCOPY RESULTS.
 ;---> RETURNS 1 IF COLP-TYPE RESULTS, OTHERWISE 0.
 ;---> DA=IEN OF PROCEDURE IN PROC FILE #9002086.1.
 N Y
 Q:'$G(DA) 0
 Q:'$D(^BWPCD(DA,0)) 0
 S Y=$P(^BWPCD(DA,0),U,4)
 Q:'Y 0
 Q:'$D(^BWPN(Y,0)) 0
 Q:$P(^BWPN(Y,0),U,3)<1 0
 Q 1
 ;
COLPA(DA) ;EP
 ;---> LOOK FOR ASSOCIATED COLPOSCOPY, RETURN ITS ACC# AND DATE.
 N X,Y
 Q:'$G(DA) ""
 S Y=$$COLP0(DA)
 Q:Y="" "None"
 S X=$P(Y,U)_" on "_$$SLDT2^BWUTL5($P(Y,U,12))
 I $P(Y,U,5) Q X_"^"_$P(^BWDIAG($P(Y,U,5),0),U)
 Q X_"^"_"Not entered"
 ;
COLP0(DA) ;EP
 ;---> IF THERE IS AN ASSOC'D COLP, RETURN ITS ZERO NODE.
 N Y
 Q:'$G(DA) ""
 Q:'$D(^BWPCD(DA,0)) ""
 Q:'$D(^BWPCD("ACOLP",DA)) ""
 S Y=$O(^BWPCD("ACOLP",DA,0)),Y=$O(^BWPCD("ACOLP",DA,Y,0))
 Q:'$D(^BWPCD(Y,0)) ""
 Q ^BWPCD(Y,0)
 ;
MARGIN(DA) ;EP
 ;---> DETERMINE WHETHER THE "MARGINS CLEAR?" QUESTION (PAGE 2 OF
 ;---> PROCEDURE EDIT) SHOULD BE ASKED FOR THIS PROCEDURE.
 N Y
 Q:'$G(DA) 0
 Q:'$D(^BWPCD(DA,0)) 0
 S Y=$P(^BWPCD(DA,0),U,4)
 Q:'Y 0
 Q:'$D(^BWPN(Y,0)) 0
 Q:$P(^BWPN(Y,0),U,11)<1 0
 Q 1
 ;
STAGE(STAGE) ;EP
 ;---> RETURN THE TEXT OF THE STAGE OF CARCINOMA.
 Q:'$G(STAGE) ""
 Q:'$D(^DD(9002086.1,.31,0)) "^DD MISSING"
 Q $P($P(^DD(9002086.1,.31,0),STAGE_":",2),";")
HPVA(DA) ;
 ; ---> LOOK FOR ASSOCIATED HPV SCREENING, RETURN ITS ACC# AND DATE
 N X,Y
 Q:'$G(DA) ""
 S Y=$$HPVA0(DA)
 Q:Y="" "None"
 S X=$P(Y,U)_" on "_$$SLDT2^BWUTL5($P(Y,U,12))
 I $P(Y,U,5) Q X_"^"_$P(^BWDIAG($P(Y,U,5),0),U)
 Q X_"^"_"Not entered"
HPVA0(DA) ;
 ;---> IF THERE IS AN ASSOC'D COLP, RETURN ITS ZERO NODE.
 N Y
 Q:'$G(DA) ""
 Q:'$D(^BWPCD(DA,0)) ""
 Q:'$D(^BWPCD("AHPV",DA)) ""
 S Y=$O(^BWPCD("AHPV",DA,0)),Y=$O(^BWPCD("AHPV",DA,Y,0))
 Q:'$D(^BWPCD(Y,0)) ""
 Q ^BWPCD(Y,0)