source: FOIAVistA/tag/r/MEDICINE-MC/MCARAM7.m@ 1789

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

initial load of FOIAVistA 6/30/08 version

File size: 4.5 KB
Line 
1MCARAM7 ;WASH ISC/JKL-MUSE SUMMARY LOOKUP AND FILE IN DHCP ;6/26/96 12:27
2 ;;2.3;Medicine;;09/13/1996
3 ;
4 ;
5 ;Lookup for last transmission in Summary file 700.5
6 ;USAGE: S X=$$LSUM^MCARAM7(A,B,.C)
7 ;WHERE: A=Date/time of record in FileMan format
8 ; B=Name of patient equivalent to name in Patient file (#2)
9 ; .C=Array into which data is placed
10 ; if unsuccessful, returns an error message
11 ; if successful, returns a function value of 0 and a value array:
12 ; C("SUM") = IEN of existing Summary record
13 ; C("PID") = PID of patient
14 ; C("NAME") = name of patient
15 ;
16 ;variables
17 ;MCERR = error message
18 ;
19LSUM(MCDT,MCNM,MCS) ;
20 ; Where MCDT is Date/time of record in FileMan format
21 ; MCNM is Name of patient equivalent to name in Patient file (#2)
22 ; MCS is array into which data is placed
23 ;
24 ; Retrieves PID from Name X-ref of Patient file (#2)
25 N MCI,DIC,D,X,Y,MCERR S MCS("SUM")=""
26 S DIC="^DPT(",DIC(0)="XZ",D="B",X=MCNM D IX^DIC
27 I +Y'>0 S MCERR="21-Name for Summary not in Patient file" Q $$LOG^MCARAM7(MCERR)
28 S MCS("PID")=+Y,MCS("NAME")=$P(Y(0),U)
29 I '$D(^MCAR(700.5,"B",MCDT)) S MCERR="22-Date/Time not in Summary file" Q $$LOG^MCARAM7(MCERR)
30 S MCI=0 F S MCI=$O(^MCAR(700.5,"B",MCDT,MCI)) Q:MCI="" I $D(^MCAR(700.5,"PT",MCS("NAME"),MCI)) S MCS("SUM")=MCI
31 I MCS("SUM")="" S MCERR="23-Name does not exist for Date/Time in Summary file" Q $$LOG^MCARAM7(MCERR)
32 Q 0
33 ;
34KPERR(MCA,MCS) ;Transfer local array data into new 700.5 Summary record in DHCP
35 ; occurs for every data transfer attempt whether or not successful
36 ;USAGE: S X=$$KPERR^MCARAM7(.A,.B)
37 ;WHERE: A=Array of local data arranged for EKG file
38 ; B=DHCP data stored in Summary file including
39 ; B("SUM")=IEN of Summary file
40 ; if unsuccessful, returns an error message
41 ; if successful, returns a function value of 0
42 ; MCS("FLDT")=Creation date in 700.5, file date/time
43 ;
44 ; Number of attempts of same data record, field 5
45 ; Obsolete with transaction processing, still needed for MCARAP* report
46 N MCI,%,DIC,X,Y,MCERR
47 S MCS(5)=1
48 ; Date/Time Initial, creation of entry in Summary file, field .05
49 D NOW^%DTC S (MCS("FLDT"),MCS(.05),MCS(.06))=%
50 ; Date/Time Latest, latest transmission attempt, field .06
51 ; Transaction processing makes latest transmission date/time
52 ; same as initial date/time except for those with imaging updates
53 ; Auto instrument name, defined in MCARAM, field 1
54 S MCS(1)=MCINST
55 ; Reason for failure to pass DHCP validity checks, field 4
56 S MCS(4)=$$RFFL(.MCA,.MCS)
57 ; Social Security Number, field 2
58 S MCS(2)=MCA(.02)
59 ; Name, field 3
60 S MCS(3)=MCA("NAME")
61 ; Type of transmission, field 7
62 S MCS(7)=MCTYPE
63 S MCI=.05,DIC("DR")=".05///"_MCS(.05) F S MCI=$O(MCS(MCI)) Q:MCI=""!(MCI?1A.A) S DIC("DR")=DIC("DR")_";"_MCI_"///"_MCS(MCI)
64 K DD,DO N DLAYGO S DLAYGO=700.5,DIC="^MCAR(700.5,",DIC(0)="LXZ",X=MCA("DT")
65 D FILE^DICN
66 I +Y>0 S MCS("SUM")=+Y Q 0
67 S MCERR="9-Summary record not filed" Q $$LOG^MCARAM7(MCERR)
68 ;
69RFFL(MCA,MCS) ; Convert processing errors to 700.5 file fields
70 ;USAGE: S X=$$RFFL^MCARAM7(.A,.B)
71 ;WHERE: A=Array of local data
72 ; B=DHCP data for Summary file including
73 ; B("SUM")=internal record number of Summary file
74 ; returns field 4 of 700.5 file, reason for failure
75 ; field 4 : "D"ate/Time error, "L"oad into DHCP error
76 ; "N"ame error, "S"ocial Security Number error
77 ; Integers for specific errors listed in the Summary Print,
78 ; MCARAP2 - Errors numbered >50 have not been filed as EKG records
79 ; returns field 6 of 700.5 file, error code for last transmission
80 ; field 6 : "S"uccessful or "U"nsuccessful
81 ; MCA("ERR") = # of processing errors
82 ;successful transfer attempt
83 S MCS(6)="S" I $$GRERR(.MCA)=0 Q ""
84 ;unsuccessful transfer attempt
85 S MCS(6)="U",MCERR=+MCA("ERR",0)
86 I +MCERR=51!(+MCERR=52)!(+MCERR=53) S:$G(MCA("DT"))="" MCA("DT")=MCS("FLDT")
87 Q $S(+MCERR>62:"P",+MCERR>60:"M",+MCERR>57:"L",+MCERR>55:"N",+MCERR>53:"S",+MCERR>50:"D",1:+MCERR)
88 ;
89GRERR(MCA) ;Find first fatal error
90 ;USAGE: S X=$$GRERR(A)
91 ;WHERE: A=array of local data
92 ; if successful, returns 1 and A("ERR",0)=first fatal error >50
93 ; if unsuccessful, returns 0
94 ;variables MCERR,MCI,MCJ
95 N MCERR,MCI,MCJ
96 I MCA("ERR")=0 Q 0
97 S MCI=MCA("ERR") F MCJ=1:1:MCI I +MCA("ERR",MCJ)>50 S MCERR=MCA("ERR",MCJ) Q
98 I $D(MCERR) S MCA("ERR",0)=MCERR Q 1
99 Q 0
100 ;
101LOG(MCERR) ;Logs type of error in local array
102 ;USAGE: S X=$$LOG^MCARAM7(A)
103 ;WHERE: A=Free text error
104 ; returns the error message and updates the error array
105 S MCA("ERR")=MCA("ERR")+1,MCA("ERR",MCA("ERR"))=MCERR
106 Q MCERR
Note: See TracBrowser for help on using the repository browser.