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

This commit is contained in:
sam 2013-05-04 00:52:48 +00:00
parent e00ebfb9c2
commit da8f4928af
2 changed files with 67 additions and 10 deletions

View File

@ -1,4 +1,4 @@
C0XPT0 ; VEN/SMH - Get patient data and do something about it ;2013-05-01 9:54 AM C0XPT0 ; VEN/SMH - Get patient data and do something about it ;2013-05-03 6:09 PM
;;1.1;FILEMAN TRIPLE STORE;; ;;1.1;FILEMAN TRIPLE STORE;;
; (C) Sam Habiel 2013 ; (C) Sam Habiel 2013
; Proprietary code. Stay out! ; Proprietary code. Stay out!
@ -187,12 +187,29 @@ VITALS(G,DFN) ; Private EP; Process Vitals for a patient graph.
QUIT QUIT
; ;
NP() ; New Person Entry NP() ; New Person Entry
N C0XFDA,C0XIEN,C0XERR Q:$O(^VA(200,"B","PROVIDER,UNKNOWN SMART",0)) $O(^(0)) ; Quit if the entry exists
;
N C0XFDA,C0XIEN,C0XERR,DIERR
S C0XFDA(200,"?+1,",.01)="PROVIDER,UNKNOWN SMART" ; Name S C0XFDA(200,"?+1,",.01)="PROVIDER,UNKNOWN SMART" ; Name
S C0XFDA(200,"?+1,",1)="USP" ; Initials S C0XFDA(200,"?+1,",1)="USP" ; Initials
S C0XFDA(200,"?+1,",28)="SMART" ; Mail Code S C0XFDA(200,"?+1,",28)="SMART" ; Mail Code
S C0XFDA(200.05,"?+2,?+1,",.01)="`144" ; Person Class - Allopathic docs.
S C0XFDA(200.05,"?+2,?+1,",2)=2700101 ; Date active
; ;
N DIC S DIC(0)="" ; An XREF in File 200 requires this. N DIC S DIC(0)="" ; An XREF in File 200 requires this.
D UPDATE^DIE("E",$NA(C0XFDA),$NA(C0XIEN),$NA(C0XERR)) ; Typical UPDATE D UPDATE^DIE("E",$NA(C0XFDA),$NA(C0XIEN),$NA(C0XERR)) ; Typical UPDATE
I $D(DIERR) S $EC=",U1,"
Q C0XIEN(1) ;Provider IEN Q C0XIEN(1) ;Provider IEN
; ;
HL() ; Hospital Location Entry
N C0XFDA,C0XIEN,C0XERR,DIERR
S C0XFDA(44,"?+1,",.01)="SMART PATIENT LOCATION" ; Name
S C0XFDA(44,"?+1,",2)="C" ; Type - Clinic
S C0XFDA(44,"?+1,",2.1)=1 ; Type Extension - Clinic
S C0XFDA(44,"?+1,",3)=+$$SITE^VASITE() ; Institution - Default institution
S C0XFDA(44,"?+1,",8)=295 ; STOP CODE NUMBER - Primary Care
S C0XFDA(44,"?+1,",9)="M" ; SERVICE
S C0XFDA(44,"?+1,",2502)="Y" ; NON-COUNT CLINIC
D UPDATE^DIE("",$NA(C0XFDA),$NA(C0XIEN),$NA(C0XERR))
I $D(DIERR) S $EC=",U1,"
Q C0XIEN(1) ; HL IEN

View File

@ -1,4 +1,4 @@
C0XPT4 ; VEN/SMH - Encounter Processing;2013-05-01 4:09 PM C0XPT4 ; VEN/SMH - Encounter Processing;2013-05-03 5:11 PM
;;1.0;FILEMAN TRIPLE STORE; ;;1.0;FILEMAN TRIPLE STORE;
; (c) 2013 Sam Habiel ; (c) 2013 Sam Habiel
; Currently proprietary code. Stay out!!! ; Currently proprietary code. Stay out!!!
@ -17,6 +17,7 @@ ENC(G,DFN) ; Extract and then process encounters; PEP
. S STARTDATE=$$FMDATE(STARTDATE) . S STARTDATE=$$FMDATE(STARTDATE)
. W " ",STARTDATE . W " ",STARTDATE
. D HISTENC(STARTDATE,DFN) ; Historical Encounter Private API . D HISTENC(STARTDATE,DFN) ; Historical Encounter Private API
K ^TMP($J,"ENC") ; data location
QUIT QUIT
; ;
; ;
@ -57,21 +58,27 @@ HISTENC(DATE,DFN,FTLOC,COMMENT) ; Private Proc; Historical Encounter Filing into
N C0XDATA N C0XDATA
S C0XDATA("ENCOUNTER",1,"ENC D/T")=DATE S C0XDATA("ENCOUNTER",1,"ENC D/T")=DATE
S C0XDATA("ENCOUNTER",1,"PATIENT")=DFN S C0XDATA("ENCOUNTER",1,"PATIENT")=DFN
S C0XDATA("ENCOUNTER",1,"SERVICE CATEGORY")="E" ; EVENT S C0XDATA("ENCOUNTER",1,"HOS LOC")=$$HL^C0XPT0()
S C0XDATA("ENCOUNTER",1,"OUTSIDE LOCATION")=FTLOC S C0XDATA("ENCOUNTER",1,"SERVICE CATEGORY")="A" ; Ambulatory
S C0XDATA("ENCOUNTER",1,"OUTSIDE LOCATION")="FROM THE WIDE WORLD"
S C0XDATA("ENCOUNTER",1,"ENCOUNTER TYPE")="P" ; Primary S C0XDATA("ENCOUNTER",1,"ENCOUNTER TYPE")="P" ; Primary
S C0XDATA("ENCOUNTER",1,"COMMENT")=COMMENT S C0XDATA("PROVIDER",1,"NAME")=$$NP^C0XPT0()
; Diangosis and procedure necessary so visit will show up in ^SDE.
S C0XDATA("DX/PL",1,"DIAGNOSIS")=$O(^ICD9("BA","V70.3 ",0))
S C0XDATA("PROCEDURE",1,"PROCEDURE")=$O(^ICPT("B","99201",0))
S C0XDATA("PROCEDURE",1,"QTY")=1
; ;
N C0XVISIT,C0XERR ; Visit, Error N C0XVISIT,C0XERR ; Visit, Error
N XQORMUTE S XQORMUTE=1 ; Unwinder: Shut the hell up. Don't execute disabled protocols rather than whining about them.
N OK S OK=$$DATA2PCE^PXAPI($NA(C0XDATA),PKG,SRC,.C0XVISIT,,,.C0XERR) N OK S OK=$$DATA2PCE^PXAPI($NA(C0XDATA),PKG,SRC,.C0XVISIT,,,.C0XERR)
I 'OK S $EC=",U1," I OK<1 S $EC=",U1,"
QUIT QUIT
; ;
; ;
DELALL(DFN) ; Private Proc; Delete ALL ALL ALL encounter information for the patient. DELALL(DFN) ; Private Proc; Delete ALL ALL ALL encounter information for the patient.
; BE VERY CAREFUL USING THIS... ; BE VERY CAREFUL USING THIS...
; Walk through the C X-Ref for this patient ; Walk through the C X-Ref for this patient
N I S I=9000009.999999999999 ; Hit the VISIT file first N I S I=9000010 ; Hit the VISIT file LAST as some xrefs in other files point to it!
N DIK,DA N DIK,DA
F S I=$O(^DIC(I)) Q:I'<9000011 D ; For each V File... F S I=$O(^DIC(I)) Q:I'<9000011 D ; For each V File...
. N OR S OR=$$ROOT^DILFD(I,"",0) ; Open Root for ^DIK . N OR S OR=$$ROOT^DILFD(I,"",0) ; Open Root for ^DIK
@ -82,6 +89,12 @@ DELALL(DFN) ; Private Proc; Delete ALL ALL ALL encounter information for the pat
. N J S J="" F S J=$O(@CR@("C",DFN,J)) Q:'J S DA=J D ^DIK ; each entry to kill . N J S J="" F S J=$O(@CR@("C",DFN,J)) Q:'J S DA=J D ^DIK ; each entry to kill
. ; W ! ; DEBUG . ; W ! ; DEBUG
; ;
; Visit file
N I S I=""
S DIK="^AUPNVSIT("
F S I=$O(^AUPNVSIT("C",DFN,I)) Q:'I S DA=I D ^DIK ;ditto
;
; Outpatient encounter file
N I S I="" N I S I=""
; W "SCE: " ; Debug ; W "SCE: " ; Debug
S DIK="^SCE(" ; ditto S DIK="^SCE(" ; ditto
@ -94,8 +107,8 @@ TEST ; Test creating an encounter using DATA2PCE^PXAPI
; This code comes from EDP aka EDIS. ; This code comes from EDP aka EDIS.
N DFN S DFN=188 ; One of those Ducks N DFN S DFN=188 ; One of those Ducks
;S LOC=$$GET^XPAR(DUZ(2)_";DIC(4,","EDPF LOCATION") ;S LOC=$$GET^XPAR(DUZ(2)_";DIC(4,","EDPF LOCATION")
S LOC=2 ; DR OFFICE N LOC S LOC=2 ; DR OFFICE
N EDPKG,EDPSRC,OK N EDPKG,EDPSRC,OK,EDPDATA,EDPVISIT,ERR
S EDPKG=$O(^DIC(9.4,"B","EMERGENCY DEPARTMENT",0)) S EDPKG=$O(^DIC(9.4,"B","EMERGENCY DEPARTMENT",0))
S EDPSRC="EDP TRACKING LOG" S EDPSRC="EDP TRACKING LOG"
S EDPDATA("ENCOUNTER",1,"PATIENT")=DFN S EDPDATA("ENCOUNTER",1,"PATIENT")=DFN
@ -131,5 +144,32 @@ TEST2 ; Test creating an historical event
S C0XDATA("ENCOUNTER",1,"ENCOUNTER TYPE")="P" ; Primary S C0XDATA("ENCOUNTER",1,"ENCOUNTER TYPE")="P" ; Primary
S C0XDATA("ENCOUNTER",1,"COMMENT")="Testing" S C0XDATA("ENCOUNTER",1,"COMMENT")="Testing"
; ;
N OK,C0XVISIT,ERR
S OK=$$DATA2PCE^PXAPI($NA(C0XDATA),PKG,SRC,.C0XVISIT,,,.ERR) S OK=$$DATA2PCE^PXAPI($NA(C0XDATA),PKG,SRC,.C0XVISIT,,,.ERR)
QUIT QUIT
TEST3 ; Test creating a real event
;
N DFN S DFN=190
N LOC S LOC=$$HL^C0XPT0()
N PKG S PKG=$O(^DIC(9.4,"B","FILEMAN TRIPLE STORE",0))
I 'PKG S $EC=",U1,"
;
N SRC S SRC="FMTS TEST"
;
N C0XDATA
S C0XDATA("ENCOUNTER",1,"ENC D/T")=$$NOW^XLFDT
S C0XDATA("ENCOUNTER",1,"PATIENT")=DFN
S C0XDATA("ENCOUNTER",1,"HOS LOC")=LOC
S C0XDATA("ENCOUNTER",1,"SERVICE CATEGORY")="A" ; Ambulatory
S C0XDATA("ENCOUNTER",1,"OUTSIDE LOCATION")="FROM THE WIDE WORLD"
S C0XDATA("ENCOUNTER",1,"ENCOUNTER TYPE")="P" ; Primary
S C0XDATA("PROVIDER",1,"NAME")=$$NP^C0XPT0()
S C0XDATA("DX/PL",1,"DIAGNOSIS")=$O(^ICD9("BA","V70.3 ",0))
S C0XDATA("PROCEDURE",1,"PROCEDURE")=$O(^ICPT("B","99201",0))
S C0XDATA("PROCEDURE",1,"QTY")=1
;
N OK,C0XVISIT,ERR
S OK=$$DATA2PCE^PXAPI($NA(C0XDATA),PKG,SRC,.C0XVISIT,,,.ERR)
;ZWRITE OK,C0XVISIT
;ZWRITE:$D(ERR) ERR
QUIT