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

NURCROP0.m

Go to the documentation of this file.
  1. NURCROP0 ;HIRMFO/RM,RTK-CARE PLAN RANK ORDER PRINT ;8/29/96
  1. ;;4.0;NURSING SERVICE;;Apr 25, 1997
  1. EN1 ; ENTRY FROM OPTION TO PRINT RANK ORDER LISTING OF CARE PLAN
  1. ;
  1. ; Select Date/Time range for report
  1. S %DT("A")="Start with Date (Time Optional): ",%DT="AET",%DT(0)="-NOW" D ^%DT I +Y'>0 G EXIT
  1. S NURCBGDT=+Y
  1. ENDT S %DT("A")="Go to Date (Time Optional): ",%DT="AET",%DT(0)=NURCBGDT D ^%DT I +Y>0 S X=+Y,%DT="T",%DT(0)="-NOW" D ^%DT W:+Y'>0 $C(7)," ??" G:+Y'>0 ENDT I +Y>0 S NURCENDT=+Y_$S(Y[".":"",1:".24")
  1. E G EXIT
  1. ;
  1. ; Select Ward(s) for report :Use Nursing utility
  1. W ! I $$MDIC^NURSAGS0'>0 G EXIT
  1. S X="" F S X=$O(NURSNLOC(X)) Q:X="" F Y=0:0 S Y=$O(NURSNLOC(X,Y)) Q:Y'>0 F NURC=0:0 S NURC=$O(^NURSF(211.4,Y,3,NURC)) Q:NURC'>0 D
  1. .S NURSMAS=+$G(^NURSF(211.4,Y,3,NURC,0)) I NURSMAS>0 S NURSMAS(0)=$P($G(^DIC(42,NURSMAS,0)),"^") I $L(NURSMAS(0)) S NURSMAS(NURSMAS(0),NURSMAS)=""
  1. ;
  1. ; Select the Ward/Group Report ID for the header
  1. K DIRUT S NURCLID=$$RPRTID^NURCROP2 G:$D(DIRUT) EXIT
  1. ;
  1. ; Select whether report is for Admitting location or all locations
  1. W ! S NURCSORT=$$SORTYP^NURCROP2 G EXIT:NURCSORT'>0
  1. DEV ; Ask device and allow to queue
  1. ; If QUEUE then call ^%ZTLOAD and exit
  1. W ! S %ZIS="Q" D ^%ZIS I POP K IO("Q") G EXIT
  1. I $E(IOST)="P",'$D(IO("Q")),'$D(IO("S")) D ^%ZISC S XQH="NURS-PRINTER QUEUE" W $C(7) D EN^XQH K XQH G DEV
  1. I $D(IO("Q")) K IO("Q") S ZTIO=ION,ZTRTN="PRINT^NURCROP0",ZTDESC="Nursing Care Plan Statistics - Rank Order Print",ZTSAVE("NURSMAS*")="",ZTSAVE("NURCBGDT")="",ZTSAVE("NURCENDT")="",ZTSAVE("NURCSORT")="",ZTSAVE("NURCLID")=""
  1. I D ^%ZTLOAD K ZTSK G EXIT
  1. ;
  1. PRINT ; ENTRY FROM TASK TO PRINT RANK ORDER PRINT IF QUEUED TO DEVICE
  1. ;
  1. ; Set up required variables for sort.
  1. ; Calculate patient census over date/time range.
  1. K ^TMP($J)
  1. D NOW^%DTC S NURCNOW=%,NURCNCP=$O(^GMRD(124.2,"AA","NURSC",2,"Nursing Care Plan",1,0)),NURCINT=$O(^GMRD(124.25,"AA","NURSC","NURSING INTERVENTION",0)),NURCORD=$O(^GMRD(124.25,"AA","NURSC","ORDERABLE",0))
  1. I '$$CENSUS^NURSACE0(NURCBGDT,NURCENDT,NURCNOW,NURCSORT)!'NURCNCP!'NURCINT!'NURCORD U IO S NURCPAGE=$$HEADER^NURCROP1(0) W !!,"There is no data for this report." S NURCPAGE=$$HEADER^NURCROP1(-1) G EXIT
  1. ;
  1. ; Loop through ^TMP($J,"NURCEN",DFN) and get DFN to process
  1. ; Loop through ^GMR(124.3,"AA",DFN,DATE) over date time range
  1. ; BEGIN
  1. F DFN=0:0 S DFN=$O(^TMP($J,"NURCEN",DFN)) Q:DFN'>0 D DEM^VADPT S NURCBS5=$E(VADM(1))_$P($P(VADM(2),"^",2),"-",3) F NURCDATE=(9999999-NURCENDT):0 S NURCDATE=$O(^GMR(124.3,"AA",DFN,NURCNCP,NURCDATE)) Q:NURCDATE'>0 D
  1. .; Get a care plan
  1. .S NURCPDA=$O(^GMR(124.3,"AA",DFN,NURCNCP,NURCDATE,0)) Q:NURCPDA'>0
  1. .; Loop through all entries in SELECTION multiple
  1. .; If ACTIVE(PROBLEM(entry)) THEN
  1. .; BEGIN
  1. .F NURCPDA1=0:0 S NURCPDA1=$O(^GMR(124.3,NURCPDA,1,NURCPDA1)) Q:NURCPDA1'>0 S NURCPTRM=+$G(^GMR(124.3,NURCPDA,1,NURCPDA1,0)) I $$ACTIVE^NURCROP1(NURCPTRM,NURCPDA,NURCBGDT,NURCENDT) D
  1. ..; Find frame with CLASSIFICATION=NURSING INTERVENTION that
  1. ..; is under this problem.
  1. ..S NURCITRM=$$GETTRM^NURCROP1(NURCPTRM,NURCINT)
  1. ..; Get list of all frames/terms under NURSING INTERVENTION
  1. ..; frame with CLASSIFICATION=ORDERABLE in NURSLIST.
  1. ..; If NURSLIST is not empty then Loop through list
  1. ..; BEGIN
  1. ..I $$GETLST^NURCROP1(NURCITRM,NURCORD) F NURCOTRM=0:0 S NURCOTRM=$O(NURSLIST(NURCOTRM)) Q:NURCOTRM'>0 I $D(^GMR(124.3,NURCPDA,1,"B",NURCOTRM)) D
  1. ...; Set up sort arrays for the orderables
  1. ...K ^TMP($J,"NURSIR",NURCPTRM,9999999-$G(^TMP($J,"NURSORD",NURCPTRM,NURCOTRM)),NURCOTRM)
  1. ...S ^TMP($J,"NURSORD",NURCPTRM,NURCOTRM)=$G(^TMP($J,"NURSORD",NURCPTRM,NURCOTRM))+1,^TMP($J,"NURSIR",NURCPTRM,9999999-^TMP($J,"NURSORD",NURCPTRM,NURCOTRM),NURCOTRM)="",^TMP($J,"NURSORD",NURCPTRM,NURCOTRM,NURCBS5)=""
  1. ..; END
  1. ..; Set up the sort arrays for the problems
  1. ..K ^TMP($J,"NURSPR",9999999-$G(^TMP($J,"NURSPROB",NURCPTRM)),NURCPTRM)
  1. ..S ^TMP($J,"NURSPROB",NURCPTRM)=$G(^TMP($J,"NURSPROB",NURCPTRM))+1,^TMP($J,"NURSPR",9999999-^TMP($J,"NURSPROB",NURCPTRM),NURCPTRM)="",^TMP($J,"NURSPROB",NURCPTRM,NURCBS5)=""
  1. .; END
  1. ; END
  1. ;
  1. ; Use IO
  1. ; Print Header
  1. U IO S NURCPAGE=$$HEADER^NURCROP1(0)
  1. I '$D(^TMP($J,"NURSPR")) W !!,"There is no data for this report." G EXIT
  1. ;
  1. ; Print the report
  1. ;
  1. D PRINT^NURCROP2
  1. EXIT ;
  1. ; Clean up variables
  1. I $D(ZTSK)#2 D KILL^%ZTLOAD
  1. K ^TMP($J) D KVAR^VADPT,CLOSE^NURSUT1,^NURCKILL
  1. Q