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

PSOPATLK.m

Go to the documentation of this file.
  1. PSOPATLK ;BIR/JAM - Patient Lookup utility ;7/21/08
  1. ;;7.0;OUTPATIENT PHARMACY;**326,348,438,564**;DEC 1997;Build 6
  1. ;
  1. ; This API looks for a patient using a prescription number, barcode,
  1. ; universal Member ID number from the patient's VHIC Card
  1. ; or the registration standard patient lookup.
  1. ;
  1. EN ;Entry point - Prompts for Patient, Prescription Number or Barcode
  1. ;
  1. ; Input - DIC(0) & DIC("A") [Optional]
  1. ; Used by DIR if defined by the calling routine.
  1. ;
  1. ; Output - PSOPTLK [Processed user response]
  1. ;
  1. N DIR
  1. K PSOPTLK,PAGE
  1. S DIR(0)="FOU"_$S($D(DIC("A")):"A",1:"")_"^^K:$$PATVAL^PSOPATLK() X"
  1. S DIR("A")=$S($D(DIC("A")):DIC("A"),1:"Select PATIENT NAME")
  1. S (DIR("?"),DIR("??"))="^D PATHLP^PSOPATLK"
  1. D ^DIR
  1. M PSOPTLK=Y
  1. K DIROUT,DIRUT,DTOUT,DUOUT
  1. Q
  1. PATHLP ;Help text for patient prompt
  1. N DIC
  1. I $E(X)'="?" Q
  1. I X="?" D
  1. .W !?1,"Enter the prescription number prefixed by a # (ex. #XXXXXXX) or"
  1. .W !?1,"Wand the barcode of the prescription. The format of the barcode is"
  1. .W !?1,"NNN-NNNNNNN where the first 3 digits are your station number."
  1. .W !?1," - OR - "
  1. .W !?1,"Enter the universal Member ID number from the patient's VHIC Card"
  1. .W !?1,"or wand the barcode of the VHIC card"
  1. .W !?1," - OR - "
  1. S DIC="^DPT(",DIC(0)="QZEXN" D ^DIC
  1. Q
  1. ;
  1. PATVAL() ;Validate user input
  1. N OUT
  1. S OUT=0
  1. ;Prescription lookup
  1. I X?1"#".E D RXLK Q OUT
  1. ;Barcode lookup
  1. I X?3N1"-".N D RXLK Q OUT
  1. ;Standard patient lookup
  1. S DIC="^DPT(" S:'$D(DIC(0)) DIC(0)="QEMZ" D ^DIC
  1. S OUT=$S(+Y>0:0,1:1)
  1. Q OUT
  1. ;
  1. RXLK ;Prescription Lookup
  1. N DFN,DIC,RXNUM,RX,Z
  1. S RXNUM=X,RX=$S($E(RXNUM)="#":$E(RXNUM,2,999999999),1:$P(RXNUM,"-",2))
  1. I RX="" W !,$C(7),"No prescription number entered." S OUT=1 Q
  1. I $E(RXNUM)'="#",$P(RXNUM,"-")'=$$INST() D S OUT=1 Q
  1. .W !!,$C(7),"This prescription is not from this institution."
  1. S Z=$S($E(RXNUM)="#":$O(^PSRX("B",RX,0)),1:RX),Y=$G(^PSRX(+Z,0))
  1. I (Y="")!(Z="") D S OUT=1 Q
  1. .W !,$C(7),"No Prescription Record found"_$S($E(RXNUM)="#":".",1:" for this barcode.")
  1. S DFN=$P(Y,"^",2) K Y
  1. N DIC,X S DIC="^DPT(",DIC(0)="QZEXN" S X=DFN D ^DIC
  1. Q
  1. INST() ;get institution number
  1. N PSOINST,DA,DIQ
  1. S DA=$P($$SITE^VASITE(),"^")
  1. S PSOINST=$$GET1^DIQ(4,DA,99,"I")
  1. Q PSOINST
  1. ;