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

BWOLD.m

Go to the documentation of this file.
BWOLD ;IHS/ANMC/MWR - CONVERT DATA FROM OLD PAP PKG;
 ;;2.0;WOMEN'S HEALTH;;MAY 16, 1996
 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
 ;;  CONVERT OLD DATA TO NEW.  PROGRAMMER UTILITY, NOT CALLED
 ;;  FROM MENUS.
 ;
 W !!!?5,"WARNING!  THIS ROUTINE SHOULD ONLY BE RUN ONCE AT A SITE!"
 S DIR("A")="     Do you wish to continue"
 S DIR(0)="Y",DIR("B")="NO" D ^DIR K DIR W !!
 Q:$D(DIRUT)!(Y<1)
 ;
 ;
 D SETVARS^BWUTL5
 S (N,BWPATS,BWPAPS,BWCOLPS)=0
 F  S N=$O(^AMCH(86,N)) Q:'N  D
 .S M=0,BWDFN=N,BWPATS=BWPATS+1
 .F  S M=$O(^AMCH(86,N,"DS",M)) Q:'M  D
 ..I $D(^AMCH(86,N,"DS",M,0)) D PAP
 ..S NN=0
 ..F  S NN=$O(^AMCH(86,N,"DS",M,2,NN)) Q:'NN  D
 ...I $D(^AMCH(86,N,"DS",M,2,NN,0)) D COLP
 W !!?3,"PATIENTS ADDED: ",BWPATS
 W ?28,"PAPS ADDED: ",BWPAPS
 W ?52,"COLPOSCOPIES ADDED: ",BWCOLPS
 W !!?10,"* DON'T FORGET TO CHECK GLOBAL ^BWOLD FOR ERRORS! *",!
 Q
 ;
 ;
PAP ;EP
 ;---> COPY THIS PAP INTO NEW DATABASE.
 N BWY,BWPOP S BWY=^AMCH(86,N,"DS",M,0),BWPOP=0
 ;---> BWDFN=DFN, BWPCDN=1="PAP SMEAR", BWDATE=DATE OF PAP.
 S BWPCDN=1,BWDATE=$P(BWY,U)
 ;---> SET PRIMARY AND SECONDARY DIAGNOSES FOR THIS PAP.
 S BW1DX=$P(BWY,U,2),BW1DX=$$PAPDX(BW1DX)
 S BW2DX=$P(BWY,U,3),BW2DX=$$PAPDX(BW2DX)
 ;
 I '$D(^AUPNPAT(BWDFN)) D  Q
 .S ^BWOLD(N,M,"PAT")="PATIENT DOES NOT EXIST IN PATIENT FILE."
 ;
 ;---> IF PATIENT IS NOT ALREADY IN DATABASE, ADD HER.
 S BWERR=1
 D:'$D(^BWP(BWDFN)) AUTOADD^BWPATE(BWDFN,DUZ(2),.BWERR)
 I BWERR<0 S ^BWOLD(N,M,"PAT")="FAILED TO ADD PATIENT." Q
 ;
 ;---> NOW GENERATE ACCESSION# FOR BW PROCEDURE FILE ENTRY.
 S X=$$ACCSSN^BWUTL5(1)
 I X']"" S ^BWOLD(N,M,"ACC#")="FAILED TO ADD ACC#." Q
 ;
 ;---> NOW ADD(TRANSFER) THE PROCEDURE.
 S DIC("DR")=".02////"_BWDFN_";.04////"_BWPCDN_";.12////"_BWDATE
 S DIC("DR")=DIC("DR")_";.05////"_BW1DX_";.06////"_BW2DX_";.14////c"
 K DD,DO S DIC="^BWPCD(",DIC(0)="ML",DLAYGO=9002086
 D FILE^DICN
 W !?3,$$NAME^BWUTL1(BWDFN),?35,$$HRCN^BWUTL1(BWDFN)
 W ?45,"ACC#: ",$P(Y,U,2)
 S BWPAPS=BWPAPS+1
 ;---> IF Y<0, CHECK PERMISSIONS.
 I Y<0 S ^BWOLD(N,M,"PCD")="UNABLE TO CREATE NEW PROCEDURE."
 Q
 ;
 ;
COLP ;EP
 ;---> COPY THIS COLP INTO NEW DATABASE.
 N BWY S BWY=^AMCH(86,N,"DS",M,2,NN,0)
 ;---> BWDFN=DFN, BWPCDN=2="COLPOSCOPY", BWDATE=DATE OF COLP.
 S BWDFN=N,BWPCDN=2,BWDATE=$P(BWY,U)
 ;---> SET PRIMARY AND SECONDARY DIAGNOSES FOR THIS PAP.
 S BW1DX=$P(BWY,U,2),BW1DX=$$COLPDX(BW1DX)
 S BW2DX=$P(BWY,U,5),BW2DX=$$COLPDX(BW2DX)
 ;
 ;---> NOW GENERATE ACCESSION# FOR BW PROCEDURE FILE ENTRY.
 S X=$$ACCSSN^BWUTL5(2)
 I X']"" S ^BWOLD(N,M,NN,"ACC#")="FAILED TO ADD ACC#." Q
 S DIC("DR")=".02////"_BWDFN_";.04////"_BWPCDN_";.12////"_BWDATE
 S DIC("DR")=DIC("DR")_";.05////"_BW1DX_";.26////"_BW2DX_";.14////c"
 K DD,DO S DIC="^BWPCD(",DIC(0)="ML",DLAYGO=9002086
 D FILE^DICN
 W !?3,$$NAME^BWUTL1(BWDFN),?35,$$HRCN^BWUTL1(BWDFN)
 W ?45,"ACC#: ",$P(Y,U,2)
 S BWCOLPS=BWCOLPS+1
 ;---> IF Y<0, CHECK PERMISSIONS.
 I Y<0 S ^BWOLD(N,M,NN,"PCD")="UNABLE TO CREATE NEW PROCEDURE."
 Q
 ;
PAPDX(Y) ;EP
 ;---> THE Y=IEN IN ^AMCH(86.1 - OLD PAP RESULTS FILE #9002086.1
 Q:Y="" ""
 Q:Y=3 5
 Q:Y=5 3
 Q:Y=6 42
 Q:Y=7 11
 Q:Y=12 12
 Q:Y=14 46
 Q:Y=15 13
 Q:Y=16 33
 Q:Y=17 33
 Q:Y=19 32
 Q:Y=21 50
 Q:Y=22 22
 Q:Y=23 39
 Q ""
 ;
COLPDX(Y) ;EP
 ;---> THE Y=IEN IN ^AMCH(86.3 - OLD COLPO&BIOPSY DIAG FILE #9002086.3
 Q:Y="" ""
 Q:Y=1 11
 Q:Y=2 30
 Q:Y=3 30
 Q:Y=4 15
 Q:Y=5 15
 Q:Y=6 16
 Q:Y=7 16
 Q:Y=8 17
 Q:Y=9 18
 Q:Y=10 19
 Q:Y=11 1
 Q:Y=12 1
 Q:Y=13 1
 Q:Y=14 12
 Q:Y=15 32
 Q:Y=16 51
 Q ""