- Timestamp:
- Feb 20, 2013, 6:15:15 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fmts/trunk/p/C0XPT3.m
r1607 r1608 1 C0XPT3 ;ISI/MLS,VEN/SMH -- MEDS IMPORT;2013-02- 19 5:01PM2 ;; FILEMAN TRIPLE STORE;1.0;;;Jun 26,2012;Build 291 C0XPT3 ;ISI/MLS,VEN/SMH -- MEDS IMPORT;2013-02-20 3:15 PM 2 ;;1.0;FILEMAN TRIPLE STORE;;Jun 26,2012;Build 29 3 3 ; 4 4 MEDS(G,DFN) ; Private Proc; Extract Medication Data from a Patient's Graph … … 8 8 ; 9 9 ; For each medication (I = COUNTER; S = Medication Node as Subject) 10 N I,S F I=0:0 S I=$O(^TMP($J,"MEDS",I)) Q:'I S S=^(I) DO MED1(G,S) 10 N I,S F I=0:0 S I=$O(^TMP($J,"MEDS",I)) Q:'I S S=^(I) DO MED1(G,S) 11 11 ; 12 12 K ^TMP($J,"MEDS") 13 13 QUIT 14 ; 14 15 MED1(G,S) ; Private Procedure; Process each medication in Graph. 15 16 ; G = Graph; S = Medication Description ID as subject. … … 17 18 ; 1. Start Date; obtain and then conv to fileman format 18 19 N STARTDT S STARTDT=$$GSPO1^C0XGET3(G,S,"sp:startDate") ; Duh! Start Date. 19 X "N %DT,X,Y S X=STARTDT D ^%DT S STARTDT=Y" ; New stack level for variables. 20 D 21 . N %DT,X,Y S X=STARTDT D ^%DT S STARTDT=Y ; New stack level for variables. 20 22 ; 21 23 ;DEBUG.ASSERT that STARTDT is greater than 1900 … … 35 37 ; 36 38 ; 5. Drug Name and Code 37 N RXN S RXN=$$GSPO1^C0XGET3(G,S,"sp:drugName.sp:code") ; RxNorm Code39 N RXN S RXN=$$GSPO1^C0XGET3(G,S,"sp:drugName.sp:code"),RXN=$P(RXN,"/",$L(RXN,"/")) ; RxNorm Code 38 40 N DN S DN=$$GSPO1^C0XGET3(G,S,"sp:drugName.dcterms:title") ; Drug Name 39 41 ; … … 41 43 ; 42 44 ; 6. Get Fill Dates 43 ;TODO. 45 N FULF ; Fulfillments 46 D GSPO^C0XGET3($NA(FULF),G,S,"sp:fulfillment") 47 ; 48 N FILLS ; Fills array. Contains every time a drug was dispensed. 49 N FILL S FILL="" F S FILL=$O(FULF(FILL)) Q:FILL="" D 50 . N S S S=FULF(FILL) ; New subject; subsumes above one in this loop 51 . ; 52 . ; Dispense Date 53 . N FILLDATE S FILLDATE=$$GSPO1^C0XGET3(G,S,"dcterms:date") 54 . D 55 . . N %DT,X,Y S X=FILLDATE D ^%DT S FILLDATE=Y 56 . I FILLDATE<2000000 W $EC=",U1," ; Converstion error 57 . ; 58 . S FILLS(RXN,FILLDATE,"sp:dispenseDaysSupply")=$$GSPO1^C0XGET3(G,S,"sp:dispenseDaysSupply") ; Self Explanatory? 59 . ; 60 . ; Get quantity value and unit 61 . S FILLS(RXN,FILLDATE,"sp:quantityDispensed.sp:value")=$$GSPO1^C0XGET3(G,S,"sp:quantityDispensed.sp:value") 62 . S FILLS(RXN,FILLDATE,"sp:quantityDispensed.sp:unit")=$TR($$GSPO1^C0XGET3(G,S,"sp:quantityDispensed.sp:unit"),"{}") 63 ; 64 ZWRITE:$D(FILLS) FILLS 44 65 QUIT 45 66 ; 46 67 MED(ISIMISC) ;Create med order entry 47 68 ; Input - ISIMISC(ARRAY) … … 67 88 Q ISIRC 68 89 ; 69 PREP 90 PREP ; 70 91 ; 71 92 N EXIT … … 75 96 S PROV=ISIMISC("PROV") ;NEW PERSON FILE (#200) 76 97 S PSODRUG=ISIMISC("DRUG") ;"" ;POINTER TO DRUG FILE (#50) 77 S PSODRUG("DEA")=$P($G(^PSDRUG(PSODRUG,0)),U,3) 98 S PSODRUG("DEA")=$P($G(^PSDRUG(PSODRUG,0)),U,3) 78 99 S QTY=ISIMISC("QTY") ;NUMBER ;0;7 NUMBER (Required) 79 100 S DAYSUPLY=ISIMISC("SUPPLY") ;NUMBER ; 0;8 NUMBER (Required) … … 101 122 Q 102 123 ; 103 CREATE 104 D AUTO^PSONRXN 124 CREATE ; 125 D AUTO^PSONRXN ;RX auto number 105 126 I $G(PSONEW("RX #"))="" S ISIRC="-1^RX Auto number error." Q 106 127 S RXNUM=PSONEW("RX #") 107 128 ; 108 129 S PSOIEN=$P($G(^PSRX(0)),"^",3)+1 109 I $D(^PSRX(PSOIEN)) S ISIRC="-1^Problem with PSRX (#50) internal counter" Q ;pointer error130 I $D(^PSRX(PSOIEN)) S ISIRC="-1^Problem with PSRX (#50) internal counter" Q ;pointer error 110 131 S $P(^PSRX(0),U,3)=PSOIEN 111 132 ; … … 137 158 ; 138 159 S ^PSRX(PSOIEN,"A",0)="^52.3DA^1^1" 139 S $P(^PSRX(PSOIEN,"A",1,0),"^",1)=LOGDT 160 S $P(^PSRX(PSOIEN,"A",1,0),"^",1)=LOGDT ;DATE 140 161 S $P(^PSRX(PSOIEN,"A",1,0),"^",2)=REASON ;SET 141 162 S $P(^PSRX(PSOIEN,"A",1,0),"^",3)=INIT ;NEW PERSON FILE (#200) … … 153 174 ; 154 175 ;S ^PSRX(PSOIEN,"IB")=TRNSTYP ;COPAY TRANSACTION TYPE IB ACTION TYPE FILE (#350.1) 155 S ^PSRX(PSOIEN,"TYPE")=0 176 S ^PSRX(PSOIEN,"TYPE")=0 ;TYPE OF RX TYPE;1 NUMBER 156 177 D OERR,F55,F52,F525 157 178 Q
Note:
See TracChangeset
for help on using the changeset viewer.