ORWDBA2 ; SLC/GDU - Billing Awareness - Phase I [11/26/04 15:43] ;05/23/12 10:35
;;3.0;ORDER ENTRY/RESULTS REPORTING;**195,361**;Dec 17, 1997;Build 39
;
;Clinician's Personal Diagnoses List
;The personal diagnoses list is stored in the NEW PERSON file # 200.
;In file # 200 it is stored in the multi-valued field PERSONAL DIAGNOSIS
;LIST, field # 351, sub-file 200.0351. This is unique to the individual
;clinician. It is designed to aid the clinician with the CIDC process
;by providing a list of diagnoses codes most frequently used by that
;clinician.
;
;External References:
; NOW^%DTC DBIA 10000
; FILE^DIE DBIA 2053
; UPDATE^DIE DBIA 2053
; DT^DILF DBIA 2054
; FDA^FILF DBIA 2054
; $$GET1^DIQ DBIA 2056
; GETS^DIQ DBIA 2056
; $$STATCHK^ICDAPIU DBIA 3991
; $$ICDDX^ICDCODE DBIA 3990
; $$NOW^XLFDT DBIA 10103
;
ADDPDL(Y,ORCIEN,ORDXA) ;Add to Personal Diagnosis List
;Add a new personal diagnosis list or new ICD9 code to an existing
;personal diagnosis list for a clinician. It will filter out duplicate
;entries before updating an existing PDL.
;Input Variables:
; ORCIEN Clinician Internal Entry Number
; ORDXA Array of dx codes to be added to personal dx list
; format: ORDXA(#)=ICD9_Code^Lexicon_Expression_IEN
;Output Variable:
; Y Return value, 1 successful, 0 unsuccessful
;Local Variables:
; DXI Diagnosis Array Index
; DXIEN Diagnosis Code Internal Entry Number
; EM Error Message
; FDXR Found Diagnoses Records Array
; FDXRI Found Diagnoses Records Array Index
; IEN Internal Entry Number
; PDL Personal Diagnoses List Array
; PDLI Personal Diagnoses List Array Index
N DXI,DXIEN,EM,FDXR,FDXRI,IEN,PDL,PDLI
;Gets clinician's Personal Diagnosis List and removes duplicates from
;dx input array. Quits if all are duplicates.
D GETS^DIQ(200,ORCIEN,"351*,","","PDL","EM")
I $D(PDL) D
. S DXI="" F S DXI=$O(ORDXA(DXI)) Q:DXI="" D
.. S PDLI="" F S PDLI=$O(PDL(200.0351,PDLI)) Q:PDLI="" D
... I PDL(200.0351,PDLI,.01)=$P($G(ORDXA(DXI)),U) K ORDXA(DXI)
I $D(ORDXA)=0 S Y=0 Q
;Process dx input array
S DXI="" F S DXI=$O(ORDXA(DXI)) Q:DXI=""!($D(EM)) D
. K FDXR,EM
. ;Get the IEN for the current diagnosis code
. D FIND^DIC(80,"","","CM",$P(ORDXA(DXI),U),"*","","","","FDXR","EM")
. I $P(FDXR("DILIST",0),U)=0 Q
. I $P(FDXR("DILIST",0),U)=1 S DXIEN=FDXR("DILIST",2,1)
. I $P(FDXR("DILIST",0),U)>1 D
.. F FDXRI=1:1:FDXR("DILIST",0) D
... I FDXR("DILIST",1,FDXRI)=$P($G(ORDXA(DXI)),U) S DXIEN=FDXR("DILIST",2,FDXRI)
. ;Add IDC9 code to personal diagnoses list
. K IEN
. S IEN="1,"_ORCIEN_",",IEN="+"_IEN
. D FDA^DILF(200.0351,IEN,.01,"",DXIEN,"FDA","EM")
. D UPDATE^DIE("","FDA","IEN","EM")
. ;Add Lexicon Expression list
. I $P(ORDXA(DXI),U,2)'="" D
.. S IEN=IEN(1)_","_ORCIEN_","
.. D FDA^DILF(200.0351,IEN,1,"",$P(ORDXA(DXI),U,2),"FDA","EM")
.. D FILE^DIE("","FDA","EM")
I $D(EM) S Y=0 Q
S Y=1
Q
;
DELPDL(Y,ORCIEN,ORDXA) ;Delete from Personal Diagnosis List
;Delete a selected diagnosis code or group of diagnoses codes from a
;Clinician's Personal DX List.
;Input Variables:
; ORCIEN Clinician Internal ID number
; ORDXA Array of dx codes to be deleted from personal dx list
;Output Variable:
; Y Return value, 1 successful, 0 unsuccessful
;Local Variables:
; DXI Diagnosis code array index
; EM Error Message
; FDA FileMan Data Array
; IEN Interanl Entry Number
; RF Record Found
N DXI,EM,FDA,IEN,RF
D GETS^DIQ(200,ORCIEN,"351*,","","RF","EM")
I $D(RF)=0 S Y=0 Q
S IEN="" F S IEN=$O(RF(200.0351,IEN)) Q:IEN="" D
.S DXI="" F S DXI=$O(ORDXA(DXI)) Q:DXI="" D
.. I RF(200.0351,IEN,.01)=ORDXA(DXI) D
... D FDA^DILF(200.0351,IEN,.01,"","@","FDA","EM")
... D FILE^DIE("","FDA","EM")
S Y=1
Q
;
GETPDL(Y,ORCIEN) ;Get Personal Diagnosis List
;This gets the clinician's personal diagnosis list. Using the personal
;diagnosis list, builds and returns an array variable with the ICD9
;codes and descriptions stored in the ICD DIAGNOSIS file, # 80.
;Flagging any inactive ICD9 code with a "#".
;Input Variable:
; ORCIEN Clinician Internal ID number
;Output Variable:
; Y Array of ICD9 codes and descriptions
; Y(#)=ICD9_code^DX_description^DX_Inactive
; If inactive # in third piece
; If active null in third piece
;Local Variables:
; DXC Diagnosis Code (for sorting)
; DXD Diagnosis Description
; DXDT Diagnosis Date
; DXI Diagnosis Inactive Flag
; EM Error Message
; ICD9 ICD9 code (for GUI)
; IEN Internal Entry Number
; RF Record Found
N DXC,DXD,DXDT,DXI,EM,ICD9,IEN,RF
S DXDT=$$NOW^XLFDT
D GETS^DIQ(200,ORCIEN,"351*,","EI","RF","EM")
I $D(RF) D
. S (DXC,DXD,DXI,ICD9,IEN)=""
. F S IEN=$O(RF(200.0351,IEN)) Q:IEN="" D
.. S ICD9=RF(200.0351,IEN,.01,"E")
.. S DXC=$$SETDXC(ICD9)
.. I $G(RF(200.0351,IEN,1,"I"))="" S DXD=$$SETDXD($P($$ICDDATA^ICDXCODE("DIAGNOSIS",ICD9,DXDT),U,4))
.. I $G(RF(200.0351,IEN,1,"I"))=1 S DXD=$$SETDXD($P($$ICDDATA^ICDXCODE("DIAGNOSIS",ICD9,DXDT),U,4))
.. I $G(RF(200.0351,IEN,1,"I"))>1 S DXD=RF(200.0351,IEN,1,"E")
.. S DXI=$$SETDXI($$STATCHK^ICDXCODE("DIAGNOSIS",ICD9,DXDT))
.. S Y(DXC)=ICD9_U_DXD_U_DXI
E S Y=0
Q
;
GETDUDC(Y,ORCIEN,ORPTIEN) ;Get Day's Unique Diagnoses Codes
;Gets all the unique ICD9 codes for the orders placed today by the
;clinician for this patient. Using the ICD9 codes it builds an array
;variable with the ICD9 code, its description from the ICD DIAGNOSIS
;file, #80. Flagging any inactive ICD9 codes with a "#".
;Input Variables:
; ORCIEN Clinician's internal ID number
; ORPTIEN Patient's internal ID number
;Output Variable:
; Y Array of ICD9 codes and descriptions
; Y(#)=ICD9_code^DX_Description^DX_Inactive
; If inactive # in third piece
; If active null in third piece
;Local Variables:
; CKDATE Check Date (stops loop)
; DXC Diagnosis Code (for sorting)
; DXD Diagnosis Description
; DXI Diagnosis Inactive Flag
; DXIEN Diagnosis Internal Entry Number
; ICD9 ICD9 code (for GUI display)
; IEN Internal Entry Number
; OBJORD Object of Order
; ORDATE Order Date
; ORDG Order Group (ACT index variable)
; OREM Order Error Message
; ORIEN Order Internal Entry Number
; ORRF Order Record Found
; RCODI Reverse Cronological Order Date Index
; SUBFILE Subfile Number
N CKDATE,DXC,DXD,DXEM,DXI,DXIEN,DXRF,ICD9,IEN,OBJORD,ORDATE,ORDG,OREM
N ORIEN,ORRF,RCODI,SUBFILE
S OBJORD=ORPTIEN_";DPT("
S (DXIEN,ORDATE,ORDG,ORIEN,RCODI)="",CKDATE=$$F24HA
F S RCODI=$O(^OR(100,"ACT",OBJORD,RCODI)) S ORDATE=9999999-RCODI Q:ORDATE<CKDATE!(RCODI="") D
. F S ORDG=$O(^OR(100,"ACT",OBJORD,RCODI,ORDG)) Q:ORDG="" D
.. S ORIEN=$QS($Q(^OR(100,"ACT",OBJORD,RCODI,ORDG)),6)
.. K ORRF,OREM
.. D GETS^DIQ(100,ORIEN,"1;5.1*","I","ORRF","OREM")
.. S IEN=$QS($Q(ORRF(100)),2)
.. Q:ORRF(100,IEN,1,"I")'=ORCIEN
.. Q:$D(ORRF(100.051))=0
.. S (DXC,DXD,DXI,DXIEN,ICD9,IEN)=""
.. F S IEN=$O(ORRF(100.051,IEN)) Q:IEN="" D
... Q:ORRF(100.051,IEN,.01,"I")=""
... S DXIEN=ORRF(100.051,IEN,.01,"I")
... S ICD9=$$GET1^DIQ(80,DXIEN,.01,"")
... S DXC=$$SETDXC(ICD9)
... S DXD=$$SETDXD($P($$ICDDATA^ICDXCODE("DIAGNOSIS",ICD9,ORDATE),U,4))
... S DXI=$$SETDXI($$STATCHK^ICDXCODE("DIAGNOSIS",ICD9,ORDATE))
... S Y(DXC)=ICD9_U_DXD_U_DXI
Q
;
SETDXC(X) ;Set diagnosis code variable for sorting
S X=$S($E(X)?1A:X,1:+X) Q X
;
SETDXD(X) ;Set upper case diagnosis discription to mixed case
N X1,X2
F X1=2:1:$L(X) D
. I $E(X,X1)?1U,$E(X,X1-1)?1A D
.. S X2=$E(X,X1)
.. S X2=$C($A(X2)+32)
.. S $E(X,X1)=X2
Q X
;
SETDXI(X) ;Set the diagnosis inactive indicator
S X=$S($P(X,U)=0:"#",1:"") Q X
;
CI(CNT) ;Counter Incrementer
; CNT - Counter
S CNT=CNT+1 Q CNT
;
F24HA() ;Returns date and time from exactly 24 hours ago
N %,%H,%I,X
D NOW^%DTC
Q %-1
;
ERRMSG(MT) ;Display Error Message
; to be determined
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORWDBA2 8467 printed Nov 22, 2024@17:45:16 Page 2
ORWDBA2 ; SLC/GDU - Billing Awareness - Phase I [11/26/04 15:43] ;05/23/12 10:35
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**195,361**;Dec 17, 1997;Build 39
+2 ;
+3 ;Clinician's Personal Diagnoses List
+4 ;The personal diagnoses list is stored in the NEW PERSON file # 200.
+5 ;In file # 200 it is stored in the multi-valued field PERSONAL DIAGNOSIS
+6 ;LIST, field # 351, sub-file 200.0351. This is unique to the individual
+7 ;clinician. It is designed to aid the clinician with the CIDC process
+8 ;by providing a list of diagnoses codes most frequently used by that
+9 ;clinician.
+10 ;
+11 ;External References:
+12 ; NOW^%DTC DBIA 10000
+13 ; FILE^DIE DBIA 2053
+14 ; UPDATE^DIE DBIA 2053
+15 ; DT^DILF DBIA 2054
+16 ; FDA^FILF DBIA 2054
+17 ; $$GET1^DIQ DBIA 2056
+18 ; GETS^DIQ DBIA 2056
+19 ; $$STATCHK^ICDAPIU DBIA 3991
+20 ; $$ICDDX^ICDCODE DBIA 3990
+21 ; $$NOW^XLFDT DBIA 10103
+22 ;
ADDPDL(Y,ORCIEN,ORDXA) ;Add to Personal Diagnosis List
+1 ;Add a new personal diagnosis list or new ICD9 code to an existing
+2 ;personal diagnosis list for a clinician. It will filter out duplicate
+3 ;entries before updating an existing PDL.
+4 ;Input Variables:
+5 ; ORCIEN Clinician Internal Entry Number
+6 ; ORDXA Array of dx codes to be added to personal dx list
+7 ; format: ORDXA(#)=ICD9_Code^Lexicon_Expression_IEN
+8 ;Output Variable:
+9 ; Y Return value, 1 successful, 0 unsuccessful
+10 ;Local Variables:
+11 ; DXI Diagnosis Array Index
+12 ; DXIEN Diagnosis Code Internal Entry Number
+13 ; EM Error Message
+14 ; FDXR Found Diagnoses Records Array
+15 ; FDXRI Found Diagnoses Records Array Index
+16 ; IEN Internal Entry Number
+17 ; PDL Personal Diagnoses List Array
+18 ; PDLI Personal Diagnoses List Array Index
+19 NEW DXI,DXIEN,EM,FDXR,FDXRI,IEN,PDL,PDLI
+20 ;Gets clinician's Personal Diagnosis List and removes duplicates from
+21 ;dx input array. Quits if all are duplicates.
+22 DO GETS^DIQ(200,ORCIEN,"351*,","","PDL","EM")
+23 IF $DATA(PDL)
Begin DoDot:1
+24 SET DXI=""
FOR
SET DXI=$ORDER(ORDXA(DXI))
if DXI=""
QUIT
Begin DoDot:2
+25 SET PDLI=""
FOR
SET PDLI=$ORDER(PDL(200.0351,PDLI))
if PDLI=""
QUIT
Begin DoDot:3
+26 IF PDL(200.0351,PDLI,.01)=$PIECE($GET(ORDXA(DXI)),U)
KILL ORDXA(DXI)
End DoDot:3
End DoDot:2
End DoDot:1
+27 IF $DATA(ORDXA)=0
SET Y=0
QUIT
+28 ;Process dx input array
+29 SET DXI=""
FOR
SET DXI=$ORDER(ORDXA(DXI))
if DXI=""!($DATA(EM))
QUIT
Begin DoDot:1
+30 KILL FDXR,EM
+31 ;Get the IEN for the current diagnosis code
+32 DO FIND^DIC(80,"","","CM",$PIECE(ORDXA(DXI),U),"*","","","","FDXR","EM")
+33 IF $PIECE(FDXR("DILIST",0),U)=0
QUIT
+34 IF $PIECE(FDXR("DILIST",0),U)=1
SET DXIEN=FDXR("DILIST",2,1)
+35 IF $PIECE(FDXR("DILIST",0),U)>1
Begin DoDot:2
+36 FOR FDXRI=1:1:FDXR("DILIST",0)
Begin DoDot:3
+37 IF FDXR("DILIST",1,FDXRI)=$PIECE($GET(ORDXA(DXI)),U)
SET DXIEN=FDXR("DILIST",2,FDXRI)
End DoDot:3
End DoDot:2
+38 ;Add IDC9 code to personal diagnoses list
+39 KILL IEN
+40 SET IEN="1,"_ORCIEN_","
SET IEN="+"_IEN
+41 DO FDA^DILF(200.0351,IEN,.01,"",DXIEN,"FDA","EM")
+42 DO UPDATE^DIE("","FDA","IEN","EM")
+43 ;Add Lexicon Expression list
+44 IF $PIECE(ORDXA(DXI),U,2)'=""
Begin DoDot:2
+45 SET IEN=IEN(1)_","_ORCIEN_","
+46 DO FDA^DILF(200.0351,IEN,1,"",$PIECE(ORDXA(DXI),U,2),"FDA","EM")
+47 DO FILE^DIE("","FDA","EM")
End DoDot:2
End DoDot:1
+48 IF $DATA(EM)
SET Y=0
QUIT
+49 SET Y=1
+50 QUIT
+51 ;
DELPDL(Y,ORCIEN,ORDXA) ;Delete from Personal Diagnosis List
+1 ;Delete a selected diagnosis code or group of diagnoses codes from a
+2 ;Clinician's Personal DX List.
+3 ;Input Variables:
+4 ; ORCIEN Clinician Internal ID number
+5 ; ORDXA Array of dx codes to be deleted from personal dx list
+6 ;Output Variable:
+7 ; Y Return value, 1 successful, 0 unsuccessful
+8 ;Local Variables:
+9 ; DXI Diagnosis code array index
+10 ; EM Error Message
+11 ; FDA FileMan Data Array
+12 ; IEN Interanl Entry Number
+13 ; RF Record Found
+14 NEW DXI,EM,FDA,IEN,RF
+15 DO GETS^DIQ(200,ORCIEN,"351*,","","RF","EM")
+16 IF $DATA(RF)=0
SET Y=0
QUIT
+17 SET IEN=""
FOR
SET IEN=$ORDER(RF(200.0351,IEN))
if IEN=""
QUIT
Begin DoDot:1
+18 SET DXI=""
FOR
SET DXI=$ORDER(ORDXA(DXI))
if DXI=""
QUIT
Begin DoDot:2
+19 IF RF(200.0351,IEN,.01)=ORDXA(DXI)
Begin DoDot:3
+20 DO FDA^DILF(200.0351,IEN,.01,"","@","FDA","EM")
+21 DO FILE^DIE("","FDA","EM")
End DoDot:3
End DoDot:2
End DoDot:1
+22 SET Y=1
+23 QUIT
+24 ;
GETPDL(Y,ORCIEN) ;Get Personal Diagnosis List
+1 ;This gets the clinician's personal diagnosis list. Using the personal
+2 ;diagnosis list, builds and returns an array variable with the ICD9
+3 ;codes and descriptions stored in the ICD DIAGNOSIS file, # 80.
+4 ;Flagging any inactive ICD9 code with a "#".
+5 ;Input Variable:
+6 ; ORCIEN Clinician Internal ID number
+7 ;Output Variable:
+8 ; Y Array of ICD9 codes and descriptions
+9 ; Y(#)=ICD9_code^DX_description^DX_Inactive
+10 ; If inactive # in third piece
+11 ; If active null in third piece
+12 ;Local Variables:
+13 ; DXC Diagnosis Code (for sorting)
+14 ; DXD Diagnosis Description
+15 ; DXDT Diagnosis Date
+16 ; DXI Diagnosis Inactive Flag
+17 ; EM Error Message
+18 ; ICD9 ICD9 code (for GUI)
+19 ; IEN Internal Entry Number
+20 ; RF Record Found
+21 NEW DXC,DXD,DXDT,DXI,EM,ICD9,IEN,RF
+22 SET DXDT=$$NOW^XLFDT
+23 DO GETS^DIQ(200,ORCIEN,"351*,","EI","RF","EM")
+24 IF $DATA(RF)
Begin DoDot:1
+25 SET (DXC,DXD,DXI,ICD9,IEN)=""
+26 FOR
SET IEN=$ORDER(RF(200.0351,IEN))
if IEN=""
QUIT
Begin DoDot:2
+27 SET ICD9=RF(200.0351,IEN,.01,"E")
+28 SET DXC=$$SETDXC(ICD9)
+29 IF $GET(RF(200.0351,IEN,1,"I"))=""
SET DXD=$$SETDXD($PIECE($$ICDDATA^ICDXCODE("DIAGNOSIS",ICD9,DXDT),U,4))
+30 IF $GET(RF(200.0351,IEN,1,"I"))=1
SET DXD=$$SETDXD($PIECE($$ICDDATA^ICDXCODE("DIAGNOSIS",ICD9,DXDT),U,4))
+31 IF $GET(RF(200.0351,IEN,1,"I"))>1
SET DXD=RF(200.0351,IEN,1,"E")
+32 SET DXI=$$SETDXI($$STATCHK^ICDXCODE("DIAGNOSIS",ICD9,DXDT))
+33 SET Y(DXC)=ICD9_U_DXD_U_DXI
End DoDot:2
End DoDot:1
+34 IF '$TEST
SET Y=0
+35 QUIT
+36 ;
GETDUDC(Y,ORCIEN,ORPTIEN) ;Get Day's Unique Diagnoses Codes
+1 ;Gets all the unique ICD9 codes for the orders placed today by the
+2 ;clinician for this patient. Using the ICD9 codes it builds an array
+3 ;variable with the ICD9 code, its description from the ICD DIAGNOSIS
+4 ;file, #80. Flagging any inactive ICD9 codes with a "#".
+5 ;Input Variables:
+6 ; ORCIEN Clinician's internal ID number
+7 ; ORPTIEN Patient's internal ID number
+8 ;Output Variable:
+9 ; Y Array of ICD9 codes and descriptions
+10 ; Y(#)=ICD9_code^DX_Description^DX_Inactive
+11 ; If inactive # in third piece
+12 ; If active null in third piece
+13 ;Local Variables:
+14 ; CKDATE Check Date (stops loop)
+15 ; DXC Diagnosis Code (for sorting)
+16 ; DXD Diagnosis Description
+17 ; DXI Diagnosis Inactive Flag
+18 ; DXIEN Diagnosis Internal Entry Number
+19 ; ICD9 ICD9 code (for GUI display)
+20 ; IEN Internal Entry Number
+21 ; OBJORD Object of Order
+22 ; ORDATE Order Date
+23 ; ORDG Order Group (ACT index variable)
+24 ; OREM Order Error Message
+25 ; ORIEN Order Internal Entry Number
+26 ; ORRF Order Record Found
+27 ; RCODI Reverse Cronological Order Date Index
+28 ; SUBFILE Subfile Number
+29 NEW CKDATE,DXC,DXD,DXEM,DXI,DXIEN,DXRF,ICD9,IEN,OBJORD,ORDATE,ORDG,OREM
+30 NEW ORIEN,ORRF,RCODI,SUBFILE
+31 SET OBJORD=ORPTIEN_";DPT("
+32 SET (DXIEN,ORDATE,ORDG,ORIEN,RCODI)=""
SET CKDATE=$$F24HA
+33 FOR
SET RCODI=$ORDER(^OR(100,"ACT",OBJORD,RCODI))
SET ORDATE=9999999-RCODI
if ORDATE<CKDATE!(RCODI="")
QUIT
Begin DoDot:1
+34 FOR
SET ORDG=$ORDER(^OR(100,"ACT",OBJORD,RCODI,ORDG))
if ORDG=""
QUIT
Begin DoDot:2
+35 SET ORIEN=$QSUBSCRIPT($QUERY(^OR(100,"ACT",OBJORD,RCODI,ORDG)),6)
+36 KILL ORRF,OREM
+37 DO GETS^DIQ(100,ORIEN,"1;5.1*","I","ORRF","OREM")
+38 SET IEN=$QSUBSCRIPT($QUERY(ORRF(100)),2)
+39 if ORRF(100,IEN,1,"I")'=ORCIEN
QUIT
+40 if $DATA(ORRF(100.051))=0
QUIT
+41 SET (DXC,DXD,DXI,DXIEN,ICD9,IEN)=""
+42 FOR
SET IEN=$ORDER(ORRF(100.051,IEN))
if IEN=""
QUIT
Begin DoDot:3
+43 if ORRF(100.051,IEN,.01,"I")=""
QUIT
+44 SET DXIEN=ORRF(100.051,IEN,.01,"I")
+45 SET ICD9=$$GET1^DIQ(80,DXIEN,.01,"")
+46 SET DXC=$$SETDXC(ICD9)
+47 SET DXD=$$SETDXD($PIECE($$ICDDATA^ICDXCODE("DIAGNOSIS",ICD9,ORDATE),U,4))
+48 SET DXI=$$SETDXI($$STATCHK^ICDXCODE("DIAGNOSIS",ICD9,ORDATE))
+49 SET Y(DXC)=ICD9_U_DXD_U_DXI
End DoDot:3
End DoDot:2
End DoDot:1
+50 QUIT
+51 ;
SETDXC(X) ;Set diagnosis code variable for sorting
+1 SET X=$SELECT($EXTRACT(X)?1A:X,1:+X)
QUIT X
+2 ;
SETDXD(X) ;Set upper case diagnosis discription to mixed case
+1 NEW X1,X2
+2 FOR X1=2:1:$LENGTH(X)
Begin DoDot:1
+3 IF $EXTRACT(X,X1)?1U
IF $EXTRACT(X,X1-1)?1A
Begin DoDot:2
+4 SET X2=$EXTRACT(X,X1)
+5 SET X2=$CHAR($ASCII(X2)+32)
+6 SET $EXTRACT(X,X1)=X2
End DoDot:2
End DoDot:1
+7 QUIT X
+8 ;
SETDXI(X) ;Set the diagnosis inactive indicator
+1 SET X=$SELECT($PIECE(X,U)=0:"#",1:"")
QUIT X
+2 ;
CI(CNT) ;Counter Incrementer
+1 ; CNT - Counter
+2 SET CNT=CNT+1
QUIT CNT
+3 ;
F24HA() ;Returns date and time from exactly 24 hours ago
+1 NEW %,%H,%I,X
+2 DO NOW^%DTC
+3 QUIT %-1
+4 ;
ERRMSG(MT) ;Display Error Message
+1 ; to be determined
+2 QUIT