source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGPTFAPI.m@ 1096

Last change on this file since 1096 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.0 KB
Line 
1DGPTFAPI ;BAY/JAT/ADL - Returns data from Patient Treatment (PTF) file; ; 10/12/00 10:00am
2 ;;5.3;Registration;**309,510**;Aug 13, 1993
3 ;;ADL;Update for CSV Project;;Mar 24, 2003
4 ; can be used as an RPC (Remote Procedure call)
5 ; see ^XWB(8994 for documentation
6 ; output: RESULTS (passed by reference)
7 ; input : PTFNUMBR, the Patient Treatment IFN (.001 of file #45)
8 ;
9RPC(RESULTS,PTFNUMBR) ;
10 N DGPTF,DG70,DGDISP,DGDXLS,DGDX2,DGDX3,DGDX4,DGDX5,DGDX6,DGDX7,DGDX8,DGDX9,DGDX10,DGDISTYP
11 S DGPTF=$G(PTFNUMBR)
12 K RESULTS S RESULTS(0)=-1
13 I 'DGPTF Q
14 I '$D(^DGPT(DGPTF,0)) Q
15 S DG70=$G(^DGPT(DGPTF,70))
16 S DGDISP=$P(DG70,U,6)
17 I DGDISP S DGDISP=$P($G(^DIC(45.6,DGDISP,0)),U)
18 S DGDISTYP=$P(DG70,U,3)
19 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:"")
20 S DGDXLS=$P(DG70,U,10)
21 S DGPTDAT=$$GETDATE^ICDGTDRG(DGPTF)
22 I DGDXLS S DGDXLS=$P($$ICDDX^ICDCODE(DGDXLS,DGPTDAT),U,2)
23 S DGDX2=$P(DG70,U,16) I DGDX2 S DGDX2=$P($$ICDDX^ICDCODE(DGDX2,DGPTDAT),U,2)
24 S DGDX3=$P(DG70,U,17) I DGDX3 S DGDX3=$P($$ICDDX^ICDCODE(DGDX3,DGPTDAT),U,2)
25 S DGDX4=$P(DG70,U,18) I DGDX4 S DGDX4=$P($$ICDDX^ICDCODE(DGDX4,DGPTDAT),U,2)
26 S DGDX5=$P(DG70,U,19) I DGDX5 S DGDX5=$P($$ICDDX^ICDCODE(DGDX5,DGPTDAT),U,2)
27 S DGDX6=$P(DG70,U,20) I DGDX6 S DGDX6=$P($$ICDDX^ICDCODE(DGDX6,DGPTDAT),U,2)
28 S DGDX7=$P(DG70,U,21) I DGDX7 S DGDX7=$P($$ICDDX^ICDCODE(DGDX7,DGPTDAT),U,2)
29 S DGDX8=$P(DG70,U,22) I DGDX8 S DGDX8=$P($$ICDDX^ICDCODE(DGDX8,DGPTDAT),U,2)
30 S DGDX9=$P(DG70,U,23) I DGDX9 S DGDX9=$P($$ICDDX^ICDCODE(DGDX9,DGPTDAT),U,2)
31 S DGDX10=$P(DG70,U,24) I DGDX10 S DGDX10=$P($$ICDDX^ICDCODE(DGDX10,DGPTDAT),U,2)
32 S RESULTS(0)=1
33 ; #72: type of disposition^#75: place of disposition (name)^#79: primary ICD9 code
34 S RESULTS(1)=DGDISTYP_U_DGDISP_U_DGDXLS
35 ; #79.16 thru 79.24: 2nd thru 10th ICD9 codes
36 S RESULTS(2)=DGDX2_U_DGDX3_U_DGDX4_U_DGDX5_U_DGDX6_U_DGDX7_U_DGDX8_U_DGDX9_U_DGDX10
37 Q
Note: See TracBrowser for help on using the repository browser.