Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: MPIFEXT3

MPIFEXT3.m

Go to the documentation of this file.
MPIFEXT3 ;SFCIO/CMC-EXTENDED PDAT 3 - RPC ;26 JUN 01
 ;;1.0; MASTER PATIENT INDEX VISTA ;**20**;30 Apr 99
 ;
 ;Integration Agreements Utilized:
 ;  ^DPT( - #2070
 ;  $$GET1^DIQ(870,+$P(ARRAY("LINKS",SUBNUM),"^",6)_",",.02,"E") - #3573
 ;  D GETS^DIQ(2,IEN_",","1*","E","MPIFA") - #3581
 ;
ALIAS(RET,IEN,RPC) ; get any Aliases for patient IEN
 N ALIEN,RET2,MPIFA
 I RPC=1 S TEXT="MPI("_IEN_",""ALIAS(ES)"")="
 S ALIEN=0,RET2=""
 D GETS^DIQ(2,IEN_",","1*","E","MPIFA")
 ;; MPIFA(2.01,"1,1,",.01,"E")=Funky K
 F  S ALIEN=$O(MPIFA(2.01,ALIEN)) Q:'ALIEN  D
 .I $G(MPIFA(2.01,ALIEN,.01,"E"))'="" S RET2=RET2_$G(MPIFA(2.01,ALIEN,.01,"E"))_"^"
 I RET2=""!(RET2?."^") S RET2="NONE"
 S RET(IEN,"ALIAS(ES)")=TEXT_""""_RET2_""""
 Q
CMORCH(RET,DFN,RPC) ; get any CMOR Change Requests for this patient
 K MPIFCCR
 D CCRDAT^MPIFUTL(DFN,"MPIFCCR")
 N REQ,FLD,TOT
 S REQ=0,TOT=$G(MPIFCCR(0))
 F  S REQ=$O(MPIFCCR(REQ)) Q:REQ=""  D
 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""REQ #"")="
 .S RET(DFN,"CMOR CHG REQ",REQ,"REQ #")=TEXT_""""_$G(MPIFCCR(REQ,.01))_""""
 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""REQ BY"")="
 .S RET(DFN,"CMOR CHG REQ",REQ,"REQ BY")=TEXT_""""_$G(MPIFCCR(REQ,.02))_""""
 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""DT REQ"")="
 .S RET(DFN,"CMOR CHG REQ",REQ,"DT REQ")=TEXT_""""_$G(MPIFCCR(REQ,.03))_""""
 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""PATIENT"")="
 .S RET(DFN,"CMOR CHG REQ",REQ,"PATIENT")=TEXT_""""_$G(MPIFCCR(REQ,.04))_""""
 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""REQ PHONE"")="
 .S RET(DFN,"CMOR CHG REQ",REQ,"REQ PHONE")=TEXT_""""_$G(MPIFCCR(REQ,.05))_""""
 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""STATUS"")="
 .S RET(DFN,"CMOR CHG REQ",REQ,"STATUS")=TEXT_""""_$G(MPIFCCR(REQ,.06))_""""
 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""SITE"")="
 .S RET(DFN,"CMOR CHG REQ",REQ,"SITE")=TEXT_""""_$G(MPIFCCR(REQ,.07))_""""
 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""TYPE"")="
 .S RET(DFN,"CMOR CHG REQ",REQ,"TYPE")=TEXT_""""_$G(MPIFCCR(REQ,.08))_""""
 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""CMOR AFTER APP"")="
 .S RET(DFN,"CMOR CHG REQ",REQ,"CMOR AFTER APP")=TEXT_""""_$G(MPIFCCR(REQ,.09))_""""
 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""REQ NAME"")="
 .S RET(DFN,"CMOR CHG REQ",REQ,"REQ NAME")=TEXT_""""_$G(MPIFCCR(REQ,1.01))_""""
 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""REQ REASON"")="
 .S RET(DFN,"CMOR CHG REQ",REQ,"REQ REASON")=TEXT_""""_$G(MPIFCCR(REQ,1.02))_""""
 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""TYPE OF ACTION"")="
 .S RET(DFN,"CMOR CHG REQ",REQ,"TYPE OF ACTION")=TEXT_""""_$G(MPIFCCR(REQ,1.03))_""""
 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""REV BY"")="
 .S RET(DFN,"CMOR CHG REQ",REQ,"REV BY")=TEXT_""""_$G(MPIFCCR(REQ,2.01))_""""
 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""DT REV"")="
 .S RET(DFN,"CMOR CHG REQ",REQ,"DT REV")=TEXT_""""_$G(MPIFCCR(REQ,2.02))_""""
 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""REV PHONE"")="
 .S RET(DFN,"CMOR CHG REQ",REQ,"REV PHONE")=TEXT_""""_$G(MPIFCCR(REQ,2.03))_""""
 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""REV BY"")="
 .S RET(DFN,"CMOR CHG REQ",REQ,"REV BY")=TEXT_""""_$G(MPIFCCR(REQ,3.01))_""""
 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""REV COMMENTS"")="
 .S RET(DFN,"CMOR CHG REQ",REQ,"REV COMMENTS")=TEXT_""""_$G(MPIFCCR(REQ,3.02))_""""
 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""BLURB"")="
 .S RET(DFN,"CMOR CHG REQ",REQ,"BLURB")=TEXT_""""_$G(MPIFCCR(REQ,999))_""""
 K MPIFCCR
 Q
TFLIST(RET,DFN,RPC) ;
 ; return the complete list of Treating Facilities for patient DFN
 N ARRAY,TEXT,XX,STN,NM
 S (STN,TEXT)="",XX=0
 D GETTFS^MPIFEXT(DFN,.ARRAY)
 I RPC=1 S TEXT="MPI("_DFN_",""TF LIST"","
 S RET(DFN,"TF LIST",0)=TEXT_XX_")="
 I +ARRAY<1 S RET(DFN,"TF LIST",0)=TEXT_XX_")="_"""NONE""" Q
 F  S STN=$O(ARRAY(STN)) Q:STN=""  D
 .S XX=XX+1
 .S NM=$P($$NNT^XUAF4($$LKUP^XUAF4(STN)),"^")
 .S RET(DFN,"TF LIST",XX)=TEXT_XX_")="_""""_NM_" ("_STN_")"""
 S RET(DFN,"TF LIST",0)=$G(RET(DFN,"TF LIST",0))_XX
 Q
SUBLST(RET,DFN,RPC) ;
 ; return the complete list of Subscribers for patient DFN
 N INST,TERM,TERMDT,MPINODE,SUBNUM,SUB,XX,MPIFX
 S XX=0,TEXT=""
 S MPINODE=$$MPINODE^MPIFAPI(DFN)
 S SUB=$P(MPINODE,"^",5)
 I RPC=1 S TEXT="MPI("_DFN_",""SUB LIST"","
 S RET(DFN,"SUB LIST",0)=TEXT_XX_")="
 I SUB<1 S RET(DFN,"SUB LIST",0)=TEXT_XX_")="_"""NONE""" Q
 D GET^HLSUB(SUB,0,"",.MPIFX)
 I '$O(MPIFX("LINKS",0)) S RET(DFN,"SUB LIST",0)=TEXT_XX_")="_"""NONE""" Q
 S SUBNUM=0
 F  S SUBNUM=$O(MPIFX("LINKS",SUBNUM)) Q:SUBNUM=""  D
 .S XX=XX+1
 .S INST=$$GET1^DIQ(870,+$P(MPIFX("LINKS",SUBNUM),"^",6)_",",.02,"E")
 .S TERM=$P(MPIFX("LINKS",SUBNUM),"^",10)
 .S TERMDT=$$FMTE^XLFDT($E(TERM,1,12)) I TERMDT="" S TERMDT="None Found"
 .S RET(DFN,"SUB LIST",XX)=TEXT_XX_")="_""""_INST_"   Termination Date:"_TERMDT_""""
 S RET(DFN,"SUB LIST",0)=$G(RET(DFN,"SUB LIST",0))_XX
 Q