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

GMRCSTS.m

Go to the documentation of this file.
  1. GMRCSTS ;SLC/DLT,JFR,MA - Group update status of consult and order; 11/25/2000
  1. ;;3.0;CONSULT/REQUEST TRACKING;**8,18,21,76**;DEC 27, 1997;Build 7
  1. ; Patch 18 - Change UPDCMT to use Editor to add comment and
  1. ; Added Scheduled consults to selection list.
  1. ; Patch 21 - Added warning message in line tag WARNING().
  1. ; This routine invokes IA #2876,3121
  1. N GMRCTO,GMRCDG,GMRCSVC,GMRCSVCN,GMRCEND,GMRCSTRT,GMRCSTOP,GMRCGRP
  1. N GMRCCVT,GMRCM,GMRCMT,GMRCDO,DIR,DIROUT,DIRUT,DTOUT,DUOUT
  1. D GETSRV I 'GMRCDG D END Q
  1. D GETDTR I GMRCEND D END Q
  1. S GMRCM=$$METHOD I GMRCEND D END Q
  1. S GMRCCVT=$$UPD1 I GMRCEND D END Q
  1. D UPDCMT(.GMRCMT)
  1. D VERIFY I GMRCEND D END Q
  1. D GETENTS^GMRCSTS1(GMRCSVC,GMRCSTRT,GMRCSTOP,GMRCM)
  1. S GMRCDO=$$WHATTODO I 'GMRCDO D END Q
  1. D DEVICE I $G(GMRCEND) D END Q
  1. I $D(IO("Q")) D QUEUE,^%ZISC,END Q
  1. D PRINT^GMRCSTS1(GMRCM,GMRCCVT,GMRCSVC,.GMRCMT,GMRCSTRT,GMRCSTOP,GMRCDO)
  1. D END Q
  1. GETSRV ;Get a service that the user is authorized to update status for
  1. D ^GMRCASV Q:'GMRCDG
  1. S GMRCSVC=+GMRCDG,GMRCSVCN=$P($G(^GMR(123.5,+GMRCSVC,0)),U,1)
  1. I $P($G(^GMR(123.5,+GMRCDG,0)),"^",4)=DUZ Q ;user has special privileges
  1. ;Check for parent service authorization
  1. N AUTH,PARENT
  1. I $P(^GMR(123.5,1,0),U,4)=DUZ Q
  1. S (AUTH,PARENT)=0 F S PARENT=$O(^GMR(123.5,"APC",+GMRCDG,PARENT)) Q:'PARENT S:$P($G(^GMR(123.5,+PARENT,0)),U,4)=DUZ AUTH=PARENT
  1. I 'AUTH D UNAUTH S GMRCDG=0 G GETSRV
  1. Q
  1. ;
  1. UNAUTH ;Unauthorized to do special update processing for service or its parent.
  1. N GMRCMSG
  1. W !
  1. S GMRCMSG="You are not defined as the SPECIAL UPDATES INDIVIDUAL for the"
  1. S GMRCMSG(1)=GMRCSVCN_" service or its parent service."
  1. S GMRCDG=0
  1. D EXAC^GMRCADC(.GMRCMSG)
  1. Q
  1. ;
  1. GETDTR ;Get the date range
  1. ;END=# of days (T-END) for stop default limitations
  1. ;GMRCSTRT=Start date/time
  1. ;GMRCSTOP=Stop date/time
  1. ;GMRCEND=1 if user timed out or "^"
  1. S GMRCEND=0
  1. N X1,X2,X,END
  1. S X1=$$DT^XLFDT,X2=-30 D C^%DTC S END=X K X
  1. D START Q:GMRCEND
  1. D STOP Q:GMRCEND
  1. Q
  1. ;
  1. START ;Get the start date
  1. N DIR,Y,ORDER,FIRST,GMRCIEN
  1. S ORDER=$O(^GMR(123,"AC",0)),GMRCIEN=$O(^GMR(123,"AC",+ORDER,""))
  1. I +$G(GMRCIEN) D
  1. . S Y=$P($G(^GMR(123,GMRCIEN,0)),U,1)
  1. . X ^DD("DD") S FIRST=$P(Y,"@",1)
  1. . S DIR("B")=FIRST
  1. . W !!,"The first order in Consults has an entry date of "_DIR("B"),!
  1. . Q
  1. S DIR(0)="D^:"_END_":AEX",DIR("A")="Update Status Start Date"
  1. S DIR("?")="^D HELP^%DTC"
  1. D ^DIR
  1. I ($D(DTOUT)!$D(DUOUT)!$D(DIRUT)!$D(DIROUT)!('Y)) S GMRCEND=1 Q
  1. S GMRCSTRT=Y
  1. Q
  1. ;
  1. STOP ;Get the stop date
  1. N DIR,Y,X
  1. S DIR(0)="D^:"_END_":AEX",DIR("A")="Update Status Stop Date"
  1. D ^DIR
  1. I ($D(DTOUT)!$D(DUOUT)!$D(DIRUT)!$D(DIROUT)!('Y)) S GMRCEND=1 Q
  1. I Y<GMRCSTRT S GMRCSTOP=GMRCSTRT,GMRCSTRT=Y
  1. E S GMRCSTOP=Y
  1. Q
  1. ;
  1. METHOD() ;Get method to determine which consults to change
  1. N DIR,Y,X
  1. ;S DIR(0)="SM^P:Pending;A:Active;S:Scheduled;ALL:For All"
  1. ;S DIR("A")="Status(es) to search for updating"
  1. S DIR("A",1)=""
  1. S DIR("A",2)=""
  1. S DIR("A",3)=" 1 = Pending"
  1. S DIR("A",4)=" 2 = Active"
  1. S DIR("A",5)=" 3 = Scheduled"
  1. S DIR("A",6)=" 4 = All"
  1. S DIR("A",7)=""
  1. S DIR("A",8)=" Enter any combination of numbers separated"
  1. S DIR("A")=" by a comma or hyphen"
  1. S DIR(0)="LO^1:4"
  1. D ^DIR
  1. I ($D(DTOUT)!$D(DUOUT)!$D(DIRUT)!$D(DIROUT)) S GMRCEND=1
  1. Q Y
  1. S DIR(0)="SM^S:Order Status of Pending or Active;R:Result Activity"
  1. S DIR("A")="Method to find Consults to Update"
  1. D ^DIR
  1. I ($D(DTOUT)!$D(DUOUT)!$D(DIRUT)!$D(DIROUT)) S GMRCEND=1 Q Y
  1. Q Y
  1. ;
  1. VERIFY ;Verify the criteria is correct
  1. W !
  1. D UPDCRIT^GMRCSTS1(GMRCCVT,GMRCM,GMRCSVC,.GMRCMT,GMRCSTRT,GMRCSTOP)
  1. N DIR
  1. S DIR(0)="Y",DIR("A")="Is this correct",DIR("B")="NO"
  1. D ^DIR I ($D(DTOUT)!$D(DUOUT)!$D(DIRUT)!$D(DIROUT)!('Y)) S GMRCEND=1 Q
  1. Q
  1. UPD1() ;Determine update status
  1. N DIR,X,Y
  1. W !!,"If orders in the date range still have the selected status, this option"
  1. W !,"will change their status in consults, and update the order."
  1. W !!,"You may change the status to COMPLETE or DISCONTINUED."
  1. W !!,"Ordering provider will not receive notification of Group Update."
  1. W !
  1. S DIR(0)="SAM^D:Discontinued;C:Complete"
  1. S DIR("A")="Change their status to: "
  1. D ^DIR I ($D(DTOUT)!$D(DUOUT)!$D(DIRUT)!$D(DIROUT)) S GMRCEND=1 Q Y
  1. Q $S(Y="D":"1^DC",1:"2^C")
  1. ;
  1. DEVICE ; device for printout of entries to group update
  1. N %ZIS,POP
  1. W !!,"The device selected will print a list of entries from file 123 that will be"
  1. W !,"updated to ",$S(+GMRCCVT=1:"DISCONTINUED",1:"COMPLETE"),"."
  1. W !!,"If you choose to update records, the update of the consult entries will take"
  1. W !,"place upon completion of the report."
  1. W !!,"It is highly advised that a printer be selected!"
  1. RETRY S %ZIS="QM",%ZIS("A")="Select device for report: ",%ZIS("B")=""
  1. D ^%ZIS
  1. I POP S GMRCEND=1 Q
  1. I $E(IOST,1,2)="C-" D G:Y<1 RETRY
  1. . W !!,$C(7),"You have not chosen a printer! If you do not choose a printer there will",!,"be no record of the entries that were updated."
  1. . N DIR,DIROUT,DIRUT,DTOUT,DUOUT
  1. . S DIR(0)="Y",DIR("A")="Are you sure you want to use this device"
  1. . S DIR("B")="NO" D ^DIR I $D(DIRUT) S GMRCEND=1
  1. Q
  1. QUEUE ; send task for print and update
  1. I GMRCDO=2,'$$WARNING D ^%ZISC,END Q ; Killed report
  1. N ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTSAVE,ZTSK
  1. S ZTRTN="PRTTSK^GMRCSTS1",ZTDESC="UPDATE OF RECORDS FILE 123"
  1. S ZTIO=ION
  1. S ZTSAVE("^TMP(""GMRCLS"",$J,")="",ZTSAVE("GMRC*")=""
  1. D ^%ZTLOAD I $G(ZTSK) W !,"Task # ",ZTSK
  1. I '$G(ZTSK) W !,"Unable to queue report! Try again later."
  1. Q
  1. UPDCMT(COMMENT) ; get comment to stuff in consult activity
  1. W !
  1. N DWPK,DWLW,DIC,DIWEPSE,INDEX
  1. W !,"Enter the Comment to be applied to all selected Consults"
  1. S DIC="^TMP(""GMRCTMP"","_$J_",1,",DWLW=80,DWPK=1,DIWEPSE=1
  1. D EN^DIWE
  1. S INDEX=0
  1. F S INDEX=$O(^TMP("GMRCTMP",$J,1,INDEX)) Q:'INDEX D
  1. . S COMMENT(INDEX,0)=^TMP("GMRCTMP",$J,1,INDEX,0)
  1. K ^TMP("GMRCTMP",$J)
  1. Q
  1. WHATTODO() ;how to handle the update
  1. N DIR
  1. S DIR(0)="SO^1:Print report only;2:Print report & update records;3:Quit"
  1. S DIR("A")="Choose the method to handle the report"
  1. D ^DIR I $D(DIRUT)!(Y=3) Q 0
  1. Q +Y
  1. WARNING() ; If REPORT/UPDATE is being task issue warning message.
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT
  1. I $D(IO("Q")) D
  1. . W !,"WARNING - Records will automatically be updated since the"
  1. . W !,"report is being tasked.",!
  1. S DIR("B")="NO",DIR(0)="Y",DIR("A")="Do you wish to continue??"
  1. D ^DIR I $D(DIRUT) S Y=0
  1. Q +Y
  1. END K ^TMP("GMRCLS",$J) Q