Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PSN4P406

PSN4P406.m

Go to the documentation of this file.
  1. PSN4P406 ;ALB/HW-Pre Install Patients with Inactive Ingredients as Causative Agents Report ; 8/14/14 4:03pm
  1. ;;4.0;NATIONAL DRUG FILE;**406**; 30 Oct 98;Build 7
  1. ; This routine uses the following IAs:
  1. ; #5843 - Read file 120.8 (controlled)
  1. ; #10061 - DEM^VADPT (supported)
  1. ; #10070 - ^XMD (supported)
  1. Q ;Must be called at entry point
  1. ;Only looking for patients that are not deceased and
  1. ;where the inactive ingredient has been entered directly as a causative agent.
  1. EN N PSNIEN,PSNINING,DFN,PSNCOUNT,DIFROM
  1. K ^TMP("PSN",$J)
  1. S PSNIEN=0,PSNCOUNT=0
  1. D BMES^XPDUTL("Patients with Inactive Ingredient(s) Entered as Causative Agent(s)")
  1. S ^TMP("PSN",$J,0)=" "_"Patients with Inactive Ingredient(s) Entered as Causative Agent(s)"
  1. D MES^XPDUTL(" ")
  1. D BMES^XPDUTL("DFN Inactive Ingredient to be Corrected ")
  1. D BMES^XPDUTL(" ")
  1. S ^TMP("PSN",$J,1)="DFN"_" "_"Inactive Ingredient to be Corrected "
  1. F S PSNIEN=$O(^PS(50.416,PSNIEN)) Q:PSNIEN'>0 D
  1. .I $G(^PS(50.416,PSNIEN,2))'>0 Q
  1. .S PSNINING=$P(^PS(50.416,PSNIEN,0),"^") D FINDPAL(PSNINING,PSNIEN,.PSNCOUNT) Q
  1. I PSNCOUNT<1 D
  1. .D BMES^XPDUTL("No patient allergies with inactive ingredient as causative agent found")
  1. .D MES^XPDUTL(" ")
  1. .S ^TMP("PSN",$J,PSNCOUNT+2)="No patient allergies with inactive ingredient as causative agent found"
  1. S XMSUB="Patient Allergies with Inactive Ingredients",XMTEXT="^TMP(""PSN"",$J,",XMY(DUZ)=""
  1. D BMES^XPDUTL(" ")
  1. D BMES^XPDUTL(" ")
  1. D ^XMD K XMSUB,XMTEXT,XMY
  1. Q
  1. FINDPAL(PSNINING,PSNIEN,PSNCOUNT) ;Search C cross-ref for matching ingr name to get 120.8 data
  1. N PSNPALR,PSNOUT,PSNPIEN,PSNX,PSNDGMAL,DFN,VADM,VAERR,VA,PSNSP1,PSNSPN1
  1. D FIND^DIC(120.8,"","@;.01EI;.02;1I;22I","X",PSNINING,"","C","","","PSNPALR($J)","PSNOUT($J)")
  1. I $D(PSNOUT($J,"DIERR"))>0 D
  1. .S ^XTMP("PSN4P406",0)=$$FMADD^XLFDT(DT,60)_"^"_DT_"^Errors matching ingredients"
  1. .M ^XTMP("PSN4P406")=PSNOUT($J)
  1. .D MES^XPDUTL("Error matching ingredient name")
  1. .S PSNCOUNT=PSNCOUNT+1,^TMP("PSN",$J,PSNCOUNT+2)="Error: Problem matching ingredient name"
  1. ;Check if entered in error and if GMR Allergy value matches
  1. I $P($G(PSNPALR($J,"DILIST",0)),"^")<1 Q
  1. S PSNPIEN=0
  1. F S PSNPIEN=$O(PSNPALR($J,"DILIST",2,PSNPIEN)) Q:PSNPIEN'>0 D
  1. .I PSNPALR($J,"DILIST","ID",PSNPIEN,22)>0 Q
  1. .S PSNDGMAL=PSNPALR($J,"DILIST","ID",PSNPIEN,1)
  1. .I PSNDGMAL'["PS(50.416" Q
  1. .I +PSNDGMAL'=PSNIEN Q
  1. .;Check if patient has DATE OF DEATH
  1. .S DFN=PSNPALR($J,"DILIST","ID",PSNPIEN,.01,"I")
  1. .D DEM^VADPT
  1. .I VAERR D Q
  1. ..D MES^XPDUTL("Error: Problem retrieving demographic data for DFN: "_DFN)
  1. ..S PSNCOUNT=PSNCOUNT+1,^TMP("PSN",$J,PSNCOUNT+2)="Error: Problem retrieving demographic data for DFN: "_DFN
  1. .I VADM(6)<1 D
  1. ..S PSNSP1=" "
  1. ..S PSNSPN1=30-$L(DFN) F PSNX=1:1:PSNSPN1 S PSNSP1=PSNSP1_" "
  1. ..S PSNCOUNT=PSNCOUNT+1,^TMP("PSN",$J,PSNCOUNT+2)=DFN_PSNSP1_PSNINING
  1. ..D MES^XPDUTL(DFN_PSNSP1_PSNINING)