Changeset 1613 for fmts/trunk/p


Ignore:
Timestamp:
Apr 8, 2013, 3:43:58 PM (12 years ago)
Author:
Sam Habiel
Message:

Changes I forgot to commit

File:
1 edited

Legend:

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

    r1609 r1613  
    1 C0XPT3  ;ISI/MLS,VEN/SMH -- MEDS IMPORT ;2013-02-21  5:05 PM
     1C0XPT3  ;ISI/MLS,VEN/SMH -- MEDS IMPORT ;2013-02-22  3:38 PM
    22        ;;1.0;FILEMAN TRIPLE STORE;;Jun 26,2012;Build 29
    33        ;
     
    77        D ONETYPE^C0XGET3($NA(^TMP($J,"MEDS")),G,"sp:Medication")
    88        ;
    9         ; For each medication (I = COUNTER; S = Medication Node as Subject)
     9        ; For each medication (C0XI = COUNTER; S = Medication Node as Subject)
    1010        N C0XI,S F C0XI=0:0 S C0XI=$O(^TMP($J,"MEDS",C0XI)) Q:'C0XI  S S=^(C0XI) DO MED1(G,S,DFN)
    1111        K ^TMP($J,"MEDS")
     
    6868        . I FILDT S FILQTY=FILLS(RXN,FILDT,"sp:quantityDispensed.sp:value"),FILDAYS=FILLS(RXN,FILDT,"sp:dispenseDaysSupply")
    6969        . E  S (FILQTY,FILDAYS)=""
    70         . D PREP(DFN,RXN,INST,FILDT,FILQTY,FILDAYS)
     70        . D PREP(DFN,RXN,INST,FILDT,FILQTY,FILDAYS,.FILLS)
    7171        ;
    7272        QUIT
    73 PREP(DFN,RXN,INST,FILDT,FILQTY,FILDAYS) ;
     73        ;
     74PREP(DFN,RXN,INST,FILDT,FILQTY,FILDAYS,FILLS) ;
     75        ; TODO:
     76        ; 1. Resolve medication
     77        ; 2. Figure out what to do with meds that have no fill history (omit?)
     78        ; 3. Don't file a med twice! Check ^PXRMINDX to make sure it aint there first
     79        ; 4. Compute the number of refills for original number so that remaining refills aren't displayed as negative
     80        ; 5. Original fill doesn't have a dispense comment
     81        ; 6. Coded sig (FVALUE, FUNIT, DOSE, DUNIT)
     82        ; 7. Fill label log section of Rx? Maybe not.
    7483        N ORZPT,PSODFN S (ORZPT,PSODFN)=DFN  ;"" ;POINTER TO PATIENT FILE (#2)
    7584        N PNTSTAT S PNTSTAT=20 ; NON-VA ;RX PATIENT STATUS FILE (#53)
     
    99108        N LDISPDT S LDISPDT=FILLDT ;    3;1 DATE
    100109        N REASON S REASON="E" ;Activity log ; SET ([E]dit)
    101         N INIT S INIT=DUZ ;NEW PERSON FILE (#200)
     110        N INIT S INIT=.5 ;NEW PERSON FILE (#200)
    102111        N COM S COM="Oupatient medication order." ;TEXT
    103112        N SIG S SIG=INST ;#51,.01
     
    115124        S $P(^PSRX(0),U,3)=PSOIEN ; Reset next available number.
    116125        S $P(^PSRX(PSOIEN,0),"^",1)=RXNUM ; 0;1 FREE TEXT (Required)
     126        L +^PSRX(PSOIEN):0 ; Lock record node
    117127        L -^PSRX(0) ; Unlock zero node, we now got it
    118128        ;
    119         L +^PSRX(PSOIEN):0 ; Lock record node
    120129        S $P(^PSRX(PSOIEN,0),"^",13)=ISSDT ; 0;13 DATE (Required)
    121130        S $P(^PSRX(PSOIEN,0),"^",2)=ORZPT ;POINTER TO PATIENT FILE (#2)
     
    143152        S $P(^PSRX(PSOIEN,3),U,1)=DISPDT ;LAST DISPENSED DATE    3;1 DATE
    144153        ;
    145         S ^PSRX(PSOIEN,"A",0)="^52.3DA^1^1"
    146         S $P(^PSRX(PSOIEN,"A",1,0),"^",1)=LOGDT ;DATE
    147         S $P(^PSRX(PSOIEN,"A",1,0),"^",2)=REASON ;SET
    148         S $P(^PSRX(PSOIEN,"A",1,0),"^",3)=INIT ;NEW PERSON FILE (#200)
    149         S $P(^PSRX(PSOIEN,"A",1,0),"^",4)=0 ;NUMBER - RX REFERENCE
    150         S $P(^PSRX(PSOIEN,"A",1,0),"^",5)="ISI automated entry." ;TEXT
     154        N C0XFILL S C0XFILL=""
     155        N C0XREFCT S C0XREFCT=0
     156        F  S C0XFILL=$O(FILLS(RXN,C0XFILL)) Q:C0XFILL=""  D
     157        . S ^PSRX(PSOIEN,"A",0)="^52.3DA"_U_(C0XREFCT+1)_U_(C0XREFCT+1)
     158        . S $P(^PSRX(PSOIEN,"A",C0XREFCT+1,0),"^",1)=LOGDT ;DATE
     159        . S $P(^PSRX(PSOIEN,"A",C0XREFCT+1,0),"^",2)="N" ;SET ; Dispensed using external interface
     160        . S $P(^PSRX(PSOIEN,"A",C0XREFCT+1,0),"^",3)=INIT ;NEW PERSON FILE (#200)
     161        . S $P(^PSRX(PSOIEN,"A",C0XREFCT+1,0),"^",4)=0 ;NUMBER - RX REFERENCE
     162        . S $P(^PSRX(PSOIEN,"A",C0XREFCT+1,0),"^",5)="Imported from Smart" ;TEXT
     163        . ;
     164        . Q:C0XFILL=FILDT  ; Don't add refill data for first fill!
     165        . ;
     166        . ; Increment counter
     167        . S C0XREFCT=C0XREFCT+1
     168        . ;
     169        . S ^PSRX(PSOIEN,1,0)="^52.1DA"_U_(C0XREFCT)_U_(C0XREFCT)
     170        . S $P(^PSRX(PSOIEN,1,C0XREFCT,0),"^",1)=C0XFILL ; REFILL DATE [D]
     171        . S $P(^PSRX(PSOIEN,1,C0XREFCT,0),"^",2)=MLWIND  ; MAIL/WINDOW [RS]
     172        . S $P(^PSRX(PSOIEN,1,C0XREFCT,0),"^",3)="Imported from Smart" ; REMARKS [F]
     173        . S $P(^PSRX(PSOIEN,1,C0XREFCT,0),"^",4)=FILLS(RXN,C0XFILL,"sp:quantityDispensed.sp:value") ; QTY [RNJ12,2X]
     174        . S $P(^PSRX(PSOIEN,1,C0XREFCT,0),"^",5)=.5 ; PHARMACIST NAME [*P200']
     175        . S $P(^PSRX(PSOIEN,1,C0XREFCT,0),"^",6)="" ; LOT [F]
     176        . S $P(^PSRX(PSOIEN,1,C0XREFCT,0),"^",7)=.5 ; CLERK CODE [RP200']
     177        . S $P(^PSRX(PSOIEN,1,C0XREFCT,0),"^",8)="" ; LOGIN DATE [D]
     178        . S $P(^PSRX(PSOIEN,1,C0XREFCT,0),"^",9)="" ; DIVISION [RP59']
     179        . S $P(^PSRX(PSOIEN,1,C0XREFCT,0),"^",17)=PROV ; PROVIDER [R*P200X'I]
     180        . S $P(^PSRX(PSOIEN,1,C0XREFCT,0),"^",19)=C0XFILL ; DISPENSED DATE [RD]
    151181        ;
    152182        S ^PSRX(PSOIEN,"OR1")=PORDITM ;PHARMACY ORDERABLE ITEM FILE (#50.7)
     
    161191        ;S ^PSRX(PSOIEN,"IB")=TRNSTYP ;COPAY TRANSACTION TYPE   IB ACTION TYPE FILE (#350.1)
    162192        S ^PSRX(PSOIEN,"TYPE")=0 ;TYPE OF RX             TYPE;1 NUMBER
    163         D OERR(PSOIEN),F55,F52,F525
     193        D OERR(PSOIEN),F55,F52(PSOIEN),F525
    164194        L -PSRX(PSOIEN) ; Unlock record
    165195        Q
     
    180210        K PSOX1
    181211        Q
    182 F52     ;; - Re-indexing file 52 entry
    183         K DIK,DA S DIK="^PSRX(",DA=PSOIEN D IX1^DIK K DIK
     212F52(PSOIEN)     ;; - Re-indexing file 52 entry
     213        N DIK,DA S DIK="^PSRX(",DA=PSOIEN D IX1^DIK K DIK
    184214        Q
    185215        ;
Note: See TracChangeset for help on using the changeset viewer.