Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: MCARAM7

MCARAM7.m

Go to the documentation of this file.
  1. MCARAM7 ;WASH ISC/JKL-MUSE SUMMARY LOOKUP AND FILE IN DHCP ;6/26/96 12:27
  1. ;;2.3;Medicine;;09/13/1996
  1. ;
  1. ;
  1. ;Lookup for last transmission in Summary file 700.5
  1. ;USAGE: S X=$$LSUM^MCARAM7(A,B,.C)
  1. ;WHERE: A=Date/time of record in FileMan format
  1. ; B=Name of patient equivalent to name in Patient file (#2)
  1. ; .C=Array into which data is placed
  1. ; if unsuccessful, returns an error message
  1. ; if successful, returns a function value of 0 and a value array:
  1. ; C("SUM") = IEN of existing Summary record
  1. ; C("PID") = PID of patient
  1. ; C("NAME") = name of patient
  1. ;
  1. ;variables
  1. ;MCERR = error message
  1. ;
  1. LSUM(MCDT,MCNM,MCS) ;
  1. ; Where MCDT is Date/time of record in FileMan format
  1. ; MCNM is Name of patient equivalent to name in Patient file (#2)
  1. ; MCS is array into which data is placed
  1. ;
  1. ; Retrieves PID from Name X-ref of Patient file (#2)
  1. N MCI,DIC,D,X,Y,MCERR S MCS("SUM")=""
  1. S DIC="^DPT(",DIC(0)="XZ",D="B",X=MCNM D IX^DIC
  1. I +Y'>0 S MCERR="21-Name for Summary not in Patient file" Q $$LOG^MCARAM7(MCERR)
  1. S MCS("PID")=+Y,MCS("NAME")=$P(Y(0),U)
  1. I '$D(^MCAR(700.5,"B",MCDT)) S MCERR="22-Date/Time not in Summary file" Q $$LOG^MCARAM7(MCERR)
  1. 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
  1. I MCS("SUM")="" S MCERR="23-Name does not exist for Date/Time in Summary file" Q $$LOG^MCARAM7(MCERR)
  1. Q 0
  1. ;
  1. KPERR(MCA,MCS) ;Transfer local array data into new 700.5 Summary record in DHCP
  1. ; occurs for every data transfer attempt whether or not successful
  1. ;USAGE: S X=$$KPERR^MCARAM7(.A,.B)
  1. ;WHERE: A=Array of local data arranged for EKG file
  1. ; B=DHCP data stored in Summary file including
  1. ; B("SUM")=IEN of Summary file
  1. ; if unsuccessful, returns an error message
  1. ; if successful, returns a function value of 0
  1. ; MCS("FLDT")=Creation date in 700.5, file date/time
  1. ;
  1. ; Number of attempts of same data record, field 5
  1. ; Obsolete with transaction processing, still needed for MCARAP* report
  1. N MCI,%,DIC,X,Y,MCERR
  1. S MCS(5)=1
  1. ; Date/Time Initial, creation of entry in Summary file, field .05
  1. D NOW^%DTC S (MCS("FLDT"),MCS(.05),MCS(.06))=%
  1. ; Date/Time Latest, latest transmission attempt, field .06
  1. ; Transaction processing makes latest transmission date/time
  1. ; same as initial date/time except for those with imaging updates
  1. ; Auto instrument name, defined in MCARAM, field 1
  1. S MCS(1)=MCINST
  1. ; Reason for failure to pass DHCP validity checks, field 4
  1. S MCS(4)=$$RFFL(.MCA,.MCS)
  1. ; Social Security Number, field 2
  1. S MCS(2)=MCA(.02)
  1. ; Name, field 3
  1. S MCS(3)=MCA("NAME")
  1. ; Type of transmission, field 7
  1. S MCS(7)=MCTYPE
  1. 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)
  1. K DD,DO N DLAYGO S DLAYGO=700.5,DIC="^MCAR(700.5,",DIC(0)="LXZ",X=MCA("DT")
  1. D FILE^DICN
  1. I +Y>0 S MCS("SUM")=+Y Q 0
  1. S MCERR="9-Summary record not filed" Q $$LOG^MCARAM7(MCERR)
  1. ;
  1. RFFL(MCA,MCS) ; Convert processing errors to 700.5 file fields
  1. ;USAGE: S X=$$RFFL^MCARAM7(.A,.B)
  1. ;WHERE: A=Array of local data
  1. ; B=DHCP data for Summary file including
  1. ; B("SUM")=internal record number of Summary file
  1. ; returns field 4 of 700.5 file, reason for failure
  1. ; field 4 : "D"ate/Time error, "L"oad into DHCP error
  1. ; "N"ame error, "S"ocial Security Number error
  1. ; Integers for specific errors listed in the Summary Print,
  1. ; MCARAP2 - Errors numbered >50 have not been filed as EKG records
  1. ; returns field 6 of 700.5 file, error code for last transmission
  1. ; field 6 : "S"uccessful or "U"nsuccessful
  1. ; MCA("ERR") = # of processing errors
  1. ;successful transfer attempt
  1. S MCS(6)="S" I $$GRERR(.MCA)=0 Q ""
  1. ;unsuccessful transfer attempt
  1. S MCS(6)="U",MCERR=+MCA("ERR",0)
  1. I +MCERR=51!(+MCERR=52)!(+MCERR=53) S:$G(MCA("DT"))="" MCA("DT")=MCS("FLDT")
  1. Q $S(+MCERR>62:"P",+MCERR>60:"M",+MCERR>57:"L",+MCERR>55:"N",+MCERR>53:"S",+MCERR>50:"D",1:+MCERR)
  1. ;
  1. GRERR(MCA) ;Find first fatal error
  1. ;USAGE: S X=$$GRERR(A)
  1. ;WHERE: A=array of local data
  1. ; if successful, returns 1 and A("ERR",0)=first fatal error >50
  1. ; if unsuccessful, returns 0
  1. ;variables MCERR,MCI,MCJ
  1. N MCERR,MCI,MCJ
  1. I MCA("ERR")=0 Q 0
  1. S MCI=MCA("ERR") F MCJ=1:1:MCI I +MCA("ERR",MCJ)>50 S MCERR=MCA("ERR",MCJ) Q
  1. I $D(MCERR) S MCA("ERR",0)=MCERR Q 1
  1. Q 0
  1. ;
  1. LOG(MCERR) ;Logs type of error in local array
  1. ;USAGE: S X=$$LOG^MCARAM7(A)
  1. ;WHERE: A=Free text error
  1. ; returns the error message and updates the error array
  1. S MCA("ERR")=MCA("ERR")+1,MCA("ERR",MCA("ERR"))=MCERR
  1. Q MCERR