[613] | 1 | VEPERPTA ;DAOU/KFK - HL7 ERROR REPORT PRINT ; 6/2/05 6:30pm
|
---|
| 2 | ;;1.0;;;;Build 1
|
---|
| 3 | ; This is the print routine for the Patient Lookup Error Report.
|
---|
| 4 | ; It is called from VEPERIER. The data is printed from the scratch
|
---|
| 5 | ; global (^TMP($J...)).
|
---|
| 6 | ;
|
---|
| 7 | ; Must call at EN6
|
---|
| 8 | Q
|
---|
| 9 | ;
|
---|
| 10 | EN6(HL7ERTN) ;Entry point
|
---|
| 11 | ;Initialize variables
|
---|
| 12 | N CRT,DIR,DTOUT,DUOUT,HL7PGC,LIN,MAXCNT,X,Y
|
---|
| 13 | ;
|
---|
| 14 | ;Determine IO parameters
|
---|
| 15 | I IOST["C-" S MAXCNT=IOSL-3,CRT=1,HL7PGC=0
|
---|
| 16 | E S MAXCNT=IOSL-6,CRT=0
|
---|
| 17 | ;
|
---|
| 18 | D PRINT(HL7ERTN,MAXCNT,CRT)
|
---|
| 19 | I $G(ZSTOP) G EXIT6
|
---|
| 20 | I CRT,HL7PGC>0,'$D(ZTQUEUED) D
|
---|
| 21 | . I MAXCNT<51 F LIN=1:1:(MAXCNT-$Y) W !
|
---|
| 22 | . S DIR(0)="E" D ^DIR K DIR
|
---|
| 23 | Q
|
---|
| 24 | ;
|
---|
| 25 | PRINT(RTN,MAX,CRT) ; Print data
|
---|
| 26 | ;
|
---|
| 27 | N EORMSG,NONEMSG,SORT1,SORT2,SORT3
|
---|
| 28 | S EORMSG="*** END OF REPORT ***"
|
---|
| 29 | S NONEMSG="* * * N O D A T A F O U N D * * *"
|
---|
| 30 | ;
|
---|
| 31 | I '$D(^TMP($J,RTN)) D HEADER W !,?(80-$L(NONEMSG)\2),NONEMSG,!!
|
---|
| 32 | I $Y+1>MAX!('HL7PGC) D HEADER
|
---|
| 33 | S SORT1="" F S SORT1=$O(^TMP($J,RTN,SORT1)) Q:SORT1="" D
|
---|
| 34 | . S SORT2="" F S SORT2=$O(^TMP($J,RTN,SORT1,SORT2)) Q:SORT2="" D
|
---|
| 35 | . . S SORT3="" F S SORT3=$O(^TMP($J,RTN,SORT1,SORT2,SORT3)) Q:SORT3="" D
|
---|
| 36 | . . . I $Y+1>MAX!('HL7PGC) D HEADER
|
---|
| 37 | . . . D LINE
|
---|
| 38 | I $G(ZTSTOP) G PRINTX
|
---|
| 39 | W !!,?(80-$L(EORMSG)\2),EORMSG
|
---|
| 40 | PRINTX ;
|
---|
| 41 | Q
|
---|
| 42 | ;
|
---|
| 43 | HEADER ; Print hdr info
|
---|
| 44 | N DIR,DTOUT,DUOUT,HDR,LIN,OFFSET,X,Y
|
---|
| 45 | I CRT,HL7PGC>0,'$D(ZTQUEUED) D
|
---|
| 46 | . I MAX<51 F LIN=1:1:(MAX-$Y) W !
|
---|
| 47 | . S DIR(0)="E" D ^DIR K DIR
|
---|
| 48 | . I $D(DTOUT)!($D(DUOUT)) Q
|
---|
| 49 | I $D(ZTQUEUED),$$S^%ZTLOAD() S ZTSTOP=1 G HEADERX
|
---|
| 50 | S HL7PGC=HL7PGC+1
|
---|
| 51 | W @IOF,!,?1,"HL7 Error Report"
|
---|
| 52 | S HDR=$$FMTE^XLFDT($$NOW^XLFDT,1)_" Page: "_HL7PGC,OFFSET=79-$L(HDR)
|
---|
| 53 | W ?OFFSET,HDR
|
---|
| 54 | S SRT=HL7ESPC("SORT"),BDT=HL7ESPC("BEGDT"),EDT=HL7ESPC("ENDDT")
|
---|
| 55 | W !,?1,"Sorted by: "_$S(SRT=1:"Patient ID",SRT=2:"Patient",1:"Error Type")
|
---|
| 56 | W ?OFFSET
|
---|
| 57 | S HDR=$$FMTE^XLFDT(BDT,"5Z")_" - "_$$FMTE^XLFDT(EDT,"5Z")
|
---|
| 58 | S OFFSET=80-$L(HDR)\2
|
---|
| 59 | W !,?OFFSET,HDR
|
---|
| 60 | W !
|
---|
| 61 | HEADERX ;
|
---|
| 62 | Q
|
---|
| 63 | ;
|
---|
| 64 | LINE ; Print data
|
---|
| 65 | N ERDT,HL7DT,HL7SRT
|
---|
| 66 | ;
|
---|
| 67 | S HL7SRT=HL7ESPC("SORT")
|
---|
| 68 | I HL7SRT=1!(HL7SRT=3) D
|
---|
| 69 | . W !!,"Patient ID: "_SORT1,?40,"Patient Name: "_SORT2
|
---|
| 70 | I HL7SRT=2 D
|
---|
| 71 | . W !!,"Patient Name: "_SORT1,?40,"Patient ID: "_SORT2
|
---|
| 72 | S ERDT=$$FMTE^XLFDT($P(^TMP($J,RTN,SORT1,SORT2,SORT3),U),"5Z")
|
---|
| 73 | S HL7DT=$$FMTE^XLFDT($P(^TMP($J,RTN,SORT1,SORT2,SORT3),U,3),"5Z")
|
---|
| 74 | W !,"Error Date/Time: "_ERDT,?40,"HL7 Message Date/Time: "_HL7DT
|
---|
| 75 | W !,$P($P(^TMP($J,RTN,SORT1,SORT2,SORT3),U,2)," ",1,11)
|
---|
| 76 | W !,$P($P(^TMP($J,RTN,SORT1,SORT2,SORT3),U,2)," ",12,99)
|
---|
| 77 | Q
|
---|
| 78 | EXIT6 ;
|
---|
| 79 | Q
|
---|