[613] | 1 | RGRSPARS ;ALB/RJS-REGISTRATION MESSAGE PARSER FOR CIRN ;3/8/96
|
---|
| 2 | ;;1.0; CLINICAL INFO RESOURCE NETWORK ;;30 Apr 99
|
---|
| 3 | EN(ARRAY) ;
|
---|
| 4 | ;This procedure call returns an array of patient information in the
|
---|
| 5 | ;corresponding PATIENT file (#2) field numbers as well as Patient
|
---|
| 6 | ;sensitivity.
|
---|
| 7 | ;
|
---|
| 8 | ;Input: Required Variable
|
---|
| 9 | ;
|
---|
| 10 | ; ARRAY - Supplied array variable (Pass by reference)
|
---|
| 11 | ;
|
---|
| 12 | ;Output:
|
---|
| 13 | ;
|
---|
| 14 | ; ARRAY - Array of patient information gathered from HL7 segments
|
---|
| 15 | ;
|
---|
| 16 | N RGRSPID,RGRSZEL,RGRSZPD,RGRSZSP,RGC,RGRSPD1,RGRSZEM,RGRSZCT,RGRSZFF
|
---|
| 17 | N STATE,STATEIEN,SUBCOMP,STREETS,INSTITU,CNTYCODE,ADDRESS,RGRSOBX
|
---|
| 18 | N RGRSMSH
|
---|
| 19 | S RGC=$E(HL("ECH")),SUBCOMP=$E(HL("ECH"),2)
|
---|
| 20 | S RGRSMSH=$$SEG1^RGRSUTIL("MSH",1,"MSH")
|
---|
| 21 | S RGRSPID=$$SEG1^RGRSUTIL("PID",1,"PID")
|
---|
| 22 | S RGRSPD1=$$SEG1^RGRSUTIL("PD1",1,"PD1")
|
---|
| 23 | S RGRSZEL=$$SEG1^RGRSUTIL("ZEL",1,"ZEL")
|
---|
| 24 | S RGRSZPD=$$SEG1^RGRSUTIL("ZPD",1,"ZPD")
|
---|
| 25 | S RGRSZSP=$$SEG1^RGRSUTIL("ZSP",1,"ZSP")
|
---|
| 26 | S RGRSZEM=$$SEG1^RGRSUTIL("ZEM",1,"ZEM")
|
---|
| 27 | S RGRSZCT=$$SEG1^RGRSUTIL("ZCT",1,"ZCT")
|
---|
| 28 | S RGRSZFF=$$SEG1^RGRSUTIL("ZFF",1,"ZFF")
|
---|
| 29 | S RGRSOBX=$$SEG1^RGRSUTIL("OBX",1,"OBX")
|
---|
| 30 | S @ARRAY@(.01)=$$FREE($$FMNAME^HLFNC($P(RGRSPID,HL("FS"),6),HL("ECH"))) ;NAME
|
---|
| 31 | S @ARRAY@(.02)=$$SEX($P(RGRSPID,HL("FS"),9)) ;SEX
|
---|
| 32 | S @ARRAY@(.03)=$$FREE($$FMDATE^HLFNC($P(RGRSPID,HL("FS"),8))) ;DOB
|
---|
| 33 | S @ARRAY@(.05)=$$MARITAL($P(RGRSPID,HL("FS"),17)) ;MARITAL STATUS
|
---|
| 34 | S @ARRAY@(.08)=$$RELIG($P(RGRSPID,HL("FS"),18)) ;RELIGIOUS PREFERENCE
|
---|
| 35 | S @ARRAY@(.09)=$$FREE($P(RGRSPID,HL("FS"),20)) ;SOCIAL SECURITY #
|
---|
| 36 | S ADDRESS=$$FREE($P(RGRSPID,HL("FS"),12)) ;ADDRESS FIELDS
|
---|
| 37 | S @ARRAY@(.111)=$$FREE($P(ADDRESS,RGC,1)) ;STREET ADDRESS [1]
|
---|
| 38 | S @ARRAY@(.112)=$$FREE($P(ADDRESS,RGC,2)) ;STREET ADDRESS [2]
|
---|
| 39 | S @ARRAY@(.113)=$$FREE($P(ADDRESS,RGC,8)) ;STREET ADDRESS [3]
|
---|
| 40 | S @ARRAY@(.114)=$$FREE($P($P(RGRSPID,HL("FS"),12),RGC,3)) ;CITY
|
---|
| 41 | S @ARRAY@(.115)=$$STATE($P($P(RGRSPID,HL("FS"),12),RGC,4)) ;STATE
|
---|
| 42 | S @ARRAY@(.1112)=$$FREE($P($P(RGRSPID,HL("FS"),12),RGC,5)) ;ZIP+4
|
---|
| 43 | S CNTYCODE=$P(RGRSPID,HL("FS"),13) ;COUNTY CODE
|
---|
| 44 | S @ARRAY@(.117)=$$COUNTY(@ARRAY@(.115),CNTYCODE)
|
---|
| 45 | S @ARRAY@(.131)=$$FREE($P(RGRSPID,HL("FS"),14)) ;PHONE NUMBER-HOME
|
---|
| 46 | S @ARRAY@(.132)=$$FREE($P(RGRSPID,HL("FS"),15)) ;PHONE NUMBER-WORK
|
---|
| 47 | S @ARRAY@(.211)=$$FREE($P(RGRSZCT,HL("FS"),4)) ;K-NAME
|
---|
| 48 | S @ARRAY@(.219)=$$FREE($P(RGRSZCT,HL("FS"),7)) ;K-PHONE NUMBER
|
---|
| 49 | S @ARRAY@(.2403)=$$FREE($P(RGRSPID,HL("FS"),7)) ;MOTHERS MAIDEN NAME
|
---|
| 50 | S @ARRAY@(.301)=$$YESNO($P(RGRSZSP,HL("FS"),3)) ;SERVICE CONNECTED
|
---|
| 51 | S @ARRAY@(.302)=$$FREE($P(RGRSZSP,HL("FS"),4)) ;SERVICE CONNECTED PERCENTAGE
|
---|
| 52 | S @ARRAY@(.31115)=$$EMP($P(RGRSZEM,HL("FS"),4)) ;EMPLOYMENT STATUS
|
---|
| 53 | S @ARRAY@(.323)=$$POS($P(RGRSZSP,HL("FS"),5)) ;PERIOD OF SERVICE
|
---|
| 54 | S @ARRAY@(.351)=$$FREE($$FMDATE^HLFNC($P(RGRSZPD,HL("FS"),10))) ;DATE OF DEATH
|
---|
| 55 | S @ARRAY@(.361)=$$ELIG($P(RGRSZEL,HL("FS"),3)) ;PRIMARY ELIGIBILITY CODE
|
---|
| 56 | S @ARRAY@(.3612)=$$FREE($$FMDATE^HLFNC($P(RGRSZEL,HL("FS"),12))) ;DT VER
|
---|
| 57 | S @ARRAY@(.3615)=$$FREE($P(RGRSZEL,HL("FS"),14)) ;VERIFICATION METHOD
|
---|
| 58 | S @ARRAY@(391)=$$TYPE($P(RGRSZEL,HL("FS"),10)) ;PATIENT TYPE
|
---|
| 59 | S @ARRAY@(1901)=$$VETERAN($P(RGRSZEL,HL("FS"),9)) ;VETERAN (Y/N)
|
---|
| 60 | S @ARRAY@(991.01)=$$FREE($P($P(RGRSPID,HL("FS"),3),"V",1)) ;INTEG CONTROL #
|
---|
| 61 | S @ARRAY@(991.02)=$$FREE($P($P(RGRSPID,HL("FS"),3),"V",2)) ;CHECKSUM
|
---|
| 62 | S @ARRAY@(991.03)=$$FREE($P($P(RGRSPD1,HL("FS"),4),RGC,1)) ;VCCI
|
---|
| 63 | S @ARRAY@("SENDING SITE")=$$FREE($P(RGRSMSH,HL("FS"),4)) ;SENDING SITE
|
---|
| 64 | S @ARRAY@("SITENUM")=$$FREE($P($P(RGRSPD1,HL("FS"),4),RGC,3)) ;VCCI SITENUM
|
---|
| 65 | S @ARRAY@("DFN")=$$FREE($P($P(RGRSPID,HL("FS"),4),RGC,1)) ;DFN
|
---|
| 66 | S @ARRAY@("FLD")=$P(RGRSZFF,HL("FS"),3) ;FIELD(S) EDITED
|
---|
| 67 | I $$FREE($P($P(RGRSOBX,HL("FS"),4),RGC,2))="SECURITY LEVEL" DO
|
---|
| 68 | . S @ARRAY@("SENSITIVITY")=$$SENSTIVE($P(RGRSOBX,HL("FS"),6),RGC) ;SENSTIVITY
|
---|
| 69 | . S @ARRAY@("SENSITIVITY USER")=$$FREE($P($P(RGRSOBX,HL("FS"),17),RGC,2))_","_$$FREE($P($P(RGRSOBX,HL("FS"),17),RGC,3)) ;REMOTE PERSON WHO MADE PT. SENSITIVE
|
---|
| 70 | . S @ARRAY@("SENSITIVITY DATE")=$$FREE($$FMDATE^HLFNC($P(RGRSOBX,HL("FS"),15))) ;DATE/TIME PERSON MADE PT. SENSITIVE AT REMOTE SITE
|
---|
| 71 | D NOW^%DTC S @ARRAY@(.097)=X
|
---|
| 72 | K %H,%I,X,%
|
---|
| 73 | Q
|
---|
| 74 | ;
|
---|
| 75 | VETERAN(HLCODE) ;
|
---|
| 76 | Q:$$FREE(HLCODE)="" ""
|
---|
| 77 | Q:$$FREE(HLCODE)="""@""" """@"""
|
---|
| 78 | Q:HLCODE=1 "YES"
|
---|
| 79 | Q:HLCODE=0 "NO"
|
---|
| 80 | Q HLCODE_"^1"
|
---|
| 81 | ;
|
---|
| 82 | STATE(STATE) ;
|
---|
| 83 | N RETURN,STATEIEN
|
---|
| 84 | Q:$$FREE(STATE)="" ""
|
---|
| 85 | Q:$$FREE(STATE)="""@""" """@"""
|
---|
| 86 | S STATEIEN=$O(^DIC(5,"C",STATE,0))
|
---|
| 87 | I $G(STATEIEN)="" Q STATE_"^1"
|
---|
| 88 | S RETURN=$P(^DIC(5,STATEIEN,0),"^",1)
|
---|
| 89 | Q:$G(RETURN)'="" RETURN
|
---|
| 90 | Q STATE_"^1"
|
---|
| 91 | ;
|
---|
| 92 | COUNTY(STATE,CNTYCODE) ;
|
---|
| 93 | ;This function entry point is used to obtain the county name
|
---|
| 94 | ;
|
---|
| 95 | ;Input: Required Variables
|
---|
| 96 | ;
|
---|
| 97 | ; STATE - State name
|
---|
| 98 | ; CNTYCODE - County code
|
---|
| 99 | ;
|
---|
| 100 | ;Output:
|
---|
| 101 | ; County name - If known
|
---|
| 102 | ; "@" - If missing required input
|
---|
| 103 | ; County Code^1 - If county code was unknown
|
---|
| 104 | ;
|
---|
| 105 | N STATEIEN,COUNTIEN,CNTYNAME
|
---|
| 106 | Q:$G(STATE)=""!($G(STATE)=HL("Q"))!($G(CNTYCODE)="") ""
|
---|
| 107 | Q:$G(CNTYCODE)=HL("Q") """@"""
|
---|
| 108 | S STATEIEN=$O(^DIC(5,"B",STATE,0))
|
---|
| 109 | Q:$G(STATEIEN)'>0 CNTYCODE_"^1"
|
---|
| 110 | S COUNTIEN=$O(^DIC(5,STATEIEN,1,"C",CNTYCODE,0))
|
---|
| 111 | Q:$G(COUNTIEN)'>0 CNTYCODE_"^1"
|
---|
| 112 | S CNTYNAME=$P(^DIC(5,STATEIEN,1,COUNTIEN,0),"^",1)
|
---|
| 113 | Q:$L(CNTYNAME)'>0 CNTYCODE_"^1"
|
---|
| 114 | Q $G(CNTYNAME)
|
---|
| 115 | ;
|
---|
| 116 | KILL ;
|
---|
| 117 | K @ARRAY
|
---|
| 118 | Q
|
---|
| 119 | ;
|
---|
| 120 | FREE(DATA) ;
|
---|
| 121 | Q:$G(DATA)="" ""
|
---|
| 122 | Q:DATA=HL("Q") """@"""
|
---|
| 123 | Q $G(DATA)
|
---|
| 124 | SEX(DATA) ;
|
---|
| 125 | Q:$$FREE(DATA)="" ""
|
---|
| 126 | Q:$$FREE(DATA)="""@""" """@"""
|
---|
| 127 | I DATA="M" Q "MALE"
|
---|
| 128 | I DATA="F" Q "FEMALE"
|
---|
| 129 | Q "^<UNRESOLVED>"
|
---|
| 130 | ;
|
---|
| 131 | MARITAL(DATA) ;
|
---|
| 132 | Q:$$FREE(DATA)="" ""
|
---|
| 133 | Q:$$FREE(DATA)="""@""" """@"""
|
---|
| 134 | Q:DATA="A" "SEPARATED"
|
---|
| 135 | Q:DATA="D" "DIVORCED"
|
---|
| 136 | Q:DATA="M" "MARRIED"
|
---|
| 137 | Q:DATA="S" "NEVER MARRIED"
|
---|
| 138 | Q:DATA="W" "WIDOW/WIDOWER"
|
---|
| 139 | Q:DATA="U" "UNKNOWN"
|
---|
| 140 | Q DATA_"^1"
|
---|
| 141 | ;
|
---|
| 142 | SENSTIVE(DATA,SUBCOMP) ;
|
---|
| 143 | Q:$G(DATA)="" 0
|
---|
| 144 | Q:$P(DATA,SUBCOMP,1)=1 1
|
---|
| 145 | Q 0
|
---|
| 146 | ;
|
---|
| 147 | YESNO(DATA) ;
|
---|
| 148 | Q:$$FREE(DATA)="" ""
|
---|
| 149 | Q:$$FREE(DATA)="""@""" """@"""
|
---|
| 150 | I DATA="1" Q "YES"
|
---|
| 151 | I DATA="0" Q "NO"
|
---|
| 152 | Q "^<UNRESOLVED>"
|
---|
| 153 | RELIG(DATA) ;
|
---|
| 154 | N IEN,RELIG
|
---|
| 155 | Q:$$FREE(DATA)="" ""
|
---|
| 156 | Q:$$FREE(DATA)="""@""" """@"""
|
---|
| 157 | S IEN=$O(^DIC(13,"C",DATA,0))
|
---|
| 158 | I $G(IEN)="" Q DATA_"^1"
|
---|
| 159 | S RELIG=$P($G(^DIC(13,IEN,0)),"^",1)
|
---|
| 160 | I $G(RELIG)="" Q DATA_"^1"
|
---|
| 161 | Q $G(RELIG)
|
---|
| 162 | POS(DATA) ;
|
---|
| 163 | N IEN,POS
|
---|
| 164 | Q:$$FREE(DATA)="" ""
|
---|
| 165 | Q:$$FREE(DATA)="""@""" """@"""
|
---|
| 166 | S IEN=$O(^DIC(21,"D",DATA,0))
|
---|
| 167 | I $G(IEN)="" Q DATA_"^1"
|
---|
| 168 | S POS=$P($G(^DIC(21,IEN,0)),"^",1)
|
---|
| 169 | I $G(POS)="" Q DATA_"^1"
|
---|
| 170 | Q $G(POS)
|
---|
| 171 | ELIG(DATA) ;
|
---|
| 172 | N IEN,ELIGPTR,ELIG
|
---|
| 173 | Q:$$FREE(DATA)="" ""
|
---|
| 174 | Q:$$FREE(DATA)="""@""" """@"""
|
---|
| 175 | S ELIGPTR=$O(^DIC(8,"D",DATA,0))
|
---|
| 176 | I $G(ELIGPTR)'>0 Q DATA_"^1"
|
---|
| 177 | S ELIG=$P($G(^DIC(8,ELIGPTR,0)),"^",1)
|
---|
| 178 | I $G(ELIG)="" Q DATA_"^1"
|
---|
| 179 | Q $G(ELIG)
|
---|
| 180 | TYPE(DATA) ;
|
---|
| 181 | N IEN,TYPE
|
---|
| 182 | Q:$$FREE(DATA)="" ""
|
---|
| 183 | Q:$$FREE(DATA)="""@""" """@"""
|
---|
| 184 | S IEN=$O(^DG(391,"B",DATA,0))
|
---|
| 185 | I $G(IEN)="" Q DATA_"^1"
|
---|
| 186 | S TYPE=$P($G(^DG(391,IEN,0)),"^",1)
|
---|
| 187 | I $G(TYPE)="" Q DATA_"^1"
|
---|
| 188 | Q $G(TYPE)
|
---|
| 189 | EMP(DATA) ;
|
---|
| 190 | N IEN,EMP
|
---|
| 191 | Q:$$FREE(DATA)="" ""
|
---|
| 192 | Q:$$FREE(DATA)="""@""" """@"""
|
---|
| 193 | Q:DATA=1 "EMPLOYED FULL TIME"
|
---|
| 194 | Q:DATA=2 "EMPLOYED PART TIME"
|
---|
| 195 | Q:DATA=3 "NOT EMPLOYED"
|
---|
| 196 | Q:DATA=4 "SELF EMPLOYED"
|
---|
| 197 | Q:DATA=5 "RETIRED"
|
---|
| 198 | Q:DATA=6 "ACTIVE MILITARY DUTY"
|
---|
| 199 | Q:DATA=9 "UNKNOWN"
|
---|
| 200 | Q DATA_"^1"
|
---|