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

TIUPS155.m

Go to the documentation of this file.
  1. TIUPS155 ; SLC/CAM - Amended consult note clean up ;2/26/03
  1. ;;1.0;TEXT INTEGRATION UTILITIES;**155**;Jun 20,1997
  1. ;
  1. ; Disassociates the retracted consult note from the consult
  1. ; Links the amended note to the consult
  1. ; This routine should only need to be run once. It can be deleted after
  1. ; it has successfully completed.
  1. ; DBIA 10035 ^DPT( .01 NAME 0;1 Direct Global Read
  1. ; DBIA 3576 TIU use of GMRCTIU
  1. ; DBIA 3162 POINT TO REQUEST/CONSULTATION (#123) FILE
  1. ;
  1. PRINT ; -- Device Selection
  1. ;
  1. S %ZIS="Q" D ^%ZIS I POP K POP G PRT
  1. I $D(IO("Q")) K IO("Q") D Q
  1. . S ZTRTN="LINK^TIUPS155"
  1. . S ZTDESC="TIU*1*155 - PRINT CLEAN-UP RESULTS"
  1. . D ^%ZTLOAD W !,$S($D(ZTSK):"Request queued",1:"Request Cancelled!")
  1. . K ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,%ZIS
  1. . D HOME^%ZIS
  1. U IO D LINK,^%ZISC
  1. PRT Q
  1. ;
  1. ; Rollsback retracted note from ^GMR(123 node 50
  1. N TIUDA,TIUDA2,STATUS,GMRCSTAT,TIUAUTH,FLAG
  1. N CNSERV,TIUPT,TIUPT1,TIUCNT,CNSLT,TIUY,TIUODA
  1. ; Variables
  1. ; TIUPT = Patient DFN
  1. ; TIUPT1 = Patient name
  1. ; CNSERV = To consult service
  1. ; TIUDA = IEN of note in TIU "G" cross ref
  1. ; TIUDA2 = IEN of note in GMR "B" cross ref of 50 node
  1. ; TIUODA = IEN of retracted note
  1. I $D(ZTQUEUED) S ZTREQ="@"
  1. S U="^"
  1. S TIUCNT=0,CNSLT=""
  1. D HDR
  1. F S CNSLT=$O(^TIU(8925,"G",CNSLT)) Q:CNSLT="" I CNSLT["GMR" D
  1. .S TIUDA=0
  1. .F S TIUDA=$O(^TIU(8925,"G",CNSLT,TIUDA)) Q:TIUDA="" D
  1. ..S STATUS=$P($G(^TIU(8925,TIUDA,0)),U,5) I STATUS=8 D
  1. ...S TIUY=+$$ISA^TIULX(+$G(^TIU(8925,TIUDA,0)),+$$CLASS^TIUCNSLT)
  1. ...I TIUY=1 D
  1. ....S TIUDA2=0
  1. ....S FLAG="NO" F S TIUDA2=$O(^GMR(123,+CNSLT,50,"B",TIUDA2)) Q:TIUDA2="" I +TIUDA2=TIUDA S FLAG="YES" Q
  1. ....I FLAG="NO" D
  1. .....S TIUCNT=TIUCNT+1
  1. .....S TIUODA=$P($G(^TIU(8925,TIUDA,14)),U,6)
  1. .....S TIUPT=$P($G(^TIU(8925,TIUDA,0)),U,2)
  1. .....S TIUPT1=$P($G(^DPT(TIUPT,0)),U) I $L(TIUPT1)<25 S TIUPT1=$$ADDSP(TIUPT1)
  1. .....S CNSERV=$$GET1^DIQ(123,+CNSLT,1) I $L(CNSERV)<25 S CNSERV=$$ADDSP(CNSERV)
  1. .....S ^XTMP("TIUP155",$J,TIUCNT)=$E(TIUPT1,1,25)_" Consult No. "_+CNSLT
  1. .....S GMRCSTAT=$S(STATUS>6:"COMPLETED",1:"INCOMPLETE")
  1. .....S TIUAUTH=$P($G(^TIU(8925,TIUDA,12)),U,2)
  1. .....D ROLLBACK^TIUCNSLT(TIUODA)
  1. .....D GET^GMRCTIU(+CNSLT,TIUDA,GMRCSTAT,TIUAUTH)
  1. .....W !,$E(TIUPT1,1,20),?22,$E(CNSERV,1,20),?45,+CNSLT
  1. W !
  1. I TIUCNT'>0 W !,"There are no records to print."
  1. D MAIL
  1. W !
  1. Q
  1. ADDSP(TIUY) ; Add space to name for display.
  1. ;
  1. N SPC,LEN,ADSP,CNT
  1. S SPC=" ",LEN=$L(TIUY),ADSP=25-LEN
  1. F CNT=1:1:ADSP S TIUY=TIUY_SPC
  1. Q TIUY
  1. MAIL ; Send mail message
  1. ;
  1. N XMSUB,XMTEXT,XMY,XMTXT,XMDUZ
  1. S XMSUB="TIU*1*155 Amended Note - Consult Clean up Report",XMDUZ="Patch TIU*1*155"
  1. I '$D(^XTMP("TIUP155")) S XMTXT(1)="",XMTXT(2)="",XMTXT(3)="There are no records to print.",XMTEXT="XMTXT("
  1. I $D(^XTMP("TIUP155")) S XMTEXT="^XTMP(""TIUP155"",$J,"
  1. S:$G(DUZ) XMY(DUZ)=""
  1. S XMY("G.PATIENT SAFETY NOTIFICATIONS")=""
  1. D ^XMD
  1. Q
  1. HDR ; --Header for report--
  1. ;
  1. W !,?2,"TIU*1.0*155 Amended Note - Consult Clean Up Report"
  1. W !!,"The following consult(s) have been updated to display and print amended"
  1. W !,"notes on the Consult Tab."
  1. W !!,"Patient",?22,"Consult Request",?45,"Consult No.",!
  1. Q