- Timestamp:
- Dec 4, 2009, 12:11:15 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WorldVistAEHR/trunk/r/ZZREGIONAL-A1C-A5C-CRHD-RGED-RGUT-RGWB-RG/RGPVMPI.m
r613 r623 1 RGPVMPI ;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 ; 7 INTRO ;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 ; 18 ASK ;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 ; 26 SEND ;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 34 NOQ ;No previous query exists for this ICN 35 I '$D(^XTMP("RGPVMPI"_RGICN)) D RPC G DISP 36 ; 37 OLDQ ;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 ; 56 DISP ;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 ; 64 EXIT ;Kill variables and quit 65 K CNT,D,DFN,DIC,DIR,DIRUT,DTOUT,DUOUT,QFLG,QUIT,RGICN,SAPV,X,Y 66 Q 67 ; 68 RPC ;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 ; 83 FAIL ;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 ; 1 RGPVMPI ;BIR/PTD-REMOTE PRIMARY VIEW DISPLAY FROM MPI ;5/17/07 2 ;;1.0;CLINICAL INFO RESOURCE NETWORK;**48**;30 Apr 99;Build 3 3 ; 4 ;Reference to EN1^XWB2HL7 supported by IA #3144 5 ;Reference to RPCCHK^XWB2HL7 supported by IA #3144 6 ; 7 INTRO ;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 ; 18 ASK ;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 ; 26 SEND ;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 34 NOQ ;No previous query exists for this ICN 35 I '$D(^XTMP("RGPVMPI",RGICN)) D RPC G DISP 36 ; 37 OLDQ ;Query previously sent for this ICN 38 I $D(^XTMP("RGPVMPI",RGICN)) D 39 .S SNTDT=$$FMTE^XLFDT($P(^XTMP("RGPVMPI",RGICN),"^",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),"^") 43 .D RPCCHK^XWB2HL7(.RESULT,RETURN(0)) 44 .;Data has NOT returned 45 .I +RESULT(0)'=1 S QUIT=1 W !,"Query data has NOT returned from the MPI; please check back later." Q 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 ; 56 DISP ;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 ; 64 EXIT ;Kill variables and quit 65 K CNT,D,DFN,DIC,DIR,DIRUT,DTOUT,DUOUT,QFLG,QUIT,RGICN,SAPV,X,Y 66 Q 67 ; 68 RPC ;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",0)=$$FMADD^XLFDT(DT,2)_"^"_DT_"^"_"PRIMARY VIEW MPI PDAT" 73 .S ^XTMP("RGPVMPI",RGICN)=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 ;quit, info not back after 30 seconds 78 ..W !,"Query data has NOT returned from the MPI; please check back later." 79 ..S QUIT=1 80 ..I SAPV=0 D PAUSE^VALM1 81 W !!,"Problem with Query: ",RETURN(0)_"^"_$G(RETURN(1)) 82 S QUIT=1 83 I SAPV=0 D PAUSE^VALM1 84 Q 85 ;
Note:
See TracChangeset
for help on using the changeset viewer.