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

BWPROF2.m

Go to the documentation of this file.
BWPROF2 ;IHS/ANMC/MWR - DISPLAY PATIENT PROFILE; [ 03/27/2002  8:48 AM ]
 ;;2.0;WOMEN'S HEALTH;**8**;MAY 16, 1996
 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
 ;;  RETRIEVE AND SORT PROCEDURES, NOTIFICATIONS, PAP REGIMENS,
 ;;  AND PREGNANCIES FOR PATIENT PROFILE.  CALLED BY BWPROF.
 ;
SORT ;EP
 ;---> SORT AND STORE ARRAY IN ^TMP("BW",$J
 ;
 K ^TMP("BW",$J)
 ;---> BWBEGDT1=ONE SECOND BEFORE BEGIN DATE.
 ;---> BWENDDT1=THE LAST SECOND OF END DATE.
 ;S BWBEGDT1=BWBEGDT-.0001,BWENDDT1=BWENDDT+.9999    ;---> XDATES
 ;
 D PATVARS^BWUTL3(BWDFN)
 ;
 ;*******************
 ;---> GET PROCEDURES
 S BWIEN=0
 F  S BWIEN=$O(^BWPCD("C",BWDFN,BWIEN)) Q:'BWIEN  D
 .;---> SET Y=THE ZERO NODE FOR THIS PROCEDURE.
 .S Y=^BWPCD(BWIEN,0)
 .;
 .;
 .;===> BEGIN CHANGES - Mike Remillard            ;IHS/ANMC/MWR 3/27/02
 .;---> Commented out this patch.
 .;---> Next line caused any Procedure without a result to drop off
 .;---> the Patient Profile.
 .;Q:'$P(Y,U,4)!'$P(Y,U,5)  ;IHS/CIM/THL PATCH 8
 .Q:'$P(Y,U,4)  ;IHS/CIM/THL PATCH 8
 .;===> END CHANGES - Mike Remillard              ;IHS/ANMC/MWR 3/27/02
 .;
 .;
 .;---> QUIT IF THIS PROCEDURE HAS A RESULT OF "ERROR/DISREGARD".
 .Q:BWERRORS&($P(Y,U,5)=8)
 .;---> QUIT IF NOT WITHIN DATE RANGE.
 .S (BWDATE,BWDATE1)=$P(Y,U,12)
 .;Q:BWDATE'>BWBEGDT1!(BWDATE>BWENDDT1)                ;---> XDATES
 .S BWDATE1=$$SLDT2^BWUTL5(BWDATE1)
 .S BWACC=$P(Y,U)                                      ;---> ACCESSION#
 .S BWPCD=$P(^BWPN($P(Y,U,4),0),U,2)                   ;---> PROC TYPE
 .S BWSTAT=$$STATUS^BWUTL4                             ;---> STATUS
 .S BWDIAG=$$DIAG^BWUTL4($P(Y,U,5))                    ;---> RESULT/DIAG
 .S BWPROV=$P(Y,U,7) D                                 ;---> PROVIDER
 ..I 'BWPROV S BWPROV="NOT ENTERED" Q
 ..;
 ..;---> NEXT LINE PATCHED (INSERTED) BY MIKE REMILLARD  1/27/99
 ..I '$D(^VA(200,BWPROV,0)) S BWPROV="BAD POINTER" Q  ;IHS/ANMC/MWR
 ..S BWPROV=$P($P(^VA(200,BWPROV,0),U),",")
 ..;
 .;---> FOR PROCEDURES, SET 1ST PIECE AND 6TH SUBSCRIPT=1.
 .;S X=1_U_BWCHRT_U_BWNAME_U_BWDATE1_U_BWPCD_U_BWACC_U_BWDIAG
 .S X=1_U_U_U_BWDATE1_U_BWPCD_U_BWACC_U_BWDIAG
 .S X=X_U_BWPROV_U_BWSTAT_U_BWIEN
 .S ^TMP("BW",$J,1,9999999.9999-BWDATE,BWACC,1,BWIEN)=X Q
 ;
 ;**********************
 ;---> GET NOTIFICATIONS
 Q:'BWD
 S BWIEN=0
 F  S BWIEN=$O(^BWNOT("B",BWDFN,BWIEN)) Q:'BWIEN  D
 .S Y=^BWNOT(BWIEN,0)
 .;---> QUIT IF NOT WITHIN DATE RANGE.  BWDATE1 PRESERVES NOTIF DATE.
 .S (BWDATE,BWDATE1)=$P(Y,U,2)
 .;Q:BWDATE'>BWBEGDT1!(BWDATE>BWENDDT1)               ;---> XDATE
 .S BWDATE1=$$SLDT2^BWUTL5(BWDATE1)
 .S BWACC=$P(Y,U,6) D                                 ;---> ACCESSION#
 ..I BWACC="" S BWACC="NO ACC#" Q
 ..;---> IF THIS NOTIFICATION PERTAINS TO A PROCEDURE (I.E., IT
 ..;---> HAS AN ACCESSION#), RESET ITS DATE SO THAT IT WILL COLLATE
 ..;---> UNDER ITS PROCEDURE IN THE DISPLAY.
 ..S BWACC=$P(^BWPCD(BWACC,0),U),BWDATE=$P(^(0),U,12)
 .S BWSTAT=$$STATUS^BWUTL4                            ;---> STATUS
 .S BWTYPE=$P(Y,U,3)  D                               ;---> TYPE
 ..I BWTYPE="" S BWTYPE="NOT ENTERED" Q
 ..S BWTYPE=$P(^BWNOTT(BWTYPE,0),U)
 .S BWPURP=$P(Y,U,4)  D                               ;---> PURPOSE
 ..I BWPURP="" S BWPURP="NOT ENTERED" Q
 ..S BWPURP=$P(^BWNOTP(BWPURP,0),U)
 .S BWOUT=$P(Y,U,5)  D                                ;---> OUTCOME
 ..I BWOUT="" S BWOUT="NOT ENTERED" Q
 ..S BWOUT=$P(^BWNOTO(BWOUT,0),U)
 .;---> FOR NOTIFICATIONS, SET 1ST PIECE AND 6TH SUBSCRIPT=2.
 .;S X=2_U_BWCHRT_U_BWNAME_U_BWDATE1_U_BWACC_U_BWTYPE_U_BWPURP
 .S X=2_U_U_U_BWDATE1_U_BWACC_U_BWTYPE_U_BWPURP
 .S X=X_U_BWOUT_U_BWSTAT_U_BWIEN
 .S ^TMP("BW",$J,1,9999999.9999-BWDATE,BWACC,2,BWIEN)=X Q
 ;
 ;**********************
 ;---> GET PAP REGIMENS
 S BWIEN=0
 F  S BWIEN=$O(^BWPLOG("C",BWDFN,BWIEN)) Q:'BWIEN  D
 .;---> SET Y=THE ZERO NODE FOR THIS PAP REGIMEN LOG ENTRY.
 .S Y=^BWPLOG(BWIEN,0)
 .;---> PIECE 1=START DATE FOR THE PAP REGIMEN.
 .S (BWDATE,BWDATE1)=$P(Y,U)                           ;---> DATE
 .;---> QUIT IF NOT WITHIN DATE RANGE.
 .;Q:BWDATE'>BWBEGDT1!(BWDATE>BWENDDT1)                ;---> XDATES
 .S BWDATE1=$$SLDT2^BWUTL5(BWDATE1)
 .S BWPAPRG1=$$PAPRG1^BWUTL1($P(Y,U,3))                ;---> PAP REGIMEN
 .;---> FOR PAP REGIMENS, SET 1ST PIECE AND 6TH SUBSCRIPT=3.
 .;S X=3_U_BWCHRT_U_BWNAME_U_BWDATE1_U_BWPAPRG1
 .S X=3_U_U_U_BWDATE1_U_BWPAPRG1
 .S ^TMP("BW",$J,1,9999999.9999-BWDATE,1,3,BWIEN)=X Q
 ;
 ;**********************
 ;---> GET PREGNANCIES
 S BWIEN=0
 F  S BWIEN=$O(^BWEDC("C",BWDFN,BWIEN)) Q:'BWIEN  D
 .;---> SET Y=THE ZERO NODE FOR THIS PREGNANCY LOG ENTRY.
 .S Y=^BWEDC(BWIEN,0)
 .;---> PIECE 1=DATE PREGNANCY LOG ENTRY WAS MADE.
 .S (BWDATE,BWDATE1)=$P(Y,U)                           ;---> DATE
 .;---> QUIT IF NOT WITHIN DATE RANGE.
 .;Q:BWDATE'>BWBEGDT1!(BWDATE>BWENDDT1)                ;---> XDATES
 .S BWDATE1=$$SLDT2^BWUTL5(BWDATE1)
 .S BWPSTAT=$S($P(Y,U,3):"PREGNANT",1:"NOT PREGNANT")  ;---> PREG STATUS
 .S BWEDCL=$S(X:$$SLDT2^BWUTL5($P(Y,U,4)),1:"")        ;---> EDC
 .;---> FOR PREGNANCIES, SET 1ST PIECE AND 6TH SUBSCRIPT=4.
 .;S X=4_U_BWCHRT_U_BWNAME_U_BWDATE1_U_BWPSTAT_U_BWEDCL
 .S X=4_U_U_U_BWDATE1_U_BWPSTAT_U_BWEDCL
 .S ^TMP("BW",$J,1,9999999.9999-BWDATE,1,4,BWIEN)=X Q
 Q