SDES2GETREGS ;ALB/TJB,JAS - Get registration info JSON format ; Aug 22, 2024
;;5.3;SCHEDULING;**873,889**;AUG 13, 1993;Build 9
;;Per VHA Directive 6402, this routine should not be modified
; Documented API's and Integration Agreements
; -------------------------------------------
; Reference to PATIENT in ICR #7030
; Reference to PATIENT in ICR #7029
; Reference to PATIENT in ICR #1476
; Reference to PATIENT in ICR #10035
; Reference to SCHEDULED ADMISSION in ICR #4425
Q
;
GETPATINFO(JSON,SDCONTEXT,SDPARAM) ;return basic reg info/demographics for given patient in JSON format
;Input Parameter:
; SDPARAM("PATIENT IEN") - Patient ID - Pointer to PATIENT file
;Returns:
; JSON formatted output
N RETURN,SDINFO,SDDFN,SDPATARR,SDDEMO,PRACE,PRACEN,PETH,PETHN,SDMHP,SDPCP,GAF,GAFR,SDZIP,SDDOD,ERRORS
D VALIDATE(.ERRORS,.SDCONTEXT,.SDPARAM)
I $D(ERRORS) S RETURN("Patient")="" M RETURN=ERRORS D BUILDJSON^SDES2JSON(.JSON,.RETURN) Q
D GETDEMOGR(.RETURN,.SDCONTEXT,.SDPARAM)
D BUILDJSON^SDES2JSON(.JSON,.RETURN)
Q
;
VALIDATE(ERRORS,SDCONTEXT,SDPARAM) ;validate input Parameter
D VALCONTEXT^SDES2VALCONTEXT(.ERRORS,.SDCONTEXT)
D VALPATDFN^SDES2VAL2(.ERRORS,$G(SDPARAM("PATIENT IEN")),1,0)
Q
;
GETPREREGTIM(DFN) ;
N PREREGTIMIEN,PREREGTIM
S PREREGTIM=""
S PREREGTIMIEN=$O(^DGS(41.41,"B",DFN,"A"),-1)
I PREREGTIMIEN'="" D
. S PREREGTIM=$$FMTISO^SDAMUTDT($$GET1^DIQ(41.41,PREREGTIMIEN_",",1,"I"))
Q PREREGTIM
;
GETDEMOGR(SDINFO,SDCONTEXT,SDPARAM) ;
N PATIENTLIST,SDDEMO,DFN,RACELIST,ETHNLIST,SDFN,FIELDS,PCE,SDPCE,SDPCEM,CAT8GROUPFLG,SDMHP,MHTC,SDPCP,SDDUZ,SDSENSITIVE,SDSECURITY
S DFN=SDPARAM("PATIENT IEN"),SDFN=DFN_","
S SDDUZ=$S(+$G(SDCONTEXT("USER DUZ")):+SDCONTEXT("USER DUZ"),1:$G(DUZ))
D SENSITIVE^SDES2UTIL(.SDSENSITIVE,DFN,SDDUZ)
S SDSECURITY=SDSENSITIVE(1)_$S($G(SDSENSITIVE(2))'="":"|"_SDSENSITIVE(2),1:"")_$S($G(SDSENSITIVE(3))'="":"|"_SDSENSITIVE(3),1:"")
D RACELIST^SDES2UTIL1(.RACELIST,DFN)
D ETHNLIST^SDES2UTIL1(.ETHNLIST,DFN) ;get ethnicity
S FIELDS=".01;.02;.05;.08;.1;.105;.111;.112;.113;.114;.115;.116;.1112;.2203;.2207;.301;.302;.331;.332;"
S FIELDS=FIELDS_".333;.334;.335;.336;.337;.338;.339;.351;.39;.1219;.1151;.1152;.1153;.1154;.1155;.1156;"
S FIELDS=FIELDS_".1173;.1223;.2201;.33011;27.01;1100.01"
D GETS^DIQ(2,SDFN,FIELDS,"IE","SDPATARR")
;patient enrollment
S PCE=$G(SDPATARR(2,SDFN,27.01,"I"))
D:+PCE GETS^DIQ(27.11,+PCE_",",".07;.12;50.01;50.02;50.03","IE","SDPCE","SDPCEM")
S:+PCE CAT8GROUPFLG=(SDPCE(27.11,+PCE_",",.07,"E")="GROUP 8")&(SDPCE(27.11,+PCE_",",.12,"E")="g")
S CAT8GROUPFLG=$S($G(CAT8GROUPFLG)'="":CAT8GROUPFLG,1:0)
S SDMHP=$$START^SCMCMHTC(DFN) ;Return Mental Health Provider
S SDPCP=$$OUTPTPR^SDUTL3(DFN) ;Return Primary Care Provider
D ASSIGNADDR(.SDDEMO,DFN) ;assign all values needed to build SDINFO array
;
;person identification information
S SDINFO("Patient","DataFileNumber")=DFN
S SDINFO("Patient","ICN")=$$GETPATICN^SDESINPUTVALUTL(DFN)
;
S SDINFO("Patient","Name")=$G(SDPATARR(2,SDFN,.01,"E")) ;SDDEMO("NAME")
S SDINFO("Patient","SocialSecurityNumber")=$$LAST4SSN^SDESINPUTVALUTL(DFN)
S SDINFO("Patient","DateOfBirth")=$$FMTISO^SDAMUTDT($$GET1^DIQ(2,SDFN,.03,"I")) ;vse-2500 IA 10035
S SDINFO("Patient","Race","IEN")=$G(RACELIST("IENS"))
S SDINFO("Patient","Race","Name")=$G(RACELIST("NAMES"))
S SDINFO("Patient","Ethnicity","IEN")=$G(ETHNLIST("IENS"))
S SDINFO("Patient","Ethnicity","Name")=$G(ETHNLIST("NAMES"))
S SDINFO("Patient","Sex")=$G(SDPATARR(2,SDFN,.02,"I"))
S SDINFO("Patient","Security")=SDSECURITY
S SDINFO("Patient","Marital")=$G(SDPATARR(2,SDFN,.05,"E"))
S SDINFO("Patient","Religion")=$G(SDPATARR(2,SDFN,.08,"E"))
S SDINFO("Patient","TimeStamp")=$$GETPREREGTIM(DFN)
;
;health information
;
S SDINFO("Patient","PrimaryCareProvider")=$P(SDPCP,"^",2)
S SDINFO("Patient","ServiceConnected")=$G(SDPATARR(2,SDFN,.301,"E"))
S SDINFO("Patient","ServiceConnectedPercentage")=$G(SDPATARR(2,SDFN,.302,"E"))
S SDINFO("Patient","Ward")=$G(SDPATARR(2,SDFN,.1,"E"))
S SDINFO("Patient","HealthRecordNumber")=$$HRN^SDES2UTIL1(DFN)
S SDINFO("Patient","MentalHealthProvider")=$P(SDMHP,"^",2)
;
;flags
;
S SDINFO("Patient","FugitiveFlag")=$G(SDPATARR(2,SDFN,1100.01,"I"))
S SDINFO("Patient","VeteranCatastrophicallyDisabled")=$G(SDPATARR(2,SDFN,.39,"I"))
S SDINFO("Patient","NationalFlag")=$$FLAGS^SDES2UTIL1(DFN,26.15)
S SDINFO("Patient","LocalFlag")=$$FLAGS^SDES2UTIL1(DFN,26.11)
S SDINFO("Patient","EnrollmentSubgroup")=$S(+PCE:SDPCE(27.11,+PCE_",",.12,"E"),1:"")
S SDINFO("Patient","Category8GFlag")=CAT8GROUPFLG
S SDINFO("Patient","SimilarPatients")=$$SIM(DFN)
S SDINFO("Patient","PriorityGroup")=$S(+PCE:SDPCE(27.11,+PCE_",",.07,"E"),1:"")
S SDINFO("Patient","GAFRequired")=$$GETGAF^SDES2UTIL1(DFN)
;
;contact information
;
S SDINFO("Patient","Cell")=SDDEMO("PCELL")
S SDINFO("Patient","Email")=SDDEMO("PEMAIL")
S SDINFO("Patient","HomePhone")=SDDEMO("HPHONE")
S SDINFO("Patient","OfficePhone")=SDDEMO("OPHONE")
;
;mail address information
;
S SDINFO("Patient","MailingAddress","Street1")=SDDEMO("PADDRES1")
S SDINFO("Patient","MailingAddress","Street2")=SDDEMO("PADDRES2")
S SDINFO("Patient","MailingAddress","Street3")=SDDEMO("PADDRES3")
S SDINFO("Patient","MailingAddress","City")=SDDEMO("PCITY")
S SDINFO("Patient","MailingAddress","State")=SDDEMO("PSTATE")
S SDINFO("Patient","MailingAddress","County")=SDDEMO("PCOUNTY")
S SDINFO("Patient","MailingAddress","Country")=SDDEMO("PCOUNTRY")
S SDINFO("Patient","MailingAddress","CountryName")=$G(SDPATARR(2,SDFN,.1173,"E"))
S SDINFO("Patient","MailingAddress","Zip4")=SDDEMO("PZIP+4")
S SDINFO("Patient","MailingAddress","Zip")=$G(SDPATARR(2,SDFN,.116,"E"))
S SDINFO("Patient","AddressIndicator")=SDDEMO("BADADD")
;
;Residential Address Info
;
S SDINFO("Patient","ResidentialAddress","Address1")=$G(SDPATARR(2,SDFN,.1151,"E"))
S SDINFO("Patient","ResidentialAddress","Address2")=$G(SDPATARR(2,SDFN,.1152,"E"))
S SDINFO("Patient","ResidentialAddress","Address3")=$G(SDPATARR(2,SDFN,.1153,"E"))
S SDINFO("Patient","ResidentialAddress","City")=$G(SDPATARR(2,SDFN,.1154,"E"))
S SDINFO("Patient","ResidentialAddress","State")=$G(SDPATARR(2,SDFN,.1155,"E"))
S SDINFO("Patient","ResidentialAddress","Zip4")=$G(SDPATARR(2,SDFN,.1156,"E"))
;
;Temp Address information
;
S SDINFO("Patient","TemporaryAddress","Address1")=SDDEMO("PTADDRESS1")
S SDINFO("Patient","TemporaryAddress","Address2")=SDDEMO("PTADDRESS2")
S SDINFO("Patient","TemporaryAddress","Address3")=SDDEMO("PTADDRESS3")
S SDINFO("Patient","TemporaryAddress","City")=SDDEMO("PTCITY")
S SDINFO("Patient","TemporaryAddress","State")=SDDEMO("PTSTATE")
S SDINFO("Patient","TemporaryAddress","Zip")=SDDEMO("PTZIP")
S SDINFO("Patient","TemporaryAddress","Zip4")=SDDEMO("PTZIP+4")
S SDINFO("Patient","TemporaryAddress","Country")=SDDEMO("PTCOUNTRY")
S SDINFO("Patient","TemporaryAddress","CountryName")=$G(SDPATARR(2,SDFN,.1223,"E"))
S SDINFO("Patient","TemporaryAddress","County")=SDDEMO("PTCOUNTY")
S SDINFO("Patient","TemporaryAddressStart")=$$FMTISO^SDAMUTDT($$GET1^DIQ(2,SDFN,.1217,"I")) ;vse-2500 IA 7019
S SDINFO("Patient","TemporaryAddressEnd")=$$FMTISO^SDAMUTDT($$GET1^DIQ(2,SDFN,.1218,"I")) ;vse-2500 IA 7019
S SDINFO("Patient","TemporaryPhone")=$G(SDPATARR(2,SDFN,.1219,"E"))
;
;Primary Next Of Kin Information
;
S SDINFO("Patient","PrimaryNextOfKin","Name")=SDDEMO("NOK")
S SDINFO("Patient","PrimaryNextOfKin","Relationship")=SDDEMO("KREL")
S SDINFO("Patient","PrimaryNextOfKin","Phone")=SDDEMO("KPHONE")
S SDINFO("Patient","PrimaryNextOfKin","Address","Address")=SDDEMO("KSTREET")
S SDINFO("Patient","PrimaryNextOfKin","Address","City")=SDDEMO("KCITY")
S SDINFO("Patient","PrimaryNextOfKin","Address","State")=SDDEMO("KSTATE")
S SDINFO("Patient","PrimaryNextOfKin","Address","Zip")=SDDEMO("KZIP")
S SDINFO("Patient","PrimaryNextOfKin","Address","street2")=SDDEMO("KSTREET2")
S SDINFO("Patient","PrimaryNextOfKin","Address","Street3")=SDDEMO("KSTREET3")
S SDINFO("Patient","PrimaryNextOfKin","Address","Zip4")=$G(SDPATARR(2,SDFN,.2207,"E"))
;
;Secondary Next of Kin Information
;
S SDINFO("Patient","SecondaryNextOfKin","Name")=SDDEMO("K2NAME")
S SDINFO("Patient","SecondaryNextOfKin","Relationship")=SDDEMO("K2REL")
S SDINFO("Patient","SecondaryNextOfKin","Phone")=SDDEMO("K2PHONE")
S SDINFO("Patient","SecondaryNextOfKin","Address","Street")=SDDEMO("K2STREET")
S SDINFO("Patient","SecondaryNextOfKin","Address","Street2")=SDDEMO("K2STREET2")
S SDINFO("Patient","SecondaryNextOfKin","Address","Street3")=SDDEMO("K2STREET3")
S SDINFO("Patient","SecondaryNextOfKin","Address","City")=SDDEMO("K2CITY")
S SDINFO("Patient","SecondaryNextOfKin","Address","State")=SDDEMO("K2STATE")
S SDINFO("Patient","SecondaryNextOfKin","Address","Zip")=SDDEMO("K2ZIP")
S SDINFO("Patient","SecondaryNextOfKin","Address","Zip4")=$G(SDPATARR(2,SDFN,.2203,"E"))
;
; Emergency Contact
;
S SDINFO("Patient","EmergencyContact","Name")=$G(SDPATARR(2,SDFN,.331,"E"))
S SDINFO("Patient","EmergencyContact","Relationship")=$G(SDPATARR(2,SDFN,.332,"E"))
S SDINFO("Patient","EmergencyContact","Phone")=$G(SDPATARR(2,SDFN,.339,"E"))
S SDINFO("Patient","EmergencyContact","WorkPhone")=$G(SDPATARR(2,SDFN,.33011,"E"))
S SDINFO("Patient","EmergencyContact","Address","Street")=$G(SDPATARR(2,SDFN,.333,"E"))
S SDINFO("Patient","EmergencyContact","Address","Street2")=$G(SDPATARR(2,SDFN,.334,"E"))
S SDINFO("Patient","EmergencyContact","Address","Street3")=$G(SDPATARR(2,SDFN,.335,"E"))
S SDINFO("Patient","EmergencyContact","Address","City")=$G(SDPATARR(2,SDFN,.336,"E"))
S SDINFO("Patient","EmergencyContact","Address","State")=$G(SDPATARR(2,SDFN,.337,"E"))
S SDINFO("Patient","EmergencyContact","Address","Zip")=$G(SDPATARR(2,SDFN,.338,"E"))
S SDINFO("Patient","EmergencyContact","Address","Zip4")=$G(SDPATARR(2,SDFN,.2201,"E"))
D GETELIGIBILITY^SDESPATSEARCH(.PATIENTLIST,DFN,1)
M SDINFO("Patient")=PATIENTLIST("Patient",1)
; Date Of Death
S SDDOD=$$FMTISO^SDAMUTDT($G(SDPATARR(2,SDFN,.351,"I"))),SDDOD=$E(SDDOD,1,10)
S SDINFO("Patient","DateOfDeath")=SDDOD
Q
;
SIM(DFN) ;get similar patient data
N MI,MSG,NOD,PATS,RET,SIM
S (MSG,PATS,SIM)=""
D GUIBS5A^DPTLK6(.RET,DFN)
S MI=1 F S MI=$O(RET(MI)) Q:MI="" D
.S NOD=RET(MI)
.I $P(NOD,U,1)=0 S MSG=MSG_$S(MSG'="":" ",1:"")_$P(NOD,U,2)
.I $P(NOD,U,1)=1 S PATS=PATS_$S(PATS'="":";;",1:"")_$TR($P(NOD,U,2,4),U,"~")_"~"_$E($P(NOD,U,5),6,$L($P(NOD,U,5))) S:(MSG'="")&($E(MSG,$L(MSG))'=".") MSG=MSG_"."
S SIM=MSG_"|"_PATS
Q SIM
;
ASSIGNADDR(RET,DFN) ;assign values to be used to build output
N SDD,SDI,SDM
N PCE,PCOUNTY,PTCOUNTY,PSTATE
Q:'+$G(DFN)
Q:'$D(^DPT(DFN,0))
;
;collect demographics
K RET
S (PCOUNTY,PTCOUNTY,RET("PCOUNTY"),RET("PTCOUNTY"))=""
;
;get addresses
K SDD,SDM D GETS^DIQ(2,DFN_",",".111:.135;.211:.2207","IE","SDD","SDM")
S RET("PADDRES1")=$G(SDD(2,DFN_",",.111,"E")) ; STREET ADDRESS [LINE 1]
S RET("PADDRES2")=$G(SDD(2,DFN_",",.112,"E")) ; STREET ADDRESS [LINE 2]
S RET("PADDRES3")=$G(SDD(2,DFN_",",.113,"E")) ; STREET ADDRESS [LINE 3]
S RET("PZIP+4")=$G(SDD(2,DFN_",",.1112,"E")) ; ZIP+4
S RET("PCITY")=$G(SDD(2,DFN_",",.114,"E")) ; CITY
S PSTATE=$G(SDD(2,DFN_",",.115,"I"))
S RET("PSTATE")=$G(SDD(2,DFN_",",.115,"E")) ; STATE name
I PSTATE'="" D
.S PCOUNTY=$G(SDD(2,DFN_",",.117,"I"))
.S:PCOUNTY'="" RET("PCOUNTY")=$P($G(^DIC(5,PSTATE,1,PCOUNTY,0)),U,1) ; - Patient County (.117)
S RET("PCOUNTRY")=$G(SDD(2,DFN_",",.1173,"I")) ; COUNTRY
I RET("PCOUNTRY")'="",'+RET("PCOUNTRY") S RET("PCOUNTRY")=$O(^HL(779.004,"B",RET("PCOUNTRY"),0))
S RET("BADADD")=$G(SDD(2,DFN_",",.121,"I")) ;bad address indicator
S RET("PTACTIVE")=$G(SDD(2,DFN_",",.12105,"I"))
S RET("PTADDRESS1")=$G(SDD(2,DFN_",",.1211,"E"))
S RET("PTADDRESS2")=$G(SDD(2,DFN_",",.1212,"E"))
S RET("PTADDRESS3")=$G(SDD(2,DFN_",",.1213,"E"))
S RET("PTCITY")=$G(SDD(2,DFN_",",.1214,"E"))
N PTSTATE S PTSTATE=$G(SDD(2,DFN_",",.1215,"I"))
S RET("PTSTATE")=$G(SDD(2,DFN_",",.1215,"E")) ; Patient Temporary STATE name
S RET("PTZIP")=$G(SDD(2,DFN_",",.1216,"E")) ; Patient Temporary Zip (.1216)
S RET("PTZIP+4")=$G(SDD(2,DFN_",",.12112,"E")) ; Patient Temporary Zip+4 (.12112)
S RET("PTCOUNTRY")=$G(SDD(2,DFN_",",.1223,"I")) ; Patient Temp COUNTRY
I PTSTATE'="" D
.S PTCOUNTY=$G(SDD(2,DFN_",",.12111,"I"))
.S:PTCOUNTY'="" RET("PTCOUNTY")=$P($G(^DIC(5,PTSTATE,1,PTCOUNTY,0)),U,1) ; - Patient Temp County (.12111)
S RET("PTSTART")=$G(SDD(2,DFN_",",.1217,"E")) ; Patient Temporary Address Start Date (.1217)
S RET("PTEND")=$G(SDD(2,DFN_",",.1218,"E")) ; Patient Temporary Address End Date (.1218)
;
;get phones
S RET("HPHONE")=$G(SDD(2,DFN_",",.131,"E")) ; phone number (residence) (home phone)
S RET("OPHONE")=$G(SDD(2,DFN_",",.132,"E")) ; phone number (work) (office phone)
S RET("PTPHONE")=$G(SDD(2,DFN_",",.1219,"E")) ; Patient Temporary Phone (.1219)
S RET("PCELL")=$G(SDD(2,DFN_",",.134,"E")) ; Patient Cell Phone (.134)
S RET("PPAGER")=$G(SDD(2,DFN_",",.135,"E")) ; Patient Pager Number (.135)
S RET("PEMAIL")=$G(SDD(2,DFN_",",.133,"E")) ; Patient Email Address (.133)
;
; Return data to add:
S RET("NOK")=$G(SDD(2,DFN_",",.211,"I")) ;Primary Next of Kin (.211)
S RET("KNAME")=$G(SDD(2,DFN_",",.211,"E")) ;Primary Next of Kin name (.211)
S RET("KREL")=$G(SDD(2,DFN_",",.212,"E")) ;Primary Next of Kin Relationship to Patient (.212)
S RET("KPHONE")=$G(SDD(2,DFN_",",.219,"E")) ;Primary Next of Kin Phone (.219)
S RET("KSTREET")=$G(SDD(2,DFN_",",.213,"E")) ;Primary Next of Kin Street Address [Line 1] (.213)
S RET("KSTREET2")=$G(SDD(2,DFN_",",.214,"E")) ;Primary Next of Kin Street Address [Line 2] (.214)
S RET("KSTREET3")=$G(SDD(2,DFN_",",.215,"E")) ;Primary Next of Kin Street Address [Line 3] (.215)
S RET("KCITY")=$G(SDD(2,DFN_",",.216,"E")) ;Primary Next of Kin City (.216)
S RET("KSTATE")=$G(SDD(2,DFN_",",.217,"E")) ;Primary Next of Kin State (.217)
S RET("KZIP")=$G(SDD(2,DFN_",",.218,"E")) ;Primary Next of Kin Zip (.218)
;
S RET("NOK2")=$G(SDD(2,DFN_",",.2191,"I")) ;Secondary Next of Kin (.2191)
S RET("K2NAME")=$G(SDD(2,DFN_",",.2191,"E")) ;Secondary Next of Kin name (.2191)
S RET("K2REL")=$G(SDD(2,DFN_",",.2192,"E")) ;Secondary Next of Kin Relationship to Patient (.2192)
S RET("K2PHONE")=$G(SDD(2,DFN_",",.2199,"E")) ;Secondary Next of Kin Phone (.2199)
S RET("K2STREET")=$G(SDD(2,DFN_",",.2193,"E")) ;Secondary Next of Kin Street Address [Line 1] (.2193)
S RET("K2STREET2")=$G(SDD(2,DFN_",",.2194,"E")) ;Secondary Next of Kin Street Address [Line 2] (.2194)
S RET("K2STREET3")=$G(SDD(2,DFN_",",.2195,"E")) ;Secondary Next of Kin Street Address [Line 3] (.2195)
S RET("K2CITY")=$G(SDD(2,DFN_",",.2196,"E")) ;Secondary Next of Kin City (.2196)
S RET("K2STATE")=$G(SDD(2,DFN_",",.2197,"E")) ;Secondary Next of Kin State (.2197)
S RET("K2ZIP")=$G(SDD(2,DFN_",",.2198,"E")) ;Secondary Next of Kin Zip (.2198)
;
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDES2GETREGS 15235 printed Dec 13, 2024@02:54:09 Page 2
SDES2GETREGS ;ALB/TJB,JAS - Get registration info JSON format ; Aug 22, 2024
+1 ;;5.3;SCHEDULING;**873,889**;AUG 13, 1993;Build 9
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ; Documented API's and Integration Agreements
+4 ; -------------------------------------------
+5 ; Reference to PATIENT in ICR #7030
+6 ; Reference to PATIENT in ICR #7029
+7 ; Reference to PATIENT in ICR #1476
+8 ; Reference to PATIENT in ICR #10035
+9 ; Reference to SCHEDULED ADMISSION in ICR #4425
+10 QUIT
+11 ;
GETPATINFO(JSON,SDCONTEXT,SDPARAM) ;return basic reg info/demographics for given patient in JSON format
+1 ;Input Parameter:
+2 ; SDPARAM("PATIENT IEN") - Patient ID - Pointer to PATIENT file
+3 ;Returns:
+4 ; JSON formatted output
+5 NEW RETURN,SDINFO,SDDFN,SDPATARR,SDDEMO,PRACE,PRACEN,PETH,PETHN,SDMHP,SDPCP,GAF,GAFR,SDZIP,SDDOD,ERRORS
+6 DO VALIDATE(.ERRORS,.SDCONTEXT,.SDPARAM)
+7 IF $DATA(ERRORS)
SET RETURN("Patient")=""
MERGE RETURN=ERRORS
DO BUILDJSON^SDES2JSON(.JSON,.RETURN)
QUIT
+8 DO GETDEMOGR(.RETURN,.SDCONTEXT,.SDPARAM)
+9 DO BUILDJSON^SDES2JSON(.JSON,.RETURN)
+10 QUIT
+11 ;
VALIDATE(ERRORS,SDCONTEXT,SDPARAM) ;validate input Parameter
+1 DO VALCONTEXT^SDES2VALCONTEXT(.ERRORS,.SDCONTEXT)
+2 DO VALPATDFN^SDES2VAL2(.ERRORS,$GET(SDPARAM("PATIENT IEN")),1,0)
+3 QUIT
+4 ;
GETPREREGTIM(DFN) ;
+1 NEW PREREGTIMIEN,PREREGTIM
+2 SET PREREGTIM=""
+3 SET PREREGTIMIEN=$ORDER(^DGS(41.41,"B",DFN,"A"),-1)
+4 IF PREREGTIMIEN'=""
Begin DoDot:1
+5 SET PREREGTIM=$$FMTISO^SDAMUTDT($$GET1^DIQ(41.41,PREREGTIMIEN_",",1,"I"))
End DoDot:1
+6 QUIT PREREGTIM
+7 ;
GETDEMOGR(SDINFO,SDCONTEXT,SDPARAM) ;
+1 NEW PATIENTLIST,SDDEMO,DFN,RACELIST,ETHNLIST,SDFN,FIELDS,PCE,SDPCE,SDPCEM,CAT8GROUPFLG,SDMHP,MHTC,SDPCP,SDDUZ,SDSENSITIVE,SDSECURITY
+2 SET DFN=SDPARAM("PATIENT IEN")
SET SDFN=DFN_","
+3 SET SDDUZ=$SELECT(+$GET(SDCONTEXT("USER DUZ")):+SDCONTEXT("USER DUZ"),1:$GET(DUZ))
+4 DO SENSITIVE^SDES2UTIL(.SDSENSITIVE,DFN,SDDUZ)
+5 SET SDSECURITY=SDSENSITIVE(1)_$SELECT($GET(SDSENSITIVE(2))'="":"|"_SDSENSITIVE(2),1:"")_$SELECT($GET(SDSENSITIVE(3))'="":"|"_SDSENSITIVE(3),1:"")
+6 DO RACELIST^SDES2UTIL1(.RACELIST,DFN)
+7 ;get ethnicity
DO ETHNLIST^SDES2UTIL1(.ETHNLIST,DFN)
+8 SET FIELDS=".01;.02;.05;.08;.1;.105;.111;.112;.113;.114;.115;.116;.1112;.2203;.2207;.301;.302;.331;.332;"
+9 SET FIELDS=FIELDS_".333;.334;.335;.336;.337;.338;.339;.351;.39;.1219;.1151;.1152;.1153;.1154;.1155;.1156;"
+10 SET FIELDS=FIELDS_".1173;.1223;.2201;.33011;27.01;1100.01"
+11 DO GETS^DIQ(2,SDFN,FIELDS,"IE","SDPATARR")
+12 ;patient enrollment
+13 SET PCE=$GET(SDPATARR(2,SDFN,27.01,"I"))
+14 if +PCE
DO GETS^DIQ(27.11,+PCE_",",".07;.12;50.01;50.02;50.03","IE","SDPCE","SDPCEM")
+15 if +PCE
SET CAT8GROUPFLG=(SDPCE(27.11,+PCE_",",.07,"E")="GROUP 8")&(SDPCE(27.11,+PCE_",",.12,"E")="g")
+16 SET CAT8GROUPFLG=$SELECT($GET(CAT8GROUPFLG)'="":CAT8GROUPFLG,1:0)
+17 ;Return Mental Health Provider
SET SDMHP=$$START^SCMCMHTC(DFN)
+18 ;Return Primary Care Provider
SET SDPCP=$$OUTPTPR^SDUTL3(DFN)
+19 ;assign all values needed to build SDINFO array
DO ASSIGNADDR(.SDDEMO,DFN)
+20 ;
+21 ;person identification information
+22 SET SDINFO("Patient","DataFileNumber")=DFN
+23 SET SDINFO("Patient","ICN")=$$GETPATICN^SDESINPUTVALUTL(DFN)
+24 ;
+25 ;SDDEMO("NAME")
SET SDINFO("Patient","Name")=$GET(SDPATARR(2,SDFN,.01,"E"))
+26 SET SDINFO("Patient","SocialSecurityNumber")=$$LAST4SSN^SDESINPUTVALUTL(DFN)
+27 ;vse-2500 IA 10035
SET SDINFO("Patient","DateOfBirth")=$$FMTISO^SDAMUTDT($$GET1^DIQ(2,SDFN,.03,"I"))
+28 SET SDINFO("Patient","Race","IEN")=$GET(RACELIST("IENS"))
+29 SET SDINFO("Patient","Race","Name")=$GET(RACELIST("NAMES"))
+30 SET SDINFO("Patient","Ethnicity","IEN")=$GET(ETHNLIST("IENS"))
+31 SET SDINFO("Patient","Ethnicity","Name")=$GET(ETHNLIST("NAMES"))
+32 SET SDINFO("Patient","Sex")=$GET(SDPATARR(2,SDFN,.02,"I"))
+33 SET SDINFO("Patient","Security")=SDSECURITY
+34 SET SDINFO("Patient","Marital")=$GET(SDPATARR(2,SDFN,.05,"E"))
+35 SET SDINFO("Patient","Religion")=$GET(SDPATARR(2,SDFN,.08,"E"))
+36 SET SDINFO("Patient","TimeStamp")=$$GETPREREGTIM(DFN)
+37 ;
+38 ;health information
+39 ;
+40 SET SDINFO("Patient","PrimaryCareProvider")=$PIECE(SDPCP,"^",2)
+41 SET SDINFO("Patient","ServiceConnected")=$GET(SDPATARR(2,SDFN,.301,"E"))
+42 SET SDINFO("Patient","ServiceConnectedPercentage")=$GET(SDPATARR(2,SDFN,.302,"E"))
+43 SET SDINFO("Patient","Ward")=$GET(SDPATARR(2,SDFN,.1,"E"))
+44 SET SDINFO("Patient","HealthRecordNumber")=$$HRN^SDES2UTIL1(DFN)
+45 SET SDINFO("Patient","MentalHealthProvider")=$PIECE(SDMHP,"^",2)
+46 ;
+47 ;flags
+48 ;
+49 SET SDINFO("Patient","FugitiveFlag")=$GET(SDPATARR(2,SDFN,1100.01,"I"))
+50 SET SDINFO("Patient","VeteranCatastrophicallyDisabled")=$GET(SDPATARR(2,SDFN,.39,"I"))
+51 SET SDINFO("Patient","NationalFlag")=$$FLAGS^SDES2UTIL1(DFN,26.15)
+52 SET SDINFO("Patient","LocalFlag")=$$FLAGS^SDES2UTIL1(DFN,26.11)
+53 SET SDINFO("Patient","EnrollmentSubgroup")=$SELECT(+PCE:SDPCE(27.11,+PCE_",",.12,"E"),1:"")
+54 SET SDINFO("Patient","Category8GFlag")=CAT8GROUPFLG
+55 SET SDINFO("Patient","SimilarPatients")=$$SIM(DFN)
+56 SET SDINFO("Patient","PriorityGroup")=$SELECT(+PCE:SDPCE(27.11,+PCE_",",.07,"E"),1:"")
+57 SET SDINFO("Patient","GAFRequired")=$$GETGAF^SDES2UTIL1(DFN)
+58 ;
+59 ;contact information
+60 ;
+61 SET SDINFO("Patient","Cell")=SDDEMO("PCELL")
+62 SET SDINFO("Patient","Email")=SDDEMO("PEMAIL")
+63 SET SDINFO("Patient","HomePhone")=SDDEMO("HPHONE")
+64 SET SDINFO("Patient","OfficePhone")=SDDEMO("OPHONE")
+65 ;
+66 ;mail address information
+67 ;
+68 SET SDINFO("Patient","MailingAddress","Street1")=SDDEMO("PADDRES1")
+69 SET SDINFO("Patient","MailingAddress","Street2")=SDDEMO("PADDRES2")
+70 SET SDINFO("Patient","MailingAddress","Street3")=SDDEMO("PADDRES3")
+71 SET SDINFO("Patient","MailingAddress","City")=SDDEMO("PCITY")
+72 SET SDINFO("Patient","MailingAddress","State")=SDDEMO("PSTATE")
+73 SET SDINFO("Patient","MailingAddress","County")=SDDEMO("PCOUNTY")
+74 SET SDINFO("Patient","MailingAddress","Country")=SDDEMO("PCOUNTRY")
+75 SET SDINFO("Patient","MailingAddress","CountryName")=$GET(SDPATARR(2,SDFN,.1173,"E"))
+76 SET SDINFO("Patient","MailingAddress","Zip4")=SDDEMO("PZIP+4")
+77 SET SDINFO("Patient","MailingAddress","Zip")=$GET(SDPATARR(2,SDFN,.116,"E"))
+78 SET SDINFO("Patient","AddressIndicator")=SDDEMO("BADADD")
+79 ;
+80 ;Residential Address Info
+81 ;
+82 SET SDINFO("Patient","ResidentialAddress","Address1")=$GET(SDPATARR(2,SDFN,.1151,"E"))
+83 SET SDINFO("Patient","ResidentialAddress","Address2")=$GET(SDPATARR(2,SDFN,.1152,"E"))
+84 SET SDINFO("Patient","ResidentialAddress","Address3")=$GET(SDPATARR(2,SDFN,.1153,"E"))
+85 SET SDINFO("Patient","ResidentialAddress","City")=$GET(SDPATARR(2,SDFN,.1154,"E"))
+86 SET SDINFO("Patient","ResidentialAddress","State")=$GET(SDPATARR(2,SDFN,.1155,"E"))
+87 SET SDINFO("Patient","ResidentialAddress","Zip4")=$GET(SDPATARR(2,SDFN,.1156,"E"))
+88 ;
+89 ;Temp Address information
+90 ;
+91 SET SDINFO("Patient","TemporaryAddress","Address1")=SDDEMO("PTADDRESS1")
+92 SET SDINFO("Patient","TemporaryAddress","Address2")=SDDEMO("PTADDRESS2")
+93 SET SDINFO("Patient","TemporaryAddress","Address3")=SDDEMO("PTADDRESS3")
+94 SET SDINFO("Patient","TemporaryAddress","City")=SDDEMO("PTCITY")
+95 SET SDINFO("Patient","TemporaryAddress","State")=SDDEMO("PTSTATE")
+96 SET SDINFO("Patient","TemporaryAddress","Zip")=SDDEMO("PTZIP")
+97 SET SDINFO("Patient","TemporaryAddress","Zip4")=SDDEMO("PTZIP+4")
+98 SET SDINFO("Patient","TemporaryAddress","Country")=SDDEMO("PTCOUNTRY")
+99 SET SDINFO("Patient","TemporaryAddress","CountryName")=$GET(SDPATARR(2,SDFN,.1223,"E"))
+100 SET SDINFO("Patient","TemporaryAddress","County")=SDDEMO("PTCOUNTY")
+101 ;vse-2500 IA 7019
SET SDINFO("Patient","TemporaryAddressStart")=$$FMTISO^SDAMUTDT($$GET1^DIQ(2,SDFN,.1217,"I"))
+102 ;vse-2500 IA 7019
SET SDINFO("Patient","TemporaryAddressEnd")=$$FMTISO^SDAMUTDT($$GET1^DIQ(2,SDFN,.1218,"I"))
+103 SET SDINFO("Patient","TemporaryPhone")=$GET(SDPATARR(2,SDFN,.1219,"E"))
+104 ;
+105 ;Primary Next Of Kin Information
+106 ;
+107 SET SDINFO("Patient","PrimaryNextOfKin","Name")=SDDEMO("NOK")
+108 SET SDINFO("Patient","PrimaryNextOfKin","Relationship")=SDDEMO("KREL")
+109 SET SDINFO("Patient","PrimaryNextOfKin","Phone")=SDDEMO("KPHONE")
+110 SET SDINFO("Patient","PrimaryNextOfKin","Address","Address")=SDDEMO("KSTREET")
+111 SET SDINFO("Patient","PrimaryNextOfKin","Address","City")=SDDEMO("KCITY")
+112 SET SDINFO("Patient","PrimaryNextOfKin","Address","State")=SDDEMO("KSTATE")
+113 SET SDINFO("Patient","PrimaryNextOfKin","Address","Zip")=SDDEMO("KZIP")
+114 SET SDINFO("Patient","PrimaryNextOfKin","Address","street2")=SDDEMO("KSTREET2")
+115 SET SDINFO("Patient","PrimaryNextOfKin","Address","Street3")=SDDEMO("KSTREET3")
+116 SET SDINFO("Patient","PrimaryNextOfKin","Address","Zip4")=$GET(SDPATARR(2,SDFN,.2207,"E"))
+117 ;
+118 ;Secondary Next of Kin Information
+119 ;
+120 SET SDINFO("Patient","SecondaryNextOfKin","Name")=SDDEMO("K2NAME")
+121 SET SDINFO("Patient","SecondaryNextOfKin","Relationship")=SDDEMO("K2REL")
+122 SET SDINFO("Patient","SecondaryNextOfKin","Phone")=SDDEMO("K2PHONE")
+123 SET SDINFO("Patient","SecondaryNextOfKin","Address","Street")=SDDEMO("K2STREET")
+124 SET SDINFO("Patient","SecondaryNextOfKin","Address","Street2")=SDDEMO("K2STREET2")
+125 SET SDINFO("Patient","SecondaryNextOfKin","Address","Street3")=SDDEMO("K2STREET3")
+126 SET SDINFO("Patient","SecondaryNextOfKin","Address","City")=SDDEMO("K2CITY")
+127 SET SDINFO("Patient","SecondaryNextOfKin","Address","State")=SDDEMO("K2STATE")
+128 SET SDINFO("Patient","SecondaryNextOfKin","Address","Zip")=SDDEMO("K2ZIP")
+129 SET SDINFO("Patient","SecondaryNextOfKin","Address","Zip4")=$GET(SDPATARR(2,SDFN,.2203,"E"))
+130 ;
+131 ; Emergency Contact
+132 ;
+133 SET SDINFO("Patient","EmergencyContact","Name")=$GET(SDPATARR(2,SDFN,.331,"E"))
+134 SET SDINFO("Patient","EmergencyContact","Relationship")=$GET(SDPATARR(2,SDFN,.332,"E"))
+135 SET SDINFO("Patient","EmergencyContact","Phone")=$GET(SDPATARR(2,SDFN,.339,"E"))
+136 SET SDINFO("Patient","EmergencyContact","WorkPhone")=$GET(SDPATARR(2,SDFN,.33011,"E"))
+137 SET SDINFO("Patient","EmergencyContact","Address","Street")=$GET(SDPATARR(2,SDFN,.333,"E"))
+138 SET SDINFO("Patient","EmergencyContact","Address","Street2")=$GET(SDPATARR(2,SDFN,.334,"E"))
+139 SET SDINFO("Patient","EmergencyContact","Address","Street3")=$GET(SDPATARR(2,SDFN,.335,"E"))
+140 SET SDINFO("Patient","EmergencyContact","Address","City")=$GET(SDPATARR(2,SDFN,.336,"E"))
+141 SET SDINFO("Patient","EmergencyContact","Address","State")=$GET(SDPATARR(2,SDFN,.337,"E"))
+142 SET SDINFO("Patient","EmergencyContact","Address","Zip")=$GET(SDPATARR(2,SDFN,.338,"E"))
+143 SET SDINFO("Patient","EmergencyContact","Address","Zip4")=$GET(SDPATARR(2,SDFN,.2201,"E"))
+144 DO GETELIGIBILITY^SDESPATSEARCH(.PATIENTLIST,DFN,1)
+145 MERGE SDINFO("Patient")=PATIENTLIST("Patient",1)
+146 ; Date Of Death
+147 SET SDDOD=$$FMTISO^SDAMUTDT($GET(SDPATARR(2,SDFN,.351,"I")))
SET SDDOD=$EXTRACT(SDDOD,1,10)
+148 SET SDINFO("Patient","DateOfDeath")=SDDOD
+149 QUIT
+150 ;
SIM(DFN) ;get similar patient data
+1 NEW MI,MSG,NOD,PATS,RET,SIM
+2 SET (MSG,PATS,SIM)=""
+3 DO GUIBS5A^DPTLK6(.RET,DFN)
+4 SET MI=1
FOR
SET MI=$ORDER(RET(MI))
if MI=""
QUIT
Begin DoDot:1
+5 SET NOD=RET(MI)
+6 IF $PIECE(NOD,U,1)=0
SET MSG=MSG_$SELECT(MSG'="":" ",1:"")_$PIECE(NOD,U,2)
+7 IF $PIECE(NOD,U,1)=1
SET PATS=PATS_$SELECT(PATS'="":";;",1:"")_$TRANSLATE($PIECE(NOD,U,2,4),U,"~")_"~"_$EXTRACT($PIECE(NOD,U,5),6,$LENGTH($PIECE(NOD,U,5)))
if (MSG'="")&($EXTRACT(MSG,$LENGTH(MSG))'=".")
SET MSG=MSG_"."
End DoDot:1
+8 SET SIM=MSG_"|"_PATS
+9 QUIT SIM
+10 ;
ASSIGNADDR(RET,DFN) ;assign values to be used to build output
+1 NEW SDD,SDI,SDM
+2 NEW PCE,PCOUNTY,PTCOUNTY,PSTATE
+3 if '+$GET(DFN)
QUIT
+4 if '$DATA(^DPT(DFN,0))
QUIT
+5 ;
+6 ;collect demographics
+7 KILL RET
+8 SET (PCOUNTY,PTCOUNTY,RET("PCOUNTY"),RET("PTCOUNTY"))=""
+9 ;
+10 ;get addresses
+11 KILL SDD,SDM
DO GETS^DIQ(2,DFN_",",".111:.135;.211:.2207","IE","SDD","SDM")
+12 ; STREET ADDRESS [LINE 1]
SET RET("PADDRES1")=$GET(SDD(2,DFN_",",.111,"E"))
+13 ; STREET ADDRESS [LINE 2]
SET RET("PADDRES2")=$GET(SDD(2,DFN_",",.112,"E"))
+14 ; STREET ADDRESS [LINE 3]
SET RET("PADDRES3")=$GET(SDD(2,DFN_",",.113,"E"))
+15 ; ZIP+4
SET RET("PZIP+4")=$GET(SDD(2,DFN_",",.1112,"E"))
+16 ; CITY
SET RET("PCITY")=$GET(SDD(2,DFN_",",.114,"E"))
+17 SET PSTATE=$GET(SDD(2,DFN_",",.115,"I"))
+18 ; STATE name
SET RET("PSTATE")=$GET(SDD(2,DFN_",",.115,"E"))
+19 IF PSTATE'=""
Begin DoDot:1
+20 SET PCOUNTY=$GET(SDD(2,DFN_",",.117,"I"))
+21 ; - Patient County (.117)
if PCOUNTY'=""
SET RET("PCOUNTY")=$PIECE($GET(^DIC(5,PSTATE,1,PCOUNTY,0)),U,1)
End DoDot:1
+22 ; COUNTRY
SET RET("PCOUNTRY")=$GET(SDD(2,DFN_",",.1173,"I"))
+23 IF RET("PCOUNTRY")'=""
IF '+RET("PCOUNTRY")
SET RET("PCOUNTRY")=$ORDER(^HL(779.004,"B",RET("PCOUNTRY"),0))
+24 ;bad address indicator
SET RET("BADADD")=$GET(SDD(2,DFN_",",.121,"I"))
+25 SET RET("PTACTIVE")=$GET(SDD(2,DFN_",",.12105,"I"))
+26 SET RET("PTADDRESS1")=$GET(SDD(2,DFN_",",.1211,"E"))
+27 SET RET("PTADDRESS2")=$GET(SDD(2,DFN_",",.1212,"E"))
+28 SET RET("PTADDRESS3")=$GET(SDD(2,DFN_",",.1213,"E"))
+29 SET RET("PTCITY")=$GET(SDD(2,DFN_",",.1214,"E"))
+30 NEW PTSTATE
SET PTSTATE=$GET(SDD(2,DFN_",",.1215,"I"))
+31 ; Patient Temporary STATE name
SET RET("PTSTATE")=$GET(SDD(2,DFN_",",.1215,"E"))
+32 ; Patient Temporary Zip (.1216)
SET RET("PTZIP")=$GET(SDD(2,DFN_",",.1216,"E"))
+33 ; Patient Temporary Zip+4 (.12112)
SET RET("PTZIP+4")=$GET(SDD(2,DFN_",",.12112,"E"))
+34 ; Patient Temp COUNTRY
SET RET("PTCOUNTRY")=$GET(SDD(2,DFN_",",.1223,"I"))
+35 IF PTSTATE'=""
Begin DoDot:1
+36 SET PTCOUNTY=$GET(SDD(2,DFN_",",.12111,"I"))
+37 ; - Patient Temp County (.12111)
if PTCOUNTY'=""
SET RET("PTCOUNTY")=$PIECE($GET(^DIC(5,PTSTATE,1,PTCOUNTY,0)),U,1)
End DoDot:1
+38 ; Patient Temporary Address Start Date (.1217)
SET RET("PTSTART")=$GET(SDD(2,DFN_",",.1217,"E"))
+39 ; Patient Temporary Address End Date (.1218)
SET RET("PTEND")=$GET(SDD(2,DFN_",",.1218,"E"))
+40 ;
+41 ;get phones
+42 ; phone number (residence) (home phone)
SET RET("HPHONE")=$GET(SDD(2,DFN_",",.131,"E"))
+43 ; phone number (work) (office phone)
SET RET("OPHONE")=$GET(SDD(2,DFN_",",.132,"E"))
+44 ; Patient Temporary Phone (.1219)
SET RET("PTPHONE")=$GET(SDD(2,DFN_",",.1219,"E"))
+45 ; Patient Cell Phone (.134)
SET RET("PCELL")=$GET(SDD(2,DFN_",",.134,"E"))
+46 ; Patient Pager Number (.135)
SET RET("PPAGER")=$GET(SDD(2,DFN_",",.135,"E"))
+47 ; Patient Email Address (.133)
SET RET("PEMAIL")=$GET(SDD(2,DFN_",",.133,"E"))
+48 ;
+49 ; Return data to add:
+50 ;Primary Next of Kin (.211)
SET RET("NOK")=$GET(SDD(2,DFN_",",.211,"I"))
+51 ;Primary Next of Kin name (.211)
SET RET("KNAME")=$GET(SDD(2,DFN_",",.211,"E"))
+52 ;Primary Next of Kin Relationship to Patient (.212)
SET RET("KREL")=$GET(SDD(2,DFN_",",.212,"E"))
+53 ;Primary Next of Kin Phone (.219)
SET RET("KPHONE")=$GET(SDD(2,DFN_",",.219,"E"))
+54 ;Primary Next of Kin Street Address [Line 1] (.213)
SET RET("KSTREET")=$GET(SDD(2,DFN_",",.213,"E"))
+55 ;Primary Next of Kin Street Address [Line 2] (.214)
SET RET("KSTREET2")=$GET(SDD(2,DFN_",",.214,"E"))
+56 ;Primary Next of Kin Street Address [Line 3] (.215)
SET RET("KSTREET3")=$GET(SDD(2,DFN_",",.215,"E"))
+57 ;Primary Next of Kin City (.216)
SET RET("KCITY")=$GET(SDD(2,DFN_",",.216,"E"))
+58 ;Primary Next of Kin State (.217)
SET RET("KSTATE")=$GET(SDD(2,DFN_",",.217,"E"))
+59 ;Primary Next of Kin Zip (.218)
SET RET("KZIP")=$GET(SDD(2,DFN_",",.218,"E"))
+60 ;
+61 ;Secondary Next of Kin (.2191)
SET RET("NOK2")=$GET(SDD(2,DFN_",",.2191,"I"))
+62 ;Secondary Next of Kin name (.2191)
SET RET("K2NAME")=$GET(SDD(2,DFN_",",.2191,"E"))
+63 ;Secondary Next of Kin Relationship to Patient (.2192)
SET RET("K2REL")=$GET(SDD(2,DFN_",",.2192,"E"))
+64 ;Secondary Next of Kin Phone (.2199)
SET RET("K2PHONE")=$GET(SDD(2,DFN_",",.2199,"E"))
+65 ;Secondary Next of Kin Street Address [Line 1] (.2193)
SET RET("K2STREET")=$GET(SDD(2,DFN_",",.2193,"E"))
+66 ;Secondary Next of Kin Street Address [Line 2] (.2194)
SET RET("K2STREET2")=$GET(SDD(2,DFN_",",.2194,"E"))
+67 ;Secondary Next of Kin Street Address [Line 3] (.2195)
SET RET("K2STREET3")=$GET(SDD(2,DFN_",",.2195,"E"))
+68 ;Secondary Next of Kin City (.2196)
SET RET("K2CITY")=$GET(SDD(2,DFN_",",.2196,"E"))
+69 ;Secondary Next of Kin State (.2197)
SET RET("K2STATE")=$GET(SDD(2,DFN_",",.2197,"E"))
+70 ;Secondary Next of Kin Zip (.2198)
SET RET("K2ZIP")=$GET(SDD(2,DFN_",",.2198,"E"))
+71 ;
+72 QUIT
+73 ;