source: WorldVistAEHR/trunk/r/SURGERY-SR/SROANEW.m@ 1154

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

initial load of WorldVistAEHR

File size: 3.6 KB
Line 
1SROANEW ;BIR/MAM - CREATE NEW RISK ASSESSMENT ;01/18/07
2 ;;3.0; Surgery ;**34,47,71,100,135,160**;24 Jun 93;Build 7
3 W @IOF,!,?1,VADM(1)_" "_VA("PID")
4 W !! S (SRDT,CNT)=0 F I=0:0 S SRDT=$O(^SRF("ADT",DFN,SRDT)) Q:'SRDT!(SRSOUT) S SRASS=0 F I=0:0 S SRASS=$O(^SRF("ADT",DFN,SRDT,SRASS)) Q:'SRASS!($D(SRTN))!(SRSOUT) D LIST I $D(SRTN) G ASK
5 I 'CNT W "No operations exist for this patient. Assessment cannot be entered.",!!,"Press RETURN to continue... " R X:DTIME G END
6OPT W !!,"Select Operation: " R X:DTIME I '$T!("^"[X) S SRSOUT=1 G END
7 I '$D(SRCASE(X)) W !!,"Enter the number of the desired operation" W $S('$D(SRNEWOP):".",1:", or '"_CNT_"' to enter a new case.") G OPT
8 S SRTN=+SRCASE(X)
9ASK I SRATYPE="N" D EXCL^SROASS
10 I $P($G(^SRF(SRTN,"RA")),"^",6)="N"!($P($G(^SRF(SRTN,"RA")),"^",7)'="") W !!,"This case is currently flagged as meeting Risk Assessment exclusion criteria.",$C(7)
11 W !!,"Are you sure that you want to create a Risk Assessment for this surgical",!,"case ? YES// " R SRYN:DTIME I '$T!(SRYN["^") K SRTN S SRSOUT=1 Q
12 S SRYN=$E(SRYN) I "YyNn"'[SRYN W !!,"Enter 'YES' to create an assessment for this surgical case, or 'NO' to quit",!,"this option." G ASK
13 I "Yy"'[SRYN K SRTN S SRSOUT=1 Q
14 I $$LOCK^SROUTL(SRTN) D D UNLOCK^SROUTL(SRTN) Q
15 .I $P($G(^SRF(SRTN,"RA")),"^",6)="N"!($P($G(^SRF(SRTN,"RA")),"^",7)'="") D DRDEL^SRONASS
16 .K DIE,DR,DA S DA=SRTN,DIE=130,DR="284////"_SRATYPE_";Q;323////Y;235////I" D ^DIE K DR,DIE,DA
17 .N X S X=$P($G(^SRF(SRTN,209)),"^",12) I X="" D
18 ..S DA=SRTN,DIE=130,DR="490////N" D ^DIE K DR,DIE,DA
19 E K SRTN
20 Q
21LIST ; list assessments
22 I $P($G(^SRF(SRASS,"NON")),"^")="Y" Q
23 S SRSCAN=1 I $D(^SRF(SRASS,.2)),$P(^(.2),"^",12)'="" K SRSCAN
24 I $D(SRSCAN),$P($G(^SRF(SRASS,30)),"^") Q
25 I $D(SRSCAN),$P($G(^SRF(SRASS,31)),"^",8) Q
26 I $D(^SRF(SRASS,37)),$P(^(37),"^") Q
27 I $Y+5>IOSL S SRBACK=0 D SEL Q:$D(SRTN)!(SRSOUT) I SRBACK S CNT=0,SRASS=SRCASE(1)-1,SRDT=$P(SRCASE(1),"^",2) W @IOF,!,?1,VADM(1)_" "_VA("PID"),! Q
28 S CNT=CNT+1,SRSDATE=$P(^SRF(SRASS,0),"^",9)
29DISP S SROPER=$P(^SRF(SRASS,"OP"),"^") I $O(^SRF(SRASS,13,0)) S SROTHER=0 F I=0:0 S SROTHER=$O(^SRF(SRASS,13,SROTHER)) Q:'SROTHER D OTHER
30 S SR("RA")=$G(^SRF(SRASS,"RA")) I "N"'[$P(SR("RA"),"^",6) S CNT=CNT-1 Q
31 S SROP=SRASS D ^SROP1
32 K SROPS,MM,MMM S:$L(SROPER)<65 SROPS(1)=SROPER I $L(SROPER)>64 S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
33 I '$D(SRTN) W CNT_". "
34CASE W $E(SRSDATE,4,5)_"-"_$E(SRSDATE,6,7)_"-"_$E(SRSDATE,2,3),?14,SROPS(1) I $D(SROPS(2)) W !,?14,SROPS(2) I $D(SROPS(3)) W !,?14,SROPS(3)
35 I $D(SROPS(4)) W !,?14,SROPS(4)
36 I $D(SRTN) Q
37 W !! S SRCASE(CNT)=SRASS_"^"_SRDT
38 Q
39OTHER ; other operations
40 S SRLONG=1 I $L(SROPER)+$L($P(^SRF(SRASS,13,SROTHER,0),"^"))>235 S SRLONG=0,SROTHER=999,SROPERS=" ..."
41 I SRLONG S SROPERS=$P(^SRF(SRASS,13,SROTHER,0),"^")
42 S SROPER=SROPER_$S(SROPERS'=" ...":", "_SROPERS,1:SROPERS)
43 Q
44LOOP ; break procedures
45 S SROPS(M)="" F LOOP=1:1 S MM=$P(SROPER," "),MMM=$P(SROPER," ",2,200) Q:MMM="" Q:$L(SROPS(M))+$L(MM)'<65 S SROPS(M)=SROPS(M)_MM_" ",SROPER=MMM
46 Q
47SEL ; select case
48 W !!!,"Select Operation, or enter <RET> to continue listing Procedures: " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
49 I X="" W @IOF,!,?1,VADM(1)_" "_VA("PID"),!! Q
50 I '$D(SRCASE(X)) W !!,"Please enter the number corresponding to the Surgical Case you want to edit.",!,"If the case desired does not appear, enter <RET> to continue listing",!,"additional cases."
51 I '$D(SRCASE(X)) W !!,"Press <RET> to continue " R X:DTIME S:'$T SRSOUT=1 S SRBACK=1 Q
52 S SRTN=+SRCASE(X)
53 Q
54TYPE K DR,DIE S DR="284////"_SRATYPE,DIE=139,DA=SRTN D ^DIE
55 K DR,DA,DIE S DR="235////I",DIE=139,DA=SRTN D ^DIE K DR
56END D ^SRSKILL W @IOF
57 Q
Note: See TracBrowser for help on using the repository browser.