source: WorldVistAEHR/trunk/r/NETWORK_HEALTH_EXCHANGE-AFJX/AFJXTRF.m@ 1073

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

initial load of WorldVistAEHR

File size: 3.0 KB
Line 
1AFJXTRF ;FO-OAKLAND/GMB-AFJXALRT (cont'd) ;2/13/01 14:59
2 ;;5.1;Network Health Exchange;**17,18,23,26,31**;Jan 23, 1996
3 ; Totally rewritten 11/2001. (Previously AAA.)
4SPL2TMP ; Transfer the lines from the spool document to the temp global
5 ; Incoming: AXPID,AXTI,AXSPDOC,AXSPDATA,AXRQFROM
6 D CHKDATA(AXSPDATA,.AXPID) Q:AXABORT
7 N AXSPI,AXDREC
8 S AXSPI=0
9 S AXTI=AXTI+1,^TMP("AFJX",$J,AXTI,0)="-Patient ID verified on all data segments-"
10 S AXTI=AXTI+1,^TMP("AFJX",$J,AXTI,0)=""
11 F D Q:'AXSPI ; Transfer one segment at a time
12 . F S AXSPI=$O(^XMBS(3.519,AXSPDATA,2,AXSPI)) Q:'AXSPI S AXDREC=^(AXSPI,0) Q:$E(AXDREC,1,3)="---"!(AXDREC["*** DECEASED ***")
13 . Q:'AXSPI
14 . S AXTI=AXTI+1,^TMP("AFJX",$J,AXTI,0)=AXPID("INFO")
15 . I AXDREC["(max 365 days) " S AXDREC=$P(AXDREC,"(max 365 days) ")_"(12 months) ---"_$P(AXDREC,"(max 365 days) ",2)
16 . S AXTI=AXTI+1,^TMP("AFJX",$J,AXTI,0)=AXDREC
17 . F S AXSPI=$O(^XMBS(3.519,AXSPDATA,2,AXSPI)) Q:'AXSPI S AXDREC=^(AXSPI,0) Q:$E(AXDREC,1,7)="*** END" D
18 . . S AXDREC=$G(^XMBS(3.519,AXSPDATA,2,AXSPI,0))
19 . . Q:AXDREC["|TOP|"!(AXDREC["(continued)")
20 . . S AXTI=AXTI+1,^TMP("AFJX",$J,AXTI,0)=AXDREC
21 Q:'$P($G(^XMB(3.51,AXSPDOC,0)),U,11)
22 S AXTI=AXTI+1,^TMP("AFJX",$J,AXTI,0)="*** Data is incomplete ***"
23 Q
24CHKDATA(AXSPDATA,AXPID) ; Patient ID Filter
25 N AXSPI,AXBAD,AXDREC,I
26 S AXSPI=0
27 F S AXSPI=$O(^XMBS(3.519,AXSPDATA,2,AXSPI)) Q:'AXSPI S AXDREC=^(AXSPI,0) D
28 . Q:AXDREC'["NHE EXTRACT SUMMARY"!(AXDREC["END ")
29 . F I=1:1:5,0 Q:$L($G(^XMBS(3.519,AXSPDATA,2,AXSPI+I,0)))
30 . Q:'I
31 . S AXDREC=$G(^XMBS(3.519,AXSPDATA,2,AXSPI+I,0))
32 . I '$$VALID(AXDREC,.AXPID) S AXBAD(AXDREC)="" ; Wrong Patient Data
33 Q:'$D(AXBAD)
34 D FAIL^AFJXALRT("Health Summary returned data for the wrong patient. Please try again.")
35 D BADMSG(.AXPID,.AXBAD)
36 Q
37VALID(AXDREC,AXPID) ; Make sure we've got the right patient.
38 ; AXDREC - Patient ID line from health summary.
39 ; AXPID("NAME") - Patient Name
40 ; AXPID("S-S-N") - Patient SSN
41 ; AXPID("DOB") - Patient Date of Birth
42 ; If AXDREC contains all three Patient ID's then AXFLD will equal zero.
43 N AXFLD
44 F AXFLD="NAME","S-S-N","DOB",0 Q:AXFLD=0 I $L($G(AXPID(AXFLD))),$L(AXDREC),AXDREC'[AXPID(AXFLD) Q
45 Q AXFLD=0
46BADMSG(AXPID,AXBAD) ; Send message if PatID Filter Blocked a Data Request.
47 ; Make sure AFJX PATID FILTER BLOCK mail group exists and has members
48 Q:'$$GOTLOCAL^XMXAPIG("AFJX PATID FILTER BLOCK")
49 N I,AXTEXT,XMSUB,XMTEXT,XMY,XMZ,AXDREC
50 S XMSUB="NHE PatID Filter Warning ("_AXPID("NAME")_")"
51 S XMY("G.AFJX PATID FILTER BLOCK")=""
52 S XMTEXT="AXTEXT("
53 S AXTEXT(1)=$$REPEAT^XLFSTR("*",69)
54 S AXTEXT(2)="NHE Data Request blocked by possible invalid Health Summary data."
55 S AXTEXT(3)="Requested by: "_$G(AXRQFROM,"Unknown user")
56 S AXTEXT(4)=$$REPEAT^XLFSTR("*",69)
57 S AXTEXT(5)=""
58 S AXTEXT(6)="Data Requested on Patient:"
59 S AXTEXT(7)=AXPID("INFO")
60 S AXTEXT(8)=""
61 S AXTEXT(9)="Patients Returned by Health Summary:"
62 S AXTEXT(10)=""
63 S I=10
64 S AXDREC=""
65 F S AXDREC=$O(AXBAD(AXDREC)) Q:AXDREC="" S I=I+1,AXTEXT(I)=AXDREC
66 D ^XMD
67 Q
Note: See TracBrowser for help on using the repository browser.