MPIFXMLG ;ALB/CKN - MPIF GET CORRESPONDING IDS ; 5/21/15 11:59pm
;;1.0;MASTER PATIENT INDEX VISTA;**61**;30 Apr 99;Build 3
Q
TEST ;Test one patient data
N ICN K MPIIDS
R !,"ICN: ",ICN
I ICN'="" D GETIDS(.MPIIDS,ICN)
Q
GETIDS(MPIIDS,ICN) ; GetCorrespondingIDs for ICN
N MPIXML,MPIXMLR
K MPIIDS
S MPIXML=$$XMLBLD(ICN)
D POST^MPIFHWSC(MPIXML,.MPIXMLR)
I '$D(MPIXMLR) S MPIIDS="-1^No corresponding IDs found." Q
D PARSE(.MPIIDS,.MPIXMLR)
Q
;
XMLBLD(ICN) ; setup xml to get corresponding Ids
; ICN - Integration Control Numer
; Returns XML for the search
N MPIXML,MPISITE,QUOTE,MPITHRES,MPIDT,MPIDUZ,MPIPRID
S QUOTE=""""
S MPISITE=$P($$SITE^VASITE,"^",3)
S MPIPRID=$P($$PARAM^HLCS2,"^",3)
S MPIDT=$$FMTHL7^XLFDT($$NOW^XLFDT)
S MPIDUZ=$P(^VA(200,DUZ,0),"^") D STDNAME^XLFNAME(.MPIDUZ,"C")
S MPITHRES=80
;
S MPIXML="<IDM_REQUEST type="_QUOTE_"GET_CORRESPONDING_IDS"_QUOTE_"><METADATA>"
S MPIXML=MPIXML_"<FIELD name="_QUOTE_"includeHistory"_QUOTE_" value="
S MPIXML=MPIXML_QUOTE_"false"_QUOTE_"/><FIELD name="_QUOTE_"useSurvivingIcn"
S MPIXML=MPIXML_QUOTE_" value="_QUOTE_"true"_QUOTE_"/><FIELD name="_QUOTE
S MPIXML=MPIXML_"returnSurvivingCorrelation"_QUOTE_" value="_QUOTE_"false"_QUOTE
S MPIXML=MPIXML_"/></METADATA>"
S MPIXML=MPIXML_"<ARGUMENTS><ARGUMENT name="_QUOTE
S MPIXML=MPIXML_"sourceId"_QUOTE_"><IDENTIFIER type="_QUOTE_"NI"_QUOTE
S MPIXML=MPIXML_" subtype="_QUOTE_"IDM"_QUOTE_"><ID>"_ICN
S MPIXML=MPIXML_"</ID></IDENTIFIER></ARGUMENT><ARGUMENT name="_QUOTE
S MPIXML=MPIXML_"statusList"_QUOTE_"><VALUE>A</VALUE></ARGUMENT>"
S MPIXML=MPIXML_"</ARGUMENTS></IDM_REQUEST>"
;W XCKN
Q MPIXML
;
PARSE(MPIDATA,MPIXML) ;Parse XML for results
;
; EN^MXMLPRSE - #4149
;
K ^TMP($J,"MPIFXMLG")
N MPICB,MPIUSE,MPIVAR,MPIIDN,MPILOC
S MPIIDN=0
S MPICB("STARTELEMENT")="SE^MPIFXMLG"
S MPICB("CHARACTERS")="VALUE^MPIFXMLG"
S ^TMP($J,"MPIFXMLG",1)=MPIXML
D EN^MXMLPRSE($NA(^TMP($J,"MPIFXMLG")),.MPICB)
K ^TMP($J,"MPIFXMLG")
Q
;
SE(MPIN,MPIA) ; - used for the parser to call back with STARTELEMENT
;
; just to protect the process
S MPIN=$G(MPIN)
S MPIA("type")=$G(MPIA("type"))
;S MPIA("subtype")=$G(MPIA("subtype"))
S MPIA("name")=$G(MPIA("name"))
;S MPIA("value")=$G(MPIA("value"))
S MPIUSE=$G(MPIUSE)
;
;No need for these tags
I MPIN="IDM_RESPONSE"!(MPIN="METADATA")!(MPIN="RESULT") Q
I MPIN="RESULT"!(MPIN="IDATTR") Q
;
I MPIN="IDENTIFIER" S MPIIDN=MPIIDN+1,MPILOC="MPIDATA("_MPIIDN D K MPIUSE Q
. S MPIUSE="IDType",MPIVAR=","""_MPIUSE_""")"
. S:$D(MPIVAR) @(MPILOC_MPIVAR)=MPIA("type") K MPIVAR
I MPIN="ID" D K MPIUSE Q
. S MPIUSE="ID",MPIVAR=","""_MPIUSE_""")"
I MPIN="SOURCE" D K MPIUSE Q
. S MPIUSE="Source",MPIVAR=","""_MPIUSE_""")"
I MPIN="ISSUER" D K MPIUSE Q
. S MPIUSE="Issuer",MPIVAR=","""_MPIUSE_""")"
I MPIN="STATUS" D K MPIUSE Q
. S MPIUSE="Status",MPIVAR=","""_MPIUSE_""")"
Q
;
VALUE(MPIT) ;used by the parser to call back with CHARACTERS
S:$D(MPIVAR) @(MPILOC_MPIVAR)=MPIT K MPIVAR Q
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMPIFXMLG 3064 printed Oct 16, 2024@18:12:33 Page 2
MPIFXMLG ;ALB/CKN - MPIF GET CORRESPONDING IDS ; 5/21/15 11:59pm
+1 ;;1.0;MASTER PATIENT INDEX VISTA;**61**;30 Apr 99;Build 3
+2 QUIT
TEST ;Test one patient data
+1 NEW ICN
KILL MPIIDS
+2 READ !,"ICN: ",ICN
+3 IF ICN'=""
DO GETIDS(.MPIIDS,ICN)
+4 QUIT
GETIDS(MPIIDS,ICN) ; GetCorrespondingIDs for ICN
+1 NEW MPIXML,MPIXMLR
+2 KILL MPIIDS
+3 SET MPIXML=$$XMLBLD(ICN)
+4 DO POST^MPIFHWSC(MPIXML,.MPIXMLR)
+5 IF '$DATA(MPIXMLR)
SET MPIIDS="-1^No corresponding IDs found."
QUIT
+6 DO PARSE(.MPIIDS,.MPIXMLR)
+7 QUIT
+8 ;
XMLBLD(ICN) ; setup xml to get corresponding Ids
+1 ; ICN - Integration Control Numer
+2 ; Returns XML for the search
+3 NEW MPIXML,MPISITE,QUOTE,MPITHRES,MPIDT,MPIDUZ,MPIPRID
+4 SET QUOTE=""""
+5 SET MPISITE=$PIECE($$SITE^VASITE,"^",3)
+6 SET MPIPRID=$PIECE($$PARAM^HLCS2,"^",3)
+7 SET MPIDT=$$FMTHL7^XLFDT($$NOW^XLFDT)
+8 SET MPIDUZ=$PIECE(^VA(200,DUZ,0),"^")
DO STDNAME^XLFNAME(.MPIDUZ,"C")
+9 SET MPITHRES=80
+10 ;
+11 SET MPIXML="<IDM_REQUEST type="_QUOTE_"GET_CORRESPONDING_IDS"_QUOTE_"><METADATA>"
+12 SET MPIXML=MPIXML_"<FIELD name="_QUOTE_"includeHistory"_QUOTE_" value="
+13 SET MPIXML=MPIXML_QUOTE_"false"_QUOTE_"/><FIELD name="_QUOTE_"useSurvivingIcn"
+14 SET MPIXML=MPIXML_QUOTE_" value="_QUOTE_"true"_QUOTE_"/><FIELD name="_QUOTE
+15 SET MPIXML=MPIXML_"returnSurvivingCorrelation"_QUOTE_" value="_QUOTE_"false"_QUOTE
+16 SET MPIXML=MPIXML_"/></METADATA>"
+17 SET MPIXML=MPIXML_"<ARGUMENTS><ARGUMENT name="_QUOTE
+18 SET MPIXML=MPIXML_"sourceId"_QUOTE_"><IDENTIFIER type="_QUOTE_"NI"_QUOTE
+19 SET MPIXML=MPIXML_" subtype="_QUOTE_"IDM"_QUOTE_"><ID>"_ICN
+20 SET MPIXML=MPIXML_"</ID></IDENTIFIER></ARGUMENT><ARGUMENT name="_QUOTE
+21 SET MPIXML=MPIXML_"statusList"_QUOTE_"><VALUE>A</VALUE></ARGUMENT>"
+22 SET MPIXML=MPIXML_"</ARGUMENTS></IDM_REQUEST>"
+23 ;W XCKN
+24 QUIT MPIXML
+25 ;
PARSE(MPIDATA,MPIXML) ;Parse XML for results
+1 ;
+2 ; EN^MXMLPRSE - #4149
+3 ;
+4 KILL ^TMP($JOB,"MPIFXMLG")
+5 NEW MPICB,MPIUSE,MPIVAR,MPIIDN,MPILOC
+6 SET MPIIDN=0
+7 SET MPICB("STARTELEMENT")="SE^MPIFXMLG"
+8 SET MPICB("CHARACTERS")="VALUE^MPIFXMLG"
+9 SET ^TMP($JOB,"MPIFXMLG",1)=MPIXML
+10 DO EN^MXMLPRSE($NAME(^TMP($JOB,"MPIFXMLG")),.MPICB)
+11 KILL ^TMP($JOB,"MPIFXMLG")
+12 QUIT
+13 ;
SE(MPIN,MPIA) ; - used for the parser to call back with STARTELEMENT
+1 ;
+2 ; just to protect the process
+3 SET MPIN=$GET(MPIN)
+4 SET MPIA("type")=$GET(MPIA("type"))
+5 ;S MPIA("subtype")=$G(MPIA("subtype"))
+6 SET MPIA("name")=$GET(MPIA("name"))
+7 ;S MPIA("value")=$G(MPIA("value"))
+8 SET MPIUSE=$GET(MPIUSE)
+9 ;
+10 ;No need for these tags
+11 IF MPIN="IDM_RESPONSE"!(MPIN="METADATA")!(MPIN="RESULT")
QUIT
+12 IF MPIN="RESULT"!(MPIN="IDATTR")
QUIT
+13 ;
+14 IF MPIN="IDENTIFIER"
SET MPIIDN=MPIIDN+1
SET MPILOC="MPIDATA("_MPIIDN
Begin DoDot:1
+15 SET MPIUSE="IDType"
SET MPIVAR=","""_MPIUSE_""")"
+16 if $DATA(MPIVAR)
SET @(MPILOC_MPIVAR)=MPIA("type")
KILL MPIVAR
End DoDot:1
KILL MPIUSE
QUIT
+17 IF MPIN="ID"
Begin DoDot:1
+18 SET MPIUSE="ID"
SET MPIVAR=","""_MPIUSE_""")"
End DoDot:1
KILL MPIUSE
QUIT
+19 IF MPIN="SOURCE"
Begin DoDot:1
+20 SET MPIUSE="Source"
SET MPIVAR=","""_MPIUSE_""")"
End DoDot:1
KILL MPIUSE
QUIT
+21 IF MPIN="ISSUER"
Begin DoDot:1
+22 SET MPIUSE="Issuer"
SET MPIVAR=","""_MPIUSE_""")"
End DoDot:1
KILL MPIUSE
QUIT
+23 IF MPIN="STATUS"
Begin DoDot:1
+24 SET MPIUSE="Status"
SET MPIVAR=","""_MPIUSE_""")"
End DoDot:1
KILL MPIUSE
QUIT
+25 QUIT
+26 ;
VALUE(MPIT) ;used by the parser to call back with CHARACTERS
+1 if $DATA(MPIVAR)
SET @(MPILOC_MPIVAR)=MPIT
KILL MPIVAR
QUIT
+2 QUIT