AMERVSIT ; IHS/OIT/SCR - INTERFACING ROUTINES OUTSIDE OF AMER NAMESPACE REQUIRED FOR PCC VISIT CREATION
;;3.0;ER VISIT SYSTEM;**1,5**;MAR 03, 2009;Build 14
;
VPRVIEN(AMERPCC,AMERPIEN) ; EP from AMERPCC1
; ROUTINE to locate ien of V PROVIDER file in question
; INPUT :
; AMERPCC - IEN OF PCC VISIT
; AMERPIEN - PROVIDER IEN OF PROVIDER IN V PROVIDER FILE
;
; RETURNS IEN OF V PROVIDER FILE
;
N AMERVIEN,AMERY,AMERFND,AMERVPRV
S AMERVIEN=""
S (AMERVPRV,AMERFND)=0
F S AMERVPRV=$O(^AUPNVPRV("AD",AMERPCC,AMERVPRV)) Q:(AMERVPRV=""!AMERFND) D
.; AMERVPRV is an IEN for a V PROVIDER entry for this visit.
.; Now see if it is the V PROVIDER you were looking for
.I AMERPIEN=$P($G(^AUPNVPRV(AMERVPRV,0)),U,1) D
..S AMERFND=1
..S AMERVIEN=AMERVPRV
.Q
Q AMERVIEN
;
VPOVIEN(AMERPCC,AMERPIEN) ;
; AMERPCC - IEN OF PCC VISIT
; AMERPIEN - ICD9 IEN OF ICD9 CODE IN V POV FILE
;
; RETURNS IEN OF V POV FILE
;
N AMERVIEN,AMERY,AMERFND,AMERVPOV
S AMERVIEN=""
S (AMERVPOV,AMERFND)=0
F S AMERVPOV=$O(^AUPNVPOV("AD",AMERPCC,AMERVPOV)) Q:(AMERVPOV=""!AMERFND) D
.; AMERVPOV is an IEN for a V POV entry for this visit.
.; Now see if it is the V POV you were looking for
.I AMERPIEN=$P($G(^AUPNVPOV(AMERVPOV,0)),U,1) D
..S AMERFND=1
..S AMERVIEN=AMERVPOV
.Q
Q AMERVIEN
;
VSITDIE(AMERPCC,AMERVDR) ; EP from AMERPCC
; Updates VISIT file with AMERPCC IEN with DR string AMERVDR
; INPUT :
; AMERPCC - the VISIT ien for the entry that is being edited
; AMERVDR - THE DR string that will be used to update this entry
N DIE,DR
S DR=AMERVDR
S DIE="^AUPNVSIT(",DA=AMERPCC
L +^AUPNVSIT(DA):2
I $T D
.D ^DIE
.L -^AUPNVSIT(DA)
.D MOD^AUPNVSIT
.Q
E D EN^DDIOL("Unable to update VISIT file","","!!")
Q
VPRVDIE(AMERVIEN,AMERVDR) ; EP from AMERPCC1
; Updates a particular V PROVIDER entry
; INPUT :
; AMERVIEN - THE IEN OF THE V PROVIDER FILE THAT IS BEING MODIFIED
; AMERVDR - THE DR STRING THAT PROVIDES INFORMATION TO BE USED
N DIE,DR
S DR=AMERVDR
S DIE="^AUPNVPRV(",DA=AMERVIEN
L +^AUPNVPRV(DA):2
I $T D
.D ^DIE
.L -^AUPNVPRV(DA)
.D MOD^AUPNVSIT ; UPATE VISIT when modifying V PROVIDER
.Q
E D EN^DDIOL("Unable to update V PROVIDER file","","!!")
Q
VPOVDIE(AMERVIEN,AMERVDR) ; EP from AMERVSIT files to update V POV data
; Updates a particular V POV entry AMERVEIEN with DR string AMERVDR
; INPUT :
; AMERVIEN : THE IEN OF THE V POV record to be updated
; AMERVDR : The DR string containing the field and value to be updated
N DIE,DR
S DR=AMERVDR
S DIE="^AUPNVPOV(",DA=AMERVIEN
L +^AUPNVPOV(DA):2
I $T D
.D ^DIE
.L -^AUPNVPOV(DA)
.D MOD^AUPNVSIT ; UPATE VISIT when modifying V POV
.Q
E D EN^DDIOL("Unable to update V POV file","","!!")
Q
DELVPRV(AMERVPRV) ; EP from AMERPCC1
; REMOVE PROVIDER EIN AMERVPRV FROM V PROVIDER FILE
; INPUT:
; AMERVPRV : PROVIDER IEN TO BE REMOVED
;
S DIK="^AUPNVPRV("
S DA=AMERVPRV
L +^AUPNVPRV(DA):2
I $T D
.D ^DIK
.D IX^DIK ; RE-INDEX FILE FOR THIS ENTRY
.L -^AUPNVPRV(DA)
.D MOD^AUPNVSIT
E D EN^DDIOL("Unable to delete from V PROVIDER entry","","!!")
Q
DELETPRV(AMERPCC) ; EP
; DELETES ALL V PROVIDER ENTRIES FOR A GIVEN PCC VISIT
; AMERPCC - VISIT IEN
N AMERVPOV,DIK,DA
S AMERVPRV=0
I '$G(AMERPCC) Q 0
L +^AUPNVPRV:3 E Q
F S AMERVPRV=$O(^AUPNVPRV("AD",AMERPCC,AMERVPRV)) Q:AMERVPRV="" D
.S DA=AMERVPRV,DIK="^AUPNVPRV(" D ^DIK
.D IX^DIK
.Q
L -^AUPNVPRV
K DA,DIK
Q 1
GETOPIEN(AMERNAME) ; EP from AMERPCC
; INPUT:
; AMERNAME : the name of the option who's ien belongs in the "created by option" field of the VISIT file
N AMEROIEN,DIC,X,Y
S DIC="^DIC(19,"
S DIC(0)="BO" ; USE "B" CROSS REFERENCE AND ONLY FIND EXACT MATCH
S X=AMERNAME
D ^DIC
I Y>0 S AMEROIEN=$P(Y,U,1)
E S AMEROIEN=-1
Q AMEROIEN
GETVOPTN(AMERPCC) ; EP from AMERPCC
; RETURNS THE option used to create a visit
; INPUT :
; AMERPCC : the IEN of the VISIT record in question
N AMEROPT
S AMEROPT=$P($G(^AUPNVSIT(AMERPCC,0)),U,24)
Q AMEROPT
UPDTNAR(AMERVIEN,AMERNAR) ; EP from AMERPCC2
; UPDATES THE PROVIDER NARRATIVE FOR A GIVEN V POV ENTRY
; INPUT :
; AMERVIEN - V POV IEN
; AMERNAR - PROVIDER NARRATIVE
N AMERDR
S AMERVDR=".04///"_AMERNAR
D VPOVDIE(AMERVIEN,AMERVDR)
Q
DELETPOV(AMERPCC) ; EP FROM AMERPCC2
; DELETES ALL V POV ENTRIES FOR A GIVEN PCC VISIT
; SO THEY CAN BE RE-ADDED WITH THE PRIMARY POV FIRST
;
; AMERPCC - VISIT IEN
;
N AMERVPOV,DIK,DA
S AMERVPOV=0
I '$G(AMERPCC) Q 0
L +^AUPNVPOV:3 E Q
F S AMERVPOV=$O(^AUPNVPOV("AD",AMERPCC,AMERVPOV)) Q:AMERVPOV="" D
.S DA=AMERVPOV,DIK="^AUPNVPOV(" D ^DIK
.Q
L -^AUPNVPOV
K DA,DIK
Q 1
REMOVPOV(AMERVPOV) ; EP from AMERPCC2
; DELETES ONE V POV ENTRY
; INPUT:
; AMERVPOV - V POV IEN TO BE DELETED
N DIK,DA
I '$G(AMERVPOV)>0 Q 0
L +^AUPNVPOV:3 E Q
S DA=AMERVPOV
S DIK="^AUPNVPOV("
D ^DIK
D IX^DIK ; RE-INDEX FILE FOR THIS ENTRY
L -^AUPNVPOV
K DA,DIK
Q 1
RTNGSLP(AMERDFN,AMERDATE) ; EP FROM AMERBSDU
; PRINTS ROUTING SLIP FOR A PATIENT WITH SCHEDULE
; INPUT:
; AMERDFN - EIN OF PATIENT IN PATIENT FILE
; AMERDATE - DATE/TIME OF ER VISIT
;
N SDX,SDSTART,ORDER,SDREP
S DIR(0)="Y",DIR("A")="Do you want to PRINT a routing slip",DIR("B")="YES"
D ^DIR
Q:Y=0
K IOP S (SDX,SDSTART,ORDER,SDREP)=""
;
;AMER*3.0*5
D LOG^AMERBUSA("P","P","AMERREP3","AMER: Printed Routing Slip",AMERDFN)
;
D WISD^BSDROUT(AMERDFN,AMERDATE,"WI") ; lEGAL WITH PIMS 1006
; WISD^BSDROUT is not a public entry point yet but is in SOW for PIMS patch 1006.
Q
NEWREG(AMERDFN,AMERDA) ; EP from AMEREDTA
; Called when a misidentified patient must be registered as a new patient
;
; AMERDFN - A PATIENT IEN
; AMERDA - AN ER VISIT EIN
;
; RETURNS 1 IF PATIENT RECORD WAS CREATED ON DAY OF VISIT
; 0 IF PATIENT RECORD WAS NOT CREATED ON DAY OF VISIT
N AMERCRTD,AMERVDAT,X1,X2,X,AMERNEW
S AMERNEW=0
S (AMERCRTD,X1)=$$DATECRTD(AMERDFN,"I")
S (AMERVDAT,X2)=$P($G(^AMERVSIT(AMERDA,0)),U,1)
D ^%DTC
I X=0 S AMERNEW=1 ; THEN THE ORIGINAL PATIENT WAS CREATED ON THE DATE OF THE ER VISIT
Q AMERNEW
DATECRTD(DFN,F) ;
; Returns DATE CREATED in F format
; F="E":DATE CREATED IN EXTERNAL FORMAT, F="I":DATE CREATED IN INTERNAL FORMAT
N AMERIDAT,AMEREDAT
S (AMERIDAT,AMEREDAT)=""
I '$G(DFN) Q -1
I '$D(^AUPNPAT(DFN,0)) Q -1
S AMERIDAT=$P($G(^AUPNPAT(DFN,0)),"^",2)
I AMERIDAT="" Q ""
S F=$G(F)
I F="E" D
.S Y=AMERIDAT
.D DD^%DT
.S AMEREDAT=Y
.Q
Q $S(F="I":AMERIDAT,F="E":AMEREDAT,1:AMERIDAT)
CHANGPAT(AMERODFN,AMERDA,AMERISNW) ; EP FROM EDADMIT^AMEREDTA
; Updates appropriate files when a patient is changed in the editing interface
; ALGORITHM:
; 1. identifY if a new patient ID should be associated to the ER VISIT
; 2a. If NO updates use paitent reg APIs to change patient name
; 2b. If YES updates ER VISIT file and creates a new VISIT with new patient ID and old information
; leaves old PCC VISIT with no V POV or V PROVIDER files and sends a mail
; message idenifying original and changed information
; INPUT:
; AMERODFN - THE ORIGINAL PATIENT DFN
; AMERDA - POINTER TO THE ER VISIT FILE THAT IS BEING EDITED
; RETURNS;
; AMERNDFN = THE NEW PATIENT DFN
N AMERNDFN,AMERNPCC,AMEROPCC,AMERDONE
N DIC,Y,DIR
S AMERNDFN="",AMERDONE=0
; NOW SAVE OFF OLD INFORMATION
S AMERDATE=$P($G(^AMERVSIT(AMERDA,0)),U,1)
S AMEROPCC=$$FINDVSIT^AMERPCC(AMERDA)
F Q:AMERDONE=1 D
.S DIC=2,DIC(0)="AEMQV"
.S DIC("B")=$P($G(^DPT(AMERDFN,0)),U,1)
.S DIC("A")="Enter the patient's NAME or LOCAL CHART NUMBER: "
.D ^DIC K DIC,AUPNPAT,AUPNDOB,AUPNDOD,AUPNDAYS,AUPNSEX
.I $D(DTOUT)!$D(DUOUT) K DTOUT,DUOUT S AMERQUIT="",AMERNDFN=0,AMERDONE=1 Q
.I +Y'=-1 S AMERNDFN=+Y
.; IF THE PATIENT WAS ORIGINALLY CREATED FOR THIS VISIT, DON'T CREATE ANOTHER ONE
.I (+Y=-1&AMERISNW) S AMERNDFN=0,AMERDONE=1 Q
.I $P(Y,U,2)=$P($G(^DPT(AMERODFN,0)),U,1) D
..S DIR(0)="Y",DIR("A")="Do you want to register a new patient for this visit "
..S DIR("B")="NO"
..D ^DIR
..; Give user a chance to create a new patient if an existing patient was incorrectly identified
..I +Y=1 D
...S DOG="" K DFN D DOG^AG0
...S:$D(DFN) AMERNDFN=DFN
...Q
..Q
.I AMERNDFN="" S AMERNDFN=AMERODFN Q ; RETURN OLD PATIENT ID IF THE NEW PATIENT ID IS UNSUCCESSFUL
.I AMERNDFN'=AMERODFN D
..S DIR(0)="Y",DIR("A")="Change patient from "_$P($G(^DPT(AMERODFN,0)),U,1)_" to "_$P($G(^DPT(AMERNDFN,0)),U,1)
..S DIR("B")="NO"
..D ^DIR
..I Y=0 S AMERNDFN=AMERODFN Q
..S AMERDONE=1 ; IF WE GOT THIS FAR, WE FOUND A PATIENT TO UPDATE SO QUIT LOOP
..; MODIFIY NEW VISIT CREATION TO WORK WITH SCHEDULED VISIT
..I $G(^AMER(2.5,DUZ(2),"SD"))="" S AMERNPCC=$$VISIT^AMERPCC(AMERNDFN,AMERDATE)
..; If the LOCATION is set up for scheduling create a PCC VISIT through ERS interface CHECKIN^AMERBSDU(AMERDFN,AMERTIME)
..I $G(^AMER(2.5,DUZ(2),"SD"))'="" S AMERNPCC=$$ERCHCKIN^AMERBSDU(AMERNDFN,AMERDATE)
..I AMERNPCC>0 D
...D SAVPCCO^AMERPCC(AMERNPCC,AMERDA) ; UPDATES ER VISIT FILE WITH NEW PCC IEN
...D DELETPRV(AMEROPCC)
...D DELETPOV(AMEROPCC)
...D SENDMSG(AMEROPCC,AMERNPCC,AMERODFN,AMERNDFN,AMERDATE)
...Q
..I AMERNPCC<1 D
...D EN^DDIOL("UNABLE TO CREATE NEW PCC VISIT FOR PATIENT "_AMERNDFN,"","!!")
...S AMERNDFN=AMERODFN
...Q
..Q
.Q
Q AMERNDFN
UPDATPAT(AMERDFN) ; EP FROM AMEREDTA
; CALLED when a patient record that was created on the day of the ER VISIT is being updated
; INPUT:
; AMERDFN : THE IEN OF THE PATIENT RECORD BEING EDITED
;
N DFN,Y,AMERBAD,AMERAGN,AMERQUIT
S (AMERQUIT,AMERAGN,AMERBAD)=0
S DFN=AMERDFN
F Q:AMERQUIT=1 D
.S AMERAGN=0
.I $$NAME^AMERAGED(AMERDFN)=0 D ; MODIFIED NAME^AGEMAN TO FORCE THIS DFN AND NO OTHER FOR EDIT
..S DIR("A")="There were problems with patient update, would you like to try again"
..S DIR(0)="Y",DIR("B")="YES"
..D ^DIR
..I Y=0 S (AMERQUIT,AMERBAD)=1
..I Y=1 S AMERAGN=1
..Q
.Q:AMERBAD!AMERAGN
.I $D(DUOUT)!$D(DTOUT) K DUOUT,DTOUT S AMERQUIT=1 Q
.D DOB^AG2A
.I $D(DUOUT)!$D(DTOUT) K DUOUT,DTOUT S AMERQUIT=1 Q
.D SEX^AG2A
.I $D(DUOUT)!$D(DTOUT) K DUOUT,DTOUT S AMERQUIT=1 Q
.D SSN^AG3A
.I $D(DUOUT)!$D(DTOUT) K DUOUT,DTOUT S AMERQUIT=1 Q
.S AMERQUIT=1
.Q
I AMERBAD Q 0
Q 1
SENDMSG(AMEROPCC,AMERNPCC,AMERODFN,AMERNDFN,AMERDATE) ;
N AMERONAM,AMERNNAM,AMERMSG,X
S AMERONAM=$P($G(^DPT(AMERODFN,0)),U,1)
S AMERNNAM=$P($G(^DPT(AMERNDFN,0)),U,1)
S Y=AMERDATE
D DD^%DT
S AMERDATE=Y
S AMERMSG=$$PATMRG1^AMERXMB(AMERODFN,AMERONAM,AMEROPCC,AMERNDFN,AMERNNAM,AMERNPCC,AMERDATE)
D EN^DDIOL("MESSAGE NUMBER "_AMERMSG_" CREATED AND SENT","","!!")
Q
UPDTVTIM(AMERDA,AMEROTIM,AMERNTIM) ; EP from AMEREDTA
; Array APCDCVDT must be passed as follows:
;
; APCDCVDT("VISIT DFN")=DFN of VISIT entry being changed.
; APCDCVDT("VISIT DATE/TIME")=date and time to be changed to in
; internal FileMan form.
; APCDCVDT("TALK")=any value including NULL
N AMERDFN,AMERPCC
K APCDCVDT
S AMERDFN=$P($G(^AMERVSIT(AMERDA,0)),U,2)
S AMERPCC=$$FINDVSIT^AMERPCC(AMERDA)
S APCDCVDT("VISIT DFN")=AMERPCC
S APCDCVDT("VISIT DATE/TIME")=AMERNTIM
S APCDCVDT("TALK")=""
I AMERPCC<1 D EN^DDIOL("VISIT NOT FOUND - TIME NOT UPDATED","","!")
D:AMERPCC>0 START^APCDCVDT
I $D(APCDCVDT("ERROR FLAG")) D EN^DDIOL("ERRORS RETURNED AFTER UPDATING PCC VISIT TIME","","!!")
K APCDCVDT
Q
CLNICPTR(AMERPCC,AMERFORM) ;
N AMERRTRN,AMERCLNC
S AMERRTRN=""
I 'AMERPCC Q -1
I '$D(^AUPNVSIT(AMERPCC)) Q -1
S AMERCLNC=$P(^AUPNVSIT(AMERPCC,0),U,8)
I AMERCLNC=""
I '$D(^DIC(40.7,AMERCLNC)) Q -1
I AMERFORM="E" S AMERRTRN=$P(^DIC(40.7,AMERCLNC,0),U,1) ; THIS IS A WORD - EMERGENCY ROOM OR URGENT CARE
S:AMERRTRN="" AMERRTRN=AMERCLNC
Q AMERRTRN
;
UPDTVCLN(AMERVPOV,AMERVCLN) ; EP FROM AMERPCC2
; UPDATES THE "clinic" field of V POV to the one identified on the VISIT
; INPUT :
; AMERVPOV - IEN OF VPOV BEING EDITED
; AMERVCLN - THE NAME OF THE CLINIC STOP FILE THAT SHOULD BE ASSOCIATED TO THIS VPOV ENTRY
N AMERVDR
S AMERVDR=".08///"_AMERVCLN
D VPOVDIE(AMERVPOV,AMERVDR)
Q
GETPOVCL(AMERVPOV) ; EP from AMERPCC2
; INPUT: AMERVPOV - IEN OF THE V POV FILE
; RETURNS: THE DESCRIPTION OF "CLINIC STOP"
N AMERVCLN
S AMERVCLN=$P($G(^AUPNVPOV(AMERVPOV,12)),U,3) ; AMERVCLN IS A CODE -'30' FOR EMERGENCY '80' FOR URGENT CARE
S:AMERVCLN'="" AMERVCLN=$P($G(^DIC(40.7,AMERVCLN,0)),U,1) ; AMERVCLN IS A WORD
Q AMERVCLN
GETPOVEP(AMERVPOV) ; EP from AMERPCC2
; INPUT AMERVPOV - IEN OF THE V POV FILE
; RETURNS - IEN OF ENCOUNTER PROVIDER FOR V POV ENTRY
N AMEREPRV
S AMEREPRV=$P($G(^AUPNVPOV(AMERVPOV,12)),U,4)
Q AMEREPRV
UPDTEPRV(AMERVIEN,AMERDOC) ; EP FROM AMERPCC2
; Updates ENCOUNTER PROVIDER in V POV file
; INPUT
; AMERVIEN : THE IEN of the V POV entr being updated
; AMERDOC : The IEN of the NEW PERSON with provider keys being added to file
; note: the four slash stuff is needed to avoid cross-referencing that can identify a provider by last four of social security
N AMERVDR
S AMERVDR="1204////"_AMERDOC
D VPOVDIE(AMERVIEN,AMERVDR)
Q
DELETVST(AMERDA) ; IHS/OIT/SCR 10/08/08 - DELETE PCC VISIT WHEN 'REGISTERED IN ERROR'
; CALLED WHEN A VISIT IS SAVED WITH DISPOSITION 'REGISTERED IN ERROR'
; Updates VISIT file with AMERPCC IEN with DR string AMERVDR
; INPUT :
; AMERPCC - the VISIT ien for the entry that is being DELETED
N APCDVDLT,AMERPCC,DIK,DA,AMERDFN,AMERTIME
S AMERPCC=$$FINDVSIT^AMERPCC(AMERDA)
I AMERPCC>0 D
.S APCDVDLT=AMERPCC
.D EN^APCDVDLT
.K APCDVDLT
S DIK="^AMERVSIT(",DA=AMERDA
D ^DIK
S AMERTIME=$P($G(^AMERVSIT(AMERDA,0)),U,1)
S AMERDFN=$P($G(^AMERVSIT(AMERDA,0)),U,2)
;IHS/OIT/SCR 10/27/08
D CANCEL^AMERBSDU(AMERDFN,AMERTIME)
Q
AMERVSIT ; IHS/OIT/SCR - INTERFACING ROUTINES OUTSIDE OF AMER NAMESPACE REQUIRED FOR PCC VISIT CREATION
+1 ;;3.0;ER VISIT SYSTEM;**1,5**;MAR 03, 2009;Build 14
+2 ;
VPRVIEN(AMERPCC,AMERPIEN) ; EP from AMERPCC1
+1 ; ROUTINE to locate ien of V PROVIDER file in question
+2 ; INPUT :
+3 ; AMERPCC - IEN OF PCC VISIT
+4 ; AMERPIEN - PROVIDER IEN OF PROVIDER IN V PROVIDER FILE
+5 ;
+6 ; RETURNS IEN OF V PROVIDER FILE
+7 ;
+8 NEW AMERVIEN,AMERY,AMERFND,AMERVPRV
+9 SET AMERVIEN=""
+10 SET (AMERVPRV,AMERFND)=0
+11 FOR
SET AMERVPRV=$ORDER(^AUPNVPRV("AD",AMERPCC,AMERVPRV))
IF (AMERVPRV=""!AMERFND)
QUIT
Begin DoDot:1
+12 ; AMERVPRV is an IEN for a V PROVIDER entry for this visit.
+13 ; Now see if it is the V PROVIDER you were looking for
+14 IF AMERPIEN=$PIECE($GET(^AUPNVPRV(AMERVPRV,0)),U,1)
Begin DoDot:2
+15 SET AMERFND=1
+16 SET AMERVIEN=AMERVPRV
End DoDot:2
+17 QUIT
End DoDot:1
+18 QUIT AMERVIEN
+19 ;
VPOVIEN(AMERPCC,AMERPIEN) ;
+1 ; AMERPCC - IEN OF PCC VISIT
+2 ; AMERPIEN - ICD9 IEN OF ICD9 CODE IN V POV FILE
+3 ;
+4 ; RETURNS IEN OF V POV FILE
+5 ;
+6 NEW AMERVIEN,AMERY,AMERFND,AMERVPOV
+7 SET AMERVIEN=""
+8 SET (AMERVPOV,AMERFND)=0
+9 FOR
SET AMERVPOV=$ORDER(^AUPNVPOV("AD",AMERPCC,AMERVPOV))
IF (AMERVPOV=""!AMERFND)
QUIT
Begin DoDot:1
+10 ; AMERVPOV is an IEN for a V POV entry for this visit.
+11 ; Now see if it is the V POV you were looking for
+12 IF AMERPIEN=$PIECE($GET(^AUPNVPOV(AMERVPOV,0)),U,1)
Begin DoDot:2
+13 SET AMERFND=1
+14 SET AMERVIEN=AMERVPOV
End DoDot:2
+15 QUIT
End DoDot:1
+16 QUIT AMERVIEN
+17 ;
VSITDIE(AMERPCC,AMERVDR) ; EP from AMERPCC
+1 ; Updates VISIT file with AMERPCC IEN with DR string AMERVDR
+2 ; INPUT :
+3 ; AMERPCC - the VISIT ien for the entry that is being edited
+4 ; AMERVDR - THE DR string that will be used to update this entry
+5 NEW DIE,DR
+6 SET DR=AMERVDR
+7 SET DIE="^AUPNVSIT("
SET DA=AMERPCC
+8 LOCK +^AUPNVSIT(DA):2
+9 IF $TEST
Begin DoDot:1
+10 DO ^DIE
+11 LOCK -^AUPNVSIT(DA)
+12 DO MOD^AUPNVSIT
+13 QUIT
End DoDot:1
+14 IF '$TEST
DO EN^DDIOL("Unable to update VISIT file","","!!")
+15 QUIT
VPRVDIE(AMERVIEN,AMERVDR) ; EP from AMERPCC1
+1 ; Updates a particular V PROVIDER entry
+2 ; INPUT :
+3 ; AMERVIEN - THE IEN OF THE V PROVIDER FILE THAT IS BEING MODIFIED
+4 ; AMERVDR - THE DR STRING THAT PROVIDES INFORMATION TO BE USED
+5 NEW DIE,DR
+6 SET DR=AMERVDR
+7 SET DIE="^AUPNVPRV("
SET DA=AMERVIEN
+8 LOCK +^AUPNVPRV(DA):2
+9 IF $TEST
Begin DoDot:1
+10 DO ^DIE
+11 LOCK -^AUPNVPRV(DA)
+12 ; UPATE VISIT when modifying V PROVIDER
DO MOD^AUPNVSIT
+13 QUIT
End DoDot:1
+14 IF '$TEST
DO EN^DDIOL("Unable to update V PROVIDER file","","!!")
+15 QUIT
VPOVDIE(AMERVIEN,AMERVDR) ; EP from AMERVSIT files to update V POV data
+1 ; Updates a particular V POV entry AMERVEIEN with DR string AMERVDR
+2 ; INPUT :
+3 ; AMERVIEN : THE IEN OF THE V POV record to be updated
+4 ; AMERVDR : The DR string containing the field and value to be updated
+5 NEW DIE,DR
+6 SET DR=AMERVDR
+7 SET DIE="^AUPNVPOV("
SET DA=AMERVIEN
+8 LOCK +^AUPNVPOV(DA):2
+9 IF $TEST
Begin DoDot:1
+10 DO ^DIE
+11 LOCK -^AUPNVPOV(DA)
+12 ; UPATE VISIT when modifying V POV
DO MOD^AUPNVSIT
+13 QUIT
End DoDot:1
+14 IF '$TEST
DO EN^DDIOL("Unable to update V POV file","","!!")
+15 QUIT
DELVPRV(AMERVPRV) ; EP from AMERPCC1
+1 ; REMOVE PROVIDER EIN AMERVPRV FROM V PROVIDER FILE
+2 ; INPUT:
+3 ; AMERVPRV : PROVIDER IEN TO BE REMOVED
+4 ;
+5 SET DIK="^AUPNVPRV("
+6 SET DA=AMERVPRV
+7 LOCK +^AUPNVPRV(DA):2
+8 IF $TEST
Begin DoDot:1
+9 DO ^DIK
+10 ; RE-INDEX FILE FOR THIS ENTRY
DO IX^DIK
+11 LOCK -^AUPNVPRV(DA)
+12 DO MOD^AUPNVSIT
End DoDot:1
+13 IF '$TEST
DO EN^DDIOL("Unable to delete from V PROVIDER entry","","!!")
+14 QUIT
DELETPRV(AMERPCC) ; EP
+1 ; DELETES ALL V PROVIDER ENTRIES FOR A GIVEN PCC VISIT
+2 ; AMERPCC - VISIT IEN
+3 NEW AMERVPOV,DIK,DA
+4 SET AMERVPRV=0
+5 IF '$GET(AMERPCC)
QUIT 0
+6 LOCK +^AUPNVPRV:3
IF '$TEST
QUIT
+7 FOR
SET AMERVPRV=$ORDER(^AUPNVPRV("AD",AMERPCC,AMERVPRV))
IF AMERVPRV=""
QUIT
Begin DoDot:1
+8 SET DA=AMERVPRV
SET DIK="^AUPNVPRV("
DO ^DIK
+9 DO IX^DIK
+10 QUIT
End DoDot:1
+11 LOCK -^AUPNVPRV
+12 KILL DA,DIK
+13 QUIT 1
GETOPIEN(AMERNAME) ; EP from AMERPCC
+1 ; INPUT:
+2 ; AMERNAME : the name of the option who's ien belongs in the "created by option" field of the VISIT file
+3 NEW AMEROIEN,DIC,X,Y
+4 SET DIC="^DIC(19,"
+5 ; USE "B" CROSS REFERENCE AND ONLY FIND EXACT MATCH
SET DIC(0)="BO"
+6 SET X=AMERNAME
+7 DO ^DIC
+8 IF Y>0
SET AMEROIEN=$PIECE(Y,U,1)
+9 IF '$TEST
SET AMEROIEN=-1
+10 QUIT AMEROIEN
GETVOPTN(AMERPCC) ; EP from AMERPCC
+1 ; RETURNS THE option used to create a visit
+2 ; INPUT :
+3 ; AMERPCC : the IEN of the VISIT record in question
+4 NEW AMEROPT
+5 SET AMEROPT=$PIECE($GET(^AUPNVSIT(AMERPCC,0)),U,24)
+6 QUIT AMEROPT
UPDTNAR(AMERVIEN,AMERNAR) ; EP from AMERPCC2
+1 ; UPDATES THE PROVIDER NARRATIVE FOR A GIVEN V POV ENTRY
+2 ; INPUT :
+3 ; AMERVIEN - V POV IEN
+4 ; AMERNAR - PROVIDER NARRATIVE
+5 NEW AMERDR
+6 SET AMERVDR=".04///"_AMERNAR
+7 DO VPOVDIE(AMERVIEN,AMERVDR)
+8 QUIT
DELETPOV(AMERPCC) ; EP FROM AMERPCC2
+1 ; DELETES ALL V POV ENTRIES FOR A GIVEN PCC VISIT
+2 ; SO THEY CAN BE RE-ADDED WITH THE PRIMARY POV FIRST
+3 ;
+4 ; AMERPCC - VISIT IEN
+5 ;
+6 NEW AMERVPOV,DIK,DA
+7 SET AMERVPOV=0
+8 IF '$GET(AMERPCC)
QUIT 0
+9 LOCK +^AUPNVPOV:3
IF '$TEST
QUIT
+10 FOR
SET AMERVPOV=$ORDER(^AUPNVPOV("AD",AMERPCC,AMERVPOV))
IF AMERVPOV=""
QUIT
Begin DoDot:1
+11 SET DA=AMERVPOV
SET DIK="^AUPNVPOV("
DO ^DIK
+12 QUIT
End DoDot:1
+13 LOCK -^AUPNVPOV
+14 KILL DA,DIK
+15 QUIT 1
REMOVPOV(AMERVPOV) ; EP from AMERPCC2
+1 ; DELETES ONE V POV ENTRY
+2 ; INPUT:
+3 ; AMERVPOV - V POV IEN TO BE DELETED
+4 NEW DIK,DA
+5 IF '$GET(AMERVPOV)>0
QUIT 0
+6 LOCK +^AUPNVPOV:3
IF '$TEST
QUIT
+7 SET DA=AMERVPOV
+8 SET DIK="^AUPNVPOV("
+9 DO ^DIK
+10 ; RE-INDEX FILE FOR THIS ENTRY
DO IX^DIK
+11 LOCK -^AUPNVPOV
+12 KILL DA,DIK
+13 QUIT 1
RTNGSLP(AMERDFN,AMERDATE) ; EP FROM AMERBSDU
+1 ; PRINTS ROUTING SLIP FOR A PATIENT WITH SCHEDULE
+2 ; INPUT:
+3 ; AMERDFN - EIN OF PATIENT IN PATIENT FILE
+4 ; AMERDATE - DATE/TIME OF ER VISIT
+5 ;
+6 NEW SDX,SDSTART,ORDER,SDREP
+7 SET DIR(0)="Y"
SET DIR("A")="Do you want to PRINT a routing slip"
SET DIR("B")="YES"
+8 DO ^DIR
+9 IF Y=0
QUIT
+10 KILL IOP
SET (SDX,SDSTART,ORDER,SDREP)=""
+11 ;
+12 ;AMER*3.0*5
+13 DO LOG^AMERBUSA("P","P","AMERREP3","AMER: Printed Routing Slip",AMERDFN)
+14 ;
+15 ; lEGAL WITH PIMS 1006
DO WISD^BSDROUT(AMERDFN,AMERDATE,"WI")
+16 ; WISD^BSDROUT is not a public entry point yet but is in SOW for PIMS patch 1006.
+17 QUIT
NEWREG(AMERDFN,AMERDA) ; EP from AMEREDTA
+1 ; Called when a misidentified patient must be registered as a new patient
+2 ;
+3 ; AMERDFN - A PATIENT IEN
+4 ; AMERDA - AN ER VISIT EIN
+5 ;
+6 ; RETURNS 1 IF PATIENT RECORD WAS CREATED ON DAY OF VISIT
+7 ; 0 IF PATIENT RECORD WAS NOT CREATED ON DAY OF VISIT
+8 NEW AMERCRTD,AMERVDAT,X1,X2,X,AMERNEW
+9 SET AMERNEW=0
+10 SET (AMERCRTD,X1)=$$DATECRTD(AMERDFN,"I")
+11 SET (AMERVDAT,X2)=$PIECE($GET(^AMERVSIT(AMERDA,0)),U,1)
+12 DO ^%DTC
+13 ; THEN THE ORIGINAL PATIENT WAS CREATED ON THE DATE OF THE ER VISIT
IF X=0
SET AMERNEW=1
+14 QUIT AMERNEW
DATECRTD(DFN,F) ;
+1 ; Returns DATE CREATED in F format
+2 ; F="E":DATE CREATED IN EXTERNAL FORMAT, F="I":DATE CREATED IN INTERNAL FORMAT
+3 NEW AMERIDAT,AMEREDAT
+4 SET (AMERIDAT,AMEREDAT)=""
+5 IF '$GET(DFN)
QUIT -1
+6 IF '$DATA(^AUPNPAT(DFN,0))
QUIT -1
+7 SET AMERIDAT=$PIECE($GET(^AUPNPAT(DFN,0)),"^",2)
+8 IF AMERIDAT=""
QUIT ""
+9 SET F=$GET(F)
+10 IF F="E"
Begin DoDot:1
+11 SET Y=AMERIDAT
+12 DO DD^%DT
+13 SET AMEREDAT=Y
+14 QUIT
End DoDot:1
+15 QUIT $SELECT(F="I":AMERIDAT,F="E":AMEREDAT,1:AMERIDAT)
CHANGPAT(AMERODFN,AMERDA,AMERISNW) ; EP FROM EDADMIT^AMEREDTA
+1 ; Updates appropriate files when a patient is changed in the editing interface
+2 ; ALGORITHM:
+3 ; 1. identifY if a new patient ID should be associated to the ER VISIT
+4 ; 2a. If NO updates use paitent reg APIs to change patient name
+5 ; 2b. If YES updates ER VISIT file and creates a new VISIT with new patient ID and old information
+6 ; leaves old PCC VISIT with no V POV or V PROVIDER files and sends a mail
+7 ; message idenifying original and changed information
+8 ; INPUT:
+9 ; AMERODFN - THE ORIGINAL PATIENT DFN
+10 ; AMERDA - POINTER TO THE ER VISIT FILE THAT IS BEING EDITED
+11 ; RETURNS;
+12 ; AMERNDFN = THE NEW PATIENT DFN
+13 NEW AMERNDFN,AMERNPCC,AMEROPCC,AMERDONE
+14 NEW DIC,Y,DIR
+15 SET AMERNDFN=""
SET AMERDONE=0
+16 ; NOW SAVE OFF OLD INFORMATION
+17 SET AMERDATE=$PIECE($GET(^AMERVSIT(AMERDA,0)),U,1)
+18 SET AMEROPCC=$$FINDVSIT^AMERPCC(AMERDA)
+19 FOR
IF AMERDONE=1
QUIT
Begin DoDot:1
+20 SET DIC=2
SET DIC(0)="AEMQV"
+21 SET DIC("B")=$PIECE($GET(^DPT(AMERDFN,0)),U,1)
+22 SET DIC("A")="Enter the patient's NAME or LOCAL CHART NUMBER: "
+23 DO ^DIC
KILL DIC,AUPNPAT,AUPNDOB,AUPNDOD,AUPNDAYS,AUPNSEX
+24 IF $DATA(DTOUT)!$DATA(DUOUT)
KILL DTOUT,DUOUT
SET AMERQUIT=""
SET AMERNDFN=0
SET AMERDONE=1
QUIT
+25 IF +Y'=-1
SET AMERNDFN=+Y
+26 ; IF THE PATIENT WAS ORIGINALLY CREATED FOR THIS VISIT, DON'T CREATE ANOTHER ONE
+27 IF (+Y=-1&AMERISNW)
SET AMERNDFN=0
SET AMERDONE=1
QUIT
+28 IF $PIECE(Y,U,2)=$PIECE($GET(^DPT(AMERODFN,0)),U,1)
Begin DoDot:2
+29 SET DIR(0)="Y"
SET DIR("A")="Do you want to register a new patient for this visit "
+30 SET DIR("B")="NO"
+31 DO ^DIR
+32 ; Give user a chance to create a new patient if an existing patient was incorrectly identified
+33 IF +Y=1
Begin DoDot:3
+34 SET DOG=""
KILL DFN
DO DOG^AG0
+35 IF $DATA(DFN)
SET AMERNDFN=DFN
+36 QUIT
End DoDot:3
+37 QUIT
End DoDot:2
+38 ; RETURN OLD PATIENT ID IF THE NEW PATIENT ID IS UNSUCCESSFUL
IF AMERNDFN=""
SET AMERNDFN=AMERODFN
QUIT
+39 IF AMERNDFN'=AMERODFN
Begin DoDot:2
+40 SET DIR(0)="Y"
SET DIR("A")="Change patient from "_$PIECE($GET(^DPT(AMERODFN,0)),U,1)_" to "_$PIECE($GET(^DPT(AMERNDFN,0)),U,1)
+41 SET DIR("B")="NO"
+42 DO ^DIR
+43 IF Y=0
SET AMERNDFN=AMERODFN
QUIT
+44 ; IF WE GOT THIS FAR, WE FOUND A PATIENT TO UPDATE SO QUIT LOOP
SET AMERDONE=1
+45 ; MODIFIY NEW VISIT CREATION TO WORK WITH SCHEDULED VISIT
+46 IF $GET(^AMER(2.5,DUZ(2),"SD"))=""
SET AMERNPCC=$$VISIT^AMERPCC(AMERNDFN,AMERDATE)
+47 ; If the LOCATION is set up for scheduling create a PCC VISIT through ERS interface CHECKIN^AMERBSDU(AMERDFN,AMERTIME)
+48 IF $GET(^AMER(2.5,DUZ(2),"SD"))'=""
SET AMERNPCC=$$ERCHCKIN^AMERBSDU(AMERNDFN,AMERDATE)
+49 IF AMERNPCC>0
Begin DoDot:3
+50 ; UPDATES ER VISIT FILE WITH NEW PCC IEN
DO SAVPCCO^AMERPCC(AMERNPCC,AMERDA)
+51 DO DELETPRV(AMEROPCC)
+52 DO DELETPOV(AMEROPCC)
+53 DO SENDMSG(AMEROPCC,AMERNPCC,AMERODFN,AMERNDFN,AMERDATE)
+54 QUIT
End DoDot:3
+55 IF AMERNPCC<1
Begin DoDot:3
+56 DO EN^DDIOL("UNABLE TO CREATE NEW PCC VISIT FOR PATIENT "_AMERNDFN,"","!!")
+57 SET AMERNDFN=AMERODFN
+58 QUIT
End DoDot:3
+59 QUIT
End DoDot:2
+60 QUIT
End DoDot:1
+61 QUIT AMERNDFN
UPDATPAT(AMERDFN) ; EP FROM AMEREDTA
+1 ; CALLED when a patient record that was created on the day of the ER VISIT is being updated
+2 ; INPUT:
+3 ; AMERDFN : THE IEN OF THE PATIENT RECORD BEING EDITED
+4 ;
+5 NEW DFN,Y,AMERBAD,AMERAGN,AMERQUIT
+6 SET (AMERQUIT,AMERAGN,AMERBAD)=0
+7 SET DFN=AMERDFN
+8 FOR
IF AMERQUIT=1
QUIT
Begin DoDot:1
+9 SET AMERAGN=0
+10 ; MODIFIED NAME^AGEMAN TO FORCE THIS DFN AND NO OTHER FOR EDIT
IF $$NAME^AMERAGED(AMERDFN)=0
Begin DoDot:2
+11 SET DIR("A")="There were problems with patient update, would you like to try again"
+12 SET DIR(0)="Y"
SET DIR("B")="YES"
+13 DO ^DIR
+14 IF Y=0
SET (AMERQUIT,AMERBAD)=1
+15 IF Y=1
SET AMERAGN=1
+16 QUIT
End DoDot:2
+17 IF AMERBAD!AMERAGN
QUIT
+18 IF $DATA(DUOUT)!$DATA(DTOUT)
KILL DUOUT,DTOUT
SET AMERQUIT=1
QUIT
+19 DO DOB^AG2A
+20 IF $DATA(DUOUT)!$DATA(DTOUT)
KILL DUOUT,DTOUT
SET AMERQUIT=1
QUIT
+21 DO SEX^AG2A
+22 IF $DATA(DUOUT)!$DATA(DTOUT)
KILL DUOUT,DTOUT
SET AMERQUIT=1
QUIT
+23 DO SSN^AG3A
+24 IF $DATA(DUOUT)!$DATA(DTOUT)
KILL DUOUT,DTOUT
SET AMERQUIT=1
QUIT
+25 SET AMERQUIT=1
+26 QUIT
End DoDot:1
+27 IF AMERBAD
QUIT 0
+28 QUIT 1
SENDMSG(AMEROPCC,AMERNPCC,AMERODFN,AMERNDFN,AMERDATE) ;
+1 NEW AMERONAM,AMERNNAM,AMERMSG,X
+2 SET AMERONAM=$PIECE($GET(^DPT(AMERODFN,0)),U,1)
+3 SET AMERNNAM=$PIECE($GET(^DPT(AMERNDFN,0)),U,1)
+4 SET Y=AMERDATE
+5 DO DD^%DT
+6 SET AMERDATE=Y
+7 SET AMERMSG=$$PATMRG1^AMERXMB(AMERODFN,AMERONAM,AMEROPCC,AMERNDFN,AMERNNAM,AMERNPCC,AMERDATE)
+8 DO EN^DDIOL("MESSAGE NUMBER "_AMERMSG_" CREATED AND SENT","","!!")
+9 QUIT
UPDTVTIM(AMERDA,AMEROTIM,AMERNTIM) ; EP from AMEREDTA
+1 ; Array APCDCVDT must be passed as follows:
+2 ;
+3 ; APCDCVDT("VISIT DFN")=DFN of VISIT entry being changed.
+4 ; APCDCVDT("VISIT DATE/TIME")=date and time to be changed to in
+5 ; internal FileMan form.
+6 ; APCDCVDT("TALK")=any value including NULL
+7 NEW AMERDFN,AMERPCC
+8 KILL APCDCVDT
+9 SET AMERDFN=$PIECE($GET(^AMERVSIT(AMERDA,0)),U,2)
+10 SET AMERPCC=$$FINDVSIT^AMERPCC(AMERDA)
+11 SET APCDCVDT("VISIT DFN")=AMERPCC
+12 SET APCDCVDT("VISIT DATE/TIME")=AMERNTIM
+13 SET APCDCVDT("TALK")=""
+14 IF AMERPCC<1
DO EN^DDIOL("VISIT NOT FOUND - TIME NOT UPDATED","","!")
+15 IF AMERPCC>0
DO START^APCDCVDT
+16 IF $DATA(APCDCVDT("ERROR FLAG"))
DO EN^DDIOL("ERRORS RETURNED AFTER UPDATING PCC VISIT TIME","","!!")
+17 KILL APCDCVDT
+18 QUIT
CLNICPTR(AMERPCC,AMERFORM) ;
+1 NEW AMERRTRN,AMERCLNC
+2 SET AMERRTRN=""
+3 IF 'AMERPCC
QUIT -1
+4 IF '$DATA(^AUPNVSIT(AMERPCC))
QUIT -1
+5 SET AMERCLNC=$PIECE(^AUPNVSIT(AMERPCC,0),U,8)
+6 IF AMERCLNC=""
+7 IF '$DATA(^DIC(40.7,AMERCLNC))
QUIT -1
+8 ; THIS IS A WORD - EMERGENCY ROOM OR URGENT CARE
IF AMERFORM="E"
SET AMERRTRN=$PIECE(^DIC(40.7,AMERCLNC,0),U,1)
+9 IF AMERRTRN=""
SET AMERRTRN=AMERCLNC
+10 QUIT AMERRTRN
+11 ;
UPDTVCLN(AMERVPOV,AMERVCLN) ; EP FROM AMERPCC2
+1 ; UPDATES THE "clinic" field of V POV to the one identified on the VISIT
+2 ; INPUT :
+3 ; AMERVPOV - IEN OF VPOV BEING EDITED
+4 ; AMERVCLN - THE NAME OF THE CLINIC STOP FILE THAT SHOULD BE ASSOCIATED TO THIS VPOV ENTRY
+5 NEW AMERVDR
+6 SET AMERVDR=".08///"_AMERVCLN
+7 DO VPOVDIE(AMERVPOV,AMERVDR)
+8 QUIT
GETPOVCL(AMERVPOV) ; EP from AMERPCC2
+1 ; INPUT: AMERVPOV - IEN OF THE V POV FILE
+2 ; RETURNS: THE DESCRIPTION OF "CLINIC STOP"
+3 NEW AMERVCLN
+4 ; AMERVCLN IS A CODE -'30' FOR EMERGENCY '80' FOR URGENT CARE
SET AMERVCLN=$PIECE($GET(^AUPNVPOV(AMERVPOV,12)),U,3)
+5 ; AMERVCLN IS A WORD
IF AMERVCLN'=""
SET AMERVCLN=$PIECE($GET(^DIC(40.7,AMERVCLN,0)),U,1)
+6 QUIT AMERVCLN
GETPOVEP(AMERVPOV) ; EP from AMERPCC2
+1 ; INPUT AMERVPOV - IEN OF THE V POV FILE
+2 ; RETURNS - IEN OF ENCOUNTER PROVIDER FOR V POV ENTRY
+3 NEW AMEREPRV
+4 SET AMEREPRV=$PIECE($GET(^AUPNVPOV(AMERVPOV,12)),U,4)
+5 QUIT AMEREPRV
UPDTEPRV(AMERVIEN,AMERDOC) ; EP FROM AMERPCC2
+1 ; Updates ENCOUNTER PROVIDER in V POV file
+2 ; INPUT
+3 ; AMERVIEN : THE IEN of the V POV entr being updated
+4 ; AMERDOC : The IEN of the NEW PERSON with provider keys being added to file
+5 ; note: the four slash stuff is needed to avoid cross-referencing that can identify a provider by last four of social security
+6 NEW AMERVDR
+7 SET AMERVDR="1204////"_AMERDOC
+8 DO VPOVDIE(AMERVIEN,AMERVDR)
+9 QUIT
DELETVST(AMERDA) ; IHS/OIT/SCR 10/08/08 - DELETE PCC VISIT WHEN 'REGISTERED IN ERROR'
+1 ; CALLED WHEN A VISIT IS SAVED WITH DISPOSITION 'REGISTERED IN ERROR'
+2 ; Updates VISIT file with AMERPCC IEN with DR string AMERVDR
+3 ; INPUT :
+4 ; AMERPCC - the VISIT ien for the entry that is being DELETED
+5 NEW APCDVDLT,AMERPCC,DIK,DA,AMERDFN,AMERTIME
+6 SET AMERPCC=$$FINDVSIT^AMERPCC(AMERDA)
+7 IF AMERPCC>0
Begin DoDot:1
+8 SET APCDVDLT=AMERPCC
+9 DO EN^APCDVDLT
+10 KILL APCDVDLT
End DoDot:1
+11 SET DIK="^AMERVSIT("
SET DA=AMERDA
+12 DO ^DIK
+13 SET AMERTIME=$PIECE($GET(^AMERVSIT(AMERDA,0)),U,1)
+14 SET AMERDFN=$PIECE($GET(^AMERVSIT(AMERDA,0)),U,2)
+15 ;IHS/OIT/SCR 10/27/08
+16 DO CANCEL^AMERBSDU(AMERDFN,AMERTIME)
+17 QUIT