source: FOIAVistA/trunk/r/PHARMACY_DATA_MANAGEMENT-PSS/PSSSPD.m@ 1607

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

initial load of FOIAVistA 6/30/08 version

File size: 2.5 KB
Line 
1PSSSPD ;BIR/RLW-PRINT/CREATE PHARMACY ORDERABLE ITEMS ; 09/01/98 7:13
2 ;;1.0;PHARMACY DATA MANAGEMENT;**15**;9/30/97
3EN ;
4 ; name-spaced variables: ADD=iv additive file SOL=iv solution file
5 ; PD=primary drug file DD=dispense drug file
6 ; NDF=national drug file DF=NDF dosage form
7 ; SPD=pharmacy orderable item file
8 N ADDIEN,ADDNAME,CHR,DDIEN,PDIEN,PDNAME,NDF,NDFVA,DF,DDNAME,DFNAME,SPDNAME,X,PGN,PSMATCH,SOLIEN,SOLNAME,SPD,SPDFN,CML,LIVE
9 ;
10 S (PDIEN,DDIEN,NDF,X)=0,CHR=$S($G(PSCREATE):"~",1:" ")
11 K ^TMP("PSSD",$J),^TMP("PSS",$J),^TMP("PSSADD",$J),^TMP("PSSOL",$J)
12LOOP ; loop through dispense drugs for each primary drug, get NDF entry
13 F S PDIEN=$O(^PSDRUG("AP",PDIEN)) Q:'PDIEN!('$D(^PS(50.3,+PDIEN,0))) S PDNAME=$P(^PS(50.3,PDIEN,0),"^"),DDIEN="" D
14 .F S DDIEN=$O(^PSDRUG("AP",PDIEN,DDIEN)) Q:'DDIEN!('$D(^PSDRUG(+DDIEN,0)))!($P($G(^PSDRUG(+DDIEN,0)),"^")="") D
15 ..D DOSE I DFNAME="",'$G(PSCREATE) S ^TMP("PSSD",$J,"ZZZZ",DDNAME)="NDF link missing or incomplete" Q
16 ..S:DFNAME]"" ^TMP("PSSD",$J,PDNAME_CHR_DFNAME,DDNAME)=PDNAME,^TMP("PSS",$J,DDNAME)=PDNAME_" "_DFNAME
17 ;
18IVADD ; IV Additives
19 S ADDIEN=0 F S ADDIEN=$O(^PS(52.6,ADDIEN)) Q:ADDIEN="" D
20 .S DDIEN=$P($G(^PS(52.6,ADDIEN,0)),"^",2) Q:DDIEN=""!('$D(^PSDRUG(+DDIEN,0))) S ADDNAME=$P($G(^PS(52.6,ADDIEN,0)),"^")
21 .D DOSE I DFNAME="",'$G(PSCREATE) S ^TMP("PSSADD",$J,"ZZZZ",DDNAME)="NDF link missing or incomplete" Q
22 .S:DFNAME]"" ^TMP("PSSADD",$J,ADDNAME,DDNAME)=DFNAME
23 ;
24IVSOL ; IV solutions
25 S (SOLNAME,SOLIEN)="" F S SOLNAME=$O(^PS(52.7,"B",SOLNAME)) Q:SOLNAME="" S SOLIEN="" F S SOLIEN=$O(^PS(52.7,"B",SOLNAME,SOLIEN)) Q:SOLIEN="" D
26 .S DDIEN=$P($G(^PS(52.7,SOLIEN,0)),"^",2) Q:DDIEN=""!('$D(^PSDRUG(+DDIEN,0))) D DOSE I DFNAME="",'$G(PSCREATE) S ^TMP("PSSOL",$J,"ZZZZ",DDNAME)="NDF link missing or incomplete" Q
27 .S:DFNAME]"" ^TMP("PSSOL",$J,SOLNAME,DFNAME,DDNAME)=SOLIEN
28 ; if PSCREATE is defined, load the Pharmacy Orderable Item file from the ^TMP global
29 D:$G(PSCREATE) ^PSSPOI
30 Q
31 ;
32DOSE ; get dispense drug name and NDF dosage form
33 S (DF,DFNAME)="",DDNAME=$P(^PSDRUG(DDIEN,0),"^"),NDF=$G(^PSDRUG(DDIEN,"ND")) S DA=$P($G(NDF),"^"),X=$$VAGN^PSNAPIS(DA),GEN=X,K=$P($G(NDF),"^",3),X=$$PSJDF^PSNAPIS(DA,K),NDFVAGN=X,X=$$PROD0^PSNAPIS(DA,K),PROD=X D
34 .Q:($P(NDF,"^")="")!(GEN=0)
35 .Q:($P(NDF,"^",3)="")!(PROD']"")
36 .I GEN'=0 D
37 ..; get pointer to dosage form file from VA PRODUCT NAME node
38 ..Q:NDFVAGN=0 D
39 ...S DF=$P(NDFVAGN,"^") Q:DF=0
40 ...S DFNAME=$P(NDFVAGN,"^",2)
41 Q
Note: See TracBrowser for help on using the repository browser.