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

BWUTL6.m

Go to the documentation of this file.
BWUTL6 ;IHS/ANMC/MWR - UTIL: TEXT VALS, DEF PRINT DATE;15-Feb-2003 22:15;PLS
 ;;2.0;WOMEN'S HEALTH;**8**;MAY 16, 1996
 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
 ;;  UTILITY: TEXT FOR PROVIDER, PROCEDURE, HOSP LOC, INSTIT, & ECC.
 ;;  PROC SPECIAL VALUE (PAP, MAM, COLP).  COMPUTE DEFAULT PRINT DATE.
 ;
 ;
PROV() ;EP
 ;---> RETURN TEXT OF PROVIDER'S NAME.
 ;---> REQUIRED VARIABLE: X=IEN IN NEW PERSON FILE #200.
 Q:'$D(X) ""
 Q:'X "UNKNOWN"
 Q:'$D(^VA(200,X,0)) "UNKNOWN POINTER"
 Q $P(^VA(200,X,0),U)
 ;
 ;
PCDNAM() ;EP
 ;---> RETURN TEXT OF PROCEDURE TYPE.
 ;---> REQUIRED VARIABLE: X=IEN IN BW PROCEDURE TYPE FILE #9002086.2.
 Q:'$D(X) ""
 Q:'X "UNKNOWN"
 Q:'$D(^BWPN(X,0)) "UNKNOWN POINTER"
 Q $P(^BWPN(X,0),U)
 ;
HOSPLC() ;EP
 ;---> RETURN TEXT OF HOSPITAL LOCATION NAME.
 ;---> REQUIRED VARIABLE: X=IEN IN HOSPITAL LOCATION FILE #44.
 Q:'$D(X) ""
 Q:'X "UNKNOWN"
 Q:'$D(^SC(X,0)) "UNKNOWN POINTER"
 Q $P(^SC(X,0),U)
 ;
INSTIT() ;EP
 ;---> RETURN IEN OF INSTITUTION (FACILITY) FILE 4, FOR THIS HOSPITAL
 ;---> LOCATION ENTRY IN HOSPITAL LOCATION FILE 44.
 ;---> ALSO CONCATENATE "`" TO THE FRONT OF IEN FOR USE IN DR STRINGS.
 Q:'$D(X) ""
 Q:X="" ""
 Q:'$D(^SC(X,0)) ""
 Q:$P(^SC(X,0),U,4)']"" ""
 Q "`"_$P(^SC(X,0),U,4)
 ;
INSTTX(FACILITY) ;EP
 ;---> RETURN TEXT OF INSTITUTION (FACILITY) NAME.
 ;---> REQUIRED VARIABLE: X=IEN IN INSTITUTION FILE #4.
 Q:'$G(FACILITY) ""
 Q:'$D(^DIC(4,FACILITY,0)) "UNKNOWN POINTER"
 Q $P(^DIC(4,FACILITY,0),U)
 ;
ECCDYS() ;EP
 ;---> RETURN TEXT FROM SET OF CODES FOR ECC DYSPLASIA, FIELD .25,
 ;---> OF PROCEDURE FILE 9002086.1.
 ;---> REQUIRED VARIABLE: X=CODE FOR TEXT OF ECC DYSPLASIA.
 Q:'$D(X) ""
 Q:X="" ""
 Q:'$D(^DD(9002086.1,.25,0)) "^DD MISSING"
 Q $P($P(^DD(9002086.1,.25,0),X_":",2),";")
 ;
PNOCX(IEN) ;EP
 ;---> RETURN 1 IF THIS PROCEDURE IS NOT ANY TYPE OF CERVICAL TX.
 Q:'$G(IEN) 1
 Q:'$D(^BWPN(IEN,0)) 1
 Q:$$PMAM(IEN) 1
 Q:IEN=27 1  Q:IEN=29 1  Q:IEN=30 1  Q:IEN=31 1  Q:IEN=32 1
 Q:IEN=33 1  Q:IEN=34 1  Q:IEN=35 1
 Q 0
 ;
 ;
PMAM(IEN) ;EP
 ;---> RETURN 1 IF THIS PROCEDURE IS ANY TYPE OF MAMMOGRAM, RETURN 0
 ;---> IF NOT.
 ;---> REQUIRED VARIABLE: IEN=IEN IN PROCEDURE TYPE FILE #9002086.2.
 ;---> 25, 26, AND 27 ARE IENS OF MAMS IN ^BWPN(.
 Q:'$G(IEN) 0
 Q:IEN=25 1  Q:IEN=26 1  Q:IEN=28 1
 Q 0
 ;
 ;
PRTDATE ;EP
 ;---> CALL BY BW NOTIF-EDITBLK-1 TO COMPUTE AND STUFF DATE NOTIFICATION
 ;---> LETTER WILL BE PRINTED, "Print Date" FIELD.  CALLED FROM
 ;---> "TYPE OF NOTIFICATION" FIELD ORDER, "POST ACTION ON CHANGE".
 ;--->
 ;---> IF THE "TYPE OF NOTIFICATION" IS PRINTABLE (LETTER), AS STORED
 ;---> IN #.02 FIELD OF FILE #9002086.403, THIS COMPUTES PRINT DATE AND
 ;---> STUFFS A DEFAULT "COMPLETE BY DATE" (FIELD #.13) AS WELL.
 ;---> "PRINT DATE" WILL BE CX/BR NEED DUE DATE - SITE PARAMETER, AS
 ;---> STORED IN #.06 FIELD OF FILE #9002086.02, OR -30 DAYS IF
 ;---> PARAMETER NOT SET.  (SEE PRTDAT^BWUTL2-ABOVE.)
 ;---> "COMPLETE BY DATE" WILL BE "PRINT DATE"+30. SEE NDELQ1^BWUTL4.
 ;--->
 ;---> IF THE "TYPE OF NOTIFICATION" IS NOT PRINTABLE (PHONE), THIS
 ;---> SETS "PRINT DATE"="" AND RECOMPUTES "COMPLETE BY DATE" BASED ON
 ;---> DATE NOTIFICATION WAS OPENED (FIELD #.02) +30 DAYS.
 ;
 ;---> (NOTE: FOR UNIFORMITY, EXECUTABLE DEFAULT FOR "PRINT DATE"
 ;---> CALLS THIS CODE TO SET ITS STORED VALUE, THEN SETS ITS DEFAULT
 ;---> EQUAL TO ITS STORED VALUE.)
 ;--->
 ;---> REQUIRED VARIABLES: BWDFN=IEN OF PATIENT
 ;--->                     DUZ(2)=SITE
 ;--->                     BWTYPE=IEN TYPE OF NOTIFICATION (LETTER, ETC)
 ;--->                     BWPURP=IEN PURPOSE OF NOTIFICATION
 ;
 N BWTYPE,BWPURP,X,Y
 S BWTYPE=$$GET^DDSVAL(DIE,DA,.03)
 I 'BWTYPE D PUT^DDSVAL(DIE,DA,.11,"") Q
 ;---> IF NOT PRINTABLE, SET PRINT DATE="".
 I '$P(^BWNOTT(BWTYPE,0),U,2) D  Q
 .D PUT^DDSVAL(DIE,DA,.11,"")
 .S X=$$NDELQ^BWUTL4 D PUT^DDSVAL(DIE,DA,.13,X)
 S BWPURP=$$GET^DDSVAL(DIE,DA,.04)
 ;---> COMPUTE AND STUFF PRINT DATE.
 D PRTDAT(BWDFN,DUZ(2),BWTYPE,BWPURP,.X)
 D PUT^DDSVAL(DIE,DA,.11,X)
 ;---> COMPUTE AND STUFF COMPLETE BY DATE.
 S X=$$NDELQ1^BWUTL4 D PUT^DDSVAL(DIE,DA,.13,X)
 Q
 ;
 ;
PRTDAT(DFN,DUZ2,TYPE,PURP,DATE) ;EP
 ;---> YIELD PATIENT'S LETTER PRINT DATE, BASED ON CX/BR NEED.
 ;---> DUE DATE MINUS SITE PARAMETER (OR 30 DAYS, IF NOT SET).
 ;---> TYPE OF NOTIFICATION MUST BE "PRINTABLE" (#.02 OF #9002086.403).
 ;---> REQUIRED VARIABLES: DFN=IEN OF PATIENT
 ;--->                     DUZ2=DUZ(2)
 ;--->                     TYPE=IEN TYPE OF NOTIFICATION
 ;--->                     PURP=IEN PURPOSE OF NOTIFICATION
 ;---> RETURNS VARIABLES:  DATE=DEFAULT DATE LETTER SHOULD BE PRINTED
 ;
 N P,Q,X,X1,X2
 S DATE=""
 Q:'TYPE!('PURP)
 ;---> QUIT IF THIS "TYPE OF NOTIFICATION" IS NOT "PRINTABLE" (PIECE 2).
 Q:'$P(^BWNOTT(TYPE,0),U,2)
 S X2=$P(^BWSITE(DUZ2,0),U,6)
 S X2=$S(X2:-X2,1:-30)
 Q:'$D(^BWP(DFN,0))
 ;---> IF THIS PURPOSE IS A RESULT LETTER, SET PRINT DATE=TODAY, QUIT.
 Q:'$D(^BWNOTP(PURP,0))
 I $P(^BWNOTP(PURP,0),U,6) S DATE=DT Q
 ;---> IF THIS IS NOT ASSOCIATED WITH BR/CX NEEDS, QUIT WITH DATE="".
 Q:$P(^BWNOTP(PURP,0),U,5)=""
 S:$P(^BWNOTP(PURP,0),U,5)="CX" P=11,Q=12
 S:$P(^BWNOTP(PURP,0),U,5)="BR" P=18,Q=19
 ;---> QUIT IF THIS PATIENT HAS NO BR/CX NEED ENTERED.
 Q:'$P(^BWP(DFN,0),U,P)
 ;---> QUIT IF THIS PATIENT HAS NO BR/CX NEED DUE DATE.
 S X=$P(^BWP(DFN,0),U,Q) Q:'X
 S:'$E(X,7) $E(X,7)=1
 S X1=X D C^%DTC
 S DATE=X
 Q