source: WorldVistAEHR/trunk/r/MASTER_PATIENT_INDEX_VISTA-MPIF/MPIFEXT3.m@ 1005

Last change on this file since 1005 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.9 KB
Line 
1MPIFEXT3 ;SFCIO/CMC-EXTENDED PDAT 3 - RPC ;26 JUN 01
2 ;;1.0; MASTER PATIENT INDEX VISTA ;**20**;30 Apr 99
3 ;
4 ;Integration Agreements Utilized:
5 ; ^DPT( - #2070
6 ; $$GET1^DIQ(870,+$P(ARRAY("LINKS",SUBNUM),"^",6)_",",.02,"E") - #3573
7 ; D GETS^DIQ(2,IEN_",","1*","E","MPIFA") - #3581
8 ;
9ALIAS(RET,IEN,RPC) ; get any Aliases for patient IEN
10 N ALIEN,RET2,MPIFA
11 I RPC=1 S TEXT="MPI("_IEN_",""ALIAS(ES)"")="
12 S ALIEN=0,RET2=""
13 D GETS^DIQ(2,IEN_",","1*","E","MPIFA")
14 ;; MPIFA(2.01,"1,1,",.01,"E")=Funky K
15 F S ALIEN=$O(MPIFA(2.01,ALIEN)) Q:'ALIEN D
16 .I $G(MPIFA(2.01,ALIEN,.01,"E"))'="" S RET2=RET2_$G(MPIFA(2.01,ALIEN,.01,"E"))_"^"
17 I RET2=""!(RET2?."^") S RET2="NONE"
18 S RET(IEN,"ALIAS(ES)")=TEXT_""""_RET2_""""
19 Q
20CMORCH(RET,DFN,RPC) ; get any CMOR Change Requests for this patient
21 K MPIFCCR
22 D CCRDAT^MPIFUTL(DFN,"MPIFCCR")
23 N REQ,FLD,TOT
24 S REQ=0,TOT=$G(MPIFCCR(0))
25 F S REQ=$O(MPIFCCR(REQ)) Q:REQ="" D
26 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""REQ #"")="
27 .S RET(DFN,"CMOR CHG REQ",REQ,"REQ #")=TEXT_""""_$G(MPIFCCR(REQ,.01))_""""
28 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""REQ BY"")="
29 .S RET(DFN,"CMOR CHG REQ",REQ,"REQ BY")=TEXT_""""_$G(MPIFCCR(REQ,.02))_""""
30 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""DT REQ"")="
31 .S RET(DFN,"CMOR CHG REQ",REQ,"DT REQ")=TEXT_""""_$G(MPIFCCR(REQ,.03))_""""
32 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""PATIENT"")="
33 .S RET(DFN,"CMOR CHG REQ",REQ,"PATIENT")=TEXT_""""_$G(MPIFCCR(REQ,.04))_""""
34 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""REQ PHONE"")="
35 .S RET(DFN,"CMOR CHG REQ",REQ,"REQ PHONE")=TEXT_""""_$G(MPIFCCR(REQ,.05))_""""
36 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""STATUS"")="
37 .S RET(DFN,"CMOR CHG REQ",REQ,"STATUS")=TEXT_""""_$G(MPIFCCR(REQ,.06))_""""
38 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""SITE"")="
39 .S RET(DFN,"CMOR CHG REQ",REQ,"SITE")=TEXT_""""_$G(MPIFCCR(REQ,.07))_""""
40 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""TYPE"")="
41 .S RET(DFN,"CMOR CHG REQ",REQ,"TYPE")=TEXT_""""_$G(MPIFCCR(REQ,.08))_""""
42 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""CMOR AFTER APP"")="
43 .S RET(DFN,"CMOR CHG REQ",REQ,"CMOR AFTER APP")=TEXT_""""_$G(MPIFCCR(REQ,.09))_""""
44 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""REQ NAME"")="
45 .S RET(DFN,"CMOR CHG REQ",REQ,"REQ NAME")=TEXT_""""_$G(MPIFCCR(REQ,1.01))_""""
46 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""REQ REASON"")="
47 .S RET(DFN,"CMOR CHG REQ",REQ,"REQ REASON")=TEXT_""""_$G(MPIFCCR(REQ,1.02))_""""
48 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""TYPE OF ACTION"")="
49 .S RET(DFN,"CMOR CHG REQ",REQ,"TYPE OF ACTION")=TEXT_""""_$G(MPIFCCR(REQ,1.03))_""""
50 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""REV BY"")="
51 .S RET(DFN,"CMOR CHG REQ",REQ,"REV BY")=TEXT_""""_$G(MPIFCCR(REQ,2.01))_""""
52 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""DT REV"")="
53 .S RET(DFN,"CMOR CHG REQ",REQ,"DT REV")=TEXT_""""_$G(MPIFCCR(REQ,2.02))_""""
54 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""REV PHONE"")="
55 .S RET(DFN,"CMOR CHG REQ",REQ,"REV PHONE")=TEXT_""""_$G(MPIFCCR(REQ,2.03))_""""
56 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""REV BY"")="
57 .S RET(DFN,"CMOR CHG REQ",REQ,"REV BY")=TEXT_""""_$G(MPIFCCR(REQ,3.01))_""""
58 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""REV COMMENTS"")="
59 .S RET(DFN,"CMOR CHG REQ",REQ,"REV COMMENTS")=TEXT_""""_$G(MPIFCCR(REQ,3.02))_""""
60 .I RPC=1 S TEXT="MPI("_DFN_",""CMOR CHG REQ"","_REQ_",""BLURB"")="
61 .S RET(DFN,"CMOR CHG REQ",REQ,"BLURB")=TEXT_""""_$G(MPIFCCR(REQ,999))_""""
62 K MPIFCCR
63 Q
64TFLIST(RET,DFN,RPC) ;
65 ; return the complete list of Treating Facilities for patient DFN
66 N ARRAY,TEXT,XX,STN,NM
67 S (STN,TEXT)="",XX=0
68 D GETTFS^MPIFEXT(DFN,.ARRAY)
69 I RPC=1 S TEXT="MPI("_DFN_",""TF LIST"","
70 S RET(DFN,"TF LIST",0)=TEXT_XX_")="
71 I +ARRAY<1 S RET(DFN,"TF LIST",0)=TEXT_XX_")="_"""NONE""" Q
72 F S STN=$O(ARRAY(STN)) Q:STN="" D
73 .S XX=XX+1
74 .S NM=$P($$NNT^XUAF4($$LKUP^XUAF4(STN)),"^")
75 .S RET(DFN,"TF LIST",XX)=TEXT_XX_")="_""""_NM_" ("_STN_")"""
76 S RET(DFN,"TF LIST",0)=$G(RET(DFN,"TF LIST",0))_XX
77 Q
78SUBLST(RET,DFN,RPC) ;
79 ; return the complete list of Subscribers for patient DFN
80 N INST,TERM,TERMDT,MPINODE,SUBNUM,SUB,XX,MPIFX
81 S XX=0,TEXT=""
82 S MPINODE=$$MPINODE^MPIFAPI(DFN)
83 S SUB=$P(MPINODE,"^",5)
84 I RPC=1 S TEXT="MPI("_DFN_",""SUB LIST"","
85 S RET(DFN,"SUB LIST",0)=TEXT_XX_")="
86 I SUB<1 S RET(DFN,"SUB LIST",0)=TEXT_XX_")="_"""NONE""" Q
87 D GET^HLSUB(SUB,0,"",.MPIFX)
88 I '$O(MPIFX("LINKS",0)) S RET(DFN,"SUB LIST",0)=TEXT_XX_")="_"""NONE""" Q
89 S SUBNUM=0
90 F S SUBNUM=$O(MPIFX("LINKS",SUBNUM)) Q:SUBNUM="" D
91 .S XX=XX+1
92 .S INST=$$GET1^DIQ(870,+$P(MPIFX("LINKS",SUBNUM),"^",6)_",",.02,"E")
93 .S TERM=$P(MPIFX("LINKS",SUBNUM),"^",10)
94 .S TERMDT=$$FMTE^XLFDT($E(TERM,1,12)) I TERMDT="" S TERMDT="None Found"
95 .S RET(DFN,"SUB LIST",XX)=TEXT_XX_")="_""""_INST_" Termination Date:"_TERMDT_""""
96 S RET(DFN,"SUB LIST",0)=$G(RET(DFN,"SUB LIST",0))_XX
97 Q
Note: See TracBrowser for help on using the repository browser.