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

ORELR1.m

Go to the documentation of this file.
  1. ORELR1 ; slc/dcm - Cross check/update file 100 with file 69
  1. ;;3.0;ORDER ENTRY/RESULTS REPORTING;**20,42,323**;Dec 17, 1997;Build 10
  1. EN ;Fix inconsistencies from ^OR to ^LRO(69
  1. W !,"This utility will look for inconsistencies between OE/RR 3.0 and Lab files."
  1. W !,"It will compare records in the Orders file (100) with the Lab Order file (69)."
  1. W !!,"Problems identified",?53,"Resolution"
  1. W !,"-------------------",?53,"----------"
  1. W !,"^OR(100,IFN,0) does not exist",?53,"^OR(100,IFN) killed"
  1. W !,"Bad pointers on child orders",?53,"Pointers removed"
  1. W !,"Child orders with no parent order",?53,"Pointer removed"
  1. W !,"Child order missing parent pointer",?53,"Pointer restored"
  1. W !,"Incorrect status on parent order",?53,"Status corrected"
  1. ;W !,"Old veiled orders",?53,"Purged" ;DJE-VM *323 - it's not appropriate to purge unveiled orders since OR*3*282
  1. W !,"Unrecognized pointer to file 69",?53,"Order cancelled"
  1. W !,"Unconverted orders from OE/RR 2.5",?53,"Order lapsed"
  1. W !,"Invalid pointer to file 69",?53,"Order cancelled"
  1. W !,"Incorrect status on uncollected specimens",?53,"Status updated"
  1. W !,"Incorrect status on completed orders",?53,"Status updated"
  1. W !,"Missing reference to file 69",?53,"Cancelled (optional)"
  1. W !,"Old pending, active & unreleased orders",?53,"Status changed"
  1. W !!,"Continue"
  1. N %,I,ORLOR,ORPEND,ORPENDT,ORIFN,ORAFIX,ZTSAVE
  1. S %=2 D YN^DICN Q:%'=1
  1. LRO W !,"Check for CPRS orders that no longer exist in the Lab Order file"
  1. 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
  1. CAN S ORPEND=0,ORPENDT=0
  1. W !,"Do you want to remove old PENDING, ACTIVE and UNRELEASED orders" S %=2 D YN^DICN Q:%=-1 S:%=1 ORPEND=1
  1. 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."
  1. I %=0 W !,"Active orders that no longer have corresponding entries in the lab files",!,"are changed to Lapsed" G CAN
  1. 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
  1. . N % D ^%DT
  1. . I Y<0 S ORPEND=0 W !!,"Old orders will not be removed." Q
  1. . S ORPEND=1,ORPENDT=Y
  1. 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
  1. 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
  1. FIX W !,"Do you want me to correct the inconsistencies now"
  1. 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
  1. F I="ORLRO","ORPEND","ORPENDT","ORIFN","ORAFIX" S ZTSAVE(I)=""
  1. D QUE^ORUTL1("DEQUE^ORELR1","Check from 100 to 69",.ZTSAVE)
  1. Q
  1. DEQUE ;Queued entry point
  1. 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
  1. 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=""
  1. D NOW^%DTC
  1. I '$D(DT) S DT=X
  1. U IO
  1. W !,"Inconsistency report between OE/RR (100) and LAB (69) files..."
  1. W !,"Date/time Started: "_$$DATETIME^ORU(%)
  1. W !,"Now looking for data..."
  1. F S ORIFN=$O(^OR(100,ORIFN)) Q:ORIFN<1 S ORSICK=ORIFN D A^ORELR2 S ORIFN=ORSICK Q:END
  1. W:IOSL-$Y<25 @IOF
  1. W !!,"Total inconsistencies: "_TTCNT
  1. W !,"Date/time Completed: "_$$DATETIME^ORU($$NOW^XLFDT())
  1. W:DCNT !,"Wrong Patient Total: "_DCNT
  1. W:PCNT !,"Old Pending orders total: "_PCNT
  1. W:APCNT !,"Old Active orders total: "_APCNT
  1. W:UCNT !,"Old Unreleased orders total: "_UCNT
  1. W:UNCNT !,"Unconverted 2.5 orders total: "_UNCNT
  1. W:PTCNT !,"Parent status update total: "_PTCNT
  1. W:HCNT !,"Bad child pointer total: "_HCNT
  1. W:NCNT !,"Orders with no status total: "_NCNT
  1. ;W:VCNT !,"Old veiled orders: "_VCNT ;DJE-VM *323 - it's not appropriate to purge unveiled orders since OR*3*282
  1. W:UCCNT !,"Unrecognized package link: "_UCCNT
  1. W:BSCNT !,"Bad package link ,null status: "_BSCNT
  1. W:IVCNT !,"Invalid package link: "_IVCNT
  1. W:WICNT !,"No enterer: "_WICNT
  1. W:PHCNT !,"No physician: "_PHCNT
  1. W:ICNT !,"Incorrect status: "_ICNT
  1. W:ACNT !,"Active canceled orders: "_ACNT
  1. W:ICCNT !,"Incomplete should be complete: "_ICCNT
  1. W:STCNT !,"Status should be complete: "_STCNT
  1. W:LCNT !,"Missing reference in 69: "_LCNT
  1. W:NOCNT !,"No order # in 69: "_NOCNT
  1. W:OCNT !,"Missing pointer to 100: "_OCNT
  1. W:SIBCNT !,"Child with no parent: "_SIBCNT
  1. W:SIBPCNT !,"Child orders with wrong parent pointer: "_SIBPCNT
  1. K ORLRO,ORPEND,ORPENDT,ORIFN,ORAFIX
  1. I $D(ZTQUEUED) S ZTREQ="@"
  1. Q