analysis.php 처방을 통한 환자분석
작성자 정보
- 삼둡 작성
- 작성일
컨텐츠 정보
- 627 조회
- 목록
본문
11 $tablename="make_herb"; //테이블 이름
12 echo "id:",$member[mb_id]," name:",$member[mb_name]," level:",$member[mb_level] , " Rx_LV:",$member[mb_1], "<br>\n" ;
13
14
15
16
17 erp_connect ();
18
19 ㅣevel(5); 레벨이 높아야합니다.
20
21 //우선 patient_management 테이블을 초기화(삭제) 한다.
22 sql_query ("delete from patient_management where serial");
처음에 모든 행을 삭제합니다. patient_management
23
24
25 $query="SELECT * from make_herb order by serial desc "; // SQL 쿼리문
26 $result=mysql_query($query) or die (mysql_error()); // 쿼리문을 실행 결과
27 //쿼리 결과를 하나씩 불러와 실제 HTML에 나타내는 것은 HTML 문 중간에 삽입합니다.
28
29
30 while ($array=mysql_fetch_array($result)) {
31
32 //array 배열에 모든 탕전=make_herb 자료를 넣어두고, 하나씩 끄집어 쓴다.
33
34
35 $환자이름=$array[pt_name];
36 $지점=$array[branch];
37 $병록번호=$array[pt_number];
38
39 echo "<PRE>";
40
41 //$result_pt_management=mysql_query($query_pt_management) or die (mysql_error()); //
42 //$rows=mysql_num_rows($result_pt_management);
43 //$row_num=mysql_num_fields($result_pt_management);
44
45 //echo $rows;
46 //$o=mysql_result($result_pt_management,0,5);
47
48
49 $data= sql_fetch(" select * from patient_management where name='$환자이름' and branch='$지점' and hospital_serial ='$병록번호' ");
한 처방을 끄집어내어
이 처방의 이름 지점 병록번호가 동일한 환자를 찾아낸다
//이름은 빼야할듯하다. 왜냐하면 2년 지난 처방의 이름은 변경하기 때문에
50
51 echo "**$data[serial]**";
52
53 if (!$data[serial])
54 {
55 echo "###";
56 $pt_name = $환자이름;
57 $pt_number = $병록번호;
58 $branch = $지점;
59
60 echo "$환자이름 : $지점 : $병록번호 ";
61 //make_herb에서 해당환자의 처방을 다 긁어오기
62
63
64 $q_makeherb = "SELECT * from make_herb where pt_name='$pt_name' and pt_number='$pt_number' and branch='$bra nch' order by serial asc";
65 //echo $q_makeherb;
66 $q = $q_makeherb;
67 $result_makeherb = sql_query($q) ;
68
69 $count = 0;
70 $cost = 0 ;
71 $total_rx ="";
72 while ($array_makeherb = mysql_fetch_array($result_makeherb) ) {
73
74 if ($count ==0 ) {$first_herb = $array_makeherb [time] ; }
75 $last_herb = $array_makeherb[time];
76
77 $cost = $cost + $array_makeherb[herb_cost] + $array_makeherb[totalservice];
78
79 $serial = $array_makeherb[serial];
80 $뉴 = totalgram_herb_at_makeherb ( $serial , '뉴' ) ;
81 $녹 = totalgram_herb_at_makeherb ( $serial , '녹' )
82 - totalgram_herb_at_makeherb ( $serial , '녹미채' )
83 ;
뉴자나 녹용이 들은 처방인가 확인하는데, 녹미채가 합산에 딸려들어가기 때문에 뺀다. 그래야 녹용량이 나오니
84 $마황 = totalgram_herb_at_makeherb ( $serial , '마황' ) ;
85
86 echo "\t\t serial:$serial --- N$녹 n$뉴 D$마황 $array_makeherb[time] \n<br>";
87
88 $rx="";
89 if ($마황 > 9) $rx="D";
90 if ($녹 > 0) $rx .= "N";
91 if ($뉴 > 0) $rx .= "n";
92
93 $rx .= $array[ch];
94 if ($count) $total_rx .="|";
95 $total_rx .= $rx ."ch";
96
97 $count ++;
98 }
99 echo "총처방수:$count 총금액:$cost 처방성격;$total_rx <br>\n";
100
101 $array[address] = addslashes($array[address]);
102
103 $sql="INSERT into patient_management set
104 branch='$branch',
105 hospital_serial='$pt_number',
106 name ='$pt_name' ,
107 phone = '$array[phone1]',
108 address = '$array[address]',
109 herb_count = $count,
110 herbs = '$total_rx',
111 first_herb = '$first_herb',
112 last_herb = '$last_herb',
113 totalcost = $cost*4 " ;
114 echo $sql;
115 sql_query ($sql) ;
116 }
117 else
118 {
119 echo "!!!$data[name]";
120 }
121 }
122
관련자료
-
이전
-
다음