source: FOIAVistA/trunk/r/ZZREGIONAL-A1C-A5C-CRHD-RGED-RGUT-RGWB-RG/RGPVMPI.m@ 1389

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

initial load of FOIAVistA 6/30/08 version

File size: 3.7 KB
Line 
1RGPVMPI ;BIR/PTD-REMOTE PRIMARY VIEW DISPLAY FROM MPI ;5/17/07
2 ;;1.0;CLINICAL INFO RESOURCE NETWORK;**48,53**;30 Apr 99;Build 2
3 ;
4 ;Reference to EN1^XWB2HL7 supported by IA #3144
5 ;Reference to RPCCHK^XWB2HL7 supported by IA #3144
6 ;
7INTRO ;Display purpose of option
8 W @IOF S SAPV=1 ;from stand alone option, not EH
9 W !,"This option sends a remote request for data to the Master Patient"
10 W !,"Index, using a Remote Procedure Call (RPC). When the RPC returns"
11 W !,"the information, you can review Primary View data as it currently"
12 W !,"exists on the MPI Patient Data Inquiry (PDAT) report."
13 ;
14 W !!,"Choose the patient for whom Primary View data is to be requested."
15 W !,"The selected patient must have an Integration Control Number (ICN)."
16 W !,"You can select by Patient Name, Social Security Number, or ICN.",!
17 ;
18ASK ;Ask For Patient
19 S DFN="",RGICN="" K DTOUT,DUOUT
20 S DIC="^DPT(",DIC(0)="QEAM",DIC("A")="Select PATIENT: ",D="SSN^AICN^B^BS^BS5"
21 D MIX^DIC1 K DIC,D
22 I Y<0 G EXIT
23 S DFN=+Y
24 S RGICN=+$$GETICN^MPIF001(DFN) I RGICN<1 W !,"There is no Integration Control Number for this patient." G ASK
25 ;
26SEND ;Send a remote query to the MPI for Primary View PDAT
27 ;Entry point from Exception Handler; DATA should be defined.
28 S (QFLG,QUIT)=0 N RETURN,RESULT,SNTDT
29 I SAPV=0 D I QUIT=1 G EXIT
30 .I DATA="" W !,"No Exception Data available." S QUIT=1 Q
31 .S RGICN=$P(DATA,"^",6) I RGICN="" W !,"No ICN defined." S QUIT=1 Q
32 .S VALMBCK=""
33 .D FULL^VALM1
34NOQ ;No previous query exists for this ICN
35 I '$D(^XTMP("RGPVMPI"_RGICN)) D RPC G DISP
36 ;
37OLDQ ;Query previously sent for this ICN
38 I $D(^XTMP("RGPVMPI"_RGICN)) D
39 .S SNTDT=$$FMTE^XLFDT($P(^XTMP("RGPVMPI"_RGICN,"DATA"),"^",2))
40 .W !,"A query was last sent for this ICN on "_SNTDT
41 .;Has data returned for query?
42 .S RETURN(0)=$P(^XTMP("RGPVMPI"_RGICN,"DATA"),"^")
43 .D RPCCHK^XWB2HL7(.RESULT,RETURN(0))
44 .;Data has NOT returned
45 .I +RESULT(0)'=1 D FAIL Q ;**53
46 .I +RESULT(0)=1 D ;Data has returned
47 ..S DIR("A")="Do you wish to view the existing query data now? ",DIR(0)="YA"
48 ..S DIR("?")="Enter YES to review the existing data; enter NO to send a new query"
49 ..S DIR("B")="YES" D ^DIR K DIR I $D(DIRUT) S QUIT=1 Q ;up-arrowed out
50 ..I Y>0 K DIR Q ;yes, use existing query
51 ..I Y=0 D Q ;no, don't use existing, send new query
52 ...K ^XTMP("RGPVMPI"_RGICN)
53 ...D RPC
54 ...K DIR
55 ;
56DISP ;Display Primary View Data
57 I QUIT'=1 D I QFLG G EXIT
58 .I SAPV=1 D Q:QFLG ;Stand alone PV display
59 ..W !,"(Be sure HISTORY is enabled to capture data!)"
60 ..S DIR(0)="E" W ! D ^DIR K DIR I 'Y S QFLG=1 Q
61 ..W !,@IOF D SAPV^RGEX06(RGICN)
62 .I SAPV=0 D EN^RGEX06(RGICN) ;Exception Handler PV display
63 ;
64EXIT ;Kill variables and quit
65 K CNT,D,DFN,DIC,DIR,DIRUT,DTOUT,DUOUT,QFLG,QUIT,RGICN,SAPV,X,Y
66 Q
67 ;
68RPC ;Send the Remote Query
69 W !!,"Sending a Remote Query to the Master Patient Index."
70 W !,"This will take some time; please be patient."
71 D EN1^XWB2HL7(.RETURN,"200M","RG PRIMARY VIEW FROM MPI",1,RGICN) I RETURN(0)'="" D Q
72 .S ^XTMP("RGPVMPI"_RGICN,0)=$$FMADD^XLFDT(DT,2)_"^"_DT_"^"_"PRIMARY VIEW MPI PDAT"
73 .S ^XTMP("RGPVMPI"_RGICN,"DATA")=RETURN(0)_"^"_$$NOW^XLFDT
74 .;Has data returned for this query?
75 .S CNT=0 F S CNT=CNT+1 D RPCCHK^XWB2HL7(.RESULT,RETURN(0)) Q:RESULT(0) H 2 I CNT>15 Q ;result(0)=status of handle
76 .I +RESULT(0)=1 W !,"Query data has returned from the MPI and is available for review."
77 .I +RESULT(0)'=1 D FAIL ;**53
78 W !!,"Problem with Query: ",RETURN(0)_"^"_$G(RETURN(1))
79 S QUIT=1
80 I SAPV=0 D PAUSE^VALM1
81 Q
82 ;
83FAIL ;Status of RPC call - unsuccessful after 30 seconds ;**53
84 W !,"Your query request has NOT returned data from the MPI after trying for"
85 W !,"30 seconds. This could be due to network issues. Please try again later."
86 K ^XTMP("RGPVMPI"_RGICN)
87 S QUIT=1
88 I SAPV=0 D PAUSE^VALM1
89 Q
90 ;
Note: See TracBrowser for help on using the repository browser.