Changeset 1466 for Scheduling/trunk/m


Ignore:
Timestamp:
Jul 3, 2012, 7:45:46 PM (12 years ago)
Author:
Sam Habiel
Message:

Refactoring BSDX25 continued...

Location:
Scheduling/trunk/m
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • Scheduling/trunk/m/BSDX25.m

    r1464 r1466  
    1 BSDX25  ; VEN/SMH - WINDOWS SCHEDULING RPCS ; 6/29/12 12:04pm
     1BSDX25  ; VEN/SMH - WINDOWS SCHEDULING RPCS ; 7/3/12 12:27pm
    22        ;;1.7T1;BSDX;;Aug 31, 2011;Build 18
    33        ; Licensed under LGPL
     
    3434        ; - Another number or text if not
    3535        ;
     36        ; Error reference:
     37        ; -1 -> Invalid Appointment ID
     38        ; -2 -> Invalid Check-in Date
     39        ; -3 -> Cannot check-in due to Fileman Filer failure
     40        ; -10 -> BSDXAPI error
     41        ; -100 -> Mumps Error
     42        ;
    3643        ; Turn off SDAM Appointment Events BSDX Protocol Processing
    3744        N BSDXNOEV
     
    4451        N $ET S $ET="G ERROR^BSDX25"
    4552        ;
     53        ; Test for error trap for Unit Tests
     54        I $G(BSDXDIE) N X S X=1/0
     55        ;
    4656        N BSDXI S BSDXI=0
    4757        ;
     
    5161        S ^BSDXTMP($J,0)="T00020ERRORID"_$C(30)
    5262        ;
    53         I '+BSDXAPPTID D ERR("Invalid Appointment ID") QUIT
    54         I '$D(^BSDXAPPT(BSDXAPPTID,0)) D ERR("Invalid Appointment ID") QUIT
    55         ;
    56         ; Lock the node for synchronizing access to appointment
    57         LOCK +^BSDXAPPT(BSDXAPPTID):1
    58         ELSE  DO ERR("-7~Lock not acquired") QUIT
     63        I '+BSDXAPPTID D ERR("-1~Invalid Appointment ID") QUIT
     64        I '$D(^BSDXAPPT(BSDXAPPTID,0)) D ERR("-1~Invalid Appointment ID") QUIT
    5965        ;
    6066        ; Remove Date formatting v.1.5. Client will send date as FM Date.
     
    6268        ;S %DT="T",X=BSDXCDT D ^%DT S BSDXCDT=Y
    6369        S BSDXCDT=+BSDXCDT  ; Strip off zeros if C# sends them
    64         I BSDXCDT=-1 D ERR(70) Q
     70        I BSDXCDT'>2000000 D ERR("-2~Invalid Check-in Date") QUIT
    6571        I BSDXCDT>$$NOW^XLFDT S BSDXCDT=$$NOW^XLFDT
    6672        ;
    67         ;Checkin BSDX APPOINTMENT entry
    68         N BSDXERR S BSDXERR=$$BSDXCHK(BSDXAPPTID,BSDXCDT)
    69         I BSDXERR D ERR("BSDX08: Fileman Filer failed to check-in appt") QUIT
    70         ;
    71         N BSDXNOD S BSDXNOD=^BSDXAPPT(BSDXAPPTID,0)
    72         N BSDXPATID S BSDXPATID=$P(BSDXNOD,U,5)
    73         N BSDXSTART S BSDXSTART=$P(BSDXNOD,U)
     73        ; Some data
     74        N BSDXNOD S BSDXNOD=^BSDXAPPT(BSDXAPPTID,0) ; Appointment Node
     75        N BSDXPATID S BSDXPATID=$P(BSDXNOD,U,5) ; DFN
     76        N BSDXSTART S BSDXSTART=$P(BSDXNOD,U) ; Appointment Start Time
    7477        ;
    7578        ; Get Hospital Location IEN from BSDXAPPT to BSDXRES (RESOUCE:HOSPITAL LOCATION)
     
    7780        I BSDXSC1,'$D(^SC(BSDXSC1,0)) S BSDXSC1="" ; Null it off if it doesn't exist
    7881        ;
     82        ; Check if we can check-in using BSDXAPI
     83        N BSDXERR S BSDXERR=0
     84        I BSDXSC1 S BSDXERR=$$CHECKIC1^BSDXAPI(BSDXPATID,BSDXSC1,BSDXSTART)
     85        I BSDXERR D ERR(-10_"~"_$P(BSDXERR,U,2)) QUIT
     86        ;
     87        ; Checkin BSDX APPOINTMENT entry
     88        ; Failure Analysis: If we fail here, no changes were made.
     89        N BSDXERR S BSDXERR=$$BSDXCHK(BSDXAPPTID,BSDXCDT)
     90        I BSDXERR D ERR("-3~Fileman Filer failed to check-in appt") QUIT
     91        ;
    7992        ; File check-in using BSDXAPI
     93        ; Failure Analysis: If we fail here, we need to roll back first check-in.
    8094        N BSDXERR S BSDXERR=0
    8195        I BSDXSC1 S BSDXERR=$$CHECKIN1^BSDXAPI(BSDXPATID,BSDXSC1,BSDXSTART)
    82         I BSDXERR D ERR($P(BSDXZ,U,2)) QUIT
    83         ;
    84         ; Unlock
    85         LOCK -^BSDXAPPT(BSDXAPPTID)
     96        I BSDXERR D  QUIT
     97        . N % S %=$$BSDXCHK(BSDXAPPTID,"@") ; No Error checking to prevent loop.
     98        . D ERR(-10_"~"_$P(BSDXERR,U,2)) ; Send error message to client
    8699        ;
    87100        S BSDXI=BSDXI+1
     
    98111        ; Output: 1^Error for error
    99112        ;         0 for success
     113        ;
     114        Q:$G(BSDXSIMERR1) 1_U_"Simulated Error 1"
    100115        ;
    101116        N BSDXIENS,BSDXMSG,BSDXFDA ; Filer variables
     
    145160        I '$D(^BSDXAPPT(BSDXAPPTID,0)) D ERR("-2~Invalid Appointment ID") QUIT
    146161        ;
    147         ; Lock the node for synchronizing access to appointment
    148         LOCK +^BSDXAPPT(BSDXAPPTID):1
    149         ELSE  DO ERR("-7~Lock not acquired") QUIT
    150         ;
    151162        ; Remove checkin from BSDX APPOINTMENT entry
    152163        N BSDXERR S BSDXERR=$$BSDXCHK(BSDXAPPTID,"@")
     
    167178        ;
    168179        N BSDXZ ; Scratch variable to hold error message
    169         I BSDXSC1]"",$D(^SC(BSDXSC1,0)) S BSDXZ=$$RMCI^BSDXAPI(BSDXPATID,BSDXSC1,BSDXSTART)
     180        I BSDXSC1]"",$D(^SC(BSDXSC1,0)) S BSDXZ=$$RMCI^BSDXAPI1(BSDXPATID,BSDXSC1,BSDXSTART)
    170181        I +$G(BSDXZ) D ERR("-5~"_$P(BSDXZ,U,2)) QUIT
    171182        ;
    172         ; Unlock
    173         LOCK -^BSDXAPPT(BSDXAPPTID)
    174         ;
    175183        ; Return ADO recordset
    176184        S BSDXI=BSDXI+1
     
    225233        S $ETRAP="D ^%ZTER HALT"  ; Emergency Error Trap for the wise
    226234        D ^%ZTER
    227         S $EC=""  ; Clear Error
     235        ; VEN/SMH: NB: I make a conscious decision not to roll back anything
     236        ; here in the error trap. Once the error is fixed, users can
     237        ; undo or redo the check-in.
     238        ; Individual portions of this routine may choose to do rolling back
     239        ; of their own (e.g. a failed call to BSDXAPI causes rollback to occur
     240        ; in CHECKIN)
     241        ;
    228242        ; Log error message and send to client
    229243        D ERR("-100~Mumps Error")
    230         Q
     244        Q:$Q "-100^Mumps Error" Q
    231245        ;
    232246ERR(BSDXERR)    ;Error processing
    233         I $G(BSDXAPPTID) LOCK -^BSDXAPPT(BSDXAPPTID)
     247        ; If last line is $C(31), we are done. No more errors to send to client.
     248        I ^BSDXTMP($J,$O(^BSDXTMP($J," "),-1))=$C(31) QUIT
    234249        S BSDXERR=$G(BSDXERR)
    235250        S BSDXERR=$P(BSDXERR,"~")_"~"_$TEXT(+0)_":"_$P(BSDXERR,"~",2) ; Append Routine Name
  • Scheduling/trunk/m/BSDXAPI.m

    r1464 r1466  
    1 BSDXAPI ; IHS/ANMC/LJF & VW/SMH - SCHEDULING APIs ; 6/29/12 12:19pm
     1BSDXAPI ; IHS/ANMC/LJF & VW/SMH - SCHEDULING APIs ; 7/3/12 12:30pm
    22        ;;1.7T1;BSDX;;Aug 31, 2011;Build 18
    33        ; Licensed under LGPL 
    44        ;
    5         ;Orignal routine is BSDAPI by IHS/LJF, HMW, and MAW
     5        ; Orignal routine is BSDAPI by IHS/LJF, HMW, and MAW
    66        ; mods (many) by WV/SMH
    7         ;Move to BSDX namespace as BSDXAPI from BSDAPI by WV/SMH
    8         ; Change History:
    9         ; 2010-11-5: (1.42)
    10         ; - Fixed errors having to do uncanceling patient appointments if it was
    11         ;   a patient cancelled appointment.
    12         ; - Use new style Fileman API for storing appointments in file 44 in
    13         ;   $$MAKE due to problems with legacy API.
    14         ; 2010-11-12: (1.42)
    15         ; - Changed ="C" to ["C" in SCIEN. Cancelled appointments can be "PC" as
    16         ;   well.
    17         ; 2010-12-5 (1.42)
    18         ; Added an entry point to update the patient note in file 44.
    19         ; 2010-12-6 (1.42)
    20         ; MAKE1 incorrectly put info field in BSDR("INFO") rather than BSDR("OI")
    21         ; 2010-12-8 (1.42)
    22         ; Removed restriction on max appt length. Even though this restriction
    23         ; exists in fileman (120 minutes), PIMS ignores it. Therefore, I
    24         ; will ignore it here too.
    25         ; 2011-01-25 (v.1.5)
    26         ; Added entry point $$RMCI to remove checked in appointments.
    27         ; In $$CANCEL, if the appointment is checked in, delete check-in rather than
    28         ;  spitting an error message to the user saying 'Delete the check-in'
    29         ; Changed all lines that look like this:
    30         ;  I $G(BSDR("ADT"))'?7N1".".4N Q 1_U_"Appt Date/Time error: "_$G(BSDR("ADT"))
    31         ; to:
    32         ;  I $G(BSDR("ADT"))'?7N.1".".4N Q 1_U_"Appt Date/Time error: "_$G(BSDR("ADT"))
    33         ; to allow for date at midnight which does not have a dot at the end.
    34         ; 2011-01-26 (v.1.5)
    35         ; More user friendly message if patient already has appointment in $$MAKE:
    36         ;  Spits out pt name and user friendly date.
    37         ; 2012-06-18 (v 1.7)
    38         ; Removing transacions. Means that code SHOULD NOT fail. Took all checks
    39         ;  out for making an appointment to MAKECK. We call this first to make sure
    40         ; that the appointment is okay to make before committing to make it. We
    41         ; still have the provision to delete the data though if we fail when we
    42         ; actually make the appointment.
    43         ; CANCELCK exists for the same purpose.
     7        ; Move to BSDX namespace as BSDXAPI from BSDAPI by WV/SMH
     8        ; Change history is located in BSDXAPI1 (to save space).
    449        ;
    4510MAKE1(DFN,CLIN,TYP,DATE,LEN,INFO)       ; Simplified PEP w/ parameters for $$MAKE - making appointment
     
    230195        ;              = 1^message means error with reason message
    231196        ;
     197        I $G(BSDXDIE2) N X S X=1/0
     198        ;
     199        N BSDXERR S BSDXERR=$$CHECKICK(.BSDR)
     200        I BSDXERR Q BSDXERR
     201        ;
     202        ; find ien for appt in file 44
     203        NEW IEN,DIE,DA,DR
     204        S IEN=$$SCIEN(BSDR("PAT"),BSDR("CLN"),BSDR("ADT"))
     205        ;
     206        ; remember before status
     207        ; Failure analysis: Only ^TMP global is set here.
     208        NEW SDATA,DFN,SDT,SDCL,SDDA,SDCIHDL,SDMODE
     209        S DFN=BSDR("PAT"),SDT=BSDR("ADT"),SDCL=BSDR("CLN"),SDMODE=2,SDDA=IEN
     210        S SDCIHDL=$$HANDLE^SDAMEVT(1),SDATA=SDDA_U_DFN_U_SDT_U_SDCL
     211        D BEFORE^SDAMEVT(.SDATA,DFN,SDT,SDCL,SDDA,SDCIHDL)
     212        ;
     213        ; set checkin; Old Code -- keep for ref VEN/SMH 3 Jul 2012
     214        ; S DIE="^SC("_BSDR("CLN")_",""S"","_BSDR("ADT")_",1,"
     215        ; S DA(2)=BSDR("CLN"),DA(1)=BSDR("ADT"),DA=IEN
     216        ; S DR="309///"_BSDR("CDT")_";302///`"_BSDR("USR")_";305///"_$$NOW^XLFDT
     217        ; D ^DIE
     218        ;
     219        I $D(BSDXSIMERR3) Q 1_U_"Simulated Error"
     220        ;
     221        ; Failure analysis: If this fails, no other changes were made in this routine
     222        N BSDXIENS S BSDXIENS=IEN_","_BSDR("ADT")_","_BSDR("CLN")_","
     223        N BSDXFDA
     224        S BSDXFDA(44.003,BSDXIENS,309)=BSDR("CDT")
     225        S BSDXFDA(44.003,BSDXIENS,302)=BSDR("USR")
     226        S BSDXFDA(44.003,BSDXIENS,305)=$$NOW^XLFDT()
     227        N BSDXERR
     228        D UPDATE^DIE("","BSDXFDA","BSDXERR")
     229        ;
     230        I $D(BSDXERR) Q 1_U_"Error checking in appointment to file 44. Error: "_BSDXERR("DIERR",1,"TEXT",1)
     231        ;
     232        ; set after status
     233        S SDDA=$$SCIEN(BSDR("PAT"),BSDR("CLN"),BSDR("ADT"))
     234        S SDCIHDL=$$HANDLE^SDAMEVT(1),SDATA=SDDA_U_DFN_U_SDT_U_SDCL
     235        D AFTER^SDAMEVT(.SDATA,DFN,SDT,SDCL,SDDA,SDCIHDL)
     236        ;
     237        ; Point of no Return
     238        ; call event driver
     239        D EVT^SDAMEVT(.SDATA,4,SDMODE,SDCIHDL)
     240        Q 0
     241        ;
     242CHECKIC1(DFN,CLIN,APDATE)       ; Simplified PEP w/ parameters for $$CHECKICK -
     243        ; Check-in Check
     244        ; Call like this for DFN 23435 checking in now at Hospital Location 33
     245        ; for appt at Dec 20, 2009 @ 10:11:59
     246        ; S RESULT=$$CHECKIC1^BSDXAPI(23435,33,3091220.221159)
     247        N BSDR
     248        S BSDR("PAT")=DFN          ;DFN
     249        S BSDR("CLN")=CLIN         ;Hosp Loc IEN
     250        S BSDR("ADT")=APDATE       ;Appt Date
     251        S BSDR("CDT")=$$NOW^XLFDT  ;Check-in date defaults to now
     252        S BSDR("USR")=DUZ          ;Check-in user defaults to current
     253        Q $$CHECKICK(.BSDR)
     254        ;
     255CHECKICK(BSDR) ; $$ PEP; - Is it okay to check-in patient?
     256        ; Input: Same as $$CHECKIN
     257        ; Output: 0 if okay or 1^message if error
     258        ;
     259        I $G(BSDXSIMERR2) Q 1_U_"Simulated Error"
     260        ;
    232261        I '$D(^DPT(+$G(BSDR("PAT")),0)) Q 1_U_"Patient not on file: "_$G(BSDR("PAT"))
    233262        I '$D(^SC(+$G(BSDR("CLN")),0)) Q 1_U_"Clinic not on file: "_$G(BSDR("CLN"))
     
    239268        ;
    240269        ; find ien for appt in file 44
    241         NEW IEN,DIE,DA,DR
    242         S IEN=$$SCIEN(BSDR("PAT"),BSDR("CLN"),BSDR("ADT"))
     270        N IEN S IEN=$$SCIEN(BSDR("PAT"),BSDR("CLN"),BSDR("ADT"))
    243271        I 'IEN Q 1_U_"Error trying to find appointment for checkin: Patient="_BSDR("PAT")_" Clinic="_BSDR("CLN")_" Appt="_BSDR("ADT")
    244         ;
    245         ; remember before status
    246         NEW SDATA,DFN,SDT,SDCL,SDDA,SDCIHDL,SDMODE
    247         S DFN=BSDR("PAT"),SDT=BSDR("ADT"),SDCL=BSDR("CLN"),SDMODE=2,SDDA=IEN
    248         S SDCIHDL=$$HANDLE^SDAMEVT(1),SDATA=SDDA_U_DFN_U_SDT_U_SDCL
    249         D BEFORE^SDAMEVT(.SDATA,DFN,SDT,SDCL,SDDA,SDCIHDL)
    250         ;
    251         ; set checkin
    252         S DIE="^SC("_BSDR("CLN")_",""S"","_BSDR("ADT")_",1,"
    253         S DA(2)=BSDR("CLN"),DA(1)=BSDR("ADT"),DA=IEN
    254         S DR="309///"_BSDR("CDT")_";302///`"_BSDR("USR")_";305///"_$$NOW^XLFDT
    255         D ^DIE
    256         ;
    257         ; set after status
    258         S SDDA=$$SCIEN(BSDR("PAT"),BSDR("CLN"),BSDR("ADT"))
    259         S SDCIHDL=$$HANDLE^SDAMEVT(1),SDATA=SDDA_U_DFN_U_SDT_U_SDCL
    260         D AFTER^SDAMEVT(.SDATA,DFN,SDT,SDCL,SDDA,SDCIHDL)
    261         ;
    262         ; call event driver
    263         D EVT^SDAMEVT(.SDATA,4,SDMODE,SDCIHDL)
    264272        Q 0
    265273        ;
     
    378386        Q $S(X:1,1:0)
    379387        ;
    380 RMCI(PAT,CLINIC,DATE)    ;PEP; -- Remove Check-in; $$
    381         ; PAT = DFN
    382         ; CLINIC = SC IEN
    383         ; DATE = FM Date/Time of Appointment
    384         ;
    385         ; Returns:
    386         ; 0 if okay
    387         ; -1 if failure
    388         ;
    389         ; Call like this: $$RMCI(233,33,3110102.1130)
    390         ;
    391         ; Move my variables into the ones used by SDAPIs (just a convenience)
    392         NEW SDATA,DFN,SDT,SDCL,SDDA,SDCIHDL,SDMODE
    393         S DFN=PAT,SDT=DATE,SDCL=CLINIC,SDMODE=2,SDDA=$$SCIEN(DFN,SDCL,SDT)
    394         ;
    395         I SDDA<1 QUIT 0    ; Appt cancelled; cancelled appts rm'ed from file 44
    396         ;
    397         ; remember before status
    398         S SDCIHDL=$$HANDLE^SDAMEVT(1),SDATA=SDDA_U_DFN_U_SDT_U_SDCL
    399         D BEFORE^SDAMEVT(.SDATA,DFN,SDT,SDCL,SDDA,SDCIHDL)
    400         ;
    401         ; remove check-in using filer.
    402         N BSDXIENS S BSDXIENS=SDDA_","_DATE_","_CLINIC_","
    403         N BSDXFDA
    404         S BSDXFDA(44.003,BSDXIENS,309)="@" ; CHECKED-IN
    405         S BSDXFDA(44.003,BSDXIENS,302)="@" ; CHECK IN USER
    406         S BSDXFDA(44.003,BSDXIENS,305)="@" ; CHECK IN ENTERED
    407         N BSDXERR
    408         D FILE^DIE("","BSDXFDA","BSDXERR")
    409         I $D(BSDXERR) QUIT "-1~Can't file for Pat "_PAT_" in Clinic "_CLINIC_" at "_DATE_". Fileman reported an error: "_BSDXERR("DIERR",1,"TEXT",1)
    410         ;
    411         ; set after status
    412         ; S SDDA=$$SCIEN(DFN,SDCL,SDT) ;smh -why is this here? SDDA won't change.
    413         S SDCIHDL=$$HANDLE^SDAMEVT(1),SDATA=SDDA_U_DFN_U_SDT_U_SDCL
    414         D AFTER^SDAMEVT(.SDATA,DFN,SDT,SDCL,SDDA,SDCIHDL)
    415         ;
    416         ; call event driver
    417         D EVT^SDAMEVT(.SDATA,4,SDMODE,SDCIHDL)
    418         QUIT 0
    419         ;
    420388SCIEN(PAT,CLINIC,DATE)  ;PEP; returns ien for appt in ^SC
    421389        NEW X,IEN
  • Scheduling/trunk/m/BSDXAPI1.m

    r1464 r1466  
    1 BSDXAPI1 ; VEN/SMH - SCHEDULING APIs - Continued!!! ; 6/29/12 11:52am
     1BSDXAPI1 ; VEN/SMH - SCHEDULING APIs - Continued!!! ; 7/3/12 12:37pm
    22        ;;1.7T1;BSDX;;Aug 31, 2011;Build 18
    33        ; Licensed under LGPL 
     4        ;
     5        ; Change History (BSDXAPI and BSDXAPI1)
     6        ; Pre 1.42:
     7        ; - Simplified entry points (MAKE1, CANCEL1, CHECKIN1)
     8        ; 2010-11-5: (1.42)
     9        ; - Fixed errors having to do uncanceling patient appointments if it was
     10        ;   a patient cancelled appointment.
     11        ; - Use new style Fileman API for storing appointments in file 44 in
     12        ;   $$MAKE due to problems with legacy API.
     13        ; 2010-11-12: (1.42)
     14        ; - Changed ="C" to ["C" in SCIEN. Cancelled appointments can be "PC" as
     15        ;   well.
     16        ; 2010-12-5 (1.42)
     17        ; Added an entry point to update the patient note in file 44.
     18        ; 2010-12-6 (1.42)
     19        ; MAKE1 incorrectly put info field in BSDR("INFO") rather than BSDR("OI")
     20        ; 2010-12-8 (1.42)
     21        ; Removed restriction on max appt length. Even though this restriction
     22        ; exists in fileman (120 minutes), PIMS ignores it. Therefore, I
     23        ; will ignore it here too.
     24        ; 2011-01-25 (v.1.5)
     25        ; Added entry point $$RMCI to remove checked in appointments.
     26        ; In $$CANCEL, if the appointment is checked in, delete check-in rather than
     27        ;  spitting an error message to the user saying 'Delete the check-in'
     28        ; Changed all lines that look like this:
     29        ;  I $G(BSDR("ADT"))'?7N1".".4N Q 1_U_"Appt Date/Time error: "_$G(BSDR("ADT"))
     30        ; to:
     31        ;  I $G(BSDR("ADT"))'?7N.1".".4N Q 1_U_"Appt Date/Time error: "_$G(BSDR("ADT"))
     32        ; to allow for date at midnight which does not have a dot at the end.
     33        ; 2011-01-26 (v.1.5)
     34        ; More user friendly message if patient already has appointment in $$MAKE:
     35        ;  Spits out pt name and user friendly date.
     36        ; 2012-06-18 (v 1.7)
     37        ; Removing transacions. Means that code SHOULD NOT fail. Took all checks
     38        ;  out for making an appointment to MAKECK. We call this first to make sure
     39        ; that the appointment is okay to make before committing to make it. We
     40        ; still have the provision to delete the data though if we fail when we
     41        ; actually make the appointment.
     42        ; CANCELCK exists for the same purpose.
     43        ; CHECKINK ditto
     44        ; New API: $$NOWSHOW^BSDXAPI1 for no-showing patients
     45        ; Moved RMCI from BSDXAPI to BSDXAPI1 because BSDXAPI1 is getting larger
     46        ;  than 20000 characters.
    447        ;
    548NOSHOW(PAT,CLINIC,DATE,NSFLAG) ; $$ PEP; No-show Patient at appt date (new in v1.7)
     
    4184        ;
    4285        ; This M error trigger tests if ^BSDXAPPT rolls back.
    43         ; I won't try to roll back ^DPT(,"S"
    44         ; The M error is caused here, so if I try to rollback, I can cause another
     86        ; I won't try to roll back ^DPT(,"S" because
     87        ; the M error is caused here, so if I try to rollback, I can cause another
    4588        ; error. Infinite Errors then.
    4689        I $D(BSDXSIMERR3) N X S X=1/0
     
    67110        ;
    68111        ; Call like this: $$RMCI(233,33,3110102.1130)
     112        ;
     113        ; Check to see if we can remove the check-in
     114        N BSDXERR S BSDXERR=$$RMCICK(PAT,CLINIC,DATE)
     115        I BSDXERR Q BSDXERR
    69116        ;
    70117        ; Move my variables into the ones used by SDAPIs (just a convenience)
     
    97144        QUIT 0
    98145        ;
     146RMCICK(PAT,CLINIC,DATE) ;PEP; Can you remove a check-in for this patient?
     147        ; PAT - DFN by value
     148        ; CLINIC - ^SC ien by value
     149        ; DATE - Appointment Date
     150        ; Output: 0 if okay or 1 if error
     151        ;
     152        ; Get appointment IEN in ^SC(DA(2),"S",DA(1),1,
     153        N SCIEN S SCIEN=$$SCIEN^BSDXAPI(PAT,CLINIC,DATE)
     154        ;
     155        ; If not there, it has been cancelled.
     156        I 'SCIEN QUIT 0
     157        ;
     158        ; Check if checked out
     159        I $$CO^BSDXAPI(PAT,CLINIC,DATE,SCIEN) Q 1_U_"Appointment Already Checked Out"
     160        ;
     161        QUIT 0
     162        ;
    99163UPDATENT(PAT,CLINIC,DATE,NOTE)  ; PEP; Update Note in ^SC for patient's appointment @ DATE
    100164        ; PAT = DFN
  • Scheduling/trunk/m/BSDXUT1.m

    r1464 r1466  
    1 BSDXUT1 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 6/29/12 12:32pm
     1BSDXUT1 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 7/3/12 12:28pm
    22        ;;1.7T1;BSDX;;Aug 31, 2011;Build 18
    33        ;
     
    9494        I APPID=0 W "Error in test 6",!
    9595        D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; Checkin
    96         S BSDXRESULT=$$RMCI^BSDXAPI(DFN,HLIEN,APPTTIME) ; remove checkin
     96        S BSDXRESULT=$$RMCI^BSDXAPI1(DFN,HLIEN,APPTTIME) ; remove checkin
    9797        D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; delete appt
    9898        I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!
     
    140140        I APPID=0 W "Error in test 6",!
    141141        D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; Checkin
    142         S BSDXRESULT=$$RMCI^BSDXAPI(DFN,HLIEN,APPTTIME) ; remove checkin
     142        S BSDXRESULT=$$RMCI^BSDXAPI1(DFN,HLIEN,APPTTIME) ; remove checkin
    143143        D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; delete appt
    144144        I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!
     
    191191        I +^BSDXTMP($J,1)=0 W "Error... task not created",! QUIT
    192192        ;
    193         W "Waiting for 5 seconds for it to finish",! HANG 5
     193        W "Waiting for 5 seconds for taskman to finish",! HANG 5
    194194        N DFN,APPTTIME S (DFN,APPTTIME)=""
    195195        F  S DFN=$O(BSDXAPPT(DFN)) Q:'DFN  D
     
    224224        I +^BSDXTMP($J,1)=0 W "Error... task not created",! QUIT
    225225        ;
    226         W "Waiting for 5 seconds for it to finish",! HANG 5
     226        W "Waiting for 5 seconds for taskman to finish",! HANG 5
    227227        W:^BSDXTMP("BSDXCOPY",+^BSDXTMP($J,1))'["  0 records" "Copy failed",!
    228228        QUIT
  • Scheduling/trunk/m/BSDXUT2.m

    r1464 r1466  
    1 BSDXUT2 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 6/29/12 12:23pm
     1BSDXUT2 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 7/3/12 12:03pm
    22        ;;1.7T1;BSDX;;Aug 31, 2011;Build 18
    33        ;
     
    4949        IF +^BSDXTMP($J,1)'=-2 WRITE "ERROR IN Etest 2",!
    5050        ; Tests for 3 to 5 difficult to produce
    51         ; Error tests follow: Mumps error test; Transaction restartability
     51        ; Error tests follow: Mumps error test;
     52        ; Error in RMCI
    5253        N BSDXDIE S BSDXDIE=1
    5354        D RMCI^BSDX25(.ZZZ,APPTID)
    5455        IF +^BSDXTMP($J,1)'=-100 WRITE "ERROR IN Etest 3",!
    5556        K BSDXDIE
     57        ; M Error in CHECKIN
     58        N BSDXDIE S BSDXDIE=1
     59        D CHECKIN^BSDX25(.ZZZ,APPTID,$$NOW^XLFDT())
     60        IF +^BSDXTMP($J,1)'=-100 WRITE "ERROR IN Etest 8",!
     61        K BSDXDIE
     62        ; M Error in $$CHECKIN^BSDXAPI
     63        N BSDXDIE2 S BSDXDIE2=1
     64        D CHECKIN^BSDX25(.ZZZ,APPTID,$$NOW^XLFDT())
     65        IF +^BSDXTMP($J,1)'=-100 WRITE "ERROR IN Etest 9",!
     66        K BSDXDIE2
     67        ;
     68        ; Get start and end times
     69        N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
     70        N APPTTIME S APPTTIME=$P(TIMES,U)
     71        N ENDTIME S ENDTIME=$P(TIMES,U,2)
     72        ;
     73        N ZZZ,DFN
     74        S DFN=5
     75        N ZZZ
     76        D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
     77        N APPTID S APPTID=+^BSDXTMP($J,1)
     78        N HL S HL=$$GET1^DIQ(9002018.4,APPTID,".07:.04","I")
     79        ;
     80        ; Simulated Error in $$BSDXCHK^BSDX25
     81        N BSDXSIMERR1 S BSDXSIMERR1=1
     82        D CHECKIN^BSDX25(.ZZZ,APPTID,$$NOW^XLFDT())
     83        IF +^BSDXTMP($J,1)'=-3 WRITE "ERROR in Etest 10",!
     84        IF $P(^BSDXAPPT(APPTID,0),U,3) WRITE "ERROR IN CHECKIN 111",!
     85        IF +$G(^SC(HL,"S",APPTTIME,1,1,"C")) WRITE "ERROR IN CHECKIN 112",!
     86        K BSDXSIMERR1
     87        ;
     88        ; Simulated Error in $$CHECKICK^BSDXAPI
     89        N BSDXSIMERR2 S BSDXSIMERR2=1
     90        D CHECKIN^BSDX25(.ZZZ,APPTID,$$NOW^XLFDT())
     91        IF +^BSDXTMP($J,1)'=-10 WRITE "ERROR in Etest 11",!
     92        IF $P(^BSDXAPPT(APPTID,0),U,3) WRITE "ERROR IN CHECKIN 113",!
     93        IF +$G(^SC(HL,"S",APPTTIME,1,1,"C")) WRITE "ERROR IN CHECKIN 114",!
     94        K BSDXSIMERR2
     95        ;
     96        ; Simulated Error in $$CHECKIN^BSDXAPI
     97        N BSDXSIMERR3 S BSDXSIMERR3=1
     98        D CHECKIN^BSDX25(.ZZZ,APPTID,$$NOW^XLFDT())
     99        IF +^BSDXTMP($J,1)'=-10 WRITE "ERROR in Etest 11",!
     100        IF $P(^BSDXAPPT(APPTID,0),U,3) WRITE "ERROR IN CHECKIN 115",!
     101        IF +$G(^SC(HL,"S",APPTTIME,1,1,"C")) WRITE "ERROR IN CHECKIN 116",!
     102        K BSDXSIMERR3
    56103        ;
    57104        ; Unlinked Clinic Tests
Note: See TracChangeset for help on using the changeset viewer.