Changeset 1621 for fmts/trunk/p/C0XPT4.m


Ignore:
Timestamp:
May 3, 2013, 8:52:48 PM (12 years ago)
Author:
Sam Habiel
Message:

boy oh boy now we file fully fledged ambulatory encounters that can show up on the CPRS cover sheet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fmts/trunk/p/C0XPT4.m

    r1620 r1621  
    1 C0XPT4 ; VEN/SMH - Encounter Processing;2013-05-01  4:09 PM
     1C0XPT4 ; VEN/SMH - Encounter Processing;2013-05-03  5:11 PM
    22 ;;1.0;FILEMAN TRIPLE STORE;
    33 ; (c) 2013 Sam Habiel
     
    1818        . W " ",STARTDATE
    1919        . D HISTENC(STARTDATE,DFN) ; Historical Encounter Private API
     20        K ^TMP($J,"ENC") ; data location
    2021        QUIT
    2122        ;
     
    5859        S C0XDATA("ENCOUNTER",1,"ENC D/T")=DATE
    5960        S C0XDATA("ENCOUNTER",1,"PATIENT")=DFN
    60         S C0XDATA("ENCOUNTER",1,"SERVICE CATEGORY")="E" ; EVENT
    61         S C0XDATA("ENCOUNTER",1,"OUTSIDE LOCATION")=FTLOC
     61        S C0XDATA("ENCOUNTER",1,"HOS LOC")=$$HL^C0XPT0()
     62        S C0XDATA("ENCOUNTER",1,"SERVICE CATEGORY")="A" ; Ambulatory
     63        S C0XDATA("ENCOUNTER",1,"OUTSIDE LOCATION")="FROM THE WIDE WORLD"
    6264        S C0XDATA("ENCOUNTER",1,"ENCOUNTER TYPE")="P" ; Primary
    63         S C0XDATA("ENCOUNTER",1,"COMMENT")=COMMENT
     65        S C0XDATA("PROVIDER",1,"NAME")=$$NP^C0XPT0()
     66        ; Diangosis and procedure necessary so visit will show up in ^SDE.
     67        S C0XDATA("DX/PL",1,"DIAGNOSIS")=$O(^ICD9("BA","V70.3 ",0))
     68        S C0XDATA("PROCEDURE",1,"PROCEDURE")=$O(^ICPT("B","99201",0))
     69        S C0XDATA("PROCEDURE",1,"QTY")=1
    6470        ;
    6571        N C0XVISIT,C0XERR ; Visit, Error
     72        N XQORMUTE S XQORMUTE=1 ; Unwinder: Shut the hell up. Don't execute disabled protocols rather than whining about them.
    6673        N OK S OK=$$DATA2PCE^PXAPI($NA(C0XDATA),PKG,SRC,.C0XVISIT,,,.C0XERR)
    67         I 'OK S $EC=",U1,"
     74        I OK<1 S $EC=",U1,"
    6875        QUIT
    6976        ;
     
    7279        ; BE VERY CAREFUL USING THIS...
    7380        ; Walk through the C X-Ref for this patient
    74         N I S I=9000009.999999999999  ; Hit the VISIT file first
     81        N I S I=9000010  ; Hit the VISIT file LAST as some xrefs in other files point to it!
    7582        N DIK,DA
    7683        F  S I=$O(^DIC(I)) Q:I'<9000011  D  ; For each V File...
     
    8390        . ; W ! ; DEBUG
    8491        ;
     92        ; Visit file
     93        N I S I=""
     94        S DIK="^AUPNVSIT("
     95        F  S I=$O(^AUPNVSIT("C",DFN,I)) Q:'I  S DA=I D ^DIK ;ditto
     96        ;
     97        ; Outpatient encounter file
    8598        N I S I=""
    8699        ; W "SCE: " ; Debug
     
    95108        N DFN S DFN=188 ; One of those Ducks
    96109        ;S LOC=$$GET^XPAR(DUZ(2)_";DIC(4,","EDPF LOCATION")
    97         S LOC=2 ; DR OFFICE
    98         N EDPKG,EDPSRC,OK
     110        N LOC S LOC=2 ; DR OFFICE
     111        N EDPKG,EDPSRC,OK,EDPDATA,EDPVISIT,ERR
    99112        S EDPKG=$O(^DIC(9.4,"B","EMERGENCY DEPARTMENT",0))
    100113        S EDPSRC="EDP TRACKING LOG"
     
    132145        S C0XDATA("ENCOUNTER",1,"COMMENT")="Testing"
    133146        ;
     147        N OK,C0XVISIT,ERR
    134148        S OK=$$DATA2PCE^PXAPI($NA(C0XDATA),PKG,SRC,.C0XVISIT,,,.ERR)
    135149        QUIT
     150TEST3 ; Test creating a real event
     151        ;
     152        N DFN S DFN=190
     153        N LOC S LOC=$$HL^C0XPT0()
     154        N PKG S PKG=$O(^DIC(9.4,"B","FILEMAN TRIPLE STORE",0))
     155        I 'PKG S $EC=",U1,"
     156        ;
     157        N SRC S SRC="FMTS TEST"
     158        ;
     159        N C0XDATA
     160        S C0XDATA("ENCOUNTER",1,"ENC D/T")=$$NOW^XLFDT
     161        S C0XDATA("ENCOUNTER",1,"PATIENT")=DFN
     162        S C0XDATA("ENCOUNTER",1,"HOS LOC")=LOC
     163        S C0XDATA("ENCOUNTER",1,"SERVICE CATEGORY")="A" ; Ambulatory
     164        S C0XDATA("ENCOUNTER",1,"OUTSIDE LOCATION")="FROM THE WIDE WORLD"
     165        S C0XDATA("ENCOUNTER",1,"ENCOUNTER TYPE")="P" ; Primary
     166        S C0XDATA("PROVIDER",1,"NAME")=$$NP^C0XPT0()
     167        S C0XDATA("DX/PL",1,"DIAGNOSIS")=$O(^ICD9("BA","V70.3 ",0))
     168        S C0XDATA("PROCEDURE",1,"PROCEDURE")=$O(^ICPT("B","99201",0))
     169        S C0XDATA("PROCEDURE",1,"QTY")=1
     170        ;
     171        N OK,C0XVISIT,ERR
     172        S OK=$$DATA2PCE^PXAPI($NA(C0XDATA),PKG,SRC,.C0XVISIT,,,.ERR)
     173        ;ZWRITE OK,C0XVISIT
     174        ;ZWRITE:$D(ERR) ERR
     175        QUIT
Note: See TracChangeset for help on using the changeset viewer.