VistA-FOIAVistA/r/REGISTRATION-DGQE-DG-DPT-GR.../DGPTFAPI.m

38 lines
2.0 KiB
Mathematica

DGPTFAPI ;BAY/JAT/ADL - Returns data from Patient Treatment (PTF) file; ; 10/12/00 10:00am
;;5.3;Registration;**309,510**;Aug 13, 1993
;;ADL;Update for CSV Project;;Mar 24, 2003
; can be used as an RPC (Remote Procedure call)
; see ^XWB(8994 for documentation
; output: RESULTS (passed by reference)
; input : PTFNUMBR, the Patient Treatment IFN (.001 of file #45)
;
RPC(RESULTS,PTFNUMBR) ;
N DGPTF,DG70,DGDISP,DGDXLS,DGDX2,DGDX3,DGDX4,DGDX5,DGDX6,DGDX7,DGDX8,DGDX9,DGDX10,DGDISTYP
S DGPTF=$G(PTFNUMBR)
K RESULTS S RESULTS(0)=-1
I 'DGPTF Q
I '$D(^DGPT(DGPTF,0)) Q
S DG70=$G(^DGPT(DGPTF,70))
S DGDISP=$P(DG70,U,6)
I DGDISP S DGDISP=$P($G(^DIC(45.6,DGDISP,0)),U)
S DGDISTYP=$P(DG70,U,3)
I DGDISTYP S DGDISTYP=$S(DGDISTYP=1:"REGULAR",DGDISTYP=2:"NBC OR WHILE ASIH",DGDISTYP=3:"EXPIRATION 6 MONTH LIMIT",DGDISTYP=4:"IRREGULAR",DGDISTYP=5:"TRANSFER",DGDISTYP=6:"DEATH WITH AUTOPSY",DGDISTYP=7:"DEATH WITHOUT AUTOPSY",1:"")
S DGDXLS=$P(DG70,U,10)
S DGPTDAT=$$GETDATE^ICDGTDRG(DGPTF)
I DGDXLS S DGDXLS=$P($$ICDDX^ICDCODE(DGDXLS,DGPTDAT),U,2)
S DGDX2=$P(DG70,U,16) I DGDX2 S DGDX2=$P($$ICDDX^ICDCODE(DGDX2,DGPTDAT),U,2)
S DGDX3=$P(DG70,U,17) I DGDX3 S DGDX3=$P($$ICDDX^ICDCODE(DGDX3,DGPTDAT),U,2)
S DGDX4=$P(DG70,U,18) I DGDX4 S DGDX4=$P($$ICDDX^ICDCODE(DGDX4,DGPTDAT),U,2)
S DGDX5=$P(DG70,U,19) I DGDX5 S DGDX5=$P($$ICDDX^ICDCODE(DGDX5,DGPTDAT),U,2)
S DGDX6=$P(DG70,U,20) I DGDX6 S DGDX6=$P($$ICDDX^ICDCODE(DGDX6,DGPTDAT),U,2)
S DGDX7=$P(DG70,U,21) I DGDX7 S DGDX7=$P($$ICDDX^ICDCODE(DGDX7,DGPTDAT),U,2)
S DGDX8=$P(DG70,U,22) I DGDX8 S DGDX8=$P($$ICDDX^ICDCODE(DGDX8,DGPTDAT),U,2)
S DGDX9=$P(DG70,U,23) I DGDX9 S DGDX9=$P($$ICDDX^ICDCODE(DGDX9,DGPTDAT),U,2)
S DGDX10=$P(DG70,U,24) I DGDX10 S DGDX10=$P($$ICDDX^ICDCODE(DGDX10,DGPTDAT),U,2)
S RESULTS(0)=1
; #72: type of disposition^#75: place of disposition (name)^#79: primary ICD9 code
S RESULTS(1)=DGDISTYP_U_DGDISP_U_DGDXLS
; #79.16 thru 79.24: 2nd thru 10th ICD9 codes
S RESULTS(2)=DGDX2_U_DGDX3_U_DGDX4_U_DGDX5_U_DGDX6_U_DGDX7_U_DGDX8_U_DGDX9_U_DGDX10
Q