| 1 | SCDXUTL2 ;ALB/MTC/JLU - PRINT UTILITY ROUTINES;23-MAY-1996 ; 20 Nov 98 12:25 AM
 | 
|---|
| 2 |  ;;5.3;Scheduling;**44,66,154**;AUG 13, 1993
 | 
|---|
| 3 |  ;
 | 
|---|
| 4 | PAT(D0) ;-- This function is used for the computed field 20.01 in file
 | 
|---|
| 5 |  ;   Transmission OutPatient Encounter file 409.73. For the given
 | 
|---|
| 6 |  ;   entry in 409.73 a determination of the PATIENT involved with
 | 
|---|
| 7 |  ;   the transaction will be determined.
 | 
|---|
| 8 |  ;
 | 
|---|
| 9 |  N SDTOE
 | 
|---|
| 10 |  S SDTOE=$G(^SD(409.73,D0,0))
 | 
|---|
| 11 |  I $P(SDTOE,U,2)="",$P(SDTOE,U,3) D
 | 
|---|
| 12 |  . S X=$P($G(^SD(409.74,$P(SDTOE,U,3),0)),U,2)
 | 
|---|
| 13 |  E  I $P(SDTOE,U,2),$P(SDTOE,U,3)="" D
 | 
|---|
| 14 |  . S X=$P($G(^SCE($P(SDTOE,U,2),0)),U,2)
 | 
|---|
| 15 |  E  S X=""
 | 
|---|
| 16 |  I X S X=$P($G(^DPT(X,0)),U)
 | 
|---|
| 17 |  Q
 | 
|---|
| 18 |  ;
 | 
|---|
| 19 | SSN(D0) ;-- This function is used for the computed field 20.04 in file
 | 
|---|
| 20 |  ;   Transmission OutPatient Encounter file 409.73. For the given
 | 
|---|
| 21 |  ;   entry in 409.73 a determination of the PATIENT SSN involved with
 | 
|---|
| 22 |  ;   the transaction will be determined.
 | 
|---|
| 23 |  ;
 | 
|---|
| 24 |  N SDTOE
 | 
|---|
| 25 |  S SDTOE=$G(^SD(409.73,D0,0))
 | 
|---|
| 26 |  I $P(SDTOE,U,2)="",$P(SDTOE,U,3) D
 | 
|---|
| 27 |  . S X=$P($G(^SD(409.74,$P(SDTOE,U,3),0)),U,2)
 | 
|---|
| 28 |  E  I $P(SDTOE,U,2),$P(SDTOE,U,3)="" D
 | 
|---|
| 29 |  . S X=$P($G(^SCE($P(SDTOE,U,2),0)),U,2)
 | 
|---|
| 30 |  E  S X=""
 | 
|---|
| 31 |  I X S X=$P($G(^DPT(X,0)),U,9)
 | 
|---|
| 32 |  Q
 | 
|---|
| 33 |  ;
 | 
|---|
| 34 | PATDFN(D0) ; This call will return the patient's DFN.  It is identical to
 | 
|---|
| 35 |  ;the PAT call above.  The only difference is that it leaves DFN defined
 | 
|---|
| 36 |  ;to the patient's DFN.
 | 
|---|
| 37 |  ;
 | 
|---|
| 38 |  N SDTOE
 | 
|---|
| 39 |  S SDTOE=$G(^SD(409.73,D0,0))
 | 
|---|
| 40 |  I $P(SDTOE,U,2)="",$P(SDTOE,U,3) D
 | 
|---|
| 41 |  . S DFN=$P($G(^SD(409.74,$P(SDTOE,U,3),0)),U,2)
 | 
|---|
| 42 |  E  I $P(SDTOE,U,2),$P(SDTOE,U,3)="" D
 | 
|---|
| 43 |  . S DFN=$P($G(^SCE($P(SDTOE,U,2),0)),U,2)
 | 
|---|
| 44 |  E  S DFN=""
 | 
|---|
| 45 |  Q
 | 
|---|
| 46 |  ;
 | 
|---|
| 47 | ECDT(D0) ;-- This function is used for the computed field 20.02 in file
 | 
|---|
| 48 |  ;   Transmission OutPatient Encounter file 409.73. For the given
 | 
|---|
| 49 |  ;   entry in 409.73 a determination of the ENCOUNTER D/T involved with
 | 
|---|
| 50 |  ;   the transaction will be determined.
 | 
|---|
| 51 |  ;
 | 
|---|
| 52 |  N SDTOE
 | 
|---|
| 53 |  S SDTOE=$G(^SD(409.73,D0,0))
 | 
|---|
| 54 |  I $P(SDTOE,U,2)="",$P(SDTOE,U,3) D
 | 
|---|
| 55 |  . S X=$P($G(^SD(409.74,$P(SDTOE,U,3),0)),U)
 | 
|---|
| 56 |  E  I $P(SDTOE,U,2),$P(SDTOE,U,3)="" D
 | 
|---|
| 57 |  . S X=$P($G(^SCE($P(SDTOE,U,2),0)),U)
 | 
|---|
| 58 |  E  S X=""
 | 
|---|
| 59 |  I X S Y=X D DD^%DT S X=$TR(Y,"@"," ")
 | 
|---|
| 60 |  Q
 | 
|---|
| 61 |  ;
 | 
|---|
| 62 | EDIV(D0,INT) ;-- This function is used for the computed fields 20.05 and 20.06
 | 
|---|
| 63 |  ;   in the Transmission OutPatient Encounter file 409.73. For the
 | 
|---|
| 64 |  ;   given entry in 409.73 a determination of the ENCOUNTER DIVISION
 | 
|---|
| 65 |  ;   involved with the transaction will be determined.
 | 
|---|
| 66 |  ;
 | 
|---|
| 67 |  ; Optional input: INT='1' to return internal (ifn) value
 | 
|---|
| 68 |  ;
 | 
|---|
| 69 |  N SDTOE
 | 
|---|
| 70 |  S SDTOE=$G(^SD(409.73,D0,0))
 | 
|---|
| 71 |  I $P(SDTOE,U,2)="",$P(SDTOE,U,3) D
 | 
|---|
| 72 |  . S X=$P($G(^SD(409.74,$P(SDTOE,U,3),1)),U,11)
 | 
|---|
| 73 |  E  I $P(SDTOE,U,2),$P(SDTOE,U,3)="" D
 | 
|---|
| 74 |  . S X=$P($G(^SCE($P(SDTOE,U,2),0)),U,11)
 | 
|---|
| 75 |  E  S X=""
 | 
|---|
| 76 |  I '$G(INT),X S X=$P($G(^DG(40.8,+X,0)),U)
 | 
|---|
| 77 |  Q
 | 
|---|
| 78 |  ;
 | 
|---|
| 79 | ECLOC(D0) ;-- This function is used for the computed field 20.03 in file
 | 
|---|
| 80 |  ;   Transmission OutPatient Encounter file 409.73. For the given
 | 
|---|
| 81 |  ;   entry in 409.73 a determination of the LOCATION involved with
 | 
|---|
| 82 |  ;   the transaction will be determined.
 | 
|---|
| 83 |  ;
 | 
|---|
| 84 |  N SDTOE
 | 
|---|
| 85 |  S SDTOE=$G(^SD(409.73,D0,0))
 | 
|---|
| 86 |  I $P(SDTOE,U,2)="",$P(SDTOE,U,3) D
 | 
|---|
| 87 |  . S X=$P($G(^SD(409.74,$P(SDTOE,U,3),1)),U,4)
 | 
|---|
| 88 |  E  I $P(SDTOE,U,2),$P(SDTOE,U,3)="" D
 | 
|---|
| 89 |  . S X=$P($G(^SCE($P(SDTOE,U,2),0)),U,4)
 | 
|---|
| 90 |  E  S X=""
 | 
|---|
| 91 |  I X S X=$P($G(^SC(X,0)),U)
 | 
|---|
| 92 |  Q
 | 
|---|
| 93 |  ;
 | 
|---|
| 94 | XDATE(D0) ;-- This function is used for the computed field 10.01 in file
 | 
|---|
| 95 |  ;  Transmitted OutPatinet Encounter Error file 409.75. For the given
 | 
|---|
| 96 |  ;  entry the x-mit date to NPCDB will be determined.
 | 
|---|
| 97 |  N SDXDT
 | 
|---|
| 98 |  S X=""
 | 
|---|
| 99 |  S SDXDT=$P($G(^SD(409.73,+$P($G(^SD(409.75,D0,0)),U),1)),U)
 | 
|---|
| 100 |  I SDXDT S Y=SDXDT X ^DD("DD") S X=$TR(Y,"@"," ")
 | 
|---|
| 101 |  Q
 | 
|---|