[613] | 1 | PXRMVCPT ; SLC/PKR - Code to handle VCPT data. ;10/21/2005
|
---|
| 2 | ;;2.0;CLINICAL REMINDERS;**4**;Feb 04, 2005;Build 21
|
---|
| 3 | ;
|
---|
| 4 | ;===============================================
|
---|
| 5 | FPDAT(DFN,TAXARR,NGET,SDIR,BDT,EDT,FLIST) ;Find data for a patient.
|
---|
| 6 | N DAS,DATE,DS,EDTT,ICPTP,NFOUND,NODE,NNODE,TDATE,TIND,TE,TLIST,TS
|
---|
| 7 | I $G(^PXRMINDX(9000010.18,"DATE BUILT"))="" D Q
|
---|
| 8 | . D NOINDEX^PXRMERRH("TX",TAXARR("IEN"),9000010.18)
|
---|
| 9 | I '$D(^PXRMINDX(9000010.18,"PPI",DFN)) Q
|
---|
| 10 | S NNODE=+$P($G(TAXARR("PDS",9000010.18,81)),U,2)
|
---|
| 11 | I NNODE=0 Q
|
---|
| 12 | ;Get the start and end of the taxonomy.
|
---|
| 13 | S TS=$O(TAXARR(81,""))-1
|
---|
| 14 | S TE=$O(TAXARR(81,""),-1)
|
---|
| 15 | S EDTT=$S(EDT[".":EDT+.0000001,1:EDT+.240001)
|
---|
| 16 | S DS=$S(SDIR=+1:BDT-.000001,1:EDTT)
|
---|
| 17 | S NFOUND=0
|
---|
| 18 | F IND=1:1:NNODE D
|
---|
| 19 | . S NODE=TAXARR("PDS",9000010.18,81,IND)
|
---|
| 20 | . S ICPTP=TS
|
---|
| 21 | . F S ICPTP=$O(^PXRMINDX(9000010.18,"PPI",DFN,NODE,ICPTP)) Q:(ICPTP>TE)!(ICPTP="") D
|
---|
| 22 | .. I '$D(TAXARR(81,ICPTP)) Q
|
---|
| 23 | .. S DATE=DS
|
---|
| 24 | .. F S DATE=+$O(^PXRMINDX(9000010.18,"PPI",DFN,NODE,ICPTP,DATE),SDIR) Q:$S(DATE=0:1,DATE<BDT:1,DATE>EDTT:1,1:0) D
|
---|
| 25 | ... S DAS=$O(^PXRMINDX(9000010.18,"PPI",DFN,NODE,ICPTP,DATE,""))
|
---|
| 26 | ... S NFOUND=NFOUND+1
|
---|
| 27 | ... S TLIST(DATE,NFOUND)=DAS_U_ICPTP_U_NODE_U_"CPT"
|
---|
| 28 | ... I NFOUND>NGET D
|
---|
| 29 | .... S TDATE=$O(TLIST(""),-SDIR),TIND=$O(TLIST(TDATE,""))
|
---|
| 30 | .... K TLIST(TDATE,TIND)
|
---|
| 31 | ;Return up to NGET of the most recent entries.
|
---|
| 32 | S NFOUND=0
|
---|
| 33 | S DATE=""
|
---|
| 34 | F S DATE=$O(TLIST(DATE),SDIR) Q:(DATE="")!(NFOUND=NGET) D
|
---|
| 35 | . S IND=0
|
---|
| 36 | . F S IND=$O(TLIST(DATE,IND)) Q:(IND="")!(NFOUND=NGET) D
|
---|
| 37 | .. S NFOUND=NFOUND+1
|
---|
| 38 | .. S FLIST(DATE,NFOUND,9000010.18)=TLIST(DATE,IND)
|
---|
| 39 | Q
|
---|
| 40 | ;
|
---|
| 41 | ;===============================================
|
---|
| 42 | GETDATA(DAS,FIEVT) ;Return data for a specified V CPT entry.
|
---|
| 43 | ;DBIA #4250.
|
---|
| 44 | D VCPT^PXPXRM(DAS,.FIEVT)
|
---|
| 45 | Q
|
---|
| 46 | ;
|
---|
| 47 | ;===============================================
|
---|
| 48 | GPLIST(TAXARR,NOCC,BDT,EDT,PLIST) ;Build patient list for V CPT entries.
|
---|
| 49 | N DAS,DATE,DFN,DS,ICPTP,NFOUND,NODE,NNODE,TEMP,TLIST
|
---|
| 50 | I $G(^PXRMINDX(9000010.18,"DATE BUILT"))="" D Q
|
---|
| 51 | . D NOINDEX^PXRMERRH("TX",TAXARR("IEN"),9000010.18)
|
---|
| 52 | S TLIST="GPLIST_PXRMVPOV"
|
---|
| 53 | K ^TMP($J,TLIST)
|
---|
| 54 | S DS=$S(EDT[".":EDT+.0000001,1:EDT+.240001)
|
---|
| 55 | S NNODE=+$P($G(TAXARR("PDS",9000010.18,81)),U,2)
|
---|
| 56 | I NNODE=0 Q
|
---|
| 57 | S ICPTP=""
|
---|
| 58 | F S ICPTP=$O(TAXARR(81,ICPTP)) Q:(ICPTP="") D
|
---|
| 59 | . I '$D(^PXRMINDX(9000010.18,"IPP",ICPTP)) Q
|
---|
| 60 | . F IND=1:1:NNODE D
|
---|
| 61 | .. S NODE=TAXARR("PDS",9000010.18,81,IND)
|
---|
| 62 | .. I '$D(^PXRMINDX(9000010.18,"IPP",ICPTP,NODE)) Q
|
---|
| 63 | .. S DFN=0
|
---|
| 64 | .. F S DFN=$O(^PXRMINDX(9000010.18,"IPP",ICPTP,NODE,DFN)) Q:DFN="" D
|
---|
| 65 | ... S DATE=DS
|
---|
| 66 | ... F S DATE=+$O(^PXRMINDX(9000010.18,"IPP",ICPTP,NODE,DFN,DATE),-1) Q:(DATE=0)!(DATE<BDT) D
|
---|
| 67 | .... S DAS=$O(^PXRMINDX(9000010.18,"IPP",ICPTP,NODE,DFN,DATE,""))
|
---|
| 68 | .... S ^TMP($J,TLIST,DFN,DATE,DAS)=ICPTP_U_"CPT"
|
---|
| 69 | ;Return up to NOCC of the most recent entries for each patient.
|
---|
| 70 | S DFN=0
|
---|
| 71 | F S DFN=$O(^TMP($J,TLIST,DFN)) Q:DFN="" D
|
---|
| 72 | . S NFOUND=0
|
---|
| 73 | . S DATE=""
|
---|
| 74 | . F S DATE=$O(^TMP($J,TLIST,DFN,DATE),-1) Q:(DATE="")!(NFOUND=NOCC) D
|
---|
| 75 | .. S DAS=""
|
---|
| 76 | .. F S DAS=$O(^TMP($J,TLIST,DFN,DATE,DAS)) Q:DAS="" D
|
---|
| 77 | ... S NFOUND=NFOUND+1
|
---|
| 78 | ... S TEMP=^TMP($J,TLIST,DFN,DATE,DAS)
|
---|
| 79 | ... S ^TMP($J,PLIST,1,DFN,DATE,9000010.18)=DAS_U_DATE_U_TEMP
|
---|
| 80 | K ^TMP($J,TLIST)
|
---|
| 81 | Q
|
---|
| 82 | ;
|
---|
| 83 | ;===============================================
|
---|
| 84 | MHVOUT(INDENT,OCCLIST,IFIEVAL,NLINES,TEXT) ;Produce the MHV output.
|
---|
| 85 | N CODE,CPTDATA,D0,ICPTP,IND,JND,NAME,NIN,NOUT
|
---|
| 86 | N PN,PP,SNAME,TEMP,TEXTIN,TEXTOUT,VDATE
|
---|
| 87 | S NAME="Encounter Procedure = "
|
---|
| 88 | S IND=0
|
---|
| 89 | F S IND=$O(OCCLIST(IND)) Q:IND="" D
|
---|
| 90 | . S VDATE=IFIEVAL(IND,"DATE")
|
---|
| 91 | . S D0=$G(^AUPNVCPT(IFIEVAL(IND,"DAS"),0))
|
---|
| 92 | . S ICPTP=IFIEVAL(IND,"CODEP")
|
---|
| 93 | . S CPTDATA=$$CPT^ICPTCOD(ICPTP,VDATE)
|
---|
| 94 | . S SNAME=$P(CPTDATA,U,3)
|
---|
| 95 | . S TEMP=NAME_SNAME_" ("_$$EDATE^PXRMDATE(VDATE)_")"
|
---|
| 96 | . D FORMATS^PXRMTEXT(INDENT+2,PXRMRM,TEMP,.NOUT,.TEXTOUT)
|
---|
| 97 | . F JND=1:1:NOUT S NLINES=NLINES+1,TEXT(NLINES)=TEXTOUT(JND)
|
---|
| 98 | S NLINES=NLINES+1,TEXT(NLINES)=""
|
---|
| 99 | Q
|
---|
| 100 | ;
|
---|
| 101 | ;===============================================
|
---|
| 102 | OUTPUT(INDENT,OCCLIST,IFIEVAL,NLINES,TEXT) ;Produce the clinical
|
---|
| 103 | ;maintenance output. The VCPT information is: DATE, ICPT CODE,
|
---|
| 104 | ;SHORT NAME, PROVIDER NARRATIVE.
|
---|
| 105 | N CODE,CPT,CPTDATA,D0,ICPTP,IND,JND,NIN,NOUT
|
---|
| 106 | N PN,PP,SNAME,TEMP,TEXTIN,TEXTOUT,VDATE
|
---|
| 107 | S NLINES=NLINES+1
|
---|
| 108 | S TEXT(NLINES)=$$INSCHR^PXRMEXLC(INDENT," ")_"Encounter Procedure:"
|
---|
| 109 | S IND=0
|
---|
| 110 | F S IND=$O(OCCLIST(IND)) Q:IND="" D
|
---|
| 111 | . S VDATE=IFIEVAL(IND,"DATE")
|
---|
| 112 | . S TEMP=$$EDATE^PXRMDATE(VDATE)
|
---|
| 113 | . S D0=$G(^AUPNVCPT(IFIEVAL(IND,"DAS"),0))
|
---|
| 114 | . S ICPTP=IFIEVAL(IND,"CODEP")
|
---|
| 115 | . S CPTDATA=$$CPT^ICPTCOD(ICPTP,VDATE)
|
---|
| 116 | . S CODE=$P(CPTDATA,U,2)
|
---|
| 117 | . S SNAME=$P(CPTDATA,U,3)
|
---|
| 118 | . S TEMP=TEMP_" "_CODE
|
---|
| 119 | . S TEMP=TEMP_"-"_SNAME
|
---|
| 120 | . S PP=$P(IFIEVAL(IND,"FILE SPECIFIC"),U,1)
|
---|
| 121 | . S PP=$S(PP="Y":"YES",1:"NO")
|
---|
| 122 | . S TEMP=TEMP_" Principle Procedure: "_PP
|
---|
| 123 | . S TEXTIN(1)=TEMP,NIN=1
|
---|
| 124 | . S PN=$P(D0,U,4)
|
---|
| 125 | . I PN'="" S PN=$P($G(^AUTNPOV(PN,0)),U,1)
|
---|
| 126 | . I PN="" S PN="MISSING"
|
---|
| 127 | . I PN'=SNAME S TEXTIN(2)=" Prov. Narr. - "_PN,NIN=2
|
---|
| 128 | . D FORMAT^PXRMTEXT(INDENT+2,PXRMRM,NIN,.TEXTIN,.NOUT,.TEXTOUT)
|
---|
| 129 | . F JND=1:1:NOUT S NLINES=NLINES+1,TEXT(NLINES)=TEXTOUT(JND)
|
---|
| 130 | . I IFIEVAL(IND,"COMMENTS")'="" D
|
---|
| 131 | .. S TEMP="Comments: "_IFIEVAL(IND,"COMMENTS")
|
---|
| 132 | .. D FORMATS^PXRMTEXT(INDENT+3,PXRMRM,TEMP,.NOUT,.TEXTOUT)
|
---|
| 133 | .. F JND=1:1:NOUT S NLINES=NLINES+1,TEXT(NLINES)=TEXTOUT(JND)
|
---|
| 134 | S NLINES=NLINES+1,TEXT(NLINES)=""
|
---|
| 135 | Q
|
---|
| 136 | ;
|
---|