ENSA ;(WASH ISC)/DH-MedTester Interface ;1/11/2001
;;7.0;ENGINEERING;**14,21,68**;Aug 17, 1993
EN ;Upload test results from MedTester
S ENSTA=$P($G(^DIC(6910,1,0)),U,2),ENSTAL=$L(ENSTA)
I ENSTA="" W !!,"Can't seem to find your STATION NUMBER. Please check File 6910.",!,"Your IRM staff may need to assist you.",*7 G ERR^ENSA3
F I=1,2,3,4,5,6,7,8 S ENSTA(I)="",ENSTAL(I)=0
I $G(^DIC(6910,1,3,0))]"" D
. S (I,ENX)=0 F S ENX=$O(^DIC(6910,1,3,ENX)) Q:'ENX!(I>8) D
.. S I=I+1,ENSTA(I)=$P(^DIC(6910,1,3,ENX,0),U)
.. S ENSTAL(I)=$L(ENSTA(I))
D NOW^%DTC S ENTID=% S:'$D(DTIME) DTIME=600 D UPLD^ENSA1 G:POP EXIT
G:'$D(ENTID) EXIT I '$D(^ENG("TMP",ENTID)) G EXIT
S ENPMWO="",X="T",U="^",%DT="" D ^%DT S DT=+Y X ^DD("DD") S ENDATE=Y
MSG W @IOF,"MedTester UPLOAD MODULE:",!!,"Should data from the MedTester be used to close out work orders on a",!,"PM worklist" S %=1 D YN^DICN G:%<0 ERR^ENSA3 G:%=2 EN3 I %=0 D MSGXTD G MSG
W !! S Y=$E(DT,1,5)_"00" X ^DD("DD") S %DT("A")="For which month do you wish to record PMI's: ",%DT("B")=Y,%DT="AEPMX" D ^%DT G:Y'>0 ERR^ENSA3 S ENPMDT=$E(Y,2,5),ENPM="M"
MORW W !,"Are you recording a MONTHLY (as opposed to a WEEKLY) worklist" S %=1 D YN^DICN G:%<0 ERR^ENSA3 G:%=0 MORW I %=1 G EN1
WEEK R !,"Week number (enter an integer from 1 to 5): ",X:DTIME G:X="^" ERR^ENSA3 I X?1N,X>0,X<6 S ENPM="W"_X G EN1
W "??",*7 G WEEK
EN1 S DIC="^DIC(6922,",DIC(0)="AEMQ" D ^DIC G:Y'>0 ERR^ENSA3 S ENSHKEY=+Y,ENSHOP=$P(^DIC(6922,ENSHKEY,0),U,1),ENSHABR=$P(^(0),U,2)
S ENPMWO="PM-"_ENSHABR_ENPMDT_ENPM
EN2 S ENDEL="" I $D(^DIC(6910,1,0)) S ENDEL=$P(^(0),U,5)
I ENDEL="" R !,"Should existing PM work orders be deleted after close out? YES// ",X:DTIME G:X="^" ERR^ENSA3 S:X=""!("Yy"[$E(X)) ENDEL="Y"
I ENDEL="","Nn"'[$E(X) D COBH1^ENEQPMR4 G EN2
EN3 D MSG^ENSA6
;Physical processing of uploaded data
I '$D(^ENG("TMP",ENTID)) W !!,*7,"No data to process." D HOLD G EXIT
PAPER W !,"Do you want a paper copy of test results (will be printed on same",!,"device as Exception Messages)" S %=2 D YN^DICN G:%<0 ERR^ENSA3 G:%<1 PAPER S ENPAPER=$S(%=1:1,1:0)
K IO("Q") W ! S %ZIS="MQ",%ZIS("A")="Select Device for EXCEPTION MESSAGES: " D ^%ZIS G:POP ERR^ENSA3
I $D(IO("Q")) K IO("Q") S ZTIO=ION,ZTRTN="CONT^ENSA",ZTDESC="Upload from MedTester",ZTSAVE("EN*")="",ZTSAVE("DT")="" D ^%ZTLOAD K ZTSK D HOME^%ZIS G EXIT1^ENSA3
CONT D PROCS^ENSA1
G EXIT
HOLD W !,"Press <RETURN> to continue..." R X:DTIME
Q
MSGXTD ;Extended help text
W !!,"If MedTester is being used in conjunction with a specific Preventive",!,"Maintenance worklist, you should answer 'YES' to this question. You will then"
W !,"be asked to identify the worklist."
W !!,"If you say 'NO' at this point, safety tests stored in the MedTester will be",!,"posted to the Equipment Histories without affecting a PM worklist in any",!,"way.",! D HOLD
Q
EXIT ;
G EXIT^ENSA3
;ENSA
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENSA 2900 printed Dec 13, 2024@01:55:28 Page 2
ENSA ;(WASH ISC)/DH-MedTester Interface ;1/11/2001
+1 ;;7.0;ENGINEERING;**14,21,68**;Aug 17, 1993
EN ;Upload test results from MedTester
+1 SET ENSTA=$PIECE($GET(^DIC(6910,1,0)),U,2)
SET ENSTAL=$LENGTH(ENSTA)
+2 IF ENSTA=""
WRITE !!,"Can't seem to find your STATION NUMBER. Please check File 6910.",!,"Your IRM staff may need to assist you.",*7
GOTO ERR^ENSA3
+3 FOR I=1,2,3,4,5,6,7,8
SET ENSTA(I)=""
SET ENSTAL(I)=0
+4 IF $GET(^DIC(6910,1,3,0))]""
Begin DoDot:1
+5 SET (I,ENX)=0
FOR
SET ENX=$ORDER(^DIC(6910,1,3,ENX))
if 'ENX!(I>8)
QUIT
Begin DoDot:2
+6 SET I=I+1
SET ENSTA(I)=$PIECE(^DIC(6910,1,3,ENX,0),U)
+7 SET ENSTAL(I)=$LENGTH(ENSTA(I))
End DoDot:2
End DoDot:1
+8 DO NOW^%DTC
SET ENTID=%
if '$DATA(DTIME)
SET DTIME=600
DO UPLD^ENSA1
if POP
GOTO EXIT
+9 if '$DATA(ENTID)
GOTO EXIT
IF '$DATA(^ENG("TMP",ENTID))
GOTO EXIT
+10 SET ENPMWO=""
SET X="T"
SET U="^"
SET %DT=""
DO ^%DT
SET DT=+Y
XECUTE ^DD("DD")
SET ENDATE=Y
MSG WRITE @IOF,"MedTester UPLOAD MODULE:",!!,"Should data from the MedTester be used to close out work orders on a",!,"PM worklist"
SET %=1
DO YN^DICN
if %<0
GOTO ERR^ENSA3
if %=2
GOTO EN3
IF %=0
DO MSGXTD
GOTO MSG
+1 WRITE !!
SET Y=$EXTRACT(DT,1,5)_"00"
XECUTE ^DD("DD")
SET %DT("A")="For which month do you wish to record PMI's: "
SET %DT("B")=Y
SET %DT="AEPMX"
DO ^%DT
if Y'>0
GOTO ERR^ENSA3
SET ENPMDT=$EXTRACT(Y,2,5)
SET ENPM="M"
MORW WRITE !,"Are you recording a MONTHLY (as opposed to a WEEKLY) worklist"
SET %=1
DO YN^DICN
if %<0
GOTO ERR^ENSA3
if %=0
GOTO MORW
IF %=1
GOTO EN1
WEEK READ !,"Week number (enter an integer from 1 to 5): ",X:DTIME
if X="^"
GOTO ERR^ENSA3
IF X?1N
IF X>0
IF X<6
SET ENPM="W"_X
GOTO EN1
+1 WRITE "??",*7
GOTO WEEK
EN1 SET DIC="^DIC(6922,"
SET DIC(0)="AEMQ"
DO ^DIC
if Y'>0
GOTO ERR^ENSA3
SET ENSHKEY=+Y
SET ENSHOP=$PIECE(^DIC(6922,ENSHKEY,0),U,1)
SET ENSHABR=$PIECE(^(0),U,2)
+1 SET ENPMWO="PM-"_ENSHABR_ENPMDT_ENPM
EN2 SET ENDEL=""
IF $DATA(^DIC(6910,1,0))
SET ENDEL=$PIECE(^(0),U,5)
+1 IF ENDEL=""
READ !,"Should existing PM work orders be deleted after close out? YES// ",X:DTIME
if X="^"
GOTO ERR^ENSA3
if X=""!("Yy"[$EXTRACT(X))
SET ENDEL="Y"
+2 IF ENDEL=""
IF "Nn"'[$EXTRACT(X)
DO COBH1^ENEQPMR4
GOTO EN2
EN3 DO MSG^ENSA6
+1 ;Physical processing of uploaded data
+2 IF '$DATA(^ENG("TMP",ENTID))
WRITE !!,*7,"No data to process."
DO HOLD
GOTO EXIT
PAPER WRITE !,"Do you want a paper copy of test results (will be printed on same",!,"device as Exception Messages)"
SET %=2
DO YN^DICN
if %<0
GOTO ERR^ENSA3
if %<1
GOTO PAPER
SET ENPAPER=$SELECT(%=1:1,1:0)
+1 KILL IO("Q")
WRITE !
SET %ZIS="MQ"
SET %ZIS("A")="Select Device for EXCEPTION MESSAGES: "
DO ^%ZIS
if POP
GOTO ERR^ENSA3
+2 IF $DATA(IO("Q"))
KILL IO("Q")
SET ZTIO=ION
SET ZTRTN="CONT^ENSA"
SET ZTDESC="Upload from MedTester"
SET ZTSAVE("EN*")=""
SET ZTSAVE("DT")=""
DO ^%ZTLOAD
KILL ZTSK
DO HOME^%ZIS
GOTO EXIT1^ENSA3
CONT DO PROCS^ENSA1
+1 GOTO EXIT
HOLD WRITE !,"Press <RETURN> to continue..."
READ X:DTIME
+1 QUIT
MSGXTD ;Extended help text
+1 WRITE !!,"If MedTester is being used in conjunction with a specific Preventive",!,"Maintenance worklist, you should answer 'YES' to this question. You will then"
+2 WRITE !,"be asked to identify the worklist."
+3 WRITE !!,"If you say 'NO' at this point, safety tests stored in the MedTester will be",!,"posted to the Equipment Histories without affecting a PM worklist in any",!,"way.",!
DO HOLD
+4 QUIT
EXIT ;
+1 GOTO EXIT^ENSA3
+2 ;ENSA