Ignore:
Timestamp:
Jun 27, 2012, 7:45:33 PM (12 years ago)
Author:
Sam Habiel
Message:

Done refactoring BSDX31 plus all Unit Tests

File:
1 edited

Legend:

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

    r1461 r1462  
    1 BSDXAPI1 ; VEN/SMH - SCHEDULING APIs - Continued!!! ; 6/26/12 4:32pm
     1BSDXAPI1 ; VEN/SMH - SCHEDULING APIs - Continued!!! ; 6/27/12 4:45pm
    22        ;;1.7T1;BSDX;;Aug 31, 2011;Build 18
    33        ; Licensed under LGPL 
     
    77        ; CLINIC = SC IEN
    88        ; DATE = FM Date/Time of Appointment
    9         ; NSFLAG = truthy value to add no-show, or falsy to remove
    10         ; -1^error for failure, 0 for success
     9        ; NSFLAG = truthy value to add no-show, or falsy to remove (use 1 or 0 pls!)
     10        ; 1^error for failure, 0 for success
    1111        ; Code follows EN1^SDN
     12        ;
     13        ; Check for failure conditions first before doing this. No globals set here
    1214        N NOSHOWCK S NOSHOWCK=$$NOSHOWCK(PAT,CLINIC,DATE,NSFLAG)
    1315        I NOSHOWCK Q NOSHOWCK
    1416        ;
     17        ; Set up Protocol Driver
    1518        N SDNSHDL,SDDA S SDNSHDL=$$HANDLE^SDAMEVT(1) S SDDA=$$SCIEN^BSDXAPI(PAT,CLINIC,DATE)
    1619        N SDATA
    17         D BEFORE^SDAMEVT(.SDATA,PAT,DATE,CLINIC,SDDA,SDNSHDL)
     20        D BEFORE^SDAMEVT(.SDATA,PAT,DATE,CLINIC,SDDA,SDNSHDL) ; Only ^TMP set here.
     21        ;
     22        ; Simulated Errors
     23        Q:$D(BSDXSIMERR2) 1_U_"Simulated Error"
     24        ;
     25        ; Edit the ^DPT( "S" node entry - Noshow or undo noshow
     26        ; Failure analysis: if we fail here, we presume no change happened in
     27        ; ^DPT(DA,"S", and so we just have to roll back ^BSDXAPPT
    1828        N BSDXIENS S BSDXIENS=DATE_","_PAT_","
    1929        N BSDXFDA
     
    2939        D FILE^DIE("","BSDXFDA","BSDXMSG")
    3040        Q:$D(BSDXMSG) 1_U_"Fileman edit to DPT error: Patient="_PAT_" Appt="_DATE_" Error="_BSDXMSG("DIERR",1,"TEXT",1)
     41        ;
     42        ; 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
     45        ; error. Infinite Errors then.
     46        I $D(BSDXSIMERR3) N X S X=1/0
     47        ;
     48        ; Run the event driver
    3149        D NOSHOW^SDAMEVT(.SDATA,PAT,DATE,CLINIC,SDDA,0,SDNSHDL)
    3250        Q 0
     51        ;
    3352NOSHOWCK(PAT,CLINIC,DATE,NSFLAG) ; $$ PEP; No-show Check
    34         ; pars are the same as above
     53        ; TODO: Not all appointments can be no showed.
     54        ; Check the code in SDAMN
     55        ; S SDSTB=$$STATUS^SDAM1(DFN,SDT,SDCL,$G(^DPT(DFN,"S",SDT,0))) ; before status 
     56        ; Q:'$$CHK ; Checks $D(^SD(409.63,"ANS",1,+SDSTB))
    3557        QUIT 0
Note: See TracChangeset for help on using the changeset viewer.