source: FOIAVistA/trunk/r/MASTER_PATIENT_INDEX_VISTA-MPIF/MPIFCMRP.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 4.7 KB
Line 
1MPIFCMRP ;BPCIO/CMC-PUSHING CMOR TO ANOTHER SITE ;NOV 15, 2000
2 ;;1.0; MASTER PATIENT INDEX VISTA ;**11,21,30,32**;30 Apr 99
3 ;
4 ; Integration Agreements Utilized:
5 ;
6 ; ^DGCN(391.91 IA #2751
7 ;
8 ;Entry point for option: PUSH CMOR REQUEST - create a new request
9 ; to change CMOR when your site is the CMOR.
10 ; No input or output variables.
11 ;
12 ;Only if the site is the CMOR can this option be used
13 ; note: code here is very similar to MPIFEDIT
14NEW ;
15 N DIC,X,Y,DTOUT,DUOUT,PAT
16 S DIC="^DPT(",DIC(0)="QEAMZ",DIC("A")="Select PATIENT: "
17 D ^DIC
18 Q:$D(DTOUT)!$D(DUOUT)!(Y=-1)
19 S PAT=+Y
20 D LM(PAT)
21 Q
22LM(PAT) ; list manager entry point to push a change of CMOR with PAT set to the DFN
23 I +$$GETICN^MPIF001(PAT)<0 W !,"Patient doesn't have ICN, try again" G NEW
24 I $E($$GETICN^MPIF001(PAT),1,3)=$P($$SITE^VASITE(),"^",3) W !,"Patient has a Local ICN, try again" G NEW
25 I $$GETVCCI^MPIF001(PAT)<0 W !,"Patient doesn't have a CMOR, try again" G NEW
26 I $$GETVCCI^MPIF001(PAT)'=$P($$SITE^VASITE(),"^",3) W !,"You are NOT the CMOR, to request to be the CMOR, use option: Create a New CMOR Change Request" G NEW
27 N TMP,TCNT
28 S TMP=$O(^DGCN(391.91,"APAT",PAT,"")) I $O(^DGCN(391.91,"APAT",PAT,TMP))="" W !,"Patient isn't SHARED - CAN'T change CMOR" Q
29 ;Pt is shared, but are they shared with another VAMC?
30 S TMP="",TCNT=0 F S TMP=$O(^DGCN(391.91,"APAT",PAT,TMP)) Q:TMP="" D
31 .;I $$GET1^DIQ(4,TMP_",",13)'="VAMC" Q
32 .N TP S TP=$$GET1^DIQ(4,TMP_",",13)
33 .Q:TP'="VAMC"&(TP'="OC")&(TP'="M&ROC")&(TP'="RO-OC")
34 .; ^ only valid types of TFs that can be a CMOR
35 .S TCNT=TCNT+1
36 I TCNT<2 W !,"Patient isn't SHARED with another VAMC - CAN'T change CMOR" Q
37 ; CHECK IF ALREADY OPEN/PENDING REQUEST
38 N ENT,STOP,MPIFNM,REQNM
39 S ENT=0,STOP=0 F S ENT=$O(^MPIF(984.9,"C",PAT,ENT)) Q:ENT=""!(STOP) D
40 .I $P($G(^MPIF(984.9,ENT,0)),"^",6)<4 S STOP=1
41 I STOP W !!,"Already have request for this patient" G NEW
42 N N0,PHONE,DA,DIE,DR,DIR,ERROR,DIK,Y,DIRUT,REQ,TDA,PERS
43 S DA=$$ADD^MPIFNEW(),TDA=DA,PHONE=""
44 S DIE="^MPIF(984.9,",DR=".04///`"_PAT D ^DIE
45 S REQ=$P($G(^MPIF(984.9,DA,0)),"^")
46 W !,"REQUEST NUMBER:",REQ
47EDIT I $D(DUZ) D
48 .S PHONE=$P($G(^MPIF(984.9,+$O(^MPIF(984.9,"AD",DUZ,""),-1),0)),"^",5)
49 .N DA,DIC,DIQ S DIQ="MPIFNM",DR=".01;.132",DIQ(0)="E",DIC="^VA(200,",DA=DUZ
50 .D EN^DIQ1
51 .S REQNM=MPIFNM(200,DUZ,.01,"E")
52 I '$D(DUZ) S (PHONE,REQNM)=""
53 ;
54REASON S DIR("A")="Reason for Request",DIR("?")="Answer must be 3-60 characters in length.",DIR(0)="F^3:60" D ^DIR
55 I Y="" W !,"Answer must be 3-60 characters in length." G REASON
56 I X="^" S DIK="^MPIF(984.9," D ^DIK W "... Request deleted" Q
57 S DIE="^MPIF(984.9,",DR="1.02///"_X D ^DIE
58REQNM S DIR("A")="Requestor's Name",DIR("B")=REQNM,DIR("?")="Answer must be a valid user",DIR(0)="P^200:EQZ" D ^DIR K DIR("B")
59 I Y="" W !,"Must pick valid user" G REQNM
60 I X="^" S DIK="^MPIF(984.9," D ^DIK W "... Request deleted" Q
61 S PERS=+Y
62 S DIE="^MPIF(984.9,",DR=".02///`"_+Y D ^DIE
63PHONE S DIR("A")="Requestor's Phone",DIR("B")=PHONE,DIR("?")="Answer must be 4-20 charaters in length.",DIR(0)="F" D ^DIR K DIR("B")
64 I Y="" W !,"Answer must be 4-20 charaters in length." G PHONE
65 I X="^" S DIK="^MPIF(984.9," D ^DIK W "... Request deleted" Q
66 S DIE="^MPIF(984.9,",DR=".05///"_X D ^DIE
67 ;
68CMOR S DIC("A")="Select Site to Be CMOR: ",DIC="^DIC(4,",DIC(0)="QEAM"
69 S DIC("S")="I $D(^DGCN(391.91,""APAT"",PAT,Y)) I +$$SITE^VASITE'=+Y N TYPE S TYPE=$$GET1^DIQ(4,+Y_"","",13) I TYPE=""VAMC""!(TYPE=""RO-OC"")!(TYPE=""OC"")!(TYPE=""M&ROC"")"
70 D ^DIC
71 I X="^" S DIK="^MPIF(984.9," D ^DIK W "... Request deleted" Q
72 N TSITE S TSITE=+Y
73 S DIE="^MPIF(984.9,",DR=".07///`"_TSITE_";1.03///3;.09///`"_TSITE D ^DIE
74 ;update site, type of action and cmor after approval
75 ;
76 I $$CHK^MPIFEDIT(DA) W !,"This request is missing required data." G EDIT
77 ;
78APP S DIR("A")="Select Request Action (SEND/EDIT/DELETE)? ",DIR("B")="SEND",DIR(0)="SAO^SEND:SEND;EDIT:EDIT;DELETE:DELETE"
79 D ^DIR K DIR
80 S DA=TDA
81 I $E(Y)="D"!$D(DIRUT) D Q
82 .S DIK="^MPIF(984.9," D ^DIK W "... Request deleted"
83 .Q
84 I $E(Y)="E" G REASON
85 S DR=".08////^S X=2;.06////^S X=2",DIE="^MPIF(984.9," D ^DIE W !,"... Request will be sent"
86 ; removed event queue due to delivery issues - this msg must be sent first followed by the actual change cmor msg.
87 N ERR,MPIFHL7 S ERR="ERRS",MPIFHL7=""
88 D EN^MPIFREQ("CMOR CHANGE REQUEST",DA,.ERR,MPIFHL7)
89 ;
90 ;NOW CHANGE CMOR AND SEND CHANGE CMOR MESSAGE
91 N TEXT,DIR,DR,CMOR,TMP,ERROR
92 S TEXT="Auto change - pushed CMOR",ERROR=0
93 S DIE="^MPIF(984.9,",DA=TDA,DR=".06///^S X=4;3.01///^S X=TEXT"
94 D ^DIE
95 S CMOR=$P($G(^MPIF(984.9,TDA,0)),"^",7)
96 I CMOR="" D Q
97 .W !,"New CMOR Not Defined, edit request"
98 .S ^DIE="^MPIF(984.9,",DA=TDA,DR=".06///^S X=1" D ^DIE
99 S TMP=$$CHANGE^MPIF001(PAT,CMOR)
100 I +TMP<0 S ^DIE="^MPIF(984.9,",DA=TDA,DR=".06///^S X=1" D ^DIE Q
101 D BROAD^MPIFCMOR(DA,.ERROR)
102 Q
Note: See TracBrowser for help on using the repository browser.