| 1 | ORY195A ;SLC/DAN Post-install for patch 195 ;10/7/04  11:49 | 
|---|
| 2 | ;;3.0;ORDER ENTRY/RESULTS REPORTING;**195**;Dec 17, 1997 | 
|---|
| 3 | ; | 
|---|
| 4 | ;DBIA SECTION | 
|---|
| 5 | ;10063 - %ZTLOAD | 
|---|
| 6 | ;10141 - XPDUTL | 
|---|
| 7 | ;10070 - XMD | 
|---|
| 8 | ;10035 - ^DPT("CN" references | 
|---|
| 9 | ;10061 - VADPT | 
|---|
| 10 | ; | 
|---|
| 11 | Q ;Entry point to queue process during install | 
|---|
| 12 | N ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTSK | 
|---|
| 13 | S ZTRTN="DQ^ORY195A",ZTDESC="OR*3*195 LAB CHILD ORDER CHECK ROUTINE",ZTIO="",ZTDTH=$H | 
|---|
| 14 | D ^%ZTLOAD I '$G(ZTSK) D BMES^XPDUTL("POST INSTALL NOT QUEUED - RUN DQ^ORY195A AFTER INSTALL FINISHES") Q | 
|---|
| 15 | D BMES^XPDUTL("Lab Child Order Check queued as task # "_$G(ZTSK)) | 
|---|
| 16 | Q | 
|---|
| 17 | ; | 
|---|
| 18 | DQ ; | 
|---|
| 19 | D SRCH,MAIL | 
|---|
| 20 | Q | 
|---|
| 21 | ; | 
|---|
| 22 | SRCH ;Search for lab orders without locations | 
|---|
| 23 | N LAB,LOC,IEN,CHD,ORD,SUB,ORLIST | 
|---|
| 24 | K ^TMP($J,"TEXT"),^TMP($J,"ERR") | 
|---|
| 25 | S LAB=$O(^ORD(100.98,"B","LAB",0)) Q:'+LAB  ;quit if no lab display group | 
|---|
| 26 | S LOC="" F  S LOC=$O(^DPT("CN",LOC)) Q:LOC=""  S IEN=0 F  S IEN=$O(^DPT("CN",LOC,IEN)) Q:'+IEN  D | 
|---|
| 27 | .K ^TMP("ORR",$J) | 
|---|
| 28 | .D EN^ORQ1(IEN_";DPT(",LAB,2) ;Get active lab orders | 
|---|
| 29 | .S SUB=0 F  S SUB=$O(^TMP("ORR",$J,ORLIST,SUB)) Q:'+SUB  S ORD=+^(SUB) I $D(^OR(100,ORD,2)) D | 
|---|
| 30 | ..I '$P(^OR(100,ORD,0),U,17) Q  ;Quit if not delayed order | 
|---|
| 31 | ..S CHD=0 F  S CHD=$O(^OR(100,ORD,2,CHD)) Q:'+CHD  I $P(^OR(100,CHD,0),U,10)="" S ^TMP($J,"ERR",LOC,CHD)=+$P(^OR(100,CHD,0),U,2) | 
|---|
| 32 | K ^TMP("ORR",$J),^TMP($J,"TEXT") | 
|---|
| 33 | Q | 
|---|
| 34 | ; | 
|---|
| 35 | MAIL ;Send message with findings | 
|---|
| 36 | N CNT,XMSUB,XMTEXT,XMDUZ,XMY,XMZ,LOC,ORD,DFN,VADM | 
|---|
| 37 | S CNT=1 | 
|---|
| 38 | S ^TMP($J,"TEXT",CNT)="The search for active lab orders without a location has finished.",CNT=CNT+1 | 
|---|
| 39 | S ^TMP($J,"TEXT",CNT)="",CNT=CNT+1 | 
|---|
| 40 | I '$D(^TMP($J,"ERR")) S ^TMP($J,"TEXT",CNT)="No problems were found so no additional work is required.",CNT=CNT+1 | 
|---|
| 41 | I $D(^TMP($J,"ERR")) D | 
|---|
| 42 | .S ^TMP($J,"TEXT",CNT)="Complex lab orders (e.g. CBC Q12Hx3) that were delayed were not being",CNT=CNT+1 | 
|---|
| 43 | .S ^TMP($J,"TEXT",CNT)="assigned a location upon release.  As a result, the lab orders were not",CNT=CNT+1 | 
|---|
| 44 | .S ^TMP($J,"TEXT",CNT)="appearing on the lab collection lists.",CNT=CNT+1 | 
|---|
| 45 | .S ^TMP($J,"TEXT",CNT)="",CNT=CNT+1 | 
|---|
| 46 | .S ^TMP($J,"TEXT",CNT)="The following patients have active lab orders without a location.",CNT=CNT+1 | 
|---|
| 47 | .S ^TMP($J,"TEXT",CNT)="It is very likely that these tests have not been done.  Please review",CNT=CNT+1 | 
|---|
| 48 | .S ^TMP($J,"TEXT",CNT)="each order to ensure that the test has been done.  You may need to DC the",CNT=CNT+1 | 
|---|
| 49 | .S ^TMP($J,"TEXT",CNT)="existing order and enter a new order so the test appears on the",CNT=CNT+1 | 
|---|
| 50 | .S ^TMP($J,"TEXT",CNT)="collection list.",CNT=CNT+1 | 
|---|
| 51 | .S ^TMP($J,"TEXT",CNT)="",CNT=CNT+1 | 
|---|
| 52 | .S ^TMP($J,"TEXT",CNT)="Please note that existing delayed complex lab orders will release correctly.",CNT=CNT+1 | 
|---|
| 53 | .S LOC="" F  S LOC=$O(^TMP($J,"ERR",LOC)) Q:LOC=""  S ^TMP($J,"TEXT",CNT)="",CNT=CNT+1,^TMP($J,"TEXT",CNT)="Location: "_LOC,CNT=CNT+1,^(CNT)="",CNT=CNT+1 S ORD=0 F  S ORD=$O(^TMP($J,"ERR",LOC,ORD)) Q:'+ORD  D | 
|---|
| 54 | ..K VADM | 
|---|
| 55 | ..S DFN=^TMP($J,"ERR",LOC,ORD) | 
|---|
| 56 | ..D DEM^VADPT | 
|---|
| 57 | ..S ^TMP($J,"TEXT",CNT)=VADM(1)_"  ("_$E(+VADM(2),6,9)_")  ORDER #: "_ORD,CNT=CNT+1,^TMP($J,"TEXT",CNT)="  ORDER TEXT: "_$G(^OR(100,ORD,8,1,.1,1,0)),CNT=CNT+1 | 
|---|
| 58 | S XMDUZ="PATCH OR*3*195 LAB CHILD ORDERS CHECK",XMY(.5)="" S:$G(DUZ) XMY(DUZ)="" | 
|---|
| 59 | S XMTEXT="^TMP($J,""TEXT"",",XMSUB="PATCH OR*3*195 Lab Order Check COMPLETED" | 
|---|
| 60 | D ^XMD | 
|---|
| 61 | Q | 
|---|