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

BWCBE.m

Go to the documentation of this file.
  1. BWCBE ;IHS/ANMC/MWR - UTIL: MOSTLY PATIENT DATA;15-Feb-2003 21:49;PLS
  1. ;;2.0;WOMEN'S HEALTH;**1,8**;MAR 30, 2001
  1. ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
  1. ;; CREATE CBE PROCEDURE IN WOMEN'S HEALTH FOR THIS PATIENT.
  1. ;
  1. ;
  1. EP(PATDFN,VSIT,VFIEN) ;EP - called from template (APCD CBE (ADD))
  1. I '$G(PATDFN) Q
  1. I '$G(VSIT) Q
  1. S VFIEN=$G(VFIEN)
  1. ;S VFRES=$G(VFRES)
  1. S APCDTRES="" ;result to pass back to V EXAM
  1. D EN^XBNEW("EP1^BWCBE","PATDFN;VSIT;VFIEN;APCDTRES")
  1. Q
  1. EP1 ;EP - called from xbnew
  1. NEW RESULT,ERR
  1. S (ERR,APCDTRES)=""
  1. ;get result
  1. S BWPN=27,DIR(0)="9002086.1,.05O",DIR("A")="Enter RESULTS/DIAGNOSIS" KILL DA D ^DIR KILL DIR
  1. S RESULT=Y
  1. D ADD(ERR,PATDFN,$P(^AUPNVSIT(VSIT,0),U),VSIT,RESULT,$$PRIMPROV^APCLV(VSIT),VFIEN)
  1. I ERR]"" W "I got an error"
  1. Q
  1. ;----------
  1. ADD(BWERR,BWDFN,BWPCCDT,BWVST,BWDX,BWPROV,BWVFDA) ;EP
  1. ;---> Add a CBE (Clinical Breast Exam) to this patient.
  1. ;---> Parameters:
  1. ; 1 - BWERR (ret) Text of error, if any.
  1. ; 2 - BWDFN (req) DFN of patient.
  1. ; 3 - BWPCCDT (req) PCC Visit Date/Time.
  1. ; 4 - BWVST (opt) Visit IEN (if any) to link this CBE to.
  1. ; 5 - BWDX (opt) IEN in BW RESULTS/DIAGNOSIS File #9002086.31.
  1. ; 6 - BWPROV (opt) Provider pointer to #200.
  1. ;
  1. ;---> If DFN not provided, set Error Code and quit.
  1. I '$G(BWDFN) D Q
  1. .S BWERR="Software error: Patient DFN not provided."
  1. ;
  1. ;---> Set required variables.
  1. D ^XBKVAR S BWERR=""
  1. ;
  1. ;
  1. PATIENT ;---> If Patient isn't in Women's Health Database, add her.
  1. I '$D(^BWP(BWDFN,0)) D
  1. .D AUTOADD^BWPATE(BWDFN,DUZ(2),.BWERR)
  1. .S:BWERR<0 BWERR="Software error: Failed to add new patient."
  1. Q:BWERR]""
  1. ;
  1. ;
  1. PROC ;---> Create CBE Procedure in BW PROCEDURE File #9002086.1.
  1. ;---> 27=IEN of Procedure Type in File #9002086.2.
  1. ;
  1. ;---> Optional use of DR string.
  1. N BWDA,BWDR
  1. S BWDR=".02////"_BWDFN_";.03////"_$G(BWPCCDT)_";.04////27"
  1. S BWDR=BWDR_";.05////"_$G(BWDX)_";.07////"_$G(BWPROV)
  1. S BWDR=BWDR_";.1////"_DUZ(2)_";.11////"_$G(BWLOC)
  1. S BWDR=BWDR_";.12////"_$P($G(BWPCCDT),".")_";.14////"_$G(BWSTAT)
  1. S BWDR=BWDR_";.18////"_DUZ_";.19////"_DT
  1. ;
  1. D NEW2^BWPROC(BWDFN,27,BWPCCDT,BWDR,"",.BWDA,.BWERR)
  1. I BWERR<0 D Q
  1. .S BWERR="Software error: Failed to create CBE in Women's Health."
  1. ;
  1. ;---> BWDA=IEN of just created Procedure in BW PROCEDURE File.
  1. ;---> Following line will call ^APCDALV and ^APCDALVR.
  1. ;---> Call to APCDALV will look for same date Visit and prompt
  1. ;---> if time does not match. (See +53^BWPCC.)
  1. ;D CREATE^BWPCC(BWDA,DUZ(2),$G(^BWPCD(BWDA,0)))
  1. N X S X=$$NORMAL^BWUTL4($P(^BWPCD(BWDA,0),U,5))
  1. S:X<2 APCDTRES=$S(X:"A",1:"N")
  1. STORE ;---> STORE VISIT AND V FILE IEN'S IN WH PROCEDURE FILE #9002086.1.
  1. I $G(BWDA) D
  1. .N DR
  1. .S DR="5.01////"_BWVST_";5.02////"_BWVFDA
  1. .D DIE^BWFMAN(9002086.1,DR,BWDA,.BWPOP)
  1. ;
  1. ;---> Or, if Visit IEN is known, set required variables and
  1. ;---> call VFILE^BWPCC.
  1. Q