source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORELR1.m

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

initial load of WorldVistAEHR

File size: 4.6 KB
Line 
1ORELR1 ; slc/dcm - Cross check/update file 100 with file 69
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**20,42**;Dec 17, 1997
3EN ;Fix inconsistencies from ^OR to ^LRO(69
4 W !,"This utility will look for inconsistencies between OE/RR 3.0 and Lab files."
5 W !,"It will compare records in the Orders file (100) with the Lab Order file (69)."
6 W !!,"Problems identified",?53,"Resolution"
7 W !,"-------------------",?53,"----------"
8 W !,"^OR(100,IFN,0) does not exist",?53,"^OR(100,IFN) killed"
9 W !,"Bad pointers on child orders",?53,"Pointers removed"
10 W !,"Child orders with no parent order",?53,"Pointer removed"
11 W !,"Child order missing parent pointer",?53,"Pointer restored"
12 W !,"Incorrect status on parent order",?53,"Status corrected"
13 W !,"Old veiled orders",?53,"Purged"
14 W !,"Unrecognized pointer to file 69",?53,"Order cancelled"
15 W !,"Unconverted orders from OE/RR 2.5",?53,"Order lapsed"
16 W !,"Invalid pointer to file 69",?53,"Order cancelled"
17 W !,"Incorrect status on uncollected specimens",?53,"Status updated"
18 W !,"Incorrect status on completed orders",?53,"Status updated"
19 W !,"Missing reference to file 69",?53,"Cancelled (optional)"
20 W !,"Old pending, active & unreleased orders",?53,"Status changed"
21 W !!,"Continue"
22 N %,I,ORLOR,ORPEND,ORPENDT,ORIFN,ORAFIX,ZTSAVE
23 S %=2 D YN^DICN Q:%'=1
24LRO W !,"Check for CPRS orders that no longer exist in the Lab Order file"
25 S ORLRO=0,%=2 D YN^DICN Q:%=-1 S:%=1 ORLRO=1 I %=0 W !!,"You may want to cancel any active orders that no longer have a valid",!,"reference to file 69 (may have been purged from lab files).",! G LRO
26CAN S ORPEND=0,ORPENDT=0
27 W !,"Do you want to remove old PENDING, ACTIVE and UNRELEASED orders" S %=2 D YN^DICN Q:%=-1 S:%=1 ORPEND=1
28 I %=0 W !!,"Unreleased orders are removed from the system.",!,"Old pending orders are changed to a Lapsed status, which will",!,"remove them from the current orders context."
29 I %=0 W !,"Active orders that no longer have corresponding entries in the lab files",!,"are changed to Lapsed" G CAN
30 I ORPEND S %DT="AEQ",%DT("A")="Remove old orders with Start dates before: ",%DT("B")="T-30" D ;_$S($P($G(^ORD(100.99,1,2)),"^",16):$P(^(2),"^",16),1:30) D
31 . N % D ^%DT
32 . I Y<0 S ORPEND=0 W !!,"Old orders will not be removed." Q
33 . S ORPEND=1,ORPENDT=Y
34 S ORIFN=0,%=2 ;,X=$P($G(^ORD(100.99,1,2)),"^",12) I X W !,"Do you want to start where the last clean-up left off (#"_X_")" S %=1 D YN^DICN Q:%=-1 S:%=1 ORIFN=X
35 I %=2 W !,"OK, which ORIFN do you want to start with: 0// " R X:DTIME Q:'$T S:X=""!(X=0) X=.1 Q:'X S ORIFN=X
36FIX W !,"Do you want me to correct the inconsistencies now"
37 S ORAFIX=0,%=2 D YN^DICN Q:%=-1 S:%=1 ORAFIX=1 I %=0 W !!,"Answer 'YES' to correct them now, or 'NO' to just display them.",! G FIX
38 F I="ORLRO","ORPEND","ORPENDT","ORIFN","ORAFIX" S ZTSAVE(I)=""
39 D QUE^ORUTL1("DEQUE^ORELR1","Check from 100 to 69",.ZTSAVE)
40 Q
41DEQUE ;Queued entry point
42 N SIBCNT,SIBPCNT,NOCNT,OCNT,UNCNT,TTCNT,PHCNT,ICNT,WICNT,BSCNT,DCNT,CNT,PCNT,APCNT,A,UCNT,END,ORDUZ,PTCNT,HCNT,NCNT,VCNT,UCCNT,IVCNT,ICNT,ACNT,ICCNT,STCNT,LCNT,PKG,ORSICK
43 S (SIBCNT,SIBPCNT,NOCNT,OCNT,UNCNT,TTCNT,PHCNT,ICNT,WICNT,BSCNT,DCNT,CNT,PCNT,APCNT,UCNT,END,ORDUZ,PTCNT,HCNT,NCNT,VCNT,UCCNT,IVCNT,ICNT,ACNT,ICCNT,STCNT,LCNT)=0,PKG=$O(^DIC(9.4,"B","LAB SERVICE",0)) Q:PKG=""
44 D NOW^%DTC
45 I '$D(DT) S DT=X
46 U IO
47 W !,"Inconsistency report between OE/RR (100) and LAB (69) files..."
48 W !,"Date/time Started: "_$$DATETIME^ORU(%)
49 W !,"Now looking for data..."
50 F S ORIFN=$O(^OR(100,ORIFN)) Q:ORIFN<1 S ORSICK=ORIFN D A^ORELR2 S ORIFN=ORSICK Q:END
51 W:IOSL-$Y<25 @IOF
52 W !!,"Total inconsistencies: "_TTCNT
53 W !,"Date/time Completed: "_$$DATETIME^ORU($$NOW^XLFDT())
54 W:DCNT !,"Wrong Patient Total: "_DCNT
55 W:PCNT !,"Old Pending orders total: "_PCNT
56 W:APCNT !,"Old Active orders total: "_APCNT
57 W:UCNT !,"Old Unreleased orders total: "_UCNT
58 W:UNCNT !,"Unconverted 2.5 orders total: "_UNCNT
59 W:PTCNT !,"Parent status update total: "_PTCNT
60 W:HCNT !,"Bad child pointer total: "_HCNT
61 W:NCNT !,"Orders with no status total: "_NCNT
62 W:VCNT !,"Old veiled orders: "_VCNT
63 W:UCCNT !,"Unrecognized package link: "_UCCNT
64 W:BSCNT !,"Bad package link ,null status: "_BSCNT
65 W:IVCNT !,"Invalid package link: "_IVCNT
66 W:WICNT !,"No enterer: "_WICNT
67 W:PHCNT !,"No physician: "_PHCNT
68 W:ICNT !,"Incorrect status: "_ICNT
69 W:ACNT !,"Active canceled orders: "_ACNT
70 W:ICCNT !,"Incomplete should be complete: "_ICCNT
71 W:STCNT !,"Status should be complete: "_STCNT
72 W:LCNT !,"Missing reference in 69: "_LCNT
73 W:NOCNT !,"No order # in 69: "_NOCNT
74 W:OCNT !,"Missing pointer to 100: "_OCNT
75 W:SIBCNT !,"Child with no parent: "_SIBCNT
76 W:SIBPCNT !,"Child orders with wrong parent pointer: "_SIBPCNT
77 K ORLRO,ORPEND,ORPENDT,ORIFN,ORAFIX
78 I $D(ZTQUEUED) S ZTREQ="@"
79 Q
Note: See TracBrowser for help on using the repository browser.