source: FOIAVistA/trunk/r/NURSING_SERVICE-NUR/NURSCPLU.m@ 635

Last change on this file since 635 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 3.4 KB
Line 
1NURSCPLU ;HIRMFO/RM,FT-Create NURSING FILE AND XREFS ;8/14/96 10:22
2 ;;4.0;NURSING SERVICE;;Apr 25, 1997
3EN1 ; ENTRY FROM OPTION NURSPT-WRDACT
4 S X="A"
5 G MAIN
6EN2 ; ENTRY FROM OPTION NURSPT-WRDINA
7 S X="I"
8MAIN ;
9 Q:'$D(^DIC(213.9,1,"OFF")) Q:$P(^DIC(213.9,1,"OFF"),"^",1)=1
10 S NURSTUS=X
11 D CKMAS I NURSBAD Q
12 S NURSEND=0
13 D DATACK
14 D:'NURSDATA FIRSTIME I NURSEND K NURSEND Q
15 D WARDSEL I $G(NURSEND) K NURSEND Q
16 D INIT214 K NURSEND
17 Q
18FIRSTIME ; IF NO DATA IN NURS PATIENT (214) FILE INITIALIZE IT
19 D EN1^NURSCPL
20 I NURSBAD S NURSEND=1 Q
21 D INIT214 K NURSWRD
22 S NURSDATA=1
23 Q
24DATACK ; CHECK TO SEE IF DATA IN THE 214 FILE
25 S NURSDATA=0,NURSCK=$O(^NURSF(214,0))
26 S:NURSCK>0 NURSDATA=1
27 Q
28WARDSEL ; SELECT WARD TO BE ACTIVATED
29 S NURSEND=0,OUTSW=0
30 F NURSI=1:1 S DIC="^NURSF(211.4,",DIC("S")="I $S('$D(^(""I"")):1,$P(^(""I""),U)'=""I"":1,1:0)",DIC(0)="AEM",DIC("A")="Select UNIT: " D ^DIC K DIC S:X="^" NURSEND=1,OUTSW=1 S:(X="")!(+Y'>0) OUTSW=1 S:(X="")&'$D(NURSWRD) NURSEND=1 Q:OUTSW D
31 .S NURSWRD(NURSI)=+Y
32 .Q
33 I NURSEND Q
34 D:'$G(NURSEND) ACTWARD
35 Q
36ACTWARD ; SET WARD STATUS TO ACTIVE
37 F NURSI=0:0 S NURSI=$O(NURSWRD(NURSI)) Q:NURSI'>0 S DA=NURSWRD(NURSI),DIE="^NURSF(211.4,",DR="1///^S X=NURSTUS" D ^DIE
38 Q
39CKMAS ; CHECKS EVERY MAS WARD TO SEE IF CORR. NURSING LOCATION
40 W !!,"Checking to see if every MAS Ward has a corresponding NURSING unit"
41 S NURSERR=0
42 F NURSY=0:0 S NURSY=$O(^DIC(42,NURSY)) S:(NURSY'>0)&(NURSERR) NURSBAD=1 Q:NURSY'>0 S X=$P(^DIC(42,NURSY,0),"^",1) D ^NURSAWCK S:NURSBAD NURSERR=1
43 I NURSBAD D BADWARD^NURSAWCK W !!!,$C(7),"Press return to continue: " R X:DTIME Q
44 Q
45INIT214 ; ENTERS PATIENTS INTO 214 FILE FROM 2 FILE
46 W:'$G(NURSDATA) !!,"Set up initial Nursing Patient file entries for inpatients"
47 W:$G(NURSDATA) !!,"Ward "_$S(NURSTUS="A":"A",1:"Dea")_"ctivation and Patient entry for the following Nursing unit(s):"
48 D DT^DICRW S U="^" D F1:$G(NURSTUS)="A",F3:$G(NURSTUS)="I"
49 W !!,"Done ... "
50 Q
51F1 ; ACTIVIATION PROCESS
52 F NURSY=0:0 S NURSY=$O(NURSWRD(NURSY)) Q:NURSY'>0 S NPWARD=NURSWRD(NURSY) D EN6^NURSAUTL W !," ",NPWARD F NURSZ=0:0 S NURSZ=$O(^NURSF(211.4,NURSWRD(NURSY),3,NURSZ)) Q:NURSZ'>0 D F10
53 Q
54F10 ;
55 S NURSWRD=$S($D(^NURSF(211.4,NURSWRD(NURSY),3,NURSZ,0)):$S($D(^DIC(42,+^NURSF(211.4,NURSWRD(NURSY),3,NURSZ,0),0)):$P(^(0),"^"),1:""),1:"")
56 I NURSWRD'="" F DFN=0:0 S DFN=$O(^DPT("CN",NURSWRD,DFN)) Q:DFN'>0 D F2
57 Q
58F2 ; ACTIVATE PATIENT
59 I '$D(^DPT(DFN,.1)),'$D(^DPT(DFN)) W !!,*7,*7,"PATIENT WITH IEN#",DFN," DOES NOT HAVE A RECORD",!,"IN THE PATIENT FILE." Q
60 I '$D(^DPT(DFN,.1)) W !!,*7,*7,$P(^DPT(DFN,0),"^",1)," CANNOT BE ADMITTED INTO",!,"THE NURSING SERVICE BECAUSE OF A PROBLEM WITH THE MAS PATIENT FILE -- NOTIFY MAS" Q
61 I NURSDATA D MASCK Q:NURSNOTV
62 S X=^DPT(DFN,.1)
63 S DA=DFN,DIC="" D EN1^NURSCPL
64 Q
65F3 ; DEACTIVATION PROCESS
66 F NURSY=0:0 S NURSY=$O(NURSWRD(NURSY)) Q:NURSY'>0 S (NPWARD,NURSWRD)=NURSWRD(NURSY) D EN6^NURSAUTL W !," "_NPWARD F DA=0:0 S DA=$O(^NURSF(214,"AF","A",NURSWRD,DA)) Q:DA'>0 S X=NURSWRD D EN2^NURSCPL
67 Q
68MASCK ; CHECKS TO SEE IF THE MAS WARD IS AN ACTIVATED NURSE LOCATION.
69 S NURSWARD=$S($P(^DPT(DFN,.1),"^",1)="":"",1:$O(^DIC(42,"B",$P(^DPT(DFN,.1),"^",1),"")))
70 S NURSNOTV=1
71 Q:NURSWARD=""
72 F NURSWCK=0:0 S NURSWCK=$O(^NURSF(211.4,"C",NURSWARD,NURSWCK)) Q:NURSWCK'>0 D WARDCK Q:'NURSNOTV
73 Q
74WARDCK ; THIS CHECKS THAT THE NURSE LOCATION WAS ONE SELECTED TO ACTIVATE
75 F NURSI=0:0 S NURSI=$O(NURSWRD(NURSI)) Q:(NURSI'>0)!('NURSNOTV) S:NURSWCK=NURSWRD(NURSI) NURSNOTV=0
76 Q
Note: See TracBrowser for help on using the repository browser.