├── .gitignore ├── LICENSE ├── README.md ├── SQL语句.sql ├── java源码 ├── cn │ └── linyer │ │ ├── controller │ │ └── Login.java │ │ ├── dao │ │ ├── ObjDao.java │ │ ├── UserQueryDao.java │ │ └── impl │ │ │ ├── AdminDaoImpl.java │ │ │ ├── DepartmentDaoImpl.java │ │ │ ├── DoctorDaoImpl.java │ │ │ ├── DoctorEmpDaoIpml.java │ │ │ ├── DoctorTreatPatient.java │ │ │ ├── DoctorWirteTest.java │ │ │ ├── PatientDaoImpl.java │ │ │ ├── PatientRegist.java │ │ │ ├── PatientSeeDoctor.java │ │ │ └── PatientSelDoctor.java │ │ ├── entity │ │ ├── Blood.java │ │ ├── Department.java │ │ ├── DocInfo.java │ │ ├── Doctor.java │ │ ├── DoctorEmp.java │ │ ├── Patient.java │ │ ├── Stool.java │ │ ├── Urine.java │ │ └── UserLoginMsg.java │ │ ├── gui │ │ ├── LoginGui.java │ │ ├── SelectUserGui.java │ │ ├── adminGui │ │ │ ├── AdminGui.java │ │ │ ├── DepartmentManagerGui.java │ │ │ ├── DoctorEmpManagerGui.java │ │ │ ├── DoctorManagerGui.java │ │ │ └── PatientManagerGui.java │ │ ├── doctorGui │ │ │ ├── DoctorAuxiliaryGui.java │ │ │ └── DoctorClinicalGui.java │ │ └── patientGui │ │ │ ├── PatientRegistGui.java │ │ │ ├── PatientSeeDoctorGui.java │ │ │ └── PatientSelDoctorGui.java │ │ ├── run │ │ └── Run.java │ │ └── util │ │ └── BaseDao.java └── database.properties └── 关系模型.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Linyer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Oracle数据库课程设计 2 | Oracle数据库课程设计【医院系统数据库】(包含Java代码和SQL语句) 3 | ## 源码中的数据库连接信息 4 | - 源码中默认Oracle数据库地址为test.linyer.cn:9999 5 | - 如需修改,在[java源码/database.propertie](https://github.com/GtLinyer/OracleDatbaseCourseDisign/blob/master/java%E6%BA%90%E7%A0%81/database.properties)中修改即可! 6 | 7 | ## 关系模型 8 | ![关系模型](https://github.com/GtLinyer/OracleDatbaseCourseDisign/raw/master/%E5%85%B3%E7%B3%BB%E6%A8%A1%E5%9E%8B.png) 9 | -------------------------------------------------------------------------------- /SQL语句.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Oracle Client Version : 12.2.0.1.0 3 | 4 | Source Host : cloud.linyer.cn:19996 5 | Source Schema : HXX 6 | 7 | Target Server Type : ORACLE 8 | Target Server Version : 120200 9 | File Encoding : 65001 10 | */ 11 | 12 | 13 | -- ---------------------------- 14 | -- Table structure for Admin 15 | -- ---------------------------- 16 | DROP TABLE "HXX"."Admin"; 17 | CREATE TABLE "HXX"."Admin" ( 18 | "Ano" NUMBER(8) NOT NULL , 19 | "Aname" VARCHAR2(20 BYTE) NOT NULL , 20 | "Apwd" VARCHAR2(12 BYTE) NOT NULL 21 | ) 22 | LOGGING 23 | NOCOMPRESS 24 | NOCACHE 25 | 26 | ; 27 | 28 | -- ---------------------------- 29 | -- Table structure for Blood 30 | -- ---------------------------- 31 | DROP TABLE "HXX"."Blood"; 32 | CREATE TABLE "HXX"."Blood" ( 33 | "Cno" NUMBER(8) NOT NULL , 34 | "Pno" NUMBER(8) NOT NULL , 35 | "RBC" FLOAT(126) NOT NULL , 36 | "HCT" FLOAT(126) NOT NULL , 37 | "MCV" FLOAT(126) NOT NULL , 38 | "HXF" FLOAT(126) NOT NULL , 39 | "HGB" FLOAT(126) NOT NULL , 40 | "MCH" FLOAT(126) NOT NULL , 41 | "MCHC" FLOAT(126) NOT NULL , 42 | "WBC" FLOAT(126) NOT NULL , 43 | "MONO%" FLOAT(126) NOT NULL , 44 | "NEUT" FLOAT(126) NOT NULL , 45 | "NEUT%" FLOAT(126) NOT NULL , 46 | "LY" FLOAT(126) NOT NULL , 47 | "LY%" FLOAT(126) NOT NULL , 48 | "PLT" FLOAT(126) NOT NULL , 49 | "PDW" FLOAT(126) NOT NULL , 50 | "MPV" FLOAT(126) NOT NULL , 51 | "P-LCR" FLOAT(126) NOT NULL , 52 | "PCT" FLOAT(126) NOT NULL , 53 | "CPno" NUMBER(8) NOT NULL 54 | ) 55 | LOGGING 56 | NOCOMPRESS 57 | NOCACHE 58 | 59 | ; 60 | 61 | -- ---------------------------- 62 | -- Table structure for Departments 63 | -- ---------------------------- 64 | DROP TABLE "HXX"."Departments"; 65 | CREATE TABLE "HXX"."Departments" ( 66 | "DPno" NUMBER(8) NOT NULL , 67 | "DPname" VARCHAR2(40 BYTE) NOT NULL , 68 | "DPloca" VARCHAR2(100 BYTE) NULL , 69 | "DPbrief" VARCHAR2(1000 BYTE) NULL , 70 | "isClinical" NUMBER(1) DEFAULT 0 NOT NULL 71 | ) 72 | LOGGING 73 | NOCOMPRESS 74 | NOCACHE 75 | 76 | ; 77 | 78 | -- ---------------------------- 79 | -- Table structure for DocEmp 80 | -- ---------------------------- 81 | DROP TABLE "HXX"."DocEmp"; 82 | CREATE TABLE "HXX"."DocEmp" ( 83 | "Dno" NUMBER(8) NOT NULL , 84 | "DPno" NUMBER(8) NOT NULL , 85 | "Dwork" VARCHAR2(60 BYTE) NULL , 86 | "Lno" NUMBER(8) NOT NULL , 87 | "Dxl" VARCHAR2(60 CHAR) NULL , 88 | "Dyear" NUMBER(8) NULL , 89 | "Dsalary" NUMBER(8) NULL , 90 | "DsuperNo" NUMBER(8) NULL 91 | ) 92 | LOGGING 93 | NOCOMPRESS 94 | NOCACHE 95 | 96 | ; 97 | 98 | -- ---------------------------- 99 | -- Table structure for Doctors 100 | -- ---------------------------- 101 | DROP TABLE "HXX"."Doctors"; 102 | CREATE TABLE "HXX"."Doctors" ( 103 | "Dno" NUMBER(8) NOT NULL , 104 | "Dname" VARCHAR2(18 BYTE) NOT NULL , 105 | "Dsex" VARCHAR2(3 BYTE) NOT NULL , 106 | "Dbirth" DATE NOT NULL , 107 | "Dphone" NUMBER(11) NOT NULL , 108 | "Demail" VARCHAR2(40 BYTE) NULL , 109 | "Dbrief" VARCHAR2(3000 BYTE) NULL , 110 | "Dpwd" VARCHAR2(12 BYTE) NOT NULL 111 | ) 112 | LOGGING 113 | NOCOMPRESS 114 | NOCACHE 115 | 116 | ; 117 | 118 | -- ---------------------------- 119 | -- Table structure for Level 120 | -- ---------------------------- 121 | DROP TABLE "HXX"."Level"; 122 | CREATE TABLE "HXX"."Level" ( 123 | "Lno" NUMBER(8) NOT NULL , 124 | "Lname" VARCHAR2(20 BYTE) NOT NULL 125 | ) 126 | LOGGING 127 | NOCOMPRESS 128 | NOCACHE 129 | 130 | ; 131 | 132 | -- ---------------------------- 133 | -- Table structure for Patients 134 | -- ---------------------------- 135 | DROP TABLE "HXX"."Patients"; 136 | CREATE TABLE "HXX"."Patients" ( 137 | "Pno" NUMBER(8) NOT NULL , 138 | "Pname" VARCHAR2(21 BYTE) NOT NULL , 139 | "Psex" VARCHAR2(3 BYTE) NOT NULL , 140 | "Page" NUMBER(2) NOT NULL , 141 | "Pphone" NUMBER(11) NOT NULL , 142 | "Paddress" VARCHAR2(300 BYTE) NULL , 143 | "Dno" NUMBER(8) NULL , 144 | "PEnDate" DATE NOT NULL , 145 | "Pemployer" VARCHAR2(60 BYTE) NULL , 146 | "Ppwd" VARCHAR2(12 BYTE) NOT NULL , 147 | "PIDno" NUMBER(18) NOT NULL 148 | ) 149 | LOGGING 150 | NOCOMPRESS 151 | NOCACHE 152 | 153 | ; 154 | 155 | -- ---------------------------- 156 | -- Table structure for PatientStatus 157 | -- ---------------------------- 158 | DROP TABLE "HXX"."PatientStatus"; 159 | CREATE TABLE "HXX"."PatientStatus" ( 160 | "Pno" NUMBER(8) NOT NULL , 161 | "isSee" NUMBER(1) DEFAULT 0 NOT NULL , 162 | "isBlood" NUMBER(1) DEFAULT 0 NOT NULL , 163 | "isUrine" NUMBER(1) DEFAULT 0 NOT NULL , 164 | "isStool" NUMBER(1) DEFAULT 0 NOT NULL , 165 | "isOK" NUMBER(1) DEFAULT 0 NOT NULL 166 | ) 167 | LOGGING 168 | NOCOMPRESS 169 | NOCACHE 170 | 171 | ; 172 | 173 | -- ---------------------------- 174 | -- Table structure for Stool 175 | -- ---------------------------- 176 | DROP TABLE "HXX"."Stool"; 177 | CREATE TABLE "HXX"."Stool" ( 178 | "Cno" NUMBER(8) NOT NULL , 179 | "Pno" NUMBER(8) NOT NULL , 180 | "Color" VARCHAR2(16 BYTE) NOT NULL , 181 | "Traits" VARCHAR2(16 BYTE) NOT NULL , 182 | "WBC" FLOAT(126) NOT NULL , 183 | "Phagocyte" FLOAT(126) NOT NULL , 184 | "RBC" FLOAT(126) NOT NULL , 185 | "HB" NUMBER(1) NOT NULL , 186 | "Parasite" NUMBER(1) NOT NULL , 187 | "FG" NUMBER(1) NOT NULL , 188 | "CPno" NUMBER(8) NOT NULL 189 | ) 190 | LOGGING 191 | NOCOMPRESS 192 | NOCACHE 193 | 194 | ; 195 | 196 | -- ---------------------------- 197 | -- Table structure for Treatment 198 | -- ---------------------------- 199 | DROP TABLE "HXX"."Treatment"; 200 | CREATE TABLE "HXX"."Treatment" ( 201 | "Dno" NUMBER(8) NOT NULL , 202 | "Pno" NUMBER(8) NOT NULL , 203 | "diagnosis" VARCHAR2(400 BYTE) NULL , 204 | "treat" VARCHAR2(400 BYTE) NULL , 205 | "describe" VARCHAR2(400 BYTE) NULL 206 | ) 207 | LOGGING 208 | NOCOMPRESS 209 | NOCACHE 210 | 211 | ; 212 | 213 | -- ---------------------------- 214 | -- Table structure for Urine 215 | -- ---------------------------- 216 | DROP TABLE "HXX"."Urine"; 217 | CREATE TABLE "HXX"."Urine" ( 218 | "Cno" NUMBER(8) NOT NULL , 219 | "Pno" NUMBER(8) NOT NULL , 220 | "PH" FLOAT(126) NOT NULL , 221 | "SG" FLOAT(126) NOT NULL , 222 | "URO" FLOAT(126) NOT NULL , 223 | "BLD" NUMBER(1) NOT NULL , 224 | "WBC" NUMBER(1) NOT NULL , 225 | "PRO" NUMBER(1) NOT NULL , 226 | "GLU" NUMBER(1) NOT NULL , 227 | "BIL" NUMBER(1) NOT NULL , 228 | "KET" NUMBER(1) NOT NULL , 229 | "RBC" NUMBER(1) NOT NULL , 230 | "GOL" VARCHAR2(40 BYTE) NOT NULL , 231 | "CPno" NUMBER(8) NOT NULL 232 | ) 233 | LOGGING 234 | NOCOMPRESS 235 | NOCACHE 236 | 237 | ; 238 | 239 | -- ---------------------------- 240 | -- View structure for DocInfo 241 | -- ---------------------------- 242 | CREATE OR REPLACE FORCE VIEW "HXX"."DocInfo" AS 243 | SELECT 244 | HXX."Doctors"."Dno" AS "医师工号", 245 | HXX."Doctors"."Demail" AS "医师邮箱", 246 | HXX."DocEmp"."DPno" AS "所属科室编号", 247 | HXX."DocEmp"."Dxl" AS "医师学历", 248 | HXX."DocEmp"."Dyear" AS "医师年资", 249 | HXX."Departments"."DPname" AS "所属科室名称", 250 | HXX."Level"."Lname" AS "医师职称", 251 | HXX."DocEmp"."Lno" AS "医师职称编号", 252 | HXX."Doctors"."Dbrief" AS "医师简介", 253 | HXX."Doctors"."Dname" AS "医师姓名", 254 | HXX."Doctors"."Dsex" AS "医师性别" 255 | FROM 256 | HXX."Doctors" 257 | INNER JOIN HXX."DocEmp" ON HXX."DocEmp"."Dno" = HXX."Doctors"."Dno" 258 | INNER JOIN HXX."Departments" ON HXX."DocEmp"."DPno" = HXX."Departments"."DPno" 259 | INNER JOIN HXX."Level" ON HXX."DocEmp"."Lno" = HXX."Level"."Lno"; 260 | 261 | -- ---------------------------- 262 | -- View structure for DoctorLogin 263 | -- ---------------------------- 264 | CREATE OR REPLACE FORCE VIEW "HXX"."DoctorLogin" AS 265 | SELECT 266 | HXX."Doctors"."Dno" AS "工号", 267 | HXX."Doctors"."Dname" AS "姓名", 268 | HXX."Doctors"."Dpwd" AS "密码", 269 | HXX."Departments"."isClinical" AS "是否临床" 270 | FROM 271 | HXX."Doctors" 272 | INNER JOIN HXX."DocEmp" ON HXX."DocEmp"."Dno" = HXX."Doctors"."Dno" 273 | INNER JOIN HXX."Departments" ON HXX."DocEmp"."DPno" = HXX."Departments"."DPno"; 274 | 275 | -- ---------------------------- 276 | -- View structure for PatientLogin 277 | -- ---------------------------- 278 | CREATE OR REPLACE FORCE VIEW "HXX"."PatientLogin" AS 279 | SELECT 280 | HXX."Patients"."Pno" AS "病历号", 281 | HXX."Patients"."Pname" AS "姓名", 282 | HXX."Patients"."Ppwd" AS "密码" 283 | FROM 284 | HXX."Patients"; 285 | 286 | -- ---------------------------- 287 | -- View structure for SelPatient 288 | -- ---------------------------- 289 | CREATE OR REPLACE FORCE VIEW "HXX"."SelPatient" AS 290 | SELECT 291 | HXX."Patients"."Pno" AS "病历号", 292 | HXX."Patients"."Pname" AS "患者姓名", 293 | HXX."Patients"."Psex" AS "患者性别", 294 | HXX."Patients"."Page" AS "患者年龄", 295 | HXX."Patients"."Pphone" AS "患者联系电话", 296 | HXX."Patients"."Paddress" AS "患者住址", 297 | HXX."Patients"."PEnDate" AS "患者入院时间", 298 | HXX."Patients"."Pemployer" AS "患者职业", 299 | HXX."Patients"."Dno" AS "主治医师", 300 | HXX."PatientStatus"."isSee" AS "是否已看诊", 301 | HXX."PatientStatus"."isBlood" AS "是否需要血检", 302 | HXX."PatientStatus"."isUrine" AS "是否需要尿检", 303 | HXX."PatientStatus"."isStool" AS "是否需要便检", 304 | HXX."PatientStatus"."isOK" AS "是否可以出院" 305 | FROM 306 | HXX."Patients" 307 | INNER JOIN HXX."PatientStatus" ON HXX."PatientStatus"."Pno" = HXX."Patients"."Pno"; 308 | 309 | -- ---------------------------- 310 | -- Sequence structure for BCNO_SEQ 311 | -- ---------------------------- 312 | DROP SEQUENCE "HXX"."BCNO_SEQ"; 313 | CREATE SEQUENCE "HXX"."BCNO_SEQ" 314 | INCREMENT BY 1 315 | MINVALUE 30000001 316 | MAXVALUE 49999999 317 | START WITH 30000002 318 | NOCACHE 319 | ORDER ; 320 | 321 | -- ---------------------------- 322 | -- Sequence structure for DNO_SEQ 323 | -- ---------------------------- 324 | DROP SEQUENCE "HXX"."DNO_SEQ"; 325 | CREATE SEQUENCE "HXX"."DNO_SEQ" 326 | INCREMENT BY 1 327 | MINVALUE 1000 328 | MAXVALUE 9999 329 | START WITH 1008 330 | NOCACHE 331 | ORDER ; 332 | 333 | -- ---------------------------- 334 | -- Sequence structure for DPNO_SEQ 335 | -- ---------------------------- 336 | DROP SEQUENCE "HXX"."DPNO_SEQ"; 337 | CREATE SEQUENCE "HXX"."DPNO_SEQ" 338 | INCREMENT BY 1 339 | MINVALUE 101 340 | MAXVALUE 999 341 | START WITH 104 342 | NOCACHE 343 | ORDER ; 344 | 345 | -- ---------------------------- 346 | -- Sequence structure for PNO_SEQ 347 | -- ---------------------------- 348 | DROP SEQUENCE "HXX"."PNO_SEQ"; 349 | CREATE SEQUENCE "HXX"."PNO_SEQ" 350 | INCREMENT BY 1 351 | MINVALUE 10000001 352 | MAXVALUE 29999999 353 | START WITH 10000005 354 | NOCACHE 355 | ORDER ; 356 | 357 | -- ---------------------------- 358 | -- Sequence structure for SCNO_SEQ 359 | -- ---------------------------- 360 | DROP SEQUENCE "HXX"."SCNO_SEQ"; 361 | CREATE SEQUENCE "HXX"."SCNO_SEQ" 362 | INCREMENT BY 1 363 | MINVALUE 70000001 364 | MAXVALUE 99999999 365 | START WITH 70000001 366 | NOCACHE 367 | ORDER ; 368 | 369 | -- ---------------------------- 370 | -- Sequence structure for UCNO_SEQ 371 | -- ---------------------------- 372 | DROP SEQUENCE "HXX"."UCNO_SEQ"; 373 | CREATE SEQUENCE "HXX"."UCNO_SEQ" 374 | INCREMENT BY 1 375 | MINVALUE 50000001 376 | MAXVALUE 69999999 377 | START WITH 50000001 378 | NOCACHE 379 | ORDER ; 380 | 381 | -- ---------------------------- 382 | -- Checks structure for table Admin 383 | -- ---------------------------- 384 | ALTER TABLE "HXX"."Admin" ADD CHECK ("Ano" IS NOT NULL); 385 | ALTER TABLE "HXX"."Admin" ADD CHECK ("Aname" IS NOT NULL); 386 | ALTER TABLE "HXX"."Admin" ADD CHECK ("Apwd" IS NOT NULL); 387 | 388 | -- ---------------------------- 389 | -- Triggers structure for table Blood 390 | -- ---------------------------- 391 | CREATE OR REPLACE TRIGGER "HXX"."DELETE_BLOOD_FROM_PATIENTS" BEFORE DELETE ON "HXX"."Blood" REFERENCING OLD AS "OLD" NEW AS "NEW" FOR EACH ROW ENABLE 392 | begin 393 | DELETE "Patients" WHERE "Pno"=:new."Pno"; 394 | end Delete_Blood_From_Patients; 395 | -- ---------------------------- 396 | -- Checks structure for table Blood 397 | -- ---------------------------- 398 | ALTER TABLE "HXX"."Blood" ADD CHECK ("Cno" IS NOT NULL); 399 | ALTER TABLE "HXX"."Blood" ADD CHECK ("Pno" IS NOT NULL); 400 | ALTER TABLE "HXX"."Blood" ADD CHECK ("RBC" IS NOT NULL); 401 | ALTER TABLE "HXX"."Blood" ADD CHECK ("HCT" IS NOT NULL); 402 | ALTER TABLE "HXX"."Blood" ADD CHECK ("MCV" IS NOT NULL); 403 | ALTER TABLE "HXX"."Blood" ADD CHECK ("HXF" IS NOT NULL); 404 | ALTER TABLE "HXX"."Blood" ADD CHECK ("HGB" IS NOT NULL); 405 | ALTER TABLE "HXX"."Blood" ADD CHECK ("MCH" IS NOT NULL); 406 | ALTER TABLE "HXX"."Blood" ADD CHECK ("MCHC" IS NOT NULL); 407 | ALTER TABLE "HXX"."Blood" ADD CHECK ("WBC" IS NOT NULL); 408 | ALTER TABLE "HXX"."Blood" ADD CHECK ("MONO%" IS NOT NULL); 409 | ALTER TABLE "HXX"."Blood" ADD CHECK ("NEUT" IS NOT NULL); 410 | ALTER TABLE "HXX"."Blood" ADD CHECK ("NEUT%" IS NOT NULL); 411 | ALTER TABLE "HXX"."Blood" ADD CHECK ("LY" IS NOT NULL); 412 | ALTER TABLE "HXX"."Blood" ADD CHECK ("LY%" IS NOT NULL); 413 | ALTER TABLE "HXX"."Blood" ADD CHECK ("PLT" IS NOT NULL); 414 | ALTER TABLE "HXX"."Blood" ADD CHECK ("PDW" IS NOT NULL); 415 | ALTER TABLE "HXX"."Blood" ADD CHECK ("MPV" IS NOT NULL); 416 | ALTER TABLE "HXX"."Blood" ADD CHECK ("P-LCR" IS NOT NULL); 417 | ALTER TABLE "HXX"."Blood" ADD CHECK ("PCT" IS NOT NULL); 418 | ALTER TABLE "HXX"."Blood" ADD CHECK ("CPno" IS NOT NULL); 419 | 420 | -- ---------------------------- 421 | -- Primary Key structure for table Blood 422 | -- ---------------------------- 423 | ALTER TABLE "HXX"."Blood" ADD PRIMARY KEY ("Cno"); 424 | 425 | -- ---------------------------- 426 | -- Checks structure for table Departments 427 | -- ---------------------------- 428 | ALTER TABLE "HXX"."Departments" ADD CHECK ("DPname" IS NOT NULL); 429 | ALTER TABLE "HXX"."Departments" ADD CHECK ("isClinical" IS NOT NULL); 430 | ALTER TABLE "HXX"."Departments" ADD CHECK ("DPno" IS NOT NULL); 431 | ALTER TABLE "HXX"."Departments" ADD CHECK ("DPno" IS NOT NULL); 432 | 433 | -- ---------------------------- 434 | -- Primary Key structure for table Departments 435 | -- ---------------------------- 436 | ALTER TABLE "HXX"."Departments" ADD PRIMARY KEY ("DPno"); 437 | 438 | -- ---------------------------- 439 | -- Triggers structure for table DocEmp 440 | -- ---------------------------- 441 | CREATE OR REPLACE TRIGGER "HXX"."DELETE_DOCEMP_FROM_DOCTORS" BEFORE DELETE ON "HXX"."DocEmp" REFERENCING OLD AS "OLD" NEW AS "NEW" FOR EACH ROW ENABLE 442 | begin 443 | DELETE "Doctors" WHERE "Dno"=:new."Dno"; 444 | end Delete_DocEmp_From_Doctors; 445 | -- ---------------------------- 446 | -- Checks structure for table DocEmp 447 | -- ---------------------------- 448 | ALTER TABLE "HXX"."DocEmp" ADD CHECK ("DPno" IS NOT NULL); 449 | ALTER TABLE "HXX"."DocEmp" ADD CHECK ("Lno" IS NOT NULL); 450 | ALTER TABLE "HXX"."DocEmp" ADD CHECK ("Dno" IS NOT NULL); 451 | ALTER TABLE "HXX"."DocEmp" ADD CHECK ("Dno" IS NOT NULL); 452 | 453 | -- ---------------------------- 454 | -- Primary Key structure for table DocEmp 455 | -- ---------------------------- 456 | ALTER TABLE "HXX"."DocEmp" ADD PRIMARY KEY ("Dno"); 457 | 458 | -- ---------------------------- 459 | -- Checks structure for table Doctors 460 | -- ---------------------------- 461 | ALTER TABLE "HXX"."Doctors" ADD CHECK ("Dname" IS NOT NULL); 462 | ALTER TABLE "HXX"."Doctors" ADD CHECK ("Dsex" IS NOT NULL); 463 | ALTER TABLE "HXX"."Doctors" ADD CHECK ("Dbirth" IS NOT NULL); 464 | ALTER TABLE "HXX"."Doctors" ADD CHECK ("Dphone" IS NOT NULL); 465 | ALTER TABLE "HXX"."Doctors" ADD CHECK ("Dpwd" IS NOT NULL); 466 | ALTER TABLE "HXX"."Doctors" ADD CHECK ("Dno" IS NOT NULL); 467 | ALTER TABLE "HXX"."Doctors" ADD CHECK ("Dno" IS NOT NULL); 468 | ALTER TABLE "HXX"."Doctors" ADD CHECK ("Dsex" IN ('男','女')); 469 | 470 | -- ---------------------------- 471 | -- Primary Key structure for table Doctors 472 | -- ---------------------------- 473 | ALTER TABLE "HXX"."Doctors" ADD PRIMARY KEY ("Dno"); 474 | 475 | -- ---------------------------- 476 | -- Checks structure for table Level 477 | -- ---------------------------- 478 | ALTER TABLE "HXX"."Level" ADD CHECK ("Lname" IS NOT NULL); 479 | ALTER TABLE "HXX"."Level" ADD CHECK ("Lno" IS NOT NULL); 480 | ALTER TABLE "HXX"."Level" ADD CHECK ("Lno" IS NOT NULL); 481 | 482 | -- ---------------------------- 483 | -- Primary Key structure for table Level 484 | -- ---------------------------- 485 | ALTER TABLE "HXX"."Level" ADD PRIMARY KEY ("Lno"); 486 | 487 | -- ---------------------------- 488 | -- Triggers structure for table Patients 489 | -- ---------------------------- 490 | CREATE OR REPLACE TRIGGER "HXX"."ADD_PATIENTSTATUS_FROM_PATIENTS" AFTER INSERT ON "HXX"."Patients" REFERENCING OLD AS "OLD" NEW AS "NEW" FOR EACH ROW ENABLE 491 | begin 492 | insert into "PatientStatus"("Pno") values(:new."Pno"); 493 | end Add_PatientStatus_From_Patients; 494 | 495 | -- ---------------------------- 496 | -- Checks structure for table Patients 497 | -- ---------------------------- 498 | ALTER TABLE "HXX"."Patients" ADD CHECK ("Pname" IS NOT NULL); 499 | ALTER TABLE "HXX"."Patients" ADD CHECK ("Psex" IS NOT NULL); 500 | ALTER TABLE "HXX"."Patients" ADD CHECK ("Page" IS NOT NULL); 501 | ALTER TABLE "HXX"."Patients" ADD CHECK ("Pphone" IS NOT NULL); 502 | ALTER TABLE "HXX"."Patients" ADD CHECK ("PEnDate" IS NOT NULL); 503 | ALTER TABLE "HXX"."Patients" ADD CHECK ("Ppwd" IS NOT NULL); 504 | ALTER TABLE "HXX"."Patients" ADD CHECK ("PIDno" IS NOT NULL); 505 | ALTER TABLE "HXX"."Patients" ADD CHECK ("Pno" IS NOT NULL); 506 | ALTER TABLE "HXX"."Patients" ADD CHECK ("Pno" IS NOT NULL); 507 | 508 | -- ---------------------------- 509 | -- Primary Key structure for table Patients 510 | -- ---------------------------- 511 | ALTER TABLE "HXX"."Patients" ADD PRIMARY KEY ("Pno"); 512 | 513 | -- ---------------------------- 514 | -- Checks structure for table PatientStatus 515 | -- ---------------------------- 516 | ALTER TABLE "HXX"."PatientStatus" ADD CHECK ("Pno" IS NOT NULL); 517 | ALTER TABLE "HXX"."PatientStatus" ADD CHECK ("isSee" IS NOT NULL); 518 | ALTER TABLE "HXX"."PatientStatus" ADD CHECK ("isBlood" IS NOT NULL); 519 | ALTER TABLE "HXX"."PatientStatus" ADD CHECK ("isUrine" IS NOT NULL); 520 | ALTER TABLE "HXX"."PatientStatus" ADD CHECK ("isStool" IS NOT NULL); 521 | ALTER TABLE "HXX"."PatientStatus" ADD CHECK ("isOK" IS NOT NULL); 522 | 523 | -- ---------------------------- 524 | -- Triggers structure for table Stool 525 | -- ---------------------------- 526 | CREATE OR REPLACE TRIGGER "HXX"."DELETE_STOOL_FROM_PATIENTS" BEFORE DELETE ON "HXX"."Stool" REFERENCING OLD AS "OLD" NEW AS "NEW" FOR EACH ROW ENABLE 527 | begin 528 | DELETE "Patients" WHERE "Pno"=:new."Pno"; 529 | end Delete_Stool_From_Patients; 530 | -- ---------------------------- 531 | -- Checks structure for table Stool 532 | -- ---------------------------- 533 | ALTER TABLE "HXX"."Stool" ADD CHECK ("Cno" IS NOT NULL); 534 | ALTER TABLE "HXX"."Stool" ADD CHECK ("Pno" IS NOT NULL); 535 | ALTER TABLE "HXX"."Stool" ADD CHECK ("Color" IS NOT NULL); 536 | ALTER TABLE "HXX"."Stool" ADD CHECK ("Traits" IS NOT NULL); 537 | ALTER TABLE "HXX"."Stool" ADD CHECK ("WBC" IS NOT NULL); 538 | ALTER TABLE "HXX"."Stool" ADD CHECK ("Phagocyte" IS NOT NULL); 539 | ALTER TABLE "HXX"."Stool" ADD CHECK ("RBC" IS NOT NULL); 540 | ALTER TABLE "HXX"."Stool" ADD CHECK ("HB" IS NOT NULL); 541 | ALTER TABLE "HXX"."Stool" ADD CHECK ("Parasite" IS NOT NULL); 542 | ALTER TABLE "HXX"."Stool" ADD CHECK ("FG" IS NOT NULL); 543 | ALTER TABLE "HXX"."Stool" ADD CHECK ("CPno" IS NOT NULL); 544 | 545 | -- ---------------------------- 546 | -- Primary Key structure for table Stool 547 | -- ---------------------------- 548 | ALTER TABLE "HXX"."Stool" ADD PRIMARY KEY ("Cno"); 549 | 550 | -- ---------------------------- 551 | -- Checks structure for table Treatment 552 | -- ---------------------------- 553 | ALTER TABLE "HXX"."Treatment" ADD CHECK ("Dno" IS NOT NULL); 554 | ALTER TABLE "HXX"."Treatment" ADD CHECK ("Pno" IS NOT NULL); 555 | 556 | -- ---------------------------- 557 | -- Primary Key structure for table Treatment 558 | -- ---------------------------- 559 | ALTER TABLE "HXX"."Treatment" ADD PRIMARY KEY ("Dno"); 560 | 561 | -- ---------------------------- 562 | -- Triggers structure for table Urine 563 | -- ---------------------------- 564 | CREATE OR REPLACE TRIGGER "HXX"."DELETE_URINE_FROM_PATIENTS" BEFORE DELETE ON "HXX"."Urine" REFERENCING OLD AS "OLD" NEW AS "NEW" FOR EACH ROW ENABLE 565 | begin 566 | DELETE "Patients" WHERE "Pno"=:new."Pno"; 567 | end Delete_Urine_From_Patients; 568 | -- ---------------------------- 569 | -- Checks structure for table Urine 570 | -- ---------------------------- 571 | ALTER TABLE "HXX"."Urine" ADD CHECK ("Cno" IS NOT NULL); 572 | ALTER TABLE "HXX"."Urine" ADD CHECK ("Pno" IS NOT NULL); 573 | ALTER TABLE "HXX"."Urine" ADD CHECK ("PH" IS NOT NULL); 574 | ALTER TABLE "HXX"."Urine" ADD CHECK ("SG" IS NOT NULL); 575 | ALTER TABLE "HXX"."Urine" ADD CHECK ("URO" IS NOT NULL); 576 | ALTER TABLE "HXX"."Urine" ADD CHECK ("BLD" IS NOT NULL); 577 | ALTER TABLE "HXX"."Urine" ADD CHECK ("WBC" IS NOT NULL); 578 | ALTER TABLE "HXX"."Urine" ADD CHECK ("PRO" IS NOT NULL); 579 | ALTER TABLE "HXX"."Urine" ADD CHECK ("GLU" IS NOT NULL); 580 | ALTER TABLE "HXX"."Urine" ADD CHECK ("BIL" IS NOT NULL); 581 | ALTER TABLE "HXX"."Urine" ADD CHECK ("KET" IS NOT NULL); 582 | ALTER TABLE "HXX"."Urine" ADD CHECK ("RBC" IS NOT NULL); 583 | ALTER TABLE "HXX"."Urine" ADD CHECK ("GOL" IS NOT NULL); 584 | ALTER TABLE "HXX"."Urine" ADD CHECK ("CPno" IS NOT NULL); 585 | 586 | -- ---------------------------- 587 | -- Primary Key structure for table Urine 588 | -- ---------------------------- 589 | ALTER TABLE "HXX"."Urine" ADD PRIMARY KEY ("Cno"); 590 | 591 | -- ---------------------------- 592 | -- Foreign Key structure for table "HXX"."Blood" 593 | -- ---------------------------- 594 | ALTER TABLE "HXX"."Blood" ADD FOREIGN KEY ("CPno") REFERENCES "HXX"."Doctors" ("Dno"); 595 | ALTER TABLE "HXX"."Blood" ADD FOREIGN KEY ("Pno") REFERENCES "HXX"."Patients" ("Pno"); 596 | 597 | -- ---------------------------- 598 | -- Foreign Key structure for table "HXX"."DocEmp" 599 | -- ---------------------------- 600 | ALTER TABLE "HXX"."DocEmp" ADD FOREIGN KEY ("DPno") REFERENCES "HXX"."Departments" ("DPno"); 601 | ALTER TABLE "HXX"."DocEmp" ADD FOREIGN KEY ("Dno") REFERENCES "HXX"."Doctors" ("Dno"); 602 | ALTER TABLE "HXX"."DocEmp" ADD FOREIGN KEY ("DsuperNo") REFERENCES "HXX"."Doctors" ("Dno"); 603 | ALTER TABLE "HXX"."DocEmp" ADD FOREIGN KEY ("Lno") REFERENCES "HXX"."Level" ("Lno"); 604 | 605 | -- ---------------------------- 606 | -- Foreign Key structure for table "HXX"."Patients" 607 | -- ---------------------------- 608 | ALTER TABLE "HXX"."Patients" ADD FOREIGN KEY ("Dno") REFERENCES "HXX"."Doctors" ("Dno"); 609 | 610 | -- ---------------------------- 611 | -- Foreign Key structure for table "HXX"."PatientStatus" 612 | -- ---------------------------- 613 | ALTER TABLE "HXX"."PatientStatus" ADD FOREIGN KEY ("Pno") REFERENCES "HXX"."Patients" ("Pno"); 614 | 615 | -- ---------------------------- 616 | -- Foreign Key structure for table "HXX"."Stool" 617 | -- ---------------------------- 618 | ALTER TABLE "HXX"."Stool" ADD FOREIGN KEY ("CPno") REFERENCES "HXX"."Doctors" ("Dno"); 619 | ALTER TABLE "HXX"."Stool" ADD FOREIGN KEY ("Pno") REFERENCES "HXX"."Patients" ("Pno"); 620 | 621 | -- ---------------------------- 622 | -- Foreign Key structure for table "HXX"."Treatment" 623 | -- ---------------------------- 624 | ALTER TABLE "HXX"."Treatment" ADD FOREIGN KEY ("Pno") REFERENCES "HXX"."Patients" ("Pno"); 625 | 626 | -- ---------------------------- 627 | -- Foreign Key structure for table "HXX"."Urine" 628 | -- ---------------------------- 629 | ALTER TABLE "HXX"."Urine" ADD FOREIGN KEY ("CPno") REFERENCES "HXX"."Doctors" ("Dno"); 630 | ALTER TABLE "HXX"."Urine" ADD FOREIGN KEY ("Pno") REFERENCES "HXX"."Patients" ("Pno"); 631 | -------------------------------------------------------------------------------- /java源码/cn/linyer/controller/Login.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.controller; 2 | 3 | import cn.linyer.dao.UserQueryDao; 4 | import cn.linyer.dao.impl.AdminDaoImpl; 5 | import cn.linyer.dao.impl.DoctorDaoImpl; 6 | import cn.linyer.dao.impl.PatientDaoImpl; 7 | import cn.linyer.entity.UserLoginMsg; 8 | /** 9 | * @author Linyer 10 | * 用户登录控制 11 | * 12 | */ 13 | public class Login { 14 | private String userNo = "error"; 15 | private String userName = "error"; 16 | private String userPwd = "error"; 17 | private String isClinical = null; 18 | 19 | public String getUserNo() { 20 | return userNo; 21 | } 22 | public void setUserNo(String userNo) { 23 | this.userNo = userNo; 24 | } 25 | public String getUserName() { 26 | return userName; 27 | } 28 | public void setUserName(String userName) { 29 | this.userName = userName; 30 | } 31 | public String getUserPwd() { 32 | return userPwd; 33 | } 34 | public void setUserPwd(String userPwd) { 35 | this.userPwd = userPwd; 36 | } 37 | public String getIsClinical() { 38 | return isClinical; 39 | } 40 | public void setIsClinical(String isClinical) { 41 | this.isClinical = isClinical; 42 | } 43 | 44 | public Boolean selectPatient() { 45 | UserQueryDao patientDao = new PatientDaoImpl(); 46 | UserLoginMsg patient = patientDao.queryUser(this.getUserNo(), this.getUserPwd()); 47 | if(patient!=null) { 48 | this.setUserName(patient.getName()); 49 | return true; 50 | }else { 51 | return false; 52 | } 53 | } 54 | public Boolean selectAdmin() { 55 | UserQueryDao AdminDao = new AdminDaoImpl(); 56 | UserLoginMsg admin = AdminDao.queryUser(this.getUserNo(), this.getUserPwd()); 57 | if(admin!=null) { 58 | this.setUserName(admin.getName()); 59 | return true; 60 | }else { 61 | return false; 62 | } 63 | } 64 | public Boolean selectDoctor() { 65 | UserQueryDao DoctorDao = new DoctorDaoImpl(); 66 | UserLoginMsg doctor = DoctorDao.queryUser(this.getUserNo(), this.getUserPwd()); 67 | if(doctor!=null) { 68 | this.setUserName(doctor.getName()); 69 | if(doctor.getIsClinical().equals("1")) { 70 | this.setIsClinical("1"); 71 | }else { 72 | this.setIsClinical("0"); 73 | } 74 | return true; 75 | }else { 76 | return false; 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /java源码/cn/linyer/dao/ObjDao.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.dao; 2 | /** 3 | * @author Linyer 4 | * 增删改操作接口 5 | * 6 | */ 7 | public interface ObjDao { 8 | //增 9 | public boolean addObj(Object object); 10 | //删 11 | public boolean deleObj(String no); 12 | //改 13 | public boolean exeObj(Object object); 14 | } 15 | -------------------------------------------------------------------------------- /java源码/cn/linyer/dao/UserQueryDao.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.dao; 2 | 3 | import cn.linyer.entity.UserLoginMsg; 4 | /** 5 | * @author Linyer 6 | * 用户登录查询数据库接口 7 | * 8 | */ 9 | public interface UserQueryDao { 10 | //查询用户信息 11 | public UserLoginMsg queryUser(String no,String pwd); 12 | } -------------------------------------------------------------------------------- /java源码/cn/linyer/dao/impl/AdminDaoImpl.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.dao.impl; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | import cn.linyer.dao.UserQueryDao; 8 | import cn.linyer.entity.UserLoginMsg; 9 | import cn.linyer.util.BaseDao; 10 | /** 11 | * @author Linyer 12 | * 操作管理员数据库信息 13 | * 14 | */ 15 | public class AdminDaoImpl extends BaseDao implements UserQueryDao { 16 | //管理员登录信息 17 | public UserLoginMsg queryUser(String no,String pwd) { 18 | Connection conn = getConnection(); 19 | PreparedStatement pstmt = null; 20 | ResultSet rs = null; 21 | UserLoginMsg admin = null; 22 | 23 | try { 24 | String sql = "select \"Ano\",\"Aname\",\"Apwd\" from \"Admin\" where \"Ano\"=? and \"Apwd\"=?"; 25 | pstmt = conn.prepareStatement(sql); 26 | pstmt.setString(1, no); 27 | pstmt.setString(2, pwd); 28 | rs = pstmt.executeQuery(); 29 | while(rs.next()){ 30 | admin = new UserLoginMsg(); 31 | admin.setNo(rs.getString("Ano")); 32 | admin.setName(rs.getString("Aname")); 33 | admin.setPwd(rs.getString("Apwd")); 34 | } 35 | } catch (SQLException e) { 36 | e.printStackTrace(); 37 | } finally { 38 | closeAll(conn, pstmt, rs); 39 | } 40 | return admin; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /java源码/cn/linyer/dao/impl/DepartmentDaoImpl.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.dao.impl; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | import cn.linyer.dao.ObjDao; 11 | import cn.linyer.entity.Department; 12 | import cn.linyer.util.BaseDao; 13 | 14 | /** 15 | * @author Linyer 16 | * 操作数据库科室信息 17 | * 18 | */ 19 | public class DepartmentDaoImpl extends BaseDao implements ObjDao { 20 | //查询科室信息 21 | public Department selDepartment(String DPno) { 22 | Connection conn = getConnection(); 23 | PreparedStatement pstmt = null; 24 | ResultSet rs = null; 25 | Department dp = null; 26 | 27 | try { 28 | String sql = "select * from \"Departments\" where \"DPno\"=?"; 29 | pstmt = conn.prepareStatement(sql); 30 | pstmt.setString(1, DPno); 31 | rs = pstmt.executeQuery(); 32 | while(rs.next()){ 33 | dp = new Department(); 34 | dp.setDPno(rs.getString("DPno")); 35 | dp.setDPname(rs.getString("DPname")); 36 | dp.setDPloca(rs.getString("DPloca")); 37 | dp.setDPbrief(rs.getString("DPbrief")); 38 | dp.setIsClinical(rs.getString("isClinical")); 39 | } 40 | } catch (SQLException e) { 41 | e.printStackTrace(); 42 | } finally { 43 | closeAll(conn, pstmt, rs); 44 | } 45 | return dp; 46 | } 47 | //添加科室信息 48 | public boolean addObj(Object dpObj) { 49 | Department dp = (Department) dpObj; 50 | BaseDao bd = new BaseDao(); 51 | String[] params = {dp.getDPname(),dp.getDPloca(),dp.getDPbrief(),dp.getIsClinical()}; 52 | String sql = "insert into \"Departments\"(\"DPno\",\"DPname\",\"DPloca\",\"DPbrief\",\"isClinical\") values(DPNO_SEQ.NEXTVAL,?,?,?,?)"; 53 | int i = bd.exeUpdate(sql, params); 54 | if(i == 0){ 55 | return false; 56 | }else{ 57 | return true; 58 | } 59 | } 60 | //添加医师后查看工号 61 | public String selDpNo(String name) { 62 | Connection conn = getConnection(); 63 | PreparedStatement pstmt = null; 64 | ResultSet rs = null; 65 | String num = null; 66 | 67 | try { 68 | String sql = "select \"DPno\" from \"Departments\" where \"DPname\"=?"; 69 | pstmt = conn.prepareStatement(sql); 70 | pstmt.setString(1, name); 71 | rs = pstmt.executeQuery(); 72 | while(rs.next()){ 73 | num = rs.getString("DPno"); 74 | } 75 | } catch (SQLException e) { 76 | e.printStackTrace(); 77 | } finally { 78 | closeAll(conn, pstmt, rs); 79 | } 80 | return num; 81 | } 82 | //删除科室信息 83 | public boolean deleObj(String no) { 84 | BaseDao bd = new BaseDao(); 85 | String[] params = {no}; 86 | String sql = "delete from \"Departments\" where \"DPno\"=?"; 87 | int i = bd.exeUpdate(sql, params); 88 | if(i == 0){ 89 | return false; 90 | }else{ 91 | return true; 92 | } 93 | } 94 | //修改科室信息 95 | public boolean exeObj(Object dpObj) { 96 | Department dp = (Department) dpObj; 97 | if(dp.getDPname()==null && dp.getDPloca()==null && dp.getDPbrief()==null && dp.getIsClinical()==null) { 98 | return false; 99 | }else { 100 | BaseDao bd = new BaseDao(); 101 | StringBuffer set = new StringBuffer(); 102 | int i = 0; 103 | List paramList = new ArrayList(); 104 | if(dp.getDPname()!=null && dp.getDPname().length()!=0) { 105 | set.append("\"DPname\"=?,"); 106 | paramList.add(0, dp.getDPname()); 107 | i++; 108 | } 109 | if(dp.getDPloca()!=null && dp.getDPloca().length()!=0) { 110 | set.append("\"DPloca\"=?,"); 111 | if(i == 0) { 112 | paramList.add(0, dp.getDPloca()); 113 | i++; 114 | }else { 115 | paramList.add(i, dp.getDPloca()); 116 | i++; 117 | } 118 | } 119 | if(dp.getDPbrief()!=null && dp.getDPbrief().length()!=0) { 120 | set.append("\"DPbrief\"=?,"); 121 | if(i == 0) { 122 | paramList.add(0, dp.getDPbrief()); 123 | i++; 124 | }else { 125 | paramList.add(i, dp.getDPbrief()); 126 | i++; 127 | } 128 | } 129 | if(dp.getIsClinical()!=null && dp.getIsClinical().length()!=0) { 130 | set.append("\"isClinical\"=?,"); 131 | if(i == 0) { 132 | paramList.add(0, dp.getIsClinical()); 133 | i++; 134 | }else { 135 | paramList.add(i, dp.getIsClinical()); 136 | i++; 137 | } 138 | } 139 | 140 | String[] params = new String[paramList.size()+1]; 141 | 142 | for(int k=0; k paramList = new ArrayList(); 143 | if(doctor.getDname()!=null && doctor.getDname().length()!=0) { 144 | set.append("\"Dname\"=?,"); 145 | paramList.add(0, doctor.getDname()); 146 | i++; 147 | } 148 | if(doctor.getDsex()!=null && doctor.getDsex().length()!=0) { 149 | set.append("\"Dsex\"=?,"); 150 | if(i == 0) { 151 | paramList.add(0, doctor.getDsex()); 152 | i++; 153 | }else { 154 | paramList.add(i, doctor.getDsex()); 155 | i++; 156 | } 157 | } 158 | if(doctor.getDbirth()!=null && doctor.getDbirth().length()!=0) { 159 | set.append("\"Dbirth\"=to_date(?,'yyyy-mm-dd'),"); 160 | if(i == 0) { 161 | paramList.add(0, doctor.getDbirth()); 162 | i++; 163 | }else { 164 | paramList.add(i, doctor.getDbirth()); 165 | i++; 166 | } 167 | } 168 | if(doctor.getDphone()!=null && doctor.getDphone().length()!=0) { 169 | set.append("\"Dphone\"=?,"); 170 | if(i == 0) { 171 | paramList.add(0, doctor.getDphone()); 172 | i++; 173 | }else { 174 | paramList.add(i, doctor.getDphone()); 175 | i++; 176 | } 177 | } 178 | if(doctor.getDemail()!=null && doctor.getDemail().length()!=0) { 179 | set.append("\"Demail\"=?,"); 180 | if(i == 0) { 181 | paramList.add(0, doctor.getDemail()); 182 | i++; 183 | }else { 184 | paramList.add(i, doctor.getDemail()); 185 | i++; 186 | } 187 | } 188 | if(doctor.getDbrief()!=null && doctor.getDbrief().length()!=0) { 189 | set.append("\"Dbrief\"=?,"); 190 | if(i == 0) { 191 | paramList.add(0, doctor.getDbrief()); 192 | i++; 193 | }else { 194 | paramList.add(i, doctor.getDbrief()); 195 | i++; 196 | } 197 | } 198 | if(doctor.getDpwd()!=null && doctor.getDpwd().length()!=0) { 199 | set.append("\"Dpwd\"=?,"); 200 | if(i == 0) { 201 | paramList.add(0, doctor.getDpwd()); 202 | i++; 203 | }else { 204 | paramList.add(i, doctor.getDpwd()); 205 | i++; 206 | } 207 | } 208 | 209 | String[] params = new String[paramList.size()+1]; 210 | 211 | for(int k=0; k paramList = new ArrayList(); 90 | if(doctorEmp.getDPno()!=null && doctorEmp.getDPno().length()!=0) { 91 | set.append("\"DPno\"=?,"); 92 | paramList.add(0, doctorEmp.getDPno()); 93 | i++; 94 | } 95 | if(doctorEmp.getDwork()!=null && doctorEmp.getDwork().length()!=0) { 96 | set.append("\"Dwork\"=?,"); 97 | if(i == 0) { 98 | paramList.add(0, doctorEmp.getDwork()); 99 | i++; 100 | }else { 101 | paramList.add(i, doctorEmp.getDwork()); 102 | i++; 103 | } 104 | } 105 | if(doctorEmp.getLno()!=null && doctorEmp.getLno().length()!=0) { 106 | set.append("\"Lno\"=?,"); 107 | if(i == 0) { 108 | paramList.add(0, doctorEmp.getLno()); 109 | i++; 110 | }else { 111 | paramList.add(i, doctorEmp.getLno()); 112 | i++; 113 | } 114 | } 115 | if(doctorEmp.getDxl()!=null && doctorEmp.getDxl().length()!=0) { 116 | set.append("\"Dxl\"=?,"); 117 | if(i == 0) { 118 | paramList.add(0, doctorEmp.getDxl()); 119 | i++; 120 | }else { 121 | paramList.add(i, doctorEmp.getDxl()); 122 | i++; 123 | } 124 | } 125 | if(doctorEmp.getDyear()!=null && doctorEmp.getDyear().length()!=0) { 126 | set.append("\"Dyear\"=?,"); 127 | if(i == 0) { 128 | paramList.add(0, doctorEmp.getDyear()); 129 | i++; 130 | }else { 131 | paramList.add(i, doctorEmp.getDyear()); 132 | i++; 133 | } 134 | } 135 | if(doctorEmp.getDsalary()!=null && doctorEmp.getDsalary().length()!=0) { 136 | set.append("\"Dsalary\"=?,"); 137 | if(i == 0) { 138 | paramList.add(0, doctorEmp.getDsalary()); 139 | i++; 140 | }else { 141 | paramList.add(i, doctorEmp.getDsalary()); 142 | i++; 143 | } 144 | } 145 | if(doctorEmp.getDsuperNo()!=null && doctorEmp.getDsuperNo().length()!=0) { 146 | set.append("\"DsuperNo\"=?,"); 147 | if(i == 0) { 148 | paramList.add(0, doctorEmp.getDsuperNo()); 149 | i++; 150 | }else { 151 | paramList.add(i, doctorEmp.getDsuperNo()); 152 | i++; 153 | } 154 | } 155 | 156 | String[] params = new String[paramList.size()+1]; 157 | 158 | for(int k=0; k paramList = new ArrayList(); 149 | if(patient.getPname()!=null && patient.getPname().length()!=0) { 150 | set.append("\"Pname\"=?,"); 151 | paramList.add(0, patient.getPname()); 152 | i++; 153 | } 154 | if(patient.getPsex()!=null && patient.getPsex().length()!=0) { 155 | set.append("\"Psex\"=?,"); 156 | if(i == 0) { 157 | paramList.add(0, patient.getPsex()); 158 | i++; 159 | }else { 160 | paramList.add(i, patient.getPsex()); 161 | i++; 162 | } 163 | } 164 | if(patient.getPage()!=null && patient.getPage().length()!=0) { 165 | set.append("\"Page\"=?,"); 166 | if(i == 0) { 167 | paramList.add(0, patient.getPage()); 168 | i++; 169 | }else { 170 | paramList.add(i, patient.getPage()); 171 | i++; 172 | } 173 | } 174 | if(patient.getPphone()!=null && patient.getPphone().length()!=0) { 175 | set.append("\"Pphone\"=?,"); 176 | if(i == 0) { 177 | paramList.add(0, patient.getPphone()); 178 | i++; 179 | }else { 180 | paramList.add(i, patient.getPphone()); 181 | i++; 182 | } 183 | } 184 | if(patient.getPaddress()!=null && patient.getPaddress().length()!=0) { 185 | set.append("\"Paddress\"=?,"); 186 | if(i == 0) { 187 | paramList.add(0, patient.getPaddress()); 188 | i++; 189 | }else { 190 | paramList.add(i, patient.getPaddress()); 191 | i++; 192 | } 193 | } 194 | if(patient.getDno()!=null && patient.getDno().length()!=0) { 195 | set.append("\"Dno\"=?,"); 196 | if(i == 0) { 197 | paramList.add(0, patient.getDno()); 198 | i++; 199 | }else { 200 | paramList.add(i, patient.getDno()); 201 | i++; 202 | } 203 | } 204 | if(patient.getPEnDate()!=null && patient.getPEnDate().length()!=0) { 205 | set.append("\"PEnDate\"=?,"); 206 | if(i == 0) { 207 | paramList.add(0, patient.getPEnDate()); 208 | i++; 209 | }else { 210 | paramList.add(i, patient.getPEnDate()); 211 | i++; 212 | } 213 | } 214 | if(patient.getPemployer()!=null && patient.getPemployer().length()!=0) { 215 | set.append("\"Pemployer\"=?,"); 216 | if(i == 0) { 217 | paramList.add(0, patient.getPemployer()); 218 | i++; 219 | }else { 220 | paramList.add(i, patient.getPemployer()); 221 | i++; 222 | } 223 | } 224 | if(patient.getPpwd()!=null && patient.getPpwd().length()!=0) { 225 | set.append("\"Ppwd\"=?,"); 226 | if(i == 0) { 227 | paramList.add(0, patient.getPpwd()); 228 | i++; 229 | }else { 230 | paramList.add(i, patient.getPpwd()); 231 | i++; 232 | } 233 | } 234 | if(patient.getPIDno()!=null && patient.getPIDno().length()!=0) { 235 | set.append("\"PIDno\"=?,"); 236 | if(i == 0) { 237 | paramList.add(0, patient.getPIDno()); 238 | i++; 239 | }else { 240 | paramList.add(i, patient.getPIDno()); 241 | i++; 242 | } 243 | } 244 | 245 | String[] params = new String[paramList.size()+1]; 246 | 247 | for(int k=0; k selDep() { 22 | List depList = new ArrayList(); 23 | Department department = null; 24 | Connection conn = getConnection(); 25 | PreparedStatement pstmt = null; 26 | ResultSet rs = null; 27 | int i = 0; 28 | 29 | try { 30 | String sql = "select * from \"Departments\""; 31 | pstmt = conn.prepareStatement(sql); 32 | rs = pstmt.executeQuery(); 33 | while(rs.next()){ 34 | department = new Department(); 35 | department.setDPno(rs.getString("DPno")); 36 | department.setDPname(rs.getString("DPname")); 37 | department.setDPloca(rs.getString("DPloca")); 38 | department.setDPbrief(rs.getString("DPbrief")); 39 | depList.add(i,department); 40 | i ++; 41 | } 42 | } catch (SQLException e) { 43 | e.printStackTrace(); 44 | } finally { 45 | closeAll(conn, pstmt, rs); 46 | } 47 | return depList; 48 | } 49 | //查询医师信息 50 | public List selDoc(String dp,int dL) { 51 | List docInfoList = new ArrayList(); 52 | DocInfo docInfo = null; 53 | Connection conn = getConnection(); 54 | PreparedStatement pstmt = null; 55 | ResultSet rs = null; 56 | String where = null; 57 | //医师类型(普通还是专家) 58 | int i = 0; 59 | if(dL == 1) { 60 | where = "\"医师职称编号\"='2'"; 61 | }else { 62 | where = "(\"医师职称编号\"='3' or \"医师职称编号\"='4')"; 63 | } 64 | 65 | try { 66 | String sql = "select * from \"DocInfo\" where \"所属科室编号\"=? and " + where; 67 | pstmt = conn.prepareStatement(sql); 68 | pstmt.setString(1, dp); 69 | rs = pstmt.executeQuery(); 70 | while(rs.next()){ 71 | docInfo = new DocInfo(); 72 | docInfo.setDno(rs.getString("医师工号")); 73 | docInfo.setDname(rs.getString("医师姓名")); 74 | docInfo.setDsex(rs.getString("医师性别")); 75 | docInfo.setDemail(rs.getString("医师邮箱")); 76 | docInfo.setDPname(rs.getString("所属科室名称")); 77 | docInfo.setLname(rs.getString("医师职称")); 78 | docInfo.setDxl(rs.getString("医师学历")); 79 | docInfo.setDyear(rs.getString("医师年资")); 80 | docInfo.setDbrief(rs.getString("医师简介")); 81 | docInfoList.add(i,docInfo); 82 | i ++; 83 | } 84 | } catch (SQLException e) { 85 | e.printStackTrace(); 86 | } finally { 87 | closeAll(conn, pstmt, rs); 88 | } 89 | return docInfoList; 90 | } 91 | //病人选择要看的医师后,更新数据库中的信息 92 | public boolean addDocForPatient(String dNo,String pNo) { 93 | BaseDao bd = new BaseDao(); 94 | String[] params = {dNo,pNo}; 95 | String sql = "update \"Patients\" set \"Dno\"=? where \"Pno\"=?"; 96 | int i = bd.exeUpdate(sql, params); 97 | if(i == 0){ 98 | return false; 99 | }else{ 100 | return true; 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /java源码/cn/linyer/entity/Blood.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.entity; 2 | 3 | /** 4 | * @author Linyer 5 | * 血检报告 6 | * 7 | */ 8 | public class Blood { 9 | private String Cno = null; 10 | private String Pno = null; 11 | private String RBC = null; 12 | private String HCT = null; 13 | private String MCV = null; 14 | private String HXF = null; 15 | private String HGB = null; 16 | private String MCH = null; 17 | private String MCHC = null; 18 | private String WBC = null; 19 | private String MONO_per = null; 20 | private String NEUT = null; 21 | private String NEUT_per = null; 22 | private String LY = null; 23 | private String LY_per = null; 24 | private String PLT = null; 25 | private String PDW = null; 26 | private String MPV = null; 27 | private String P_LCR = null; 28 | private String PCT = null; 29 | private String CPno = null; 30 | 31 | public String getCno() { 32 | return Cno; 33 | } 34 | public void setCno(String cno) { 35 | Cno = cno; 36 | } 37 | public String getPno() { 38 | return Pno; 39 | } 40 | public void setPno(String pno) { 41 | Pno = pno; 42 | } 43 | public String getRBC() { 44 | return RBC; 45 | } 46 | public void setRBC(String rBC) { 47 | RBC = rBC; 48 | } 49 | public String getHCT() { 50 | return HCT; 51 | } 52 | public void setHCT(String hCT) { 53 | HCT = hCT; 54 | } 55 | public String getMCV() { 56 | return MCV; 57 | } 58 | public void setMCV(String mCV) { 59 | MCV = mCV; 60 | } 61 | public String getHXF() { 62 | return HXF; 63 | } 64 | public void setHXF(String hXF) { 65 | HXF = hXF; 66 | } 67 | public String getHGB() { 68 | return HGB; 69 | } 70 | public void setHGB(String hGB) { 71 | HGB = hGB; 72 | } 73 | public String getMCH() { 74 | return MCH; 75 | } 76 | public void setMCH(String mCH) { 77 | MCH = mCH; 78 | } 79 | public String getMCHC() { 80 | return MCHC; 81 | } 82 | public void setMCHC(String mCHC) { 83 | MCHC = mCHC; 84 | } 85 | public String getWBC() { 86 | return WBC; 87 | } 88 | public void setWBC(String wBC) { 89 | WBC = wBC; 90 | } 91 | public String getMONO_per() { 92 | return MONO_per; 93 | } 94 | public void setMONO_per(String mONO_per) { 95 | MONO_per = mONO_per; 96 | } 97 | public String getNEUT() { 98 | return NEUT; 99 | } 100 | public void setNEUT(String nEUT) { 101 | NEUT = nEUT; 102 | } 103 | public String getNEUT_per() { 104 | return NEUT_per; 105 | } 106 | public void setNEUT_per(String nEUT_per) { 107 | NEUT_per = nEUT_per; 108 | } 109 | public String getLY() { 110 | return LY; 111 | } 112 | public void setLY(String lY) { 113 | LY = lY; 114 | } 115 | public String getLY_per() { 116 | return LY_per; 117 | } 118 | public void setLY_per(String lY_per) { 119 | LY_per = lY_per; 120 | } 121 | public String getPLT() { 122 | return PLT; 123 | } 124 | public void setPLT(String pLT) { 125 | PLT = pLT; 126 | } 127 | public String getPDW() { 128 | return PDW; 129 | } 130 | public void setPDW(String pDW) { 131 | PDW = pDW; 132 | } 133 | public String getMPV() { 134 | return MPV; 135 | } 136 | public void setMPV(String mPV) { 137 | MPV = mPV; 138 | } 139 | public String getP_LCR() { 140 | return P_LCR; 141 | } 142 | public void setP_LCR(String p_LCR) { 143 | P_LCR = p_LCR; 144 | } 145 | public String getPCT() { 146 | return PCT; 147 | } 148 | public void setPCT(String pCT) { 149 | PCT = pCT; 150 | } 151 | public String getCPno() { 152 | return CPno; 153 | } 154 | public void setCPno(String cPno) { 155 | CPno = cPno; 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /java源码/cn/linyer/entity/Department.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.entity; 2 | 3 | /** 4 | * @author Linyer 5 | * 科室信息 6 | * 7 | */ 8 | public class Department { 9 | private String DPno = null; 10 | private String DPname = null; 11 | private String DPloca = null; 12 | private String DPbrief = null; 13 | private String isClinical = null; 14 | 15 | public String getDPno() { 16 | return DPno; 17 | } 18 | public void setDPno(String dPno) { 19 | DPno = dPno; 20 | } 21 | public String getDPname() { 22 | return DPname; 23 | } 24 | public void setDPname(String dPname) { 25 | DPname = dPname; 26 | } 27 | public String getDPloca() { 28 | return DPloca; 29 | } 30 | public void setDPloca(String dPloca) { 31 | DPloca = dPloca; 32 | } 33 | public String getDPbrief() { 34 | return DPbrief; 35 | } 36 | public void setDPbrief(String dPbrief) { 37 | DPbrief = dPbrief; 38 | } 39 | public String getIsClinical() { 40 | return isClinical; 41 | } 42 | public void setIsClinical(String isClinical) { 43 | this.isClinical = isClinical; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /java源码/cn/linyer/entity/DocInfo.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.entity; 2 | 3 | /** 4 | * @author Linyer 5 | * 给患者看到的医师信息 6 | * 7 | */ 8 | public class DocInfo { 9 | private String Dno = null; 10 | private String Dname = null; 11 | private String Dsex = null; 12 | private String Demail = null; 13 | private String DPname = null; 14 | private String Lname = null; 15 | private String Dxl = null; 16 | private String Dyear = null; 17 | private String Dbrief = null; 18 | 19 | public String getDno() { 20 | return Dno; 21 | } 22 | public void setDno(String dno) { 23 | Dno = dno; 24 | } 25 | public String getDname() { 26 | return Dname; 27 | } 28 | public void setDname(String dname) { 29 | Dname = dname; 30 | } 31 | public String getDsex() { 32 | return Dsex; 33 | } 34 | public void setDsex(String dsex) { 35 | Dsex = dsex; 36 | } 37 | public String getDemail() { 38 | return Demail; 39 | } 40 | public void setDemail(String demail) { 41 | Demail = demail; 42 | } 43 | public String getDPname() { 44 | return DPname; 45 | } 46 | public void setDPname(String dPname) { 47 | DPname = dPname; 48 | } 49 | public String getLname() { 50 | return Lname; 51 | } 52 | public void setLname(String lname) { 53 | Lname = lname; 54 | } 55 | public String getDxl() { 56 | return Dxl; 57 | } 58 | public void setDxl(String dxl) { 59 | Dxl = dxl; 60 | } 61 | public String getDyear() { 62 | return Dyear; 63 | } 64 | public void setDyear(String dyear) { 65 | Dyear = dyear; 66 | } 67 | public String getDbrief() { 68 | return Dbrief; 69 | } 70 | public void setDbrief(String dbrief) { 71 | Dbrief = dbrief; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /java源码/cn/linyer/entity/Doctor.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.entity; 2 | 3 | /** 4 | * @author Linyer 5 | * 医师基本信息 6 | * 7 | */ 8 | public class Doctor { 9 | private String Dno = null; 10 | private String Dname = null; 11 | private String Dsex = null; 12 | private String Dbirth = null; 13 | private String Dphone = null; 14 | private String Demail = null; 15 | private String Dbrief = null; 16 | private String Dpwd = null; 17 | 18 | public String getDno() { 19 | return Dno; 20 | } 21 | public void setDno(String dno) { 22 | Dno = dno; 23 | } 24 | public String getDname() { 25 | return Dname; 26 | } 27 | public void setDname(String dname) { 28 | Dname = dname; 29 | } 30 | public String getDsex() { 31 | return Dsex; 32 | } 33 | public void setDsex(String dsex) { 34 | Dsex = dsex; 35 | } 36 | public String getDbirth() { 37 | return Dbirth; 38 | } 39 | public void setDbirth(String dbirth) { 40 | Dbirth = dbirth; 41 | } 42 | public String getDphone() { 43 | return Dphone; 44 | } 45 | public void setDphone(String dphone) { 46 | Dphone = dphone; 47 | } 48 | public String getDemail() { 49 | return Demail; 50 | } 51 | public void setDemail(String demail) { 52 | Demail = demail; 53 | } 54 | public String getDbrief() { 55 | return Dbrief; 56 | } 57 | public void setDbrief(String dbrief) { 58 | Dbrief = dbrief; 59 | } 60 | public String getDpwd() { 61 | return Dpwd; 62 | } 63 | public void setDpwd(String dpwd) { 64 | Dpwd = dpwd; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /java源码/cn/linyer/entity/DoctorEmp.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.entity; 2 | 3 | /** 4 | * @author Linyer 5 | * 医师职业信息 6 | * 7 | */ 8 | public class DoctorEmp { 9 | private String Dno = null; 10 | private String DPno = null; 11 | private String Dwork = null; 12 | private String Lno = null; 13 | private String Dxl = null; 14 | private String Dyear = null; 15 | private String Dsalary = null; 16 | private String DsuperNo = null; 17 | 18 | public String getDno() { 19 | return Dno; 20 | } 21 | public void setDno(String dno) { 22 | Dno = dno; 23 | } 24 | public String getDPno() { 25 | return DPno; 26 | } 27 | public void setDPno(String dPno) { 28 | DPno = dPno; 29 | } 30 | public String getDwork() { 31 | return Dwork; 32 | } 33 | public void setDwork(String dwork) { 34 | Dwork = dwork; 35 | } 36 | public String getLno() { 37 | return Lno; 38 | } 39 | public void setLno(String lno) { 40 | Lno = lno; 41 | } 42 | public String getDxl() { 43 | return Dxl; 44 | } 45 | public void setDxl(String dxl) { 46 | Dxl = dxl; 47 | } 48 | public String getDyear() { 49 | return Dyear; 50 | } 51 | public void setDyear(String dyear) { 52 | Dyear = dyear; 53 | } 54 | public String getDsalary() { 55 | return Dsalary; 56 | } 57 | public void setDsalary(String dsalary) { 58 | Dsalary = dsalary; 59 | } 60 | public String getDsuperNo() { 61 | return DsuperNo; 62 | } 63 | public void setDsuperNo(String dsuperNo) { 64 | DsuperNo = dsuperNo; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /java源码/cn/linyer/entity/Patient.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.entity; 2 | 3 | /** 4 | * @author Linyer 5 | * 患者基本信息 6 | * 7 | */ 8 | public class Patient { 9 | private String Pno = null; 10 | private String Pname = null; 11 | private String Psex = null; 12 | private String Page = null; 13 | private String Pphone = null; 14 | private String Paddress = null; 15 | private String Dno = null; 16 | private String PEnDate = null; 17 | private String Pemployer = null; 18 | private String Ppwd = null; 19 | private String PIDno = null; 20 | private String isBlood = null; 21 | private String isSee = null; 22 | private String isUrine = null; 23 | private String isStool = null; 24 | private String isOk = null; 25 | 26 | public String getPno() { 27 | return Pno; 28 | } 29 | public void setPno(String pno) { 30 | Pno = pno; 31 | } 32 | public String getPname() { 33 | return Pname; 34 | } 35 | public void setPname(String pname) { 36 | Pname = pname; 37 | } 38 | public String getPsex() { 39 | return Psex; 40 | } 41 | public void setPsex(String psex) { 42 | Psex = psex; 43 | } 44 | public String getPage() { 45 | return Page; 46 | } 47 | public void setPage(String page) { 48 | Page = page; 49 | } 50 | public String getPphone() { 51 | return Pphone; 52 | } 53 | public void setPphone(String pphone) { 54 | Pphone = pphone; 55 | } 56 | public String getPaddress() { 57 | return Paddress; 58 | } 59 | public void setPaddress(String paddress) { 60 | Paddress = paddress; 61 | } 62 | public String getDno() { 63 | return Dno; 64 | } 65 | public void setDno(String dno) { 66 | Dno = dno; 67 | } 68 | public String getPEnDate() { 69 | return PEnDate; 70 | } 71 | public void setPEnDate(String pEnDate) { 72 | PEnDate = pEnDate; 73 | } 74 | public String getPemployer() { 75 | return Pemployer; 76 | } 77 | public void setPemployer(String pemployer) { 78 | Pemployer = pemployer; 79 | } 80 | public String getPpwd() { 81 | return Ppwd; 82 | } 83 | public void setPpwd(String ppwd) { 84 | Ppwd = ppwd; 85 | } 86 | public String getPIDno() { 87 | return PIDno; 88 | } 89 | public void setPIDno(String pIDno) { 90 | PIDno = pIDno; 91 | } 92 | public String getIsSee() { 93 | return isSee; 94 | } 95 | public void setIsSee(String isSee) { 96 | this.isSee = isSee; 97 | } 98 | public String getIsBlood() { 99 | return isBlood; 100 | } 101 | public void setIsBlood(String isBlood) { 102 | this.isBlood = isBlood; 103 | } 104 | public String getIsUrine() { 105 | return isUrine; 106 | } 107 | public void setIsUrine(String isUrine) { 108 | this.isUrine = isUrine; 109 | } 110 | public String getIsStool() { 111 | return isStool; 112 | } 113 | public void setIsStool(String isStool) { 114 | this.isStool = isStool; 115 | } 116 | public String getIsOk() { 117 | return isOk; 118 | } 119 | public void setIsOk(String isOk) { 120 | this.isOk = isOk; 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /java源码/cn/linyer/entity/Stool.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.entity; 2 | 3 | /** 4 | * @author Linyer 5 | * 便检报告 6 | * 7 | */ 8 | public class Stool { 9 | private String Cno = null; 10 | private String Pno = null; 11 | private String Color = null; 12 | private String Traits = null; 13 | private String WBC = null; 14 | private String Phagocyte = null; 15 | private String RBC = null; 16 | private String HB = null; 17 | private String Parasite = null; 18 | private String FG = null; 19 | private String CPno = null; 20 | 21 | public String getCno() { 22 | return Cno; 23 | } 24 | public void setCno(String cno) { 25 | Cno = cno; 26 | } 27 | public String getPno() { 28 | return Pno; 29 | } 30 | public void setPno(String pno) { 31 | Pno = pno; 32 | } 33 | public String getColor() { 34 | return Color; 35 | } 36 | public void setColor(String color) { 37 | Color = color; 38 | } 39 | public String getTraits() { 40 | return Traits; 41 | } 42 | public void setTraits(String traits) { 43 | Traits = traits; 44 | } 45 | public String getWBC() { 46 | return WBC; 47 | } 48 | public void setWBC(String wBC) { 49 | WBC = wBC; 50 | } 51 | public String getPhagocyte() { 52 | return Phagocyte; 53 | } 54 | public void setPhagocyte(String phagocyte) { 55 | Phagocyte = phagocyte; 56 | } 57 | public String getRBC() { 58 | return RBC; 59 | } 60 | public void setRBC(String rBC) { 61 | RBC = rBC; 62 | } 63 | public String getHB() { 64 | return HB; 65 | } 66 | public void setHB(String hB) { 67 | HB = hB; 68 | } 69 | public String getParasite() { 70 | return Parasite; 71 | } 72 | public void setParasite(String parasite) { 73 | Parasite = parasite; 74 | } 75 | public String getFG() { 76 | return FG; 77 | } 78 | public void setFG(String fG) { 79 | FG = fG; 80 | } 81 | public String getCPno() { 82 | return CPno; 83 | } 84 | public void setCPno(String cPno) { 85 | CPno = cPno; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /java源码/cn/linyer/entity/Urine.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.entity; 2 | 3 | /** 4 | * @author Linyer 5 | * 尿检报告 6 | * 7 | */ 8 | public class Urine { 9 | private String Cno = null; 10 | private String Pno = null; 11 | private String PH = null; 12 | private String SG = null; 13 | private String URO = null; 14 | private String BLD = null; 15 | private String WBC = null; 16 | private String PRO = null; 17 | private String GLU = null; 18 | private String BIL = null; 19 | private String KET = null; 20 | private String RBC = null; 21 | private String GOL = null; 22 | private String CPno = null; 23 | 24 | public String getCno() { 25 | return Cno; 26 | } 27 | public void setCno(String cno) { 28 | Cno = cno; 29 | } 30 | public String getPno() { 31 | return Pno; 32 | } 33 | public void setPno(String pno) { 34 | Pno = pno; 35 | } 36 | public String getPH() { 37 | return PH; 38 | } 39 | public void setPH(String pH) { 40 | PH = pH; 41 | } 42 | public String getSG() { 43 | return SG; 44 | } 45 | public void setSG(String sG) { 46 | SG = sG; 47 | } 48 | public String getURO() { 49 | return URO; 50 | } 51 | public void setURO(String uRO) { 52 | URO = uRO; 53 | } 54 | public String getBLD() { 55 | return BLD; 56 | } 57 | public void setBLD(String bLD) { 58 | BLD = bLD; 59 | } 60 | public String getWBC() { 61 | return WBC; 62 | } 63 | public void setWBC(String wBC) { 64 | WBC = wBC; 65 | } 66 | public String getPRO() { 67 | return PRO; 68 | } 69 | public void setPRO(String pRO) { 70 | PRO = pRO; 71 | } 72 | public String getGLU() { 73 | return GLU; 74 | } 75 | public void setGLU(String gLU) { 76 | GLU = gLU; 77 | } 78 | public String getBIL() { 79 | return BIL; 80 | } 81 | public void setBIL(String bIL) { 82 | BIL = bIL; 83 | } 84 | public String getKET() { 85 | return KET; 86 | } 87 | public void setKET(String kET) { 88 | KET = kET; 89 | } 90 | public String getRBC() { 91 | return RBC; 92 | } 93 | public void setRBC(String rBC) { 94 | RBC = rBC; 95 | } 96 | public String getGOL() { 97 | return GOL; 98 | } 99 | public void setGOL(String gOL) { 100 | GOL = gOL; 101 | } 102 | public String getCPno() { 103 | return CPno; 104 | } 105 | public void setCPno(String cPno) { 106 | CPno = cPno; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /java源码/cn/linyer/entity/UserLoginMsg.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.entity; 2 | /** 3 | * @author Linyer 4 | * 用户登录信息 5 | * 6 | */ 7 | public class UserLoginMsg { 8 | private String no = null; 9 | private String name = null; 10 | private String pwd = null; 11 | private String isClinical = null; 12 | 13 | public String getNo() { 14 | return no; 15 | } 16 | public void setNo(String no) { 17 | this.no = no; 18 | } 19 | public String getName() { 20 | return name; 21 | } 22 | public void setName(String name) { 23 | this.name = name; 24 | } 25 | public String getPwd() { 26 | return pwd; 27 | } 28 | public void setPwd(String pwd) { 29 | this.pwd = pwd; 30 | } 31 | public String getIsClinical() { 32 | return isClinical; 33 | } 34 | public void setIsClinical(String isClinical) { 35 | this.isClinical = isClinical; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /java源码/cn/linyer/gui/LoginGui.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.gui; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Color; 5 | import java.awt.Font; 6 | import java.awt.GridLayout; 7 | import java.awt.event.ActionEvent; 8 | import java.awt.event.ActionListener; 9 | 10 | import javax.swing.JButton; 11 | import javax.swing.JFrame; 12 | import javax.swing.JLabel; 13 | import javax.swing.JOptionPane; 14 | import javax.swing.JPanel; 15 | import javax.swing.JPasswordField; 16 | import javax.swing.JTextField; 17 | 18 | import cn.linyer.controller.Login; 19 | import cn.linyer.gui.adminGui.AdminGui; 20 | import cn.linyer.gui.doctorGui.DoctorAuxiliaryGui; 21 | import cn.linyer.gui.doctorGui.DoctorClinicalGui; 22 | import cn.linyer.gui.patientGui.PatientSelDoctorGui; 23 | import cn.linyer.gui.patientGui.PatientRegistGui; 24 | 25 | /** 26 | * @author Linyer 27 | * 登录界面 28 | * 29 | */ 30 | public class LoginGui { 31 | public static JFrame frame; 32 | private JPanel panelNorth = new JPanel(); 33 | private JPanel panelWest = new JPanel(); 34 | private JPanel panelCenter = new JPanel(); 35 | private JPanel panelSouth = new JPanel(); 36 | private JLabel label; 37 | private JLabel noLabel; 38 | private JTextField no = new JTextField(8); 39 | private JLabel pwdLabel = new JLabel("密码:"); 40 | private JPasswordField pwd = new JPasswordField(12); 41 | private JButton login = new JButton("登录"); 42 | private JButton regist = new JButton("注册"); 43 | private Font fontMid = new Font("华文楷体",Font.PLAIN,24); 44 | Login loginMsg = new Login(); 45 | 46 | public LoginGui(String type) { 47 | //不同用户界面 48 | frame = new JFrame("登录"); 49 | label = new JLabel(type + "登录"); 50 | if(type.equals("患者")) { 51 | noLabel = new JLabel("患者病历号:"); 52 | }else if(type.equals("医师")) { 53 | noLabel = new JLabel("医师工号:"); 54 | }else if(type.equals("管理员")) { 55 | noLabel = new JLabel("管理员编号:"); 56 | } 57 | //布局 58 | frame.setLayout(new BorderLayout()); 59 | panelWest.setLayout(new GridLayout(2,1)); 60 | panelCenter.setLayout(new GridLayout(2,1)); 61 | //设置组件的字体、颜色 62 | label.setFont(new Font("华文楷体",Font.BOLD,36)); 63 | label.setForeground(new Color(220, 118, 51)); 64 | noLabel.setFont(fontMid); 65 | pwdLabel.setFont(fontMid); 66 | no.setFont(fontMid); 67 | pwd.setFont(fontMid); 68 | login.setFont(fontMid); 69 | regist.setFont(fontMid); 70 | //添加各个组件 71 | frame.add(panelNorth,BorderLayout.NORTH); 72 | frame.add(panelWest,BorderLayout.WEST); 73 | frame.add(panelCenter,BorderLayout.CENTER); 74 | frame.add(panelSouth,BorderLayout.SOUTH); 75 | panelNorth.add(label); 76 | panelWest.add(noLabel); 77 | panelWest.add(pwdLabel); 78 | panelCenter.add(no); 79 | panelCenter.add(pwd); 80 | panelSouth.add(login); 81 | if(type.equals("患者")) { 82 | panelSouth.add(regist); 83 | } 84 | //登录按钮监听器 85 | class LoginButton implements ActionListener { 86 | public void actionPerformed(ActionEvent e) { 87 | //获取用户编号、密码 88 | String userNo = no.getText(); 89 | String userPwd = String.valueOf(pwd.getPassword()); 90 | 91 | if(userNo.equals("") || userNo.length()==0 || userNo.indexOf(" ")!=-1) { 92 | loginMsg.setUserNo("error"); 93 | } else { 94 | loginMsg.setUserNo(userNo); 95 | } 96 | 97 | if(userPwd.equals("") || userPwd.length()==0 || userPwd.indexOf(" ")!=-1) { 98 | loginMsg.setUserPwd("error"); 99 | } else { 100 | loginMsg.setUserPwd(userPwd); 101 | } 102 | //判断是否登录成功 103 | if(type.equals("患者")) { 104 | if(loginMsg.selectPatient()) { 105 | JOptionPane.showMessageDialog(frame, "登录成功!","登陆提示",JOptionPane.PLAIN_MESSAGE); 106 | new PatientSelDoctorGui(loginMsg.getUserName(),loginMsg.getUserNo()); 107 | frame.setVisible(false); 108 | }else { 109 | JOptionPane.showMessageDialog(frame, "登录失败!请重试!","登陆提示",JOptionPane.ERROR_MESSAGE); 110 | } 111 | }else if(type.equals("医师")) { 112 | if(loginMsg.selectDoctor()) { 113 | JOptionPane.showMessageDialog(frame, "登录成功!","登陆提示",JOptionPane.PLAIN_MESSAGE); 114 | if(loginMsg.getIsClinical().equals("1")) { 115 | new DoctorClinicalGui(loginMsg.getUserName(),loginMsg.getUserNo()); 116 | }else { 117 | new DoctorAuxiliaryGui(loginMsg.getUserName(),loginMsg.getUserNo()); 118 | } 119 | frame.setVisible(false); 120 | }else { 121 | JOptionPane.showMessageDialog(frame, "登录失败!请重试!","登陆提示",JOptionPane.ERROR_MESSAGE); 122 | } 123 | }else if(type.equals("管理员")) { 124 | if(loginMsg.selectAdmin()) { 125 | JOptionPane.showMessageDialog(frame, "登录成功!","登陆提示",JOptionPane.PLAIN_MESSAGE); 126 | new AdminGui(loginMsg.getUserName()); 127 | frame.setVisible(false); 128 | }else { 129 | JOptionPane.showMessageDialog(frame, "登录失败!请重试!","登陆提示",JOptionPane.ERROR_MESSAGE); 130 | } 131 | } 132 | } 133 | } 134 | 135 | //注册按钮监听器 136 | class RegistButton implements ActionListener { 137 | public void actionPerformed(ActionEvent e) { 138 | new PatientRegistGui(); 139 | } 140 | } 141 | 142 | LoginButton loginButton = new LoginButton(); 143 | login.addActionListener(loginButton); 144 | 145 | RegistButton registButton = new RegistButton(); 146 | regist.addActionListener(registButton); 147 | 148 | frame.pack(); 149 | frame.setResizable(false); 150 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 151 | frame.setVisible(true); 152 | frame.setLocationRelativeTo(null); 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /java源码/cn/linyer/gui/SelectUserGui.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.gui; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Color; 5 | import java.awt.Font; 6 | import java.awt.event.ActionEvent; 7 | import java.awt.event.ActionListener; 8 | 9 | import javax.swing.JButton; 10 | import javax.swing.JComboBox; 11 | import javax.swing.JFrame; 12 | import javax.swing.JLabel; 13 | import javax.swing.JPanel; 14 | /** 15 | * @author Linyer 16 | * 用户类型选择界面 17 | * 18 | */ 19 | public class SelectUserGui { 20 | private JFrame frame = new JFrame("欢迎!"); 21 | private JPanel panelNorth = new JPanel(); 22 | private JPanel panelWest = new JPanel(); 23 | private JPanel panelCenter = new JPanel(); 24 | private JPanel panelSouth = new JPanel(); 25 | private JLabel label = new JLabel("欢迎使用医院管理系统!"); 26 | private JLabel selectLabel = new JLabel("用户类型:"); 27 | private JComboBox userType = new JComboBox(); 28 | private JButton yes = new JButton("确定"); 29 | private Color ftColor = new Color(220, 118, 51); 30 | private Font fontBig = new Font("华文楷体",Font.BOLD,36); 31 | private Font fontMid = new Font("华文楷体",Font.PLAIN,24); 32 | 33 | public SelectUserGui() { 34 | //布局 35 | frame.setLayout(new BorderLayout()); 36 | //设置组件的字体、颜色 37 | label.setFont(fontBig); 38 | label.setForeground(ftColor); 39 | selectLabel.setFont(fontMid); 40 | userType.setFont(fontMid); 41 | yes.setFont(fontMid); 42 | //添加各个组件 43 | frame.add(panelNorth,BorderLayout.NORTH); 44 | frame.add(panelWest,BorderLayout.WEST); 45 | frame.add(panelCenter,BorderLayout.CENTER); 46 | frame.add(panelSouth,BorderLayout.SOUTH); 47 | panelNorth.add(label); 48 | panelWest.add(selectLabel); 49 | panelCenter.add(userType); 50 | panelSouth.add(yes); 51 | //添加下拉框内容 52 | userType.addItem("--请选择用户类型--"); 53 | userType.addItem("患者"); 54 | userType.addItem("医师"); 55 | userType.addItem("管理员"); 56 | //确定按钮监听器 57 | class YesButton implements ActionListener { 58 | public void actionPerformed(ActionEvent e) { 59 | String userTp = (String) userType.getSelectedItem(); 60 | if(userTp.equals("患者")) { 61 | new LoginGui("患者"); 62 | frame.setVisible(false); 63 | }else if(userTp.equals("医师")) { 64 | new LoginGui("医师"); 65 | frame.setVisible(false); 66 | }else if(userTp.equals("管理员")){ 67 | new LoginGui("管理员"); 68 | frame.setVisible(false); 69 | } 70 | } 71 | } 72 | 73 | YesButton yesButton = new YesButton(); 74 | yes.addActionListener(yesButton); 75 | 76 | frame.pack(); 77 | frame.setResizable(false); 78 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 79 | frame.setVisible(true); 80 | frame.setLocationRelativeTo(null); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /java源码/cn/linyer/gui/adminGui/AdminGui.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.gui.adminGui; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Color; 5 | import java.awt.Font; 6 | import java.awt.GridLayout; 7 | import java.awt.event.ActionEvent; 8 | import java.awt.event.ActionListener; 9 | 10 | import javax.swing.JButton; 11 | import javax.swing.JComboBox; 12 | import javax.swing.JFrame; 13 | import javax.swing.JLabel; 14 | import javax.swing.JPanel; 15 | 16 | /** 17 | * @author Linyer 18 | * 管理员管理主界面 19 | * 20 | */ 21 | public class AdminGui { 22 | static JFrame frame = new JFrame("管理员管理"); 23 | private JPanel panelNorth = new JPanel(); 24 | private JPanel panelCenter = new JPanel(); 25 | 26 | private JLabel label; 27 | private JLabel typeLabel = new JLabel("管理对象:"); 28 | private JComboBox type = new JComboBox(); 29 | private JButton yes = new JButton("确定"); 30 | 31 | private Font fontMid = new Font("华文楷体",Font.PLAIN,24); 32 | 33 | public AdminGui(String adName) { 34 | //欢迎管理员 35 | label = new JLabel("管理员:" + adName + ",欢迎您!"); 36 | //布局 37 | frame.setLayout(new BorderLayout()); 38 | panelCenter.setLayout(new GridLayout(1,2)); 39 | //设置各个组件的属性 40 | label.setFont(new Font("华文琥珀",Font.BOLD,36)); 41 | label.setForeground(new Color(220, 118, 51)); 42 | typeLabel.setFont(fontMid); 43 | type.setFont(fontMid); 44 | yes.setFont(fontMid); 45 | //添加组件 46 | panelCenter.add(typeLabel); 47 | panelCenter.add(type); 48 | //为下拉框添加选项 49 | type.addItem("医师基本信息"); 50 | type.addItem("医师职业信息"); 51 | type.addItem("科室信息"); 52 | type.addItem("患者信息"); 53 | 54 | frame.add(panelNorth,BorderLayout.NORTH); 55 | frame.add(panelCenter,BorderLayout.CENTER); 56 | frame.add(yes,BorderLayout.SOUTH); 57 | 58 | panelNorth.add(label); 59 | 60 | class YesButton implements ActionListener { 61 | public void actionPerformed(ActionEvent e) { 62 | String manageTp = (String) type.getSelectedItem(); 63 | if(manageTp.equals("医师基本信息")) { 64 | new DoctorManagerGui(); 65 | frame.setVisible(false); 66 | }else if(manageTp.equals("医师职业信息")) { 67 | new DoctorEmpManagerGui(); 68 | frame.setVisible(false); 69 | }else if(manageTp.equals("科室信息")) { 70 | new DepartmentManagerGui(); 71 | frame.setVisible(false); 72 | }else if(manageTp.equals("患者信息")) { 73 | new PatientManagerGui(); 74 | frame.setVisible(false); 75 | } 76 | } 77 | } 78 | 79 | YesButton yesButton = new YesButton(); 80 | yes.addActionListener(yesButton); 81 | 82 | frame.pack(); 83 | frame.setResizable(false); 84 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 85 | frame.setVisible(true); 86 | frame.setLocationRelativeTo(null); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /java源码/cn/linyer/gui/adminGui/DepartmentManagerGui.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.gui.adminGui; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Color; 5 | import java.awt.Font; 6 | import java.awt.GridLayout; 7 | import java.awt.event.ActionEvent; 8 | import java.awt.event.ActionListener; 9 | import javax.swing.JButton; 10 | import javax.swing.JComboBox; 11 | import javax.swing.JFrame; 12 | import javax.swing.JLabel; 13 | import javax.swing.JOptionPane; 14 | import javax.swing.JPanel; 15 | import javax.swing.JTextArea; 16 | import javax.swing.JTextField; 17 | 18 | import cn.linyer.dao.impl.DepartmentDaoImpl; 19 | import cn.linyer.entity.Department; 20 | 21 | 22 | /** 23 | * @author Linyer 24 | * 管理员管理科室信息界面 25 | * 26 | */ 27 | public class DepartmentManagerGui { 28 | //主体部分定义 29 | private JFrame frame = new JFrame("管理科室信息"); 30 | 31 | private JLabel dpLabel = new JLabel("科室信息管理",JLabel.CENTER); 32 | private JPanel dpPanel = new JPanel(); 33 | //查询/删除 部分组件定义 34 | private JPanel dpSDPanel = new JPanel(); 35 | private JPanel dpSDCenPanel = new JPanel(); 36 | private JPanel dpSDCenTablePanel = new JPanel(); 37 | 38 | private JLabel dpSDLabel = new JLabel("查询/删除 科室信息",JLabel.CENTER); 39 | private JLabel dpSDTypeLabel = new JLabel("操作类型:"); 40 | 41 | private JComboBox dpSDType = new JComboBox(); 42 | 43 | private JLabel dpSDNoLabel = new JLabel("科室编号:"); 44 | 45 | private JTextField dpSDNo = new JTextField(8); 46 | private JTextArea dpSDArea = new JTextArea(8,25); 47 | 48 | private JButton dpSDBtn = new JButton("确定 查询/删除"); 49 | 50 | //增加/修改 部分组件定义 51 | private JPanel dpAEPanel = new JPanel(); 52 | private JPanel dpAECenPanel = new JPanel(); 53 | 54 | private JLabel dpAELabel = new JLabel("增加/修改 科室信息",JLabel.CENTER); 55 | private JLabel dpAETypeLabel = new JLabel("操作类型:"); 56 | private JLabel dpAENoLabel = new JLabel("科室编号:"); 57 | private JLabel dpAENameLabel = new JLabel("科室名称:"); 58 | private JLabel dpAELocaLabel = new JLabel("科室位置:"); 59 | private JLabel dpAEBriefLabel = new JLabel("科室简介:"); 60 | private JLabel dpAEIsClicLabel = new JLabel("是否临床科室:"); 61 | 62 | private JComboBox dpAEType = new JComboBox(); 63 | private JTextField dpAENo = new JTextField(8); 64 | private JTextField dpAEName = new JTextField(40); 65 | private JTextField dpAELoca = new JTextField(100); 66 | private JTextField dpAEBrief = new JTextField(1000); 67 | private JComboBox dpAEIsClic = new JComboBox(); 68 | 69 | private JButton dpAEBtn = new JButton("确定 增加/修改"); 70 | //返回按钮 71 | private JButton backBtn = new JButton("返回上一界面"); 72 | //颜色字体定义 73 | private Color myBlue = new Color(52, 152, 219); 74 | private Color myGreen = new Color(19, 141, 117); 75 | private Color myPink = new Color(171, 40, 199); 76 | 77 | private Font fontMid = new Font("华文楷体",Font.PLAIN,24); 78 | 79 | public DepartmentManagerGui() { 80 | //布局 81 | frame.setLayout(new BorderLayout()); 82 | dpPanel.setLayout(new BorderLayout()); 83 | dpSDPanel.setLayout(new BorderLayout()); 84 | dpSDCenPanel.setLayout(new BorderLayout()); 85 | dpSDCenTablePanel.setLayout(new GridLayout(2,2)); 86 | dpAEPanel.setLayout(new BorderLayout()); 87 | dpAECenPanel.setLayout(new GridLayout(6,2)); 88 | //设置各个组件的属性 89 | dpLabel.setFont(new Font("华文琥珀",Font.BOLD,36)); 90 | dpLabel.setForeground(myBlue); 91 | //查询组件属性 92 | dpSDLabel.setFont(new Font("黑体",Font.BOLD,28)); 93 | dpSDLabel.setForeground(myGreen); 94 | dpSDTypeLabel.setFont(fontMid); 95 | dpSDTypeLabel.setForeground(Color.red); 96 | dpSDType.setFont(fontMid); 97 | dpSDType.setForeground(Color.red); 98 | dpSDNoLabel.setFont(fontMid); 99 | dpSDNoLabel.setForeground(myPink); 100 | dpSDNo.setFont(fontMid); 101 | dpSDArea.setFont(fontMid); 102 | dpSDBtn.setFont(fontMid); 103 | //增加/修改组件属性 104 | dpAELabel.setFont(new Font("黑体",Font.BOLD,28)); 105 | dpAELabel.setForeground(myGreen); 106 | dpAETypeLabel.setFont(fontMid); 107 | dpAETypeLabel.setForeground(Color.red); 108 | dpAENoLabel.setFont(fontMid); 109 | dpAENoLabel.setForeground(myPink); 110 | dpAENameLabel.setFont(fontMid); 111 | dpAELocaLabel.setFont(fontMid); 112 | dpAEBriefLabel.setFont(fontMid); 113 | dpAEType.setFont(fontMid); 114 | dpAEType.setForeground(Color.red); 115 | dpAENo.setFont(fontMid); 116 | dpAEName.setFont(fontMid); 117 | dpAELoca.setFont(fontMid); 118 | dpAEBrief.setFont(fontMid); 119 | dpAEBtn.setFont(fontMid); 120 | dpAEIsClicLabel.setFont(fontMid); 121 | dpAEIsClic.setFont(fontMid); 122 | 123 | backBtn.setFont(fontMid); 124 | //设置查询中的文本域不可编辑 125 | dpSDArea.setEditable(false); 126 | 127 | //添加组件 128 | frame.add(dpLabel,BorderLayout.NORTH); 129 | frame.add(dpPanel,BorderLayout.CENTER); 130 | frame.add(backBtn,BorderLayout.SOUTH); 131 | 132 | dpPanel.add(dpSDPanel,BorderLayout.WEST); 133 | dpPanel.add(dpAEPanel,BorderLayout.CENTER); 134 | 135 | dpSDPanel.add(dpSDLabel,BorderLayout.NORTH); 136 | dpSDPanel.add(dpSDCenPanel,BorderLayout.CENTER); 137 | dpSDPanel.add(dpSDBtn,BorderLayout.SOUTH); 138 | 139 | dpSDCenPanel.add(dpSDCenTablePanel,BorderLayout.NORTH); 140 | dpSDCenPanel.add(dpSDArea,BorderLayout.SOUTH); 141 | 142 | dpSDCenTablePanel.add(dpSDTypeLabel); 143 | dpSDCenTablePanel.add(dpSDType); 144 | dpSDCenTablePanel.add(dpSDNoLabel); 145 | dpSDCenTablePanel.add(dpSDNo); 146 | 147 | dpAEPanel.add(dpAELabel,BorderLayout.NORTH); 148 | dpAEPanel.add(dpAECenPanel,BorderLayout.CENTER); 149 | dpAEPanel.add(dpAEBtn,BorderLayout.SOUTH); 150 | 151 | dpAECenPanel.add(dpAETypeLabel); 152 | dpAECenPanel.add(dpAEType); 153 | dpAECenPanel.add(dpAENoLabel); 154 | dpAECenPanel.add(dpAENo); 155 | dpAECenPanel.add(dpAENameLabel); 156 | dpAECenPanel.add(dpAEName); 157 | dpAECenPanel.add(dpAELocaLabel); 158 | dpAECenPanel.add(dpAELoca); 159 | dpAECenPanel.add(dpAELocaLabel); 160 | dpAECenPanel.add(dpAELoca); 161 | dpAECenPanel.add(dpAEBriefLabel); 162 | dpAECenPanel.add(dpAEBrief); 163 | dpAECenPanel.add(dpAEIsClicLabel); 164 | dpAECenPanel.add(dpAEIsClic); 165 | 166 | dpSDType.addItem("查询"); 167 | dpSDType.addItem("删除"); 168 | 169 | dpAEType.addItem("增加"); 170 | dpAEType.addItem("修改"); 171 | 172 | dpAEIsClic.addItem("是"); 173 | dpAEIsClic.addItem("否"); 174 | //启动之时,默认为增加 175 | dpAENo.setEditable(false); 176 | dpAENo.setText("自动生成编号"); 177 | 178 | DepartmentDaoImpl dpSDAE = new DepartmentDaoImpl(); 179 | 180 | //查询/删除 科室信息,按钮事件处理 181 | class dpSDBtn implements ActionListener { 182 | public void actionPerformed(ActionEvent e) { 183 | dpSDArea.setText(null); 184 | String dpSDTp = (String) dpSDType.getSelectedItem(); 185 | String dPNo = dpSDNo.getText(); 186 | if(dPNo.length()>0 || dPNo.length()<=8) { 187 | if(dpSDTp.equals("查询")) { 188 | Department dp = new Department(); 189 | dp = dpSDAE.selDepartment(dPNo); 190 | if(dp != null) { 191 | String dpInfo = "科室编号:" + dp.getDPno() 192 | + "\n科室名称:"+ dp.getDPname() 193 | + "\n科室位置:" + dp.getDPloca() 194 | + "\n科室简介:" + dp.getDPbrief() 195 | + "\n是否临床科室:" + dp.getIsClinical(); 196 | dpSDArea.setText(dpInfo); 197 | }else { 198 | dpSDArea.setText("此科室信息不存在"); 199 | } 200 | }else if(dpSDTp.equals("删除")) { 201 | Boolean isOK = dpSDAE.deleObj(dPNo); 202 | if(isOK) { 203 | JOptionPane.showMessageDialog(frame,dpSDNo.getText() + "科室信息 已被删除!","科室信息删除提示",JOptionPane.PLAIN_MESSAGE); 204 | }else { 205 | JOptionPane.showMessageDialog(frame, "删除科室信息 失败!","科室信息删除提示",JOptionPane.ERROR_MESSAGE); 206 | } 207 | } 208 | }else { 209 | JOptionPane.showMessageDialog(frame, "请输入1-8位编号!","输入错误提示",JOptionPane.ERROR_MESSAGE); 210 | } 211 | } 212 | } 213 | //判断选择的是增加还是修改,设置科室编号是否可以输入 214 | class DpAETp implements ActionListener { 215 | public void actionPerformed(ActionEvent e) { 216 | String dpAETp = (String) dpAEType.getSelectedItem(); 217 | if(dpAETp.equals("增加")) { 218 | dpAENo.setEditable(false); 219 | dpAENo.setText("自动生成编号"); 220 | }else if(dpAETp.equals("修改")) { 221 | dpAENo.setEditable(true); 222 | dpAENo.setText(null); 223 | dpAEIsClic.setSelectedItem(null); 224 | } 225 | } 226 | 227 | } 228 | //判断是增加还是修改,执行相应的事件 229 | class dpAEBtn implements ActionListener { 230 | public void actionPerformed(ActionEvent e) { 231 | String dpAETp = (String) dpAEType.getSelectedItem(); 232 | if(dpAETp.equals("增加")) { 233 | Department dp = new Department(); 234 | dp.setDPname(dpAEName.getText()); 235 | dp.setDPloca(dpAELoca.getText()); 236 | dp.setDPbrief(dpAEBrief.getText()); 237 | if(dpAEIsClic.getSelectedItem().equals("是")) { 238 | dp.setIsClinical("1"); 239 | }else { 240 | dp.setIsClinical("0"); 241 | } 242 | Boolean isOK = dpSDAE.addObj(dp); 243 | if(isOK) { 244 | JOptionPane.showMessageDialog(frame,dpAEName.getText() + "的信息 已成功添加!","科室信息添加提示",JOptionPane.PLAIN_MESSAGE); 245 | String dnum = dpSDAE.selDpNo(dp.getDPname()); 246 | JOptionPane.showMessageDialog(frame,"生成的编号为:"+ dnum +"!","科室信息添加提示",JOptionPane.INFORMATION_MESSAGE); 247 | }else { 248 | JOptionPane.showMessageDialog(frame, "添加科室信息 失败!","科室信息添加提示",JOptionPane.ERROR_MESSAGE); 249 | } 250 | }else if(dpAETp.equals("修改")) { 251 | if(dpAENo.getText()!=null) { 252 | Department dp = new Department(); 253 | dp.setDPno(dpAENo.getText()); 254 | dp.setDPname(dpAEName.getText()); 255 | dp.setDPloca(dpAELoca.getText()); 256 | dp.setDPbrief(dpAEBrief.getText()); 257 | if(dpAEIsClic.getSelectedItem().equals("是")) { 258 | dp.setIsClinical("1"); 259 | }else { 260 | dp.setIsClinical("0"); 261 | } 262 | Boolean isOK = dpSDAE.exeObj(dp); 263 | if(isOK) { 264 | JOptionPane.showMessageDialog(frame, "编号为:"+ dpAENo.getText() + " 的科室信息 已成功修改!","科室信息修改提示",JOptionPane.PLAIN_MESSAGE); 265 | }else { 266 | JOptionPane.showMessageDialog(frame, "修改科室信息 失败!","科室信息修改提示",JOptionPane.ERROR_MESSAGE); 267 | } 268 | }else { 269 | JOptionPane.showMessageDialog(frame, "必须输入编号!","科室信息修改提示",JOptionPane.ERROR_MESSAGE); 270 | } 271 | } 272 | } 273 | } 274 | //返回上一界面的按钮事件 275 | class BackBtn implements ActionListener { 276 | public void actionPerformed(ActionEvent e) { 277 | frame.setVisible(false); 278 | AdminGui.frame.setVisible(true); 279 | } 280 | } 281 | 282 | dpSDBtn dESDBtn = new dpSDBtn(); 283 | dpSDBtn.addActionListener(dESDBtn); 284 | 285 | DpAETp dpAETp = new DpAETp(); 286 | dpAEType.addActionListener(dpAETp); 287 | 288 | dpAEBtn dEAEBtn = new dpAEBtn(); 289 | dpAEBtn.addActionListener(dEAEBtn); 290 | 291 | BackBtn bkBtn = new BackBtn(); 292 | backBtn.addActionListener(bkBtn); 293 | 294 | frame.setResizable(false); 295 | frame.setSize(880, 530); 296 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 297 | frame.setVisible(true); 298 | frame.setLocationRelativeTo(null); 299 | } 300 | } 301 | -------------------------------------------------------------------------------- /java源码/cn/linyer/gui/adminGui/DoctorEmpManagerGui.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.gui.adminGui; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Color; 5 | import java.awt.Font; 6 | import java.awt.GridLayout; 7 | import java.awt.event.ActionEvent; 8 | import java.awt.event.ActionListener; 9 | import javax.swing.JButton; 10 | import javax.swing.JComboBox; 11 | import javax.swing.JFrame; 12 | import javax.swing.JLabel; 13 | import javax.swing.JOptionPane; 14 | import javax.swing.JPanel; 15 | import javax.swing.JTextArea; 16 | import javax.swing.JTextField; 17 | 18 | import cn.linyer.dao.impl.DoctorEmpDaoIpml; 19 | import cn.linyer.entity.DoctorEmp; 20 | 21 | /** 22 | * @author Linyer 23 | * 管理员管理医师职业信息界面 24 | * 25 | */ 26 | public class DoctorEmpManagerGui { 27 | //主体部分定义 28 | private JFrame frame = new JFrame("管理医师职业信息"); 29 | 30 | private JLabel doctorEmpLabel = new JLabel("医师职业信息管理",JLabel.CENTER); 31 | private JPanel doctorEmpPanel = new JPanel(); 32 | //查询/删除 部分组件定义 33 | private JPanel doctorEmpSDPanel = new JPanel(); 34 | private JPanel doctorEmpSDCenPanel = new JPanel(); 35 | private JPanel doctorEmpSDCenTablePanel = new JPanel(); 36 | 37 | private JLabel doctorEmpSDLabel = new JLabel("查询/删除 医师职业信息",JLabel.CENTER); 38 | private JLabel doctorEmpSDTypeLabel = new JLabel("操作类型:"); 39 | 40 | private JComboBox doctorEmpSDType = new JComboBox(); 41 | 42 | private JLabel doctorEmpSDNoLabel = new JLabel("医师工号:"); 43 | 44 | private JTextField doctorEmpSDNo = new JTextField(8); 45 | private JTextArea doctorEmpSDArea = new JTextArea(12,30); 46 | 47 | private JButton doctorEmpSDBtn = new JButton("确定 查询/删除"); 48 | 49 | //增加/修改 部分组件定义 50 | private JPanel doctorEmpAEPanel = new JPanel(); 51 | private JPanel doctorEmpAECenPanel = new JPanel(); 52 | 53 | private JLabel doctorEmpAELabel = new JLabel("增加/修改 医师职业信息",JLabel.CENTER); 54 | private JLabel doctorEmpAETypeLabel = new JLabel("操作类型:"); 55 | private JLabel doctorEmpAENoLabel = new JLabel("医师工号:"); 56 | private JLabel doctorEmpAEDPnoLabel = new JLabel("医师所在科室编号:"); 57 | private JLabel doctorEmpAEWorkLabel = new JLabel("医师职务:"); 58 | private JLabel doctorEmpAELnoLabel = new JLabel("医师职称编号:"); 59 | private JLabel doctorEmpAEXlLabel = new JLabel("医师学历:"); 60 | private JLabel doctorEmpAEYearLabel = new JLabel("医师年资:"); 61 | private JLabel doctorEmpAESalaryLabel = new JLabel("医师薪资:"); 62 | private JLabel doctorEmpAESuperNoLabel = new JLabel("上级医师工号:"); 63 | 64 | private JComboBox doctorEmpAEType = new JComboBox(); 65 | private JTextField doctorEmpAENo = new JTextField(8); 66 | private JTextField doctorEmpAEDPno = new JTextField(8); 67 | private JTextField doctorEmpAEWork = new JTextField(60); 68 | private JTextField doctorEmpAELno = new JTextField(8); 69 | private JTextField doctorEmpAEXl = new JTextField(60); 70 | private JTextField doctorEmpAEYear = new JTextField(40); 71 | private JTextField doctorEmpAESalary = new JTextField(8); 72 | private JTextField doctorEmpAESuperNo = new JTextField(8); 73 | 74 | private JButton doctorEmpAEBtn = new JButton("确定 增加/修改"); 75 | //返回按钮 76 | private JButton backBtn = new JButton("返回上一界面"); 77 | //颜色字体定义 78 | private Color myBlue = new Color(52, 152, 219); 79 | private Color myGreen = new Color(19, 141, 117); 80 | private Color myPink = new Color(171, 40, 199); 81 | 82 | private Font fontMid = new Font("华文楷体",Font.PLAIN,24); 83 | 84 | public DoctorEmpManagerGui() { 85 | //布局 86 | frame.setLayout(new BorderLayout()); 87 | doctorEmpPanel.setLayout(new BorderLayout()); 88 | doctorEmpSDPanel.setLayout(new BorderLayout()); 89 | doctorEmpSDCenPanel.setLayout(new BorderLayout()); 90 | doctorEmpSDCenTablePanel.setLayout(new GridLayout(2,2)); 91 | doctorEmpAEPanel.setLayout(new BorderLayout()); 92 | doctorEmpAECenPanel.setLayout(new GridLayout(9,2)); 93 | //设置各个组件的属性 94 | doctorEmpLabel.setFont(new Font("华文琥珀",Font.BOLD,36)); 95 | doctorEmpLabel.setForeground(myBlue); 96 | //查询组件属性 97 | doctorEmpSDLabel.setFont(new Font("黑体",Font.BOLD,28)); 98 | doctorEmpSDLabel.setForeground(myGreen); 99 | doctorEmpSDTypeLabel.setFont(fontMid); 100 | doctorEmpSDTypeLabel.setForeground(Color.red); 101 | doctorEmpSDType.setFont(fontMid); 102 | doctorEmpSDType.setForeground(Color.red); 103 | doctorEmpSDNoLabel.setFont(fontMid); 104 | doctorEmpSDNoLabel.setForeground(myPink); 105 | doctorEmpSDNo.setFont(fontMid); 106 | doctorEmpSDArea.setFont(fontMid); 107 | doctorEmpSDBtn.setFont(fontMid); 108 | //增加/修改组件属性 109 | doctorEmpAELabel.setFont(new Font("黑体",Font.BOLD,28)); 110 | doctorEmpAELabel.setForeground(myGreen); 111 | doctorEmpAETypeLabel.setFont(fontMid); 112 | doctorEmpAETypeLabel.setForeground(Color.red); 113 | doctorEmpAENoLabel.setFont(fontMid); 114 | doctorEmpAENoLabel.setForeground(myPink); 115 | doctorEmpAEDPnoLabel.setFont(fontMid); 116 | doctorEmpAEWorkLabel.setFont(fontMid); 117 | doctorEmpAELnoLabel.setFont(fontMid); 118 | doctorEmpAEXlLabel.setFont(fontMid); 119 | doctorEmpAEYearLabel.setFont(fontMid); 120 | doctorEmpAESalaryLabel.setFont(fontMid); 121 | doctorEmpAESuperNoLabel.setFont(fontMid); 122 | doctorEmpAEType.setFont(fontMid); 123 | doctorEmpAEType.setForeground(Color.red); 124 | doctorEmpAENo.setFont(fontMid); 125 | doctorEmpAEDPno.setFont(fontMid); 126 | doctorEmpAEWork.setFont(fontMid); 127 | doctorEmpAELno.setFont(fontMid); 128 | doctorEmpAEXl.setFont(fontMid); 129 | doctorEmpAEYear.setFont(fontMid); 130 | doctorEmpAESalary.setFont(fontMid); 131 | doctorEmpAESuperNo.setFont(fontMid); 132 | doctorEmpAEBtn.setFont(fontMid); 133 | 134 | backBtn.setFont(fontMid); 135 | //设置查询中的文本域不可编辑 136 | doctorEmpSDArea.setEditable(false); 137 | 138 | //添加组件 139 | frame.add(doctorEmpLabel,BorderLayout.NORTH); 140 | frame.add(doctorEmpPanel,BorderLayout.CENTER); 141 | frame.add(backBtn,BorderLayout.SOUTH); 142 | 143 | doctorEmpPanel.add(doctorEmpSDPanel,BorderLayout.WEST); 144 | doctorEmpPanel.add(doctorEmpAEPanel,BorderLayout.CENTER); 145 | 146 | doctorEmpSDPanel.add(doctorEmpSDLabel,BorderLayout.NORTH); 147 | doctorEmpSDPanel.add(doctorEmpSDCenPanel,BorderLayout.CENTER); 148 | doctorEmpSDPanel.add(doctorEmpSDBtn,BorderLayout.SOUTH); 149 | 150 | doctorEmpSDCenPanel.add(doctorEmpSDCenTablePanel,BorderLayout.NORTH); 151 | doctorEmpSDCenPanel.add(doctorEmpSDArea,BorderLayout.SOUTH); 152 | 153 | doctorEmpSDCenTablePanel.add(doctorEmpSDTypeLabel); 154 | doctorEmpSDCenTablePanel.add(doctorEmpSDType); 155 | doctorEmpSDCenTablePanel.add(doctorEmpSDNoLabel); 156 | doctorEmpSDCenTablePanel.add(doctorEmpSDNo); 157 | 158 | doctorEmpAEPanel.add(doctorEmpAELabel,BorderLayout.NORTH); 159 | doctorEmpAEPanel.add(doctorEmpAECenPanel,BorderLayout.CENTER); 160 | doctorEmpAEPanel.add(doctorEmpAEBtn,BorderLayout.SOUTH); 161 | 162 | doctorEmpAECenPanel.add(doctorEmpAETypeLabel); 163 | doctorEmpAECenPanel.add(doctorEmpAEType); 164 | doctorEmpAECenPanel.add(doctorEmpAENoLabel); 165 | doctorEmpAECenPanel.add(doctorEmpAENo); 166 | doctorEmpAECenPanel.add(doctorEmpAEDPnoLabel); 167 | doctorEmpAECenPanel.add(doctorEmpAEDPno); 168 | doctorEmpAECenPanel.add(doctorEmpAEWorkLabel); 169 | doctorEmpAECenPanel.add(doctorEmpAEWork); 170 | doctorEmpAECenPanel.add(doctorEmpAELnoLabel); 171 | doctorEmpAECenPanel.add(doctorEmpAELno); 172 | doctorEmpAECenPanel.add(doctorEmpAEXlLabel); 173 | doctorEmpAECenPanel.add(doctorEmpAEXl); 174 | doctorEmpAECenPanel.add(doctorEmpAEYearLabel); 175 | doctorEmpAECenPanel.add(doctorEmpAEYear); 176 | doctorEmpAECenPanel.add(doctorEmpAESalaryLabel); 177 | doctorEmpAECenPanel.add(doctorEmpAESalary); 178 | doctorEmpAECenPanel.add(doctorEmpAESuperNoLabel); 179 | doctorEmpAECenPanel.add(doctorEmpAESuperNo); 180 | 181 | doctorEmpSDType.addItem("查询"); 182 | doctorEmpSDType.addItem("删除"); 183 | 184 | doctorEmpAEType.addItem("增加"); 185 | doctorEmpAEType.addItem("修改"); 186 | 187 | DoctorEmpDaoIpml doctorEmpSDAE = new DoctorEmpDaoIpml(); 188 | 189 | //查询/删除医师职业信息,按钮事件处理 190 | class DoctorEmpSDBtn implements ActionListener { 191 | public void actionPerformed(ActionEvent e) { 192 | doctorEmpSDArea.setText(null); 193 | String doctorEmpSDTp = (String) doctorEmpSDType.getSelectedItem(); 194 | String dNo = doctorEmpSDNo.getText(); 195 | if(dNo.length()>0 || dNo.length()<=8) { 196 | if(doctorEmpSDTp.equals("查询")) { 197 | DoctorEmp doctorEmp = new DoctorEmp(); 198 | doctorEmp = doctorEmpSDAE.selDoctorEmp(dNo); 199 | if(doctorEmp != null) { 200 | String doctorEmpInfo = "医师工号:" + doctorEmp.getDno() 201 | + "\n医师所在科室编号:"+ doctorEmp.getDPno() 202 | + "\n医师职务:" + doctorEmp.getDwork() 203 | + "\n医师职称编号:" + doctorEmp.getLno() 204 | + "\n医师学历:" + doctorEmp.getDxl() 205 | + "\n医师年资:" + doctorEmp.getDyear() 206 | + "\n医师薪资:" + doctorEmp.getDsalary() 207 | + "\n上级医师工号:" + doctorEmp.getDsuperNo(); 208 | doctorEmpSDArea.setText(doctorEmpInfo); 209 | }else { 210 | doctorEmpSDArea.setText("此医师职业信息不存在"); 211 | } 212 | }else if(doctorEmpSDTp.equals("删除")) { 213 | Boolean isOK = doctorEmpSDAE.deleObj(dNo); 214 | if(isOK) { 215 | JOptionPane.showMessageDialog(frame,doctorEmpSDNo.getText() + "医师职业信息 已被删除!", 216 | "医师职业信息删除提示",JOptionPane.PLAIN_MESSAGE); 217 | }else { 218 | JOptionPane.showMessageDialog(frame, "删除医师职业信息 失败!", 219 | "医师职业信息删除提示",JOptionPane.ERROR_MESSAGE); 220 | } 221 | } 222 | }else { 223 | JOptionPane.showMessageDialog(frame, "请输入1-8位工号!", 224 | "输入错误提示",JOptionPane.ERROR_MESSAGE); 225 | } 226 | } 227 | } 228 | 229 | //判断是增加还是修改,执行相应的事件 230 | class DoctorEmpAEBtn implements ActionListener { 231 | public void actionPerformed(ActionEvent e) { 232 | String doctorEmpAETp = (String) doctorEmpAEType.getSelectedItem(); 233 | DoctorEmp doctorEmp = new DoctorEmp(); 234 | doctorEmp.setDno(doctorEmpAENo.getText()); 235 | doctorEmp.setDPno(doctorEmpAEDPno.getText()); 236 | doctorEmp.setDwork(doctorEmpAEWork.getText()); 237 | doctorEmp.setLno(doctorEmpAELno.getText()); 238 | doctorEmp.setDxl(doctorEmpAEXl.getText()); 239 | doctorEmp.setDyear(doctorEmpAEYear.getText()); 240 | doctorEmp.setDsalary(doctorEmpAESalary.getText()); 241 | doctorEmp.setDsuperNo(doctorEmpAESuperNo.getText()); 242 | if(doctorEmpAETp.equals("增加")) { 243 | if(doctorEmpSDAE.addObj(doctorEmp)) { 244 | JOptionPane.showMessageDialog(frame,"工号为:" + doctorEmpAENo.getText() + " 医师的职业信息 已成功添加!", 245 | "医师职业信息添加提示",JOptionPane.PLAIN_MESSAGE); 246 | }else { 247 | JOptionPane.showMessageDialog(frame, "添加医师职业信息 失败!", 248 | "医师职业信息添加提示",JOptionPane.ERROR_MESSAGE); 249 | } 250 | }else if(doctorEmpAETp.equals("修改")) { 251 | if(doctorEmpAENo.getText()!=null) { 252 | if(doctorEmpSDAE.exeObj(doctorEmp)) { 253 | JOptionPane.showMessageDialog(frame, "工号为:"+ doctorEmpAENo.getText() + " 的医师的职业信息 已成功修改!", 254 | "医师职业信息修改提示",JOptionPane.PLAIN_MESSAGE); 255 | }else { 256 | JOptionPane.showMessageDialog(frame, "修改医师职业信息 失败!", 257 | "医师职业信息修改提示",JOptionPane.ERROR_MESSAGE); 258 | } 259 | }else { 260 | JOptionPane.showMessageDialog(frame, "必须输入工号!","医师职业信息修改提示",JOptionPane.ERROR_MESSAGE); 261 | } 262 | } 263 | } 264 | } 265 | //返回上一界面的按钮事件 266 | class BackBtn implements ActionListener { 267 | public void actionPerformed(ActionEvent e) { 268 | frame.setVisible(false); 269 | AdminGui.frame.setVisible(true); 270 | } 271 | } 272 | 273 | DoctorEmpSDBtn dESDBtn = new DoctorEmpSDBtn(); 274 | doctorEmpSDBtn.addActionListener(dESDBtn); 275 | 276 | DoctorEmpAEBtn dEAEBtn = new DoctorEmpAEBtn(); 277 | doctorEmpAEBtn.addActionListener(dEAEBtn); 278 | 279 | BackBtn bkBtn = new BackBtn(); 280 | backBtn.addActionListener(bkBtn); 281 | 282 | frame.setResizable(false); 283 | frame.setSize(1200, 700); 284 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 285 | frame.setVisible(true); 286 | frame.setLocationRelativeTo(null); 287 | } 288 | } 289 | -------------------------------------------------------------------------------- /java源码/cn/linyer/gui/adminGui/DoctorManagerGui.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.gui.adminGui; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Color; 5 | import java.awt.Font; 6 | import java.awt.GridLayout; 7 | import java.awt.event.ActionEvent; 8 | import java.awt.event.ActionListener; 9 | import java.awt.event.WindowEvent; 10 | import java.awt.event.WindowListener; 11 | 12 | import javax.swing.JButton; 13 | import javax.swing.JComboBox; 14 | import javax.swing.JFrame; 15 | import javax.swing.JLabel; 16 | import javax.swing.JOptionPane; 17 | import javax.swing.JPanel; 18 | import javax.swing.JTextArea; 19 | import javax.swing.JTextField; 20 | 21 | import cn.linyer.dao.impl.DoctorDaoImpl; 22 | import cn.linyer.entity.Doctor; 23 | 24 | /** 25 | * @author Linyer 26 | * 管理员管理医师基本信息界面 27 | * 28 | */ 29 | public class DoctorManagerGui { 30 | //主体部分定义 31 | private JFrame frame = new JFrame("管理医师基本信息"); 32 | 33 | private JLabel doctorLabel = new JLabel("医师基本信息管理",JLabel.CENTER); 34 | private JPanel doctorPanel = new JPanel(); 35 | //查询/删除 部分组件定义 36 | private JPanel doctorSDPanel = new JPanel(); 37 | private JPanel doctorSDCenPanel = new JPanel(); 38 | private JPanel doctorSDCenTablePanel = new JPanel(); 39 | 40 | private JLabel doctorSDLabel = new JLabel("查询/删除 医师基本信息",JLabel.CENTER); 41 | private JLabel doctorSDTypeLabel = new JLabel("操作类型:"); 42 | 43 | private JComboBox doctorSDType = new JComboBox(); 44 | 45 | private JLabel doctorSDNoLabel = new JLabel("医师工号:"); 46 | 47 | private JTextField doctorSDNo = new JTextField(8); 48 | private JTextArea doctorSDArea = new JTextArea(12,30); 49 | 50 | private JButton doctorSDBtn = new JButton("确定 查询/删除"); 51 | 52 | //增加/修改 部分组件定义 53 | private JPanel doctorAEPanel = new JPanel(); 54 | private JPanel doctorAECenPanel = new JPanel(); 55 | 56 | private JLabel doctorAELabel = new JLabel("增加/修改 医师基本信息",JLabel.CENTER); 57 | private JLabel doctorAETypeLabel = new JLabel("操作类型:"); 58 | private JLabel doctorAENoLabel = new JLabel("医师工号:"); 59 | private JLabel doctorAENameLabel = new JLabel("医师姓名:"); 60 | private JLabel doctorAESexLabel = new JLabel("医师性别:"); 61 | private JLabel doctorAEBirthLabel = new JLabel("医师出生日期:"); 62 | private JLabel doctorAEPhoneLabel = new JLabel("医师联系电话:"); 63 | private JLabel doctorAEEmailLabel = new JLabel("医师电子邮箱:"); 64 | private JLabel doctorAEBriefLabel = new JLabel("医师简介:"); 65 | private JLabel doctorAEPwdLabel = new JLabel("医师账号密码:"); 66 | 67 | private JComboBox doctorAEType = new JComboBox(); 68 | private JTextField doctorAENo = new JTextField(8); 69 | private JTextField doctorAEName = new JTextField(18); 70 | private JComboBox doctorAESex = new JComboBox(); 71 | private JTextField doctorAEBirth = new JTextField(10); 72 | private JTextField doctorAEPhone = new JTextField(11); 73 | private JTextField doctorAEEmail = new JTextField(40); 74 | private JTextField doctorAEBrief = new JTextField(3000); 75 | private JTextField doctorAEPwd = new JTextField(12); 76 | 77 | private JButton doctorAEBtn = new JButton("确定 增加/修改"); 78 | //返回按钮 79 | private JButton backBtn = new JButton("返回上一界面"); 80 | //颜色字体定义 81 | private Color myBlue = new Color(52, 152, 219); 82 | private Color myGreen = new Color(19, 141, 117); 83 | private Color myPink = new Color(171, 40, 199); 84 | 85 | private Font fontMid = new Font("华文楷体",Font.PLAIN,24); 86 | 87 | public DoctorManagerGui() { 88 | //布局 89 | frame.setLayout(new BorderLayout()); 90 | doctorPanel.setLayout(new BorderLayout()); 91 | doctorSDPanel.setLayout(new BorderLayout()); 92 | doctorSDCenPanel.setLayout(new BorderLayout()); 93 | doctorSDCenTablePanel.setLayout(new GridLayout(2,2)); 94 | doctorAEPanel.setLayout(new BorderLayout()); 95 | doctorAECenPanel.setLayout(new GridLayout(9,2)); 96 | //设置各个组件的属性 97 | doctorLabel.setFont(new Font("华文琥珀",Font.BOLD,36)); 98 | doctorLabel.setForeground(myBlue); 99 | //查询组件属性 100 | doctorSDLabel.setFont(new Font("黑体",Font.BOLD,28)); 101 | doctorSDLabel.setForeground(myGreen); 102 | doctorSDTypeLabel.setFont(fontMid); 103 | doctorSDTypeLabel.setForeground(Color.red); 104 | doctorSDType.setFont(fontMid); 105 | doctorSDType.setForeground(Color.red); 106 | doctorSDNoLabel.setFont(fontMid); 107 | doctorSDNoLabel.setForeground(myPink); 108 | doctorSDNo.setFont(fontMid); 109 | doctorSDArea.setFont(fontMid); 110 | doctorSDBtn.setFont(fontMid); 111 | //增加/修改组件属性 112 | doctorAELabel.setFont(new Font("黑体",Font.BOLD,28)); 113 | doctorAELabel.setForeground(myGreen); 114 | doctorAETypeLabel.setFont(fontMid); 115 | doctorAETypeLabel.setForeground(Color.red); 116 | doctorAENoLabel.setFont(fontMid); 117 | doctorAENoLabel.setForeground(myPink); 118 | doctorAENameLabel.setFont(fontMid); 119 | doctorAESexLabel.setFont(fontMid); 120 | doctorAEBirthLabel.setFont(fontMid); 121 | doctorAEPhoneLabel.setFont(fontMid); 122 | doctorAEEmailLabel.setFont(fontMid); 123 | doctorAEBriefLabel.setFont(fontMid); 124 | doctorAEPwdLabel.setFont(fontMid); 125 | doctorAEType.setFont(fontMid); 126 | doctorAEType.setForeground(Color.red); 127 | doctorAENo.setFont(fontMid); 128 | doctorAEName.setFont(fontMid); 129 | doctorAESex.setFont(fontMid); 130 | doctorAEBirth.setFont(fontMid); 131 | doctorAEPhone.setFont(fontMid); 132 | doctorAEEmail.setFont(fontMid); 133 | doctorAEBrief.setFont(fontMid); 134 | doctorAEPwd.setFont(fontMid); 135 | doctorAEBtn.setFont(fontMid); 136 | 137 | backBtn.setFont(fontMid); 138 | //设置查询中的文本域不可编辑 139 | doctorSDArea.setEditable(false); 140 | 141 | //添加组件 142 | frame.add(doctorLabel,BorderLayout.NORTH); 143 | frame.add(doctorPanel,BorderLayout.CENTER); 144 | frame.add(backBtn,BorderLayout.SOUTH); 145 | 146 | doctorPanel.add(doctorSDPanel,BorderLayout.WEST); 147 | doctorPanel.add(doctorAEPanel,BorderLayout.CENTER); 148 | 149 | doctorSDPanel.add(doctorSDLabel,BorderLayout.NORTH); 150 | doctorSDPanel.add(doctorSDCenPanel,BorderLayout.CENTER); 151 | doctorSDPanel.add(doctorSDBtn,BorderLayout.SOUTH); 152 | 153 | doctorSDCenPanel.add(doctorSDCenTablePanel,BorderLayout.NORTH); 154 | doctorSDCenPanel.add(doctorSDArea,BorderLayout.SOUTH); 155 | 156 | doctorSDCenTablePanel.add(doctorSDTypeLabel); 157 | doctorSDCenTablePanel.add(doctorSDType); 158 | doctorSDCenTablePanel.add(doctorSDNoLabel); 159 | doctorSDCenTablePanel.add(doctorSDNo); 160 | 161 | doctorAEPanel.add(doctorAELabel,BorderLayout.NORTH); 162 | doctorAEPanel.add(doctorAECenPanel,BorderLayout.CENTER); 163 | doctorAEPanel.add(doctorAEBtn,BorderLayout.SOUTH); 164 | 165 | doctorAECenPanel.add(doctorAETypeLabel); 166 | doctorAECenPanel.add(doctorAEType); 167 | doctorAECenPanel.add(doctorAENoLabel); 168 | doctorAECenPanel.add(doctorAENo); 169 | doctorAECenPanel.add(doctorAENameLabel); 170 | doctorAECenPanel.add(doctorAEName); 171 | doctorAECenPanel.add(doctorAESexLabel); 172 | doctorAECenPanel.add(doctorAESex); 173 | doctorAECenPanel.add(doctorAEBirthLabel); 174 | doctorAECenPanel.add(doctorAEBirth); 175 | doctorAECenPanel.add(doctorAEPhoneLabel); 176 | doctorAECenPanel.add(doctorAEPhone); 177 | doctorAECenPanel.add(doctorAEEmailLabel); 178 | doctorAECenPanel.add(doctorAEEmail); 179 | doctorAECenPanel.add(doctorAEBriefLabel); 180 | doctorAECenPanel.add(doctorAEBrief); 181 | doctorAECenPanel.add(doctorAEPwdLabel); 182 | doctorAECenPanel.add(doctorAEPwd); 183 | 184 | doctorSDType.addItem("查询"); 185 | doctorSDType.addItem("删除"); 186 | 187 | doctorAEType.addItem("增加"); 188 | doctorAEType.addItem("修改"); 189 | 190 | doctorAESex.addItem(null); 191 | doctorAESex.addItem("男"); 192 | doctorAESex.addItem("女"); 193 | //窗口一打开就判断一下是增加还是修改 194 | class DoctorWindowOpenIsAE implements WindowListener { 195 | public void windowActivated(WindowEvent e) { 196 | String doctorAETp = (String) doctorAEType.getSelectedItem(); 197 | if(doctorAETp.equals("增加")) { 198 | doctorAENo.setEditable(false); 199 | doctorAENo.setText("自动生成工号"); 200 | }else if(doctorAETp.equals("修改")) { 201 | doctorAENo.setEditable(true); 202 | doctorAENo.setText(null); 203 | } 204 | } 205 | 206 | public void windowOpened(WindowEvent e) {} 207 | public void windowClosing(WindowEvent e) {} 208 | public void windowClosed(WindowEvent e) {} 209 | public void windowIconified(WindowEvent e) {} 210 | public void windowDeiconified(WindowEvent e) {} 211 | public void windowDeactivated(WindowEvent e) {} 212 | } 213 | 214 | DoctorDaoImpl doctorSDAE = new DoctorDaoImpl(); 215 | 216 | //查询/删除医师基本信息,按钮事件处理 217 | class DoctorSDBtn implements ActionListener { 218 | public void actionPerformed(ActionEvent e) { 219 | doctorSDArea.setText(null); 220 | String doctorSDTp = (String) doctorSDType.getSelectedItem(); 221 | String dNo = doctorSDNo.getText(); 222 | if(dNo.length()>0 || dNo.length()<=8) { 223 | if(doctorSDTp.equals("查询")) { 224 | Doctor doctor = new Doctor(); 225 | doctor = doctorSDAE.selDoctor(dNo); 226 | if(doctor != null) { 227 | String doctorInfo = "医师工号:" + doctor.getDno() 228 | + "\n医师姓名:"+ doctor.getDname() 229 | + "\n医师性别:" + doctor.getDsex() 230 | + "\n医师出生日期:" + doctor.getDbirth() 231 | + "\n医师联系电话:" + doctor.getDphone() 232 | + "\n医师电子邮箱:" + doctor.getDemail() 233 | + "\n医师简介:" + doctor.getDbrief() 234 | + "\n医师账号密码:" + doctor.getDpwd(); 235 | doctorSDArea.setText(doctorInfo); 236 | }else { 237 | doctorSDArea.setText("此医师基本信息不存在"); 238 | } 239 | }else if(doctorSDTp.equals("删除")) { 240 | Boolean isOK = doctorSDAE.deleObj(dNo); 241 | if(isOK) { 242 | JOptionPane.showMessageDialog(frame,doctorSDNo.getText() + "医师基本信息 已被删除!","医师基本信息删除提示",JOptionPane.PLAIN_MESSAGE); 243 | }else { 244 | JOptionPane.showMessageDialog(frame, "删除医师基本信息 失败!","医师基本信息删除提示",JOptionPane.ERROR_MESSAGE); 245 | } 246 | } 247 | }else { 248 | JOptionPane.showMessageDialog(frame, "请输入1-8位工号!","输入错误提示",JOptionPane.ERROR_MESSAGE); 249 | } 250 | } 251 | } 252 | //判断选择的是增加还是修改,设置医师工号是否可以输入 253 | class DoctorAETp implements ActionListener { 254 | public void actionPerformed(ActionEvent e) { 255 | String doctorAETp = (String) doctorAEType.getSelectedItem(); 256 | if(doctorAETp.equals("增加")) { 257 | doctorAENo.setEditable(false); 258 | doctorAENo.setText("自动生成工号"); 259 | }else if(doctorAETp.equals("修改")) { 260 | doctorAENo.setEditable(true); 261 | doctorAENo.setText(null); 262 | } 263 | } 264 | 265 | } 266 | //判断是增加还是修改,执行相应的事件 267 | class DoctorAEBtn implements ActionListener { 268 | public void actionPerformed(ActionEvent e) { 269 | String doctorAETp = (String) doctorAEType.getSelectedItem(); 270 | Doctor doctor = new Doctor(); 271 | doctor.setDname(doctorAEName.getText()); 272 | doctor.setDsex((String)doctorAESex.getSelectedItem()); 273 | doctor.setDbirth(doctorAEBirth.getText()); 274 | doctor.setDphone(doctorAEPhone.getText()); 275 | doctor.setDemail(doctorAEEmail.getText()); 276 | doctor.setDbrief(doctorAEBrief.getText()); 277 | doctor.setDpwd(doctorAEPwd.getText()); 278 | if(doctorAETp.equals("增加")) { 279 | Boolean isOK = doctorSDAE.addObj(doctor); 280 | if(isOK) { 281 | JOptionPane.showMessageDialog(frame,doctorAEName.getText() + "医师的基本信息 已成功添加!","医师基本信息添加提示",JOptionPane.PLAIN_MESSAGE); 282 | String dnum = doctorSDAE.selDoctorNo(doctor.getDname()); 283 | JOptionPane.showMessageDialog(frame,"生成的工号为:"+ dnum +"!","医师基本信息添加提示",JOptionPane.INFORMATION_MESSAGE); 284 | }else { 285 | JOptionPane.showMessageDialog(frame, "添加医师基本信息 失败!","医师基本信息添加提示",JOptionPane.ERROR_MESSAGE); 286 | } 287 | }else if(doctorAETp.equals("修改")) { 288 | if(doctorAENo.getText()!=null) { 289 | Boolean isOK = doctorSDAE.exeObj(doctor); 290 | if(isOK) { 291 | JOptionPane.showMessageDialog(frame, "工号为:"+ doctorAENo.getText() + " 的医师的基本信息 已成功修改!","医师基本信息修改提示",JOptionPane.PLAIN_MESSAGE); 292 | }else { 293 | JOptionPane.showMessageDialog(frame, "修改医师基本信息 失败!","医师基本信息修改提示",JOptionPane.ERROR_MESSAGE); 294 | } 295 | }else { 296 | JOptionPane.showMessageDialog(frame, "必须输入工号!","医师基本信息修改提示",JOptionPane.ERROR_MESSAGE); 297 | } 298 | } 299 | } 300 | } 301 | //返回上一界面的按钮事件 302 | class BackBtn implements ActionListener { 303 | public void actionPerformed(ActionEvent e) { 304 | frame.setVisible(false); 305 | AdminGui.frame.setVisible(true); 306 | } 307 | } 308 | 309 | DoctorWindowOpenIsAE dWOIAE = new DoctorWindowOpenIsAE(); 310 | frame.addWindowListener(dWOIAE); 311 | 312 | DoctorSDBtn dSDBtn = new DoctorSDBtn(); 313 | doctorSDBtn.addActionListener(dSDBtn); 314 | 315 | DoctorAETp dAETp = new DoctorAETp(); 316 | doctorAEType.addActionListener(dAETp); 317 | 318 | DoctorAEBtn dAEBtn = new DoctorAEBtn(); 319 | doctorAEBtn.addActionListener(dAEBtn); 320 | 321 | BackBtn bkBtn = new BackBtn(); 322 | backBtn.addActionListener(bkBtn); 323 | 324 | frame.setResizable(false); 325 | frame.setSize(1000, 700); 326 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 327 | frame.setVisible(true); 328 | frame.setLocationRelativeTo(null); 329 | } 330 | } 331 | -------------------------------------------------------------------------------- /java源码/cn/linyer/gui/adminGui/PatientManagerGui.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.gui.adminGui; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Color; 5 | import java.awt.Font; 6 | import java.awt.GridLayout; 7 | import java.awt.event.ActionEvent; 8 | import java.awt.event.ActionListener; 9 | import java.awt.event.WindowEvent; 10 | import java.awt.event.WindowListener; 11 | 12 | import javax.swing.JButton; 13 | import javax.swing.JComboBox; 14 | import javax.swing.JFrame; 15 | import javax.swing.JLabel; 16 | import javax.swing.JOptionPane; 17 | import javax.swing.JPanel; 18 | import javax.swing.JTextArea; 19 | import javax.swing.JTextField; 20 | 21 | import cn.linyer.dao.impl.PatientDaoImpl; 22 | import cn.linyer.entity.Patient; 23 | 24 | /** 25 | * @author Linyer 26 | * 管理员管理患者信息界面 27 | * 28 | */ 29 | public class PatientManagerGui { 30 | //主体部分定义 31 | private JFrame frame = new JFrame("管理患者信息"); 32 | 33 | private JLabel patientLabel = new JLabel("患者信息管理",JLabel.CENTER); 34 | private JPanel patientPanel = new JPanel(); 35 | //查询/删除 部分组件定义 36 | private JPanel patientSDPanel = new JPanel(); 37 | private JPanel patientSDCenPanel = new JPanel(); 38 | private JPanel patientSDCenTablePanel = new JPanel(); 39 | 40 | private JLabel patientSDLabel = new JLabel("查询/删除 患者信息",JLabel.CENTER); 41 | private JLabel patientSDTypeLabel = new JLabel("操作类型:"); 42 | 43 | private JComboBox patientSDType = new JComboBox(); 44 | 45 | private JLabel patientSDNoLabel = new JLabel("患者编号:"); 46 | 47 | private JTextField patientSDNo = new JTextField(8); 48 | private JTextArea patientSDArea = new JTextArea(12,30); 49 | 50 | private JButton patientSDBtn = new JButton("确定 查询/删除"); 51 | 52 | //增加/修改 部分组件定义 53 | private JPanel patientAEPanel = new JPanel(); 54 | private JPanel patientAECenPanel = new JPanel(); 55 | 56 | private JLabel patientAELabel = new JLabel("增加/修改 患者信息",JLabel.CENTER); 57 | private JLabel patientAETypeLabel = new JLabel("操作类型:"); 58 | private JLabel patientAENoLabel = new JLabel("病历号:"); 59 | private JLabel patientAENameLabel = new JLabel("患者姓名:"); 60 | private JLabel patientAESexLabel = new JLabel("患者性别:"); 61 | private JLabel patientAEAgeLabel = new JLabel("患者年龄:"); 62 | private JLabel patientAEPhoneLabel = new JLabel("患者联系电话:"); 63 | private JLabel patientAEAddressLabel = new JLabel("患者住址:"); 64 | private JLabel patientAEDnoLabel = new JLabel("主治医师工号:"); 65 | private JLabel patientAEEnDateLabel = new JLabel("患者入院日期:"); 66 | private JLabel patientAEEmpLabel = new JLabel("患者职业:"); 67 | private JLabel patientAEPwdLabel = new JLabel("患者登录密码:"); 68 | private JLabel patientAEIDnoLabel = new JLabel("患者身份证号:"); 69 | 70 | 71 | private JComboBox patientAEType = new JComboBox(); 72 | private JTextField patientAENo = new JTextField(8); 73 | private JTextField patientAEName = new JTextField(21); 74 | private JComboBox patientAESex = new JComboBox(); 75 | private JTextField patientAEAge = new JTextField(3); 76 | private JTextField patientAEPhone = new JTextField(11); 77 | private JTextField patientAEAddress = new JTextField(300); 78 | private JTextField patientAEDno = new JTextField(8); 79 | private JTextField patientAEEnDate = new JTextField(12); 80 | private JTextField patientAEEmp = new JTextField(60); 81 | private JTextField patientAEPwd = new JTextField(12); 82 | private JTextField patientAEIDno = new JTextField(18); 83 | 84 | private JButton patientAEBtn = new JButton("确定 增加/修改"); 85 | //返回按钮 86 | private JButton backBtn = new JButton("返回上一界面"); 87 | //颜色字体定义 88 | private Color myBlue = new Color(52, 152, 219); 89 | private Color myGreen = new Color(19, 141, 117); 90 | private Color myPink = new Color(171, 40, 199); 91 | 92 | private Font fontMid = new Font("华文楷体",Font.PLAIN,24); 93 | 94 | public PatientManagerGui() { 95 | //布局 96 | frame.setLayout(new BorderLayout()); 97 | patientPanel.setLayout(new BorderLayout()); 98 | patientSDPanel.setLayout(new BorderLayout()); 99 | patientSDCenPanel.setLayout(new BorderLayout()); 100 | patientSDCenTablePanel.setLayout(new GridLayout(2,2)); 101 | patientAEPanel.setLayout(new BorderLayout()); 102 | patientAECenPanel.setLayout(new GridLayout(12,2)); 103 | //设置各个组件的属性 104 | patientLabel.setFont(new Font("华文琥珀",Font.BOLD,36)); 105 | patientLabel.setForeground(myBlue); 106 | //查询 组件属性 107 | patientSDLabel.setFont(new Font("黑体",Font.BOLD,28)); 108 | patientSDLabel.setForeground(myGreen); 109 | patientSDTypeLabel.setFont(fontMid); 110 | patientSDTypeLabel.setForeground(Color.red); 111 | patientSDType.setFont(fontMid); 112 | patientSDType.setForeground(Color.red); 113 | patientSDNoLabel.setFont(fontMid); 114 | patientSDNoLabel.setForeground(myPink); 115 | patientSDNo.setFont(fontMid); 116 | patientSDArea.setFont(fontMid); 117 | patientSDBtn.setFont(fontMid); 118 | //增加/修改 组件属性 119 | patientAELabel.setFont(new Font("黑体",Font.BOLD,28)); 120 | patientAELabel.setForeground(myGreen); 121 | patientAETypeLabel.setFont(fontMid); 122 | patientAETypeLabel.setForeground(Color.red); 123 | patientAENoLabel.setFont(fontMid); 124 | patientAENoLabel.setForeground(myPink); 125 | patientAENameLabel.setFont(fontMid); 126 | patientAESexLabel.setFont(fontMid); 127 | patientAEAgeLabel.setFont(fontMid); 128 | patientAEPhoneLabel.setFont(fontMid); 129 | patientAEAddressLabel.setFont(fontMid); 130 | patientAEDnoLabel.setFont(fontMid); 131 | patientAEEnDateLabel.setFont(fontMid); 132 | patientAEEmpLabel.setFont(fontMid); 133 | patientAEPwdLabel.setFont(fontMid); 134 | patientAEIDnoLabel.setFont(fontMid); 135 | patientAEType.setFont(fontMid); 136 | patientAEType.setForeground(Color.red); 137 | patientAENo.setFont(fontMid); 138 | patientAEName.setFont(fontMid); 139 | patientAESex.setFont(fontMid); 140 | patientAEAge.setFont(fontMid); 141 | patientAEPhone.setFont(fontMid); 142 | patientAEAddress.setFont(fontMid); 143 | patientAEDno.setFont(fontMid); 144 | patientAEEnDate.setFont(fontMid); 145 | patientAEEmp.setFont(fontMid); 146 | patientAEPwd.setFont(fontMid); 147 | patientAEIDno.setFont(fontMid); 148 | patientAEBtn.setFont(fontMid); 149 | 150 | backBtn.setFont(fontMid); 151 | //设置查询中的文本域不可编辑 152 | patientSDArea.setEditable(false); 153 | 154 | //添加组件 155 | frame.add(patientLabel,BorderLayout.NORTH); 156 | frame.add(patientPanel,BorderLayout.CENTER); 157 | frame.add(backBtn,BorderLayout.SOUTH); 158 | 159 | patientPanel.add(patientSDPanel,BorderLayout.WEST); 160 | patientPanel.add(patientAEPanel,BorderLayout.CENTER); 161 | 162 | patientSDPanel.add(patientSDLabel,BorderLayout.NORTH); 163 | patientSDPanel.add(patientSDCenPanel,BorderLayout.CENTER); 164 | patientSDPanel.add(patientSDBtn,BorderLayout.SOUTH); 165 | 166 | patientSDCenPanel.add(patientSDCenTablePanel,BorderLayout.NORTH); 167 | patientSDCenPanel.add(patientSDArea,BorderLayout.SOUTH); 168 | 169 | patientSDCenTablePanel.add(patientSDTypeLabel); 170 | patientSDCenTablePanel.add(patientSDType); 171 | patientSDCenTablePanel.add(patientSDNoLabel); 172 | patientSDCenTablePanel.add(patientSDNo); 173 | 174 | patientAEPanel.add(patientAELabel,BorderLayout.NORTH); 175 | patientAEPanel.add(patientAECenPanel,BorderLayout.CENTER); 176 | patientAEPanel.add(patientAEBtn,BorderLayout.SOUTH); 177 | 178 | patientAECenPanel.add(patientAETypeLabel); 179 | patientAECenPanel.add(patientAEType); 180 | patientAECenPanel.add(patientAENoLabel); 181 | patientAECenPanel.add(patientAENo); 182 | patientAECenPanel.add(patientAENameLabel); 183 | patientAECenPanel.add(patientAEName); 184 | patientAECenPanel.add(patientAESexLabel); 185 | patientAECenPanel.add(patientAESex); 186 | patientAECenPanel.add(patientAEAgeLabel); 187 | patientAECenPanel.add(patientAEAge); 188 | patientAECenPanel.add(patientAEPhoneLabel); 189 | patientAECenPanel.add(patientAEPhone); 190 | patientAECenPanel.add(patientAEAddressLabel); 191 | patientAECenPanel.add(patientAEAddress); 192 | patientAECenPanel.add(patientAEDnoLabel); 193 | patientAECenPanel.add(patientAEDno); 194 | patientAECenPanel.add(patientAEEnDateLabel); 195 | patientAECenPanel.add(patientAEEnDate); 196 | patientAECenPanel.add(patientAEEmpLabel); 197 | patientAECenPanel.add(patientAEEmp); 198 | patientAECenPanel.add(patientAEPwdLabel); 199 | patientAECenPanel.add(patientAEPwd); 200 | patientAECenPanel.add(patientAEIDnoLabel); 201 | patientAECenPanel.add(patientAEIDno); 202 | 203 | patientSDType.addItem("查询"); 204 | patientSDType.addItem("删除"); 205 | 206 | patientAEType.addItem("增加"); 207 | patientAEType.addItem("修改"); 208 | 209 | patientAESex.addItem(null); 210 | patientAESex.addItem("男"); 211 | patientAESex.addItem("女"); 212 | 213 | //窗口一打开就判断一下是增加还是修改 214 | class DoctorWindowOpenIsAE implements WindowListener { 215 | public void windowActivated(WindowEvent e) { 216 | String doctorAETp = (String) patientAEType.getSelectedItem(); 217 | if(doctorAETp.equals("增加")) { 218 | patientAENo.setEditable(false); 219 | patientAENo.setText("自动生成病历号"); 220 | }else if(doctorAETp.equals("修改")) { 221 | patientAENo.setEditable(true); 222 | patientAENo.setText(null); 223 | } 224 | } 225 | 226 | public void windowOpened(WindowEvent e) {} 227 | public void windowClosing(WindowEvent e) {} 228 | public void windowClosed(WindowEvent e) {} 229 | public void windowIconified(WindowEvent e) {} 230 | public void windowDeiconified(WindowEvent e) {} 231 | public void windowDeactivated(WindowEvent e) {} 232 | } 233 | 234 | PatientDaoImpl patientSDAE = new PatientDaoImpl(); 235 | 236 | //查询/删除 患者信息,按钮事件处理 237 | class patientSDBtn implements ActionListener { 238 | public void actionPerformed(ActionEvent e) { 239 | patientSDArea.setText(null); 240 | String patientSDTp = (String) patientSDType.getSelectedItem(); 241 | String patientNo = patientSDNo.getText(); 242 | if(patientNo.length()>0 || patientNo.length()<=8) { 243 | if(patientSDTp.equals("查询")) { 244 | Patient patient = new Patient(); 245 | patient = patientSDAE.selPatient(patientNo); 246 | if(patient != null) { 247 | String patientInfo = "病历号:" + patient.getPno() 248 | + "\n患者姓名:"+ patient.getPname() 249 | + "\n患者性别:" + patient.getPsex() 250 | + "\n患者年龄:" + patient.getPage() 251 | + "\n患者联系电话:" + patient.getPphone() 252 | + "\n患者住址:" + patient.getPaddress() 253 | + "\n主治医师工号:" + patient.getDno() 254 | + "\n入院日期:" + patient.getPEnDate() 255 | + "\n患者职业:" + patient.getPemployer() 256 | + "\n患者登录密码:" + patient.getPpwd() 257 | + "\n患者身份证号:" + patient.getPIDno(); 258 | patientSDArea.setText(patientInfo); 259 | }else { 260 | patientSDArea.setText("此患者信息不存在"); 261 | } 262 | }else if(patientSDTp.equals("删除")) { 263 | Boolean isOK = patientSDAE.deleObj(patientNo); 264 | if(isOK) { 265 | JOptionPane.showMessageDialog(frame,patientSDNo.getText() + "患者信息 已被删除!","患者信息删除提示",JOptionPane.PLAIN_MESSAGE); 266 | }else { 267 | JOptionPane.showMessageDialog(frame, "删除患者信息 失败!","患者信息删除提示",JOptionPane.ERROR_MESSAGE); 268 | } 269 | } 270 | }else { 271 | JOptionPane.showMessageDialog(frame, "请输入1-8位编号!","输入错误提示",JOptionPane.ERROR_MESSAGE); 272 | } 273 | } 274 | } 275 | //判断选择的是增加还是修改,设置患者编号是否可以输入 276 | class patientAETp implements ActionListener { 277 | public void actionPerformed(ActionEvent e) { 278 | String patientAETp = (String) patientAEType.getSelectedItem(); 279 | if(patientAETp.equals("增加")) { 280 | patientAENo.setEditable(false); 281 | patientAENo.setText("自动生成病历号"); 282 | }else if(patientAETp.equals("修改")) { 283 | patientAENo.setEditable(true); 284 | patientAENo.setText(null); 285 | } 286 | } 287 | 288 | } 289 | //判断是增加还是修改,执行相应的事件 290 | class patientAEBtn implements ActionListener { 291 | public void actionPerformed(ActionEvent e) { 292 | String patientAETp = (String) patientAEType.getSelectedItem(); 293 | if(patientAETp.equals("增加")) { 294 | Patient patient = new Patient(); 295 | patient.setPname(patientAEName.getText()); 296 | patient.setPsex((String)patientAESex.getSelectedItem()); 297 | patient.setPage(patientAEAge.getText()); 298 | patient.setPphone(patientAEPhone.getText()); 299 | patient.setPaddress(patientAEAddress.getText()); 300 | patient.setDno(patientAEDno.getText()); 301 | patient.setPEnDate(patientAEEnDate.getText()); 302 | patient.setPemployer(patientAEEmp.getText()); 303 | patient.setPpwd(patientAEPwd.getText()); 304 | patient.setPIDno(patientAEIDno.getText()); 305 | Boolean isOK = patientSDAE.addObj(patient); 306 | if(isOK) { 307 | JOptionPane.showMessageDialog(frame,"患者:"+ patientAEName.getText() + " 的信息 已成功添加!","患者信息添加提示",JOptionPane.PLAIN_MESSAGE); 308 | String dnum = patientSDAE.selPatientNo(patient.getPname()); 309 | JOptionPane.showMessageDialog(frame,"生成的编号为:"+ dnum +"!","患者信息添加提示",JOptionPane.INFORMATION_MESSAGE); 310 | }else { 311 | JOptionPane.showMessageDialog(frame, "添加患者信息 失败!","患者信息添加提示",JOptionPane.ERROR_MESSAGE); 312 | } 313 | }else if(patientAETp.equals("修改")) { 314 | if(patientAENo.getText()!=null) { 315 | Patient patient = new Patient(); 316 | patient.setPno(patientAENo.getText()); 317 | patient.setPname(patientAEName.getText()); 318 | patient.setPsex((String)patientAESex.getSelectedItem()); 319 | patient.setPage(patientAEAge.getText()); 320 | patient.setPphone(patientAEPhone.getText()); 321 | patient.setPaddress(patientAEAddress.getText()); 322 | patient.setDno(patientAEDno.getText()); 323 | patient.setPEnDate(patientAEEnDate.getText()); 324 | patient.setPemployer(patientAEEmp.getText()); 325 | patient.setPpwd(patientAEPwd.getText()); 326 | patient.setPIDno(patientAEIDno.getText()); 327 | Boolean isOK = patientSDAE.exeObj(patient); 328 | if(isOK) { 329 | JOptionPane.showMessageDialog(frame, "编号为:"+ patientAENo.getText() + " 的患者信息 已成功修改!","患者信息修改提示",JOptionPane.PLAIN_MESSAGE); 330 | }else { 331 | JOptionPane.showMessageDialog(frame, "修改患者信息 失败!","患者信息修改提示",JOptionPane.ERROR_MESSAGE); 332 | } 333 | }else { 334 | JOptionPane.showMessageDialog(frame, "必须输入编号!","患者信息修改提示",JOptionPane.ERROR_MESSAGE); 335 | } 336 | } 337 | } 338 | } 339 | //返回上一界面的按钮事件 340 | class BackBtn implements ActionListener { 341 | public void actionPerformed(ActionEvent e) { 342 | frame.setVisible(false); 343 | AdminGui.frame.setVisible(true); 344 | } 345 | } 346 | 347 | DoctorWindowOpenIsAE dWOIAE = new DoctorWindowOpenIsAE(); 348 | frame.addWindowListener(dWOIAE); 349 | 350 | patientSDBtn dESDBtn = new patientSDBtn(); 351 | patientSDBtn.addActionListener(dESDBtn); 352 | 353 | patientAETp patientAETp = new patientAETp(); 354 | patientAEType.addActionListener(patientAETp); 355 | 356 | patientAEBtn dEAEBtn = new patientAEBtn(); 357 | patientAEBtn.addActionListener(dEAEBtn); 358 | 359 | BackBtn bkBtn = new BackBtn(); 360 | backBtn.addActionListener(bkBtn); 361 | 362 | frame.setResizable(false); 363 | frame.setSize(1000, 700); 364 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 365 | frame.setVisible(true); 366 | frame.setLocationRelativeTo(null); 367 | } 368 | } 369 | -------------------------------------------------------------------------------- /java源码/cn/linyer/gui/doctorGui/DoctorAuxiliaryGui.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.gui.doctorGui; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Color; 5 | import java.awt.Font; 6 | import java.awt.GridLayout; 7 | import java.awt.event.ActionEvent; 8 | import java.awt.event.ActionListener; 9 | 10 | import javax.swing.JButton; 11 | import javax.swing.JFrame; 12 | import javax.swing.JLabel; 13 | import javax.swing.JOptionPane; 14 | import javax.swing.JPanel; 15 | import javax.swing.JTextField; 16 | 17 | import cn.linyer.dao.impl.DoctorWirteTest; 18 | import cn.linyer.entity.Blood; 19 | import cn.linyer.entity.Patient; 20 | import cn.linyer.entity.Stool; 21 | import cn.linyer.entity.Urine; 22 | 23 | /** 24 | * @author Linyer 25 | * 检验医师填写报告单 26 | * 27 | */ 28 | public class DoctorAuxiliaryGui { 29 | //主体部分定义 30 | private JFrame frame = new JFrame("检验医师填写检验报告"); 31 | private JPanel panelNorth = new JPanel(); 32 | private JPanel panelWest = new JPanel(); 33 | private JPanel panelCenter = new JPanel(); 34 | private JPanel panelEast = new JPanel(); 35 | private JPanel panelSouth = new JPanel(); 36 | private JPanel panelBlood = new JPanel(); 37 | private JPanel panelUrine = new JPanel(); 38 | private JPanel panelStool = new JPanel(); 39 | //主提示面板 40 | private JLabel label; 41 | private JLabel bloodLabel = new JLabel(" ↑血检结果↑"); 42 | private JLabel urineLabel = new JLabel(" ↑尿检结果↑"); 43 | private JLabel stoolLabel = new JLabel(" ↑便检结果↑"); 44 | //血检部分 45 | private JLabel bRBCLabel = new JLabel(" RBC:"); 46 | private JLabel HCTLabel = new JLabel(" HCT:"); 47 | private JLabel MCVLabel = new JLabel(" MCV:"); 48 | private JLabel HXFLabel = new JLabel(" HXF:"); 49 | private JLabel HGBLabel = new JLabel(" HGB:"); 50 | private JLabel MCHLabel = new JLabel(" MCH:"); 51 | private JLabel MCHCLabel = new JLabel(" MCHC:"); 52 | private JLabel bWBCLabel = new JLabel(" WBC:"); 53 | private JLabel MONO_perLabel = new JLabel(" MONO%:"); 54 | private JLabel NEUTLabel = new JLabel(" NEUT:"); 55 | private JLabel NEUT_perLabel = new JLabel(" NEUT%:"); 56 | private JLabel LYLabel = new JLabel(" LY:"); 57 | private JLabel LY_perLabel = new JLabel(" LY%:"); 58 | private JLabel PLTLabel = new JLabel(" PLT:"); 59 | private JLabel PDWLabel = new JLabel(" PDW:"); 60 | private JLabel MPVLabel = new JLabel(" MPV:"); 61 | private JLabel P_LCRLabel = new JLabel(" P-LCR:"); 62 | private JLabel PCTLabel = new JLabel(" PCT:"); 63 | private JTextField bRBC = new JTextField(8); 64 | private JTextField HCT = new JTextField(8); 65 | private JTextField MCV = new JTextField(8); 66 | private JTextField HXF = new JTextField(8); 67 | private JTextField HGB = new JTextField(8); 68 | private JTextField MCH = new JTextField(8); 69 | private JTextField MCHC = new JTextField(8); 70 | private JTextField bWBC = new JTextField(8); 71 | private JTextField MONO_per = new JTextField(8); 72 | private JTextField NEUT = new JTextField(8); 73 | private JTextField NEUT_per = new JTextField(8); 74 | private JTextField LY = new JTextField(8); 75 | private JTextField LY_per = new JTextField(8); 76 | private JTextField PLT = new JTextField(8); 77 | private JTextField PDW = new JTextField(8); 78 | private JTextField MPV = new JTextField(8); 79 | private JTextField P_LCR = new JTextField(8); 80 | private JTextField PCT = new JTextField(8); 81 | //尿检部分 82 | private JLabel PHLabel = new JLabel(" PH:"); 83 | private JLabel SGLabel = new JLabel(" SG:"); 84 | private JLabel UROLabel = new JLabel(" URO:"); 85 | private JLabel BLDLabel = new JLabel(" BLD:"); 86 | private JLabel uWBCLabel = new JLabel(" WBC:"); 87 | private JLabel PROLabel = new JLabel(" PRO:"); 88 | private JLabel GLULabel = new JLabel(" GLU:"); 89 | private JLabel BILLabel = new JLabel(" BIL:"); 90 | private JLabel KETLabel = new JLabel(" KET:"); 91 | private JLabel uRBCLabel = new JLabel(" RBC:"); 92 | private JLabel GOLLabel = new JLabel(" GOL:"); 93 | private JTextField PH = new JTextField(8); 94 | private JTextField SG = new JTextField(8); 95 | private JTextField URO = new JTextField(8); 96 | private JTextField BLD = new JTextField(8); 97 | private JTextField uWBC = new JTextField(8); 98 | private JTextField PRO = new JTextField(8); 99 | private JTextField GLU = new JTextField(8); 100 | private JTextField BIL = new JTextField(8); 101 | private JTextField KET = new JTextField(8); 102 | private JTextField uRBC = new JTextField(8); 103 | private JTextField GOL = new JTextField(8); 104 | //便检部分 105 | private JLabel colorLabel = new JLabel(" Color:"); 106 | private JLabel traitsLabel = new JLabel(" Traits:"); 107 | private JLabel sWBCLabel = new JLabel(" WBC:"); 108 | private JLabel phagocyteLabel = new JLabel(" Phagocyte:"); 109 | private JLabel sRBCLabel = new JLabel(" RBC:"); 110 | private JLabel HBLabel = new JLabel(" HB:"); 111 | private JLabel parasiteLabel = new JLabel(" Parasite:"); 112 | private JLabel FGLabel = new JLabel(" FG"); 113 | private JTextField color = new JTextField(8); 114 | private JTextField traits = new JTextField(8); 115 | private JTextField sWBC = new JTextField(8); 116 | private JTextField phagocyte = new JTextField(8); 117 | private JTextField sRBC = new JTextField(8); 118 | private JTextField HB = new JTextField(8); 119 | private JTextField parasite = new JTextField(8); 120 | private JTextField FG = new JTextField(8); 121 | //提交按钮 122 | private JButton yesBlood = new JButton("提交血检结果"); 123 | private JButton yesUrine = new JButton("提交尿检结果"); 124 | private JButton yesStool = new JButton("提交便检结果"); 125 | //下一患者 126 | private JLabel pNoLabel = new JLabel("患者病历号:"); 127 | private JTextField pNo = new JTextField(8); 128 | private JButton nextPatient = new JButton("下一患者"); 129 | //颜色字体定义 130 | private Color ftColor = new Color(220, 118, 51); 131 | private Color myBlue = new Color(52, 152, 219); 132 | private Color myPink = new Color(171, 40, 199); 133 | 134 | private Font fontBig = new Font("华文琥珀",Font.BOLD,36); 135 | private Font fontMid = new Font("华文楷体",Font.PLAIN,24); 136 | 137 | public DoctorAuxiliaryGui(String dName,String dNo) { 138 | //欢迎医师 139 | label = new JLabel("欢迎您!" + dName + " 医师"); 140 | //布局 141 | frame.setLayout(new BorderLayout()); 142 | panelWest.setLayout(new BorderLayout()); 143 | panelCenter.setLayout(new BorderLayout()); 144 | panelEast.setLayout(new BorderLayout()); 145 | panelSouth.setLayout(new BorderLayout()); 146 | panelBlood.setLayout(new GridLayout(18,2)); 147 | panelUrine.setLayout(new GridLayout(11,2)); 148 | panelStool.setLayout(new GridLayout(8,2)); 149 | //设置字体 150 | label.setFont(fontBig); 151 | label.setForeground(ftColor); 152 | bloodLabel.setFont(fontMid); 153 | bloodLabel.setForeground(myBlue); 154 | urineLabel.setFont(fontMid); 155 | urineLabel.setForeground(myBlue); 156 | stoolLabel.setFont(fontMid); 157 | stoolLabel.setForeground(myBlue); 158 | yesBlood.setFont(fontMid); 159 | yesUrine.setFont(fontMid); 160 | yesStool.setFont(fontMid); 161 | pNoLabel.setFont(fontMid); 162 | pNoLabel.setForeground(myPink); 163 | pNo.setFont(fontMid); 164 | nextPatient.setFont(fontMid); 165 | pNo.setForeground(myPink); 166 | //血检部分字体 167 | bRBCLabel.setFont(fontMid); 168 | HCTLabel.setFont(fontMid); 169 | MCVLabel.setFont(fontMid); 170 | HXFLabel.setFont(fontMid); 171 | HGBLabel.setFont(fontMid); 172 | MCHLabel.setFont(fontMid); 173 | MCHCLabel.setFont(fontMid); 174 | bWBCLabel.setFont(fontMid); 175 | MONO_perLabel.setFont(fontMid); 176 | NEUTLabel.setFont(fontMid); 177 | NEUT_perLabel.setFont(fontMid); 178 | LYLabel.setFont(fontMid); 179 | LY_perLabel.setFont(fontMid); 180 | PLTLabel.setFont(fontMid); 181 | PDWLabel.setFont(fontMid); 182 | MPVLabel.setFont(fontMid); 183 | P_LCRLabel.setFont(fontMid); 184 | PCTLabel.setFont(fontMid); 185 | bRBC.setFont(fontMid); 186 | HCT.setFont(fontMid); 187 | MCV.setFont(fontMid); 188 | HXF.setFont(fontMid); 189 | HGB.setFont(fontMid); 190 | MCH.setFont(fontMid); 191 | MCHC.setFont(fontMid); 192 | bWBC.setFont(fontMid); 193 | MONO_per.setFont(fontMid); 194 | NEUT.setFont(fontMid); 195 | NEUT_per.setFont(fontMid); 196 | LY.setFont(fontMid); 197 | LY_per.setFont(fontMid); 198 | PLT.setFont(fontMid); 199 | PDW.setFont(fontMid); 200 | MPV.setFont(fontMid); 201 | P_LCR.setFont(fontMid); 202 | PCT.setFont(fontMid); 203 | //尿检部分字体 204 | PHLabel.setFont(fontMid); 205 | SGLabel.setFont(fontMid); 206 | UROLabel.setFont(fontMid); 207 | BLDLabel.setFont(fontMid); 208 | uWBCLabel.setFont(fontMid); 209 | PROLabel.setFont(fontMid); 210 | GLULabel.setFont(fontMid); 211 | BILLabel.setFont(fontMid); 212 | KETLabel.setFont(fontMid); 213 | uRBCLabel.setFont(fontMid); 214 | GOLLabel.setFont(fontMid); 215 | PH.setFont(fontMid); 216 | SG.setFont(fontMid); 217 | URO.setFont(fontMid); 218 | BLD.setFont(fontMid); 219 | uWBC.setFont(fontMid); 220 | PRO.setFont(fontMid); 221 | GLU.setFont(fontMid); 222 | BIL.setFont(fontMid); 223 | KET.setFont(fontMid); 224 | uRBC.setFont(fontMid); 225 | GOL.setFont(fontMid); 226 | //便检部分字体 227 | colorLabel.setFont(fontMid); 228 | traitsLabel.setFont(fontMid); 229 | sWBCLabel.setFont(fontMid); 230 | phagocyteLabel.setFont(fontMid); 231 | sRBCLabel.setFont(fontMid); 232 | HBLabel.setFont(fontMid); 233 | parasiteLabel.setFont(fontMid); 234 | FGLabel.setFont(fontMid); 235 | color.setFont(fontMid); 236 | traits.setFont(fontMid); 237 | sWBC.setFont(fontMid); 238 | phagocyte.setFont(fontMid); 239 | sRBC.setFont(fontMid); 240 | HB.setFont(fontMid); 241 | parasite.setFont(fontMid); 242 | FG.setFont(fontMid); 243 | 244 | pNo.setEnabled(false); 245 | 246 | //添加主模块 247 | frame.add(panelNorth,BorderLayout.NORTH); 248 | frame.add(panelWest,BorderLayout.WEST); 249 | frame.add(panelCenter,BorderLayout.CENTER); 250 | frame.add(panelEast,BorderLayout.EAST); 251 | frame.add(panelSouth,BorderLayout.SOUTH); 252 | panelNorth.add(label); 253 | panelWest.add(panelBlood,BorderLayout.NORTH); 254 | panelWest.add(bloodLabel,BorderLayout.CENTER); 255 | panelWest.add(yesBlood,BorderLayout.SOUTH); 256 | panelCenter.add(panelUrine,BorderLayout.NORTH); 257 | panelCenter.add(urineLabel,BorderLayout.CENTER); 258 | panelCenter.add(yesUrine,BorderLayout.SOUTH); 259 | panelEast.add(panelStool,BorderLayout.NORTH); 260 | panelEast.add(stoolLabel,BorderLayout.CENTER); 261 | panelEast.add(yesStool,BorderLayout.SOUTH); 262 | panelSouth.add(pNoLabel,BorderLayout.WEST); 263 | panelSouth.add(pNo,BorderLayout.CENTER); 264 | panelSouth.add(nextPatient,BorderLayout.EAST); 265 | //添加血检部分 266 | panelBlood.add(bRBCLabel); 267 | panelBlood.add(bRBC); 268 | panelBlood.add(HCTLabel); 269 | panelBlood.add(HCT); 270 | panelBlood.add(MCVLabel); 271 | panelBlood.add(MCV); 272 | panelBlood.add(HXFLabel); 273 | panelBlood.add(HXF); 274 | panelBlood.add(HGBLabel); 275 | panelBlood.add(HGB); 276 | panelBlood.add(MCHLabel); 277 | panelBlood.add(MCH); 278 | panelBlood.add(MCHCLabel); 279 | panelBlood.add(MCHC); 280 | panelBlood.add(bWBCLabel); 281 | panelBlood.add(bWBC); 282 | panelBlood.add(MONO_perLabel); 283 | panelBlood.add(MONO_per); 284 | panelBlood.add(NEUTLabel); 285 | panelBlood.add(NEUT); 286 | panelBlood.add(NEUT_perLabel); 287 | panelBlood.add(NEUT_per); 288 | panelBlood.add(LYLabel); 289 | panelBlood.add(LY); 290 | panelBlood.add(LY_perLabel); 291 | panelBlood.add(LY_per); 292 | panelBlood.add(PLTLabel); 293 | panelBlood.add(PLT); 294 | panelBlood.add(PDWLabel); 295 | panelBlood.add(PDW); 296 | panelBlood.add(MPVLabel); 297 | panelBlood.add(MPV); 298 | panelBlood.add(P_LCRLabel); 299 | panelBlood.add(P_LCR); 300 | panelBlood.add(PCTLabel); 301 | panelBlood.add(PCT); 302 | //添加尿检部分 303 | panelUrine.add(PHLabel); 304 | panelUrine.add(PH); 305 | panelUrine.add(SGLabel); 306 | panelUrine.add(SG); 307 | panelUrine.add(UROLabel); 308 | panelUrine.add(URO); 309 | panelUrine.add(BLDLabel); 310 | panelUrine.add(BLD); 311 | panelUrine.add(uWBCLabel); 312 | panelUrine.add(uWBC); 313 | panelUrine.add(PROLabel); 314 | panelUrine.add(PRO); 315 | panelUrine.add(GLULabel); 316 | panelUrine.add(GLU); 317 | panelUrine.add(BILLabel); 318 | panelUrine.add(BIL); 319 | panelUrine.add(KETLabel); 320 | panelUrine.add(KET); 321 | panelUrine.add(uRBCLabel); 322 | panelUrine.add(uRBC); 323 | panelUrine.add(GOLLabel); 324 | panelUrine.add(GOL); 325 | //添加便检部分 326 | panelStool.add(colorLabel); 327 | panelStool.add(color); 328 | panelStool.add(traitsLabel); 329 | panelStool.add(traits); 330 | panelStool.add(sWBCLabel); 331 | panelStool.add(sWBC); 332 | panelStool.add(phagocyteLabel); 333 | panelStool.add(phagocyte); 334 | panelStool.add(sRBCLabel); 335 | panelStool.add(sRBC); 336 | panelStool.add(HBLabel); 337 | panelStool.add(HB); 338 | panelStool.add(parasiteLabel); 339 | panelStool.add(parasite); 340 | panelStool.add(FGLabel); 341 | panelStool.add(FG); 342 | 343 | DoctorWirteTest dwt = new DoctorWirteTest(); 344 | 345 | class yesBlood implements ActionListener { 346 | public void actionPerformed(ActionEvent e) { 347 | Blood blood = new Blood(); 348 | blood.setCPno(dNo); 349 | blood.setPno(pNo.getText()); 350 | blood.setRBC(bRBC.getText()); 351 | blood.setHCT(HCT.getText()); 352 | blood.setMCV(MCV.getText()); 353 | blood.setHXF(HXF.getText()); 354 | blood.setHGB(HGB.getText()); 355 | blood.setMCH(MCH.getText()); 356 | blood.setMCHC(MCHC.getText()); 357 | blood.setWBC(bWBC.getText()); 358 | blood.setMONO_per(MONO_per.getText()); 359 | blood.setNEUT(NEUT.getText()); 360 | blood.setNEUT_per(NEUT_per.getText()); 361 | blood.setLY(LY.getText()); 362 | blood.setLY_per(LY_per.getText()); 363 | blood.setPLT(PLT.getText()); 364 | blood.setPDW(PDW.getText()); 365 | blood.setMPV(MPV.getText()); 366 | blood.setP_LCR(P_LCR.getText()); 367 | blood.setPCT(PCT.getText()); 368 | if(dwt.addBlood(blood)) { 369 | JOptionPane.showMessageDialog(frame,"提交血检结果成功!","提交提示",JOptionPane.PLAIN_MESSAGE); 370 | bRBC.setText(null); 371 | HCT.setText(null); 372 | MCV.setText(null); 373 | HXF.setText(null); 374 | HGB.setText(null); 375 | MCH.setText(null); 376 | MCHC.setText(null); 377 | bWBC.setText(null); 378 | MONO_per.setText(null); 379 | NEUT.setText(null); 380 | NEUT_per.setText(null); 381 | LY.setText(null); 382 | LY_per.setText(null); 383 | PLT.setText(null); 384 | PDW.setText(null); 385 | MPV.setText(null); 386 | P_LCR.setText(null); 387 | PCT.setText(null); 388 | bRBC.setEditable(false); 389 | HCT.setEditable(false); 390 | MCV.setEditable(false); 391 | HXF.setEditable(false); 392 | HGB.setEditable(false); 393 | MCH.setEditable(false); 394 | MCHC.setEditable(false); 395 | bWBC.setEditable(false); 396 | MONO_per.setEditable(false); 397 | NEUT.setEditable(false); 398 | NEUT_per.setEditable(false); 399 | LY.setEditable(false); 400 | LY_per.setEditable(false); 401 | PLT.setEditable(false); 402 | PDW.setEditable(false); 403 | MPV.setEditable(false); 404 | P_LCR.setEditable(false); 405 | PCT.setEditable(false); 406 | }else { 407 | JOptionPane.showMessageDialog(frame, "提交血检结果失败!请检查数据!","提交提示",JOptionPane.ERROR_MESSAGE); 408 | } 409 | } 410 | 411 | } 412 | 413 | class yesUrine implements ActionListener { 414 | public void actionPerformed(ActionEvent e) { 415 | Urine urine = new Urine(); 416 | urine.setCPno(dNo); 417 | urine.setPno(pNo.getText()); 418 | urine.setPH(PH.getText()); 419 | urine.setSG(SG.getText()); 420 | urine.setURO(URO.getText()); 421 | urine.setBLD(BLD.getText()); 422 | urine.setWBC(uWBC.getText()); 423 | urine.setPRO(PRO.getText()); 424 | urine.setGLU(GLU.getText()); 425 | urine.setBIL(BIL.getText()); 426 | urine.setKET(KET.getText()); 427 | urine.setRBC(uRBC.getText()); 428 | urine.setGOL(GOL.getText()); 429 | if(dwt.addUrine(urine)) { 430 | JOptionPane.showMessageDialog(frame,"提交尿检结果成功!","提交提示",JOptionPane.PLAIN_MESSAGE); 431 | PH.setText(null); 432 | SG.setText(null); 433 | URO.setText(null); 434 | BLD.setText(null); 435 | uWBC.setText(null); 436 | PRO.setText(null); 437 | GLU.setText(null); 438 | BIL.setText(null); 439 | KET.setText(null); 440 | uRBC.setText(null); 441 | GOL.setText(null); 442 | PH.setEditable(false); 443 | SG.setEditable(false); 444 | URO.setEditable(false); 445 | BLD.setEditable(false); 446 | uWBC.setEditable(false); 447 | PRO.setEditable(false); 448 | GLU.setEditable(false); 449 | BIL.setEditable(false); 450 | KET.setEditable(false); 451 | uRBC.setEditable(false); 452 | GOL.setEditable(false); 453 | }else { 454 | JOptionPane.showMessageDialog(frame, "提交尿检结果失败!请检查数据!","提交提示",JOptionPane.ERROR_MESSAGE); 455 | } 456 | } 457 | } 458 | 459 | class YesStool implements ActionListener { 460 | public void actionPerformed(ActionEvent e) { 461 | Stool stool = new Stool(); 462 | stool.setCPno(dNo); 463 | stool.setPno(pNo.getText()); 464 | stool.setColor(color.getText()); 465 | stool.setTraits(traits.getText()); 466 | stool.setWBC(sWBC.getText()); 467 | stool.setPhagocyte(phagocyte.getText()); 468 | stool.setRBC(sRBC.getText()); 469 | stool.setHB(HB.getText()); 470 | stool.setParasite(parasite.getText()); 471 | stool.setFG(FG.getText()); 472 | if(dwt.addStool(stool)) { 473 | JOptionPane.showMessageDialog(frame,"提交便检结果成功!","提交提示",JOptionPane.PLAIN_MESSAGE); 474 | color.setText(null); 475 | traits.setText(null); 476 | sWBC.setText(null); 477 | phagocyte.setText(null); 478 | sRBC.setText(null); 479 | HB.setText(null); 480 | parasite.setText(null); 481 | FG.setText(null); 482 | color.setEditable(false); 483 | traits.setEditable(false); 484 | sWBC.setEditable(false); 485 | phagocyte.setEditable(false); 486 | sRBC.setEditable(false); 487 | HB.setEditable(false); 488 | parasite.setEditable(false); 489 | FG.setEditable(false); 490 | }else { 491 | JOptionPane.showMessageDialog(frame, "提交便检结果失败!请检查数据!","提交提示",JOptionPane.ERROR_MESSAGE); 492 | } 493 | } 494 | 495 | } 496 | 497 | //下一患者按钮监听器 498 | class NextPt implements ActionListener { 499 | public void actionPerformed(ActionEvent e) { 500 | if(dwt.nextPatient() != null) { 501 | Patient pt = dwt.nextPatient(); 502 | pNo.setText(pt.getPno()); 503 | if(pt.getIsBlood().equals("1")) { 504 | bRBC.setEditable(true); 505 | HCT.setEditable(true); 506 | MCV.setEditable(true); 507 | HXF.setEditable(true); 508 | HGB.setEditable(true); 509 | MCH.setEditable(true); 510 | MCHC.setEditable(true); 511 | bWBC.setEditable(true); 512 | MONO_per.setEditable(true); 513 | NEUT.setEditable(true); 514 | NEUT_per.setEditable(true); 515 | LY.setEditable(true); 516 | LY_per.setEditable(true); 517 | PLT.setEditable(true); 518 | PDW.setEditable(true); 519 | MPV.setEditable(true); 520 | P_LCR.setEditable(true); 521 | PCT.setEditable(true); 522 | }else { 523 | bRBC.setEditable(false); 524 | HCT.setEditable(false); 525 | MCV.setEditable(false); 526 | HXF.setEditable(false); 527 | HGB.setEditable(false); 528 | MCH.setEditable(false); 529 | MCHC.setEditable(false); 530 | bWBC.setEditable(false); 531 | MONO_per.setEditable(false); 532 | NEUT.setEditable(false); 533 | NEUT_per.setEditable(false); 534 | LY.setEditable(false); 535 | LY_per.setEditable(false); 536 | PLT.setEditable(false); 537 | PDW.setEditable(false); 538 | MPV.setEditable(false); 539 | P_LCR.setEditable(false); 540 | PCT.setEditable(false); 541 | } 542 | if(pt.getIsUrine().equals("1")) { 543 | PH.setEditable(true); 544 | SG.setEditable(true); 545 | URO.setEditable(true); 546 | BLD.setEditable(true); 547 | uWBC.setEditable(true); 548 | PRO.setEditable(true); 549 | GLU.setEditable(true); 550 | BIL.setEditable(true); 551 | KET.setEditable(true); 552 | uRBC.setEditable(true); 553 | GOL.setEditable(true); 554 | }else { 555 | PH.setEditable(false); 556 | SG.setEditable(false); 557 | URO.setEditable(false); 558 | BLD.setEditable(false); 559 | uWBC.setEditable(false); 560 | PRO.setEditable(false); 561 | GLU.setEditable(false); 562 | BIL.setEditable(false); 563 | KET.setEditable(false); 564 | uRBC.setEditable(false); 565 | GOL.setEditable(false); 566 | } 567 | if(pt.getIsStool().equals("1")) { 568 | color.setEditable(true); 569 | traits.setEditable(true); 570 | sWBC.setEditable(true); 571 | phagocyte.setEditable(true); 572 | sRBC.setEditable(true); 573 | HB.setEditable(true); 574 | parasite.setEditable(true); 575 | FG.setEditable(true); 576 | }else { 577 | color.setEditable(false); 578 | traits.setEditable(false); 579 | sWBC.setEditable(false); 580 | phagocyte.setEditable(false); 581 | sRBC.setEditable(false); 582 | HB.setEditable(false); 583 | parasite.setEditable(false); 584 | FG.setEditable(false); 585 | } 586 | }else { 587 | JOptionPane.showMessageDialog(frame, "无患者!","患者提示",JOptionPane.ERROR_MESSAGE); 588 | } 589 | } 590 | } 591 | 592 | yesBlood yesBloodBtn = new yesBlood(); 593 | yesBlood.addActionListener(yesBloodBtn); 594 | 595 | yesUrine yesUrineBtn = new yesUrine(); 596 | yesUrine.addActionListener(yesUrineBtn); 597 | 598 | YesStool yesStoolBtn = new YesStool(); 599 | yesStool.addActionListener(yesStoolBtn); 600 | 601 | NextPt nextPt = new NextPt(); 602 | nextPatient.addActionListener(nextPt); 603 | 604 | frame.setResizable(false); 605 | frame.pack(); 606 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 607 | frame.setVisible(true); 608 | frame.setLocationRelativeTo(null); 609 | } 610 | } 611 | -------------------------------------------------------------------------------- /java源码/cn/linyer/gui/doctorGui/DoctorClinicalGui.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.gui.doctorGui; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Color; 5 | import java.awt.Font; 6 | import java.awt.GridLayout; 7 | import java.awt.event.ActionEvent; 8 | import java.awt.event.ActionListener; 9 | 10 | import javax.swing.JButton; 11 | import javax.swing.JCheckBox; 12 | import javax.swing.JFrame; 13 | import javax.swing.JLabel; 14 | import javax.swing.JOptionPane; 15 | import javax.swing.JPanel; 16 | import javax.swing.JTextArea; 17 | import javax.swing.JTextField; 18 | 19 | import cn.linyer.dao.impl.DoctorTreatPatient; 20 | import cn.linyer.entity.Blood; 21 | import cn.linyer.entity.Patient; 22 | import cn.linyer.entity.Stool; 23 | import cn.linyer.entity.Urine; 24 | 25 | /** 26 | * @author Linyer 27 | * 医师使用界面 28 | * 29 | */ 30 | public class DoctorClinicalGui { 31 | private JFrame frame = new JFrame("医师"); 32 | private JPanel panel = new JPanel(); 33 | private JLabel label; 34 | //患者信息面板 35 | private JPanel panelPInfo = new JPanel(); 36 | //选择患者面板 37 | private JPanel panelPSel = new JPanel(); 38 | //检索患着 39 | private JLabel selPLabel = new JLabel("检索患者:"); 40 | private JTextField selPField = new JTextField(8); 41 | private JButton selBtn = new JButton("检索患者"); 42 | //下一个患着 43 | private JLabel pLabel = new JLabel("病历号:"); 44 | private JTextField pField = new JTextField(8); 45 | private JButton nextPBtn = new JButton("下一患者"); 46 | //患者信息 47 | private JTextArea pArea = new JTextArea(10,2); 48 | //开具检查单面板 49 | private JPanel panelStatus = new JPanel(); 50 | private JLabel isBloodLabel = new JLabel("血检开单:"); 51 | private JCheckBox isBlood = new JCheckBox(); 52 | private JLabel isUrineLabel = new JLabel("尿检开单:"); 53 | private JCheckBox isUrine = new JCheckBox(); 54 | private JLabel isStoolLabel = new JLabel("便检开单:"); 55 | private JCheckBox isStool = new JCheckBox(); 56 | private JLabel isOkLabel = new JLabel("能否出院:"); 57 | private JCheckBox isOk = new JCheckBox(); 58 | //看病面板 59 | private JPanel panelTreat = new JPanel(); 60 | //检查结果 61 | private JPanel panelCheck = new JPanel(); 62 | private JLabel checkLabel = new JLabel("检查结果:"); 63 | private JPanel panelCheckArea = new JPanel(); 64 | private JTextArea checkBloodArea = new JTextArea(6,2); 65 | private JTextArea checkUrineArea = new JTextArea(6,2); 66 | private JTextArea checkStoolArea = new JTextArea(6,2); 67 | private JButton checkBtn = new JButton("查看检查结果"); 68 | //诊疗面板 69 | private JPanel panelDDT = new JPanel(); 70 | //病情描述 71 | private JPanel panelDescribe = new JPanel(); 72 | private JLabel describeLabel = new JLabel("病情描述:"); 73 | private JTextArea describeArea = new JTextArea(4,2); 74 | private JButton yesDescribeBtn = new JButton("提交病情描述"); 75 | //诊断结果 76 | private JPanel panelDiag = new JPanel(); 77 | private JLabel diagLabel = new JLabel("诊断结果:"); 78 | private JTextArea diagArea = new JTextArea(4,2); 79 | private JButton yesDiagBtn = new JButton("提交诊断结果"); 80 | //治疗方案 81 | private JPanel panelTreatment = new JPanel(); 82 | private JLabel treatmentLabel = new JLabel("治疗方案:"); 83 | private JTextArea treatmentArea = new JTextArea(4,2); 84 | private JButton yesTreatmentBtn = new JButton("提交治疗方案"); 85 | //颜色字体定义 86 | private Color myBlue = new Color(52, 152, 219); 87 | private Color myPink = new Color(171, 40, 199); 88 | 89 | private Font fontMid = new Font("华文楷体",Font.PLAIN,24); 90 | 91 | private String nowPatientNo = null; 92 | 93 | public DoctorClinicalGui(String dtName,String dtNo) { 94 | //欢迎医师 95 | label = new JLabel("医师:" + dtName + ",欢迎您!"); 96 | //布局 97 | frame.setLayout(new BorderLayout()); 98 | panelPInfo.setLayout(new BorderLayout()); 99 | panelPSel.setLayout(new GridLayout(2,3)); 100 | panelTreat.setLayout(new BorderLayout()); 101 | panelCheck.setLayout(new BorderLayout()); 102 | panelCheckArea.setLayout(new GridLayout(1,3)); 103 | panelDDT.setLayout(new BorderLayout()); 104 | panelDescribe.setLayout(new GridLayout(1,3)); 105 | panelDiag.setLayout(new GridLayout(1,3)); 106 | panelTreatment.setLayout(new GridLayout(1,3)); 107 | //设置字体、颜色 108 | label.setFont(new Font("华文琥珀",Font.PLAIN,36)); 109 | label.setForeground(new Color(220, 118, 51)); 110 | selPLabel.setFont(fontMid); 111 | selPField.setFont(fontMid); 112 | selBtn.setFont(fontMid); 113 | pLabel.setFont(fontMid); 114 | pLabel.setForeground(myPink); 115 | pField.setFont(fontMid); 116 | nextPBtn.setFont(fontMid); 117 | pArea.setFont(fontMid); 118 | isBloodLabel.setFont(fontMid); 119 | isBlood.setFont(fontMid); 120 | isUrineLabel.setFont(fontMid); 121 | isUrine.setFont(fontMid); 122 | isStoolLabel.setFont(fontMid); 123 | isStool.setFont(fontMid); 124 | isOkLabel.setFont(fontMid); 125 | isOk.setFont(fontMid); 126 | checkLabel.setFont(fontMid); 127 | checkLabel.setForeground(myBlue); 128 | checkBloodArea.setFont(fontMid); 129 | checkUrineArea.setFont(fontMid); 130 | checkStoolArea.setFont(fontMid); 131 | checkBtn.setFont(fontMid); 132 | describeLabel.setFont(fontMid); 133 | describeArea.setFont(fontMid); 134 | diagLabel.setFont(fontMid); 135 | diagArea.setFont(fontMid); 136 | treatmentLabel.setFont(fontMid); 137 | treatmentArea.setFont(fontMid); 138 | yesDescribeBtn.setFont(fontMid); 139 | yesDiagBtn.setFont(fontMid); 140 | yesTreatmentBtn.setFont(fontMid); 141 | //设置文本域不可编辑 142 | pField.setEditable(false); 143 | pArea.setEditable(false); 144 | checkBloodArea.setEditable(false); 145 | checkUrineArea.setEditable(false); 146 | checkStoolArea.setEditable(false); 147 | 148 | //添加模块 149 | frame.add(panel,BorderLayout.NORTH); 150 | frame.add(panelPInfo,BorderLayout.CENTER); 151 | frame.add(panelTreat,BorderLayout.SOUTH); 152 | panel.add(label); 153 | panelPInfo.add(panelPSel,BorderLayout.NORTH); 154 | panelPInfo.add(pArea,BorderLayout.CENTER); 155 | panelTreat.add(panelStatus,BorderLayout.NORTH); 156 | panelTreat.add(panelCheck,BorderLayout.CENTER); 157 | panelTreat.add(panelDDT,BorderLayout.SOUTH); 158 | panelCheck.add(checkLabel,BorderLayout.NORTH); 159 | 160 | panelCheck.add(panelCheckArea,BorderLayout.CENTER); 161 | panelCheck.add(checkBtn,BorderLayout.SOUTH); 162 | panelDDT.add(panelDescribe,BorderLayout.NORTH); 163 | panelDDT.add(panelDiag,BorderLayout.CENTER); 164 | panelDDT.add(panelTreatment,BorderLayout.SOUTH); 165 | //选择患者 166 | panelPSel.add(selPLabel); 167 | panelPSel.add(selPField); 168 | panelPSel.add(selBtn); 169 | //下一个患者 170 | panelPSel.add(pLabel); 171 | panelPSel.add(pField); 172 | panelPSel.add(nextPBtn); 173 | //开具检查单 174 | panelStatus.add(isBloodLabel); 175 | panelStatus.add(isBlood); 176 | panelStatus.add(isUrineLabel); 177 | panelStatus.add(isUrine); 178 | panelStatus.add(isStoolLabel); 179 | panelStatus.add(isStool); 180 | panelStatus.add(isOkLabel); 181 | panelStatus.add(isOk); 182 | //检查结果 183 | panelCheckArea.add(checkBloodArea); 184 | panelCheckArea.add(checkUrineArea); 185 | panelCheckArea.add(checkStoolArea); 186 | //病情描述 187 | panelDescribe.add(describeLabel); 188 | panelDescribe.add(describeArea); 189 | panelDescribe.add(yesDescribeBtn); 190 | //诊断结果 191 | panelDiag.add(diagLabel); 192 | panelDiag.add(diagArea); 193 | panelDiag.add(yesDiagBtn); 194 | //治疗方案 195 | panelTreatment.add(treatmentLabel); 196 | panelTreatment.add(treatmentArea); 197 | panelTreatment.add(yesTreatmentBtn); 198 | 199 | DoctorTreatPatient dtp = new DoctorTreatPatient(); 200 | //选择患者按钮监听器 201 | class SelButton implements ActionListener { 202 | public void actionPerformed(ActionEvent e) { 203 | nowPatientNo = null; 204 | String pno = selPField.getText(); 205 | if(pno.length()!=0) { 206 | Patient patient = dtp.selPatient(dtNo,pno); 207 | String des = dtp.describe(pno); 208 | String diag = dtp.diagnosis(pno); 209 | String tre = dtp.treat(pno); 210 | if(patient != null) { 211 | nowPatientNo = patient.getPno(); 212 | String txt = "病历号:" + patient.getPno() 213 | +"\n患者姓名:" + patient.getPname() 214 | +"\n患者性别:" + patient.getPsex() 215 | +"\n患者年龄:" + patient.getPage() 216 | +"\n患者联系电话:" + patient.getPphone() 217 | +"\n患者住址:" + patient.getPaddress() 218 | +"\n患者入院时间:" + patient.getPEnDate() 219 | +"\n患者职业:" + patient.getPemployer() 220 | +"\n是否已看诊:" + patient.getIsSee(); 221 | pArea.setText(txt); 222 | if(patient.getIsBlood().equals("0")) { 223 | isBlood.setSelected(false); 224 | isBlood.setEnabled(true); 225 | }else { 226 | isBlood.setSelected(true); 227 | isBlood.setEnabled(false); 228 | } 229 | if(patient.getIsUrine().equals("0")) { 230 | isUrine.setSelected(false); 231 | isUrine.setEnabled(true); 232 | }else { 233 | isUrine.setSelected(true); 234 | isUrine.setEnabled(false); 235 | } 236 | if(patient.getIsStool().equals("0")) { 237 | isStool.setSelected(false); 238 | isStool.setEnabled(true); 239 | }else { 240 | isStool.setSelected(true); 241 | isStool.setEnabled(false); 242 | } 243 | if(patient.getIsOk().equals("0")) { 244 | describeArea.setEditable(true); 245 | diagArea.setEditable(true); 246 | treatmentArea.setEditable(true); 247 | }else { 248 | describeArea.setEditable(false); 249 | diagArea.setEditable(false); 250 | treatmentArea.setEditable(false); 251 | } 252 | if(des!=null) { 253 | describeArea.setText(des); 254 | describeArea.setEditable(false); 255 | yesDescribeBtn.setEnabled(false); 256 | }else { 257 | describeArea.setEditable(true); 258 | yesDescribeBtn.setEnabled(true); 259 | } 260 | if(diag!=null) { 261 | diagArea.setText(diag); 262 | diagArea.setEditable(false); 263 | yesDiagBtn.setEnabled(false); 264 | }else { 265 | diagArea.setEditable(true); 266 | yesDiagBtn.setEnabled(true); 267 | } 268 | if(tre!=null) { 269 | treatmentArea.setText(tre); 270 | treatmentArea.setEditable(false); 271 | yesTreatmentBtn.setEnabled(false); 272 | }else { 273 | treatmentArea.setEditable(true); 274 | yesTreatmentBtn.setEnabled(true); 275 | } 276 | }else { 277 | JOptionPane.showMessageDialog(frame, "无此患者,或者此患者不是您的病人!","检索患者提示",JOptionPane.ERROR_MESSAGE); 278 | } 279 | }else { 280 | JOptionPane.showMessageDialog(frame, "请输入患者病历号!","检索患者提示",JOptionPane.ERROR_MESSAGE); 281 | } 282 | } 283 | } 284 | //下一患者按钮监听器 285 | class NextPButton implements ActionListener { 286 | public void actionPerformed(ActionEvent e) { 287 | nowPatientNo = null; 288 | Patient patient = dtp.nextPatient(dtNo); 289 | if(patient != null) { 290 | nowPatientNo = patient.getPno(); 291 | String txt = "病历号:" + patient.getPno() 292 | + "\n患者姓名:" + patient.getPname() 293 | + "\n患者性别:" + patient.getPsex() 294 | + "\n患者年龄:" + patient.getPage() 295 | + "\n患者联系电话:" + patient.getPphone() 296 | + "\n患者住址:" + patient.getPaddress() 297 | + "\n患者入院时间:" + patient.getPEnDate() 298 | + "\n患者职业:" + patient.getPemployer(); 299 | pArea.setText(txt); 300 | isBlood.setEnabled(true); 301 | isBlood.setSelected(false); 302 | isUrine.setEnabled(true); 303 | isUrine.setSelected(false); 304 | isStool.setEnabled(true); 305 | isStool.setSelected(false); 306 | describeArea.setEditable(true); 307 | yesDescribeBtn.setEnabled(true); 308 | diagArea.setEditable(true); 309 | yesDiagBtn.setEnabled(true); 310 | treatmentArea.setEditable(true); 311 | yesTreatmentBtn.setEnabled(true); 312 | }else { 313 | JOptionPane.showMessageDialog(frame, "没有患者了!","下一患者患者提示",JOptionPane.ERROR_MESSAGE); 314 | } 315 | } 316 | } 317 | //开血检 318 | class IsBlood implements ActionListener { 319 | public void actionPerformed(ActionEvent e) { 320 | if(isBlood.isSelected()) { 321 | if(nowPatientNo!=null) { 322 | dtp.isBlood(nowPatientNo); 323 | isBlood.setEnabled(false); 324 | }else { 325 | JOptionPane.showMessageDialog(frame, "无患者信息!","错误提示",JOptionPane.ERROR_MESSAGE); 326 | } 327 | } 328 | } 329 | } 330 | //开尿检 331 | class IsUrine implements ActionListener { 332 | public void actionPerformed(ActionEvent e) { 333 | if(isUrine.isSelected()) { 334 | if(nowPatientNo!=null) { 335 | dtp.isUrine(nowPatientNo); 336 | isUrine.setEnabled(false); 337 | }else { 338 | JOptionPane.showMessageDialog(frame, "无患者信息!","错误提示",JOptionPane.ERROR_MESSAGE); 339 | } 340 | } 341 | } 342 | } 343 | //开便检 344 | class IsStool implements ActionListener { 345 | public void actionPerformed(ActionEvent e) { 346 | if(isStool.isSelected()) { 347 | if(nowPatientNo!=null) { 348 | dtp.isStool(nowPatientNo); 349 | isStool.setEnabled(false); 350 | }else { 351 | JOptionPane.showMessageDialog(frame, "无患者信息!","错误提示",JOptionPane.ERROR_MESSAGE); 352 | } 353 | } 354 | } 355 | } 356 | //可否出院 357 | class IsOk implements ActionListener { 358 | public void actionPerformed(ActionEvent e) { 359 | if(isOk.isSelected()) { 360 | if(nowPatientNo!=null) { 361 | dtp.isOk(nowPatientNo); 362 | isOk.setEnabled(false); 363 | }else { 364 | JOptionPane.showMessageDialog(frame, "无患者信息!","错误提示",JOptionPane.ERROR_MESSAGE); 365 | } 366 | } 367 | } 368 | } 369 | //检查结果按钮监听器 370 | class CheckBtn implements ActionListener { 371 | public void actionPerformed(ActionEvent e) { 372 | Blood blood = dtp.selBlood(nowPatientNo); 373 | Urine urine = dtp.selUrine(nowPatientNo); 374 | Stool stool = dtp.selStool(nowPatientNo); 375 | if(blood != null) { 376 | String bloodTxt = "检查号:" + blood.getCno() 377 | + "\n病历号:" + blood.getPno() 378 | + "\nRBC:" + blood.getRBC() 379 | + "\nHCT:" + blood.getHCT() 380 | + "\nMCV:" + blood.getMCV() 381 | + "\nHXF:" + blood.getHXF() 382 | + "\nHGB:" + blood.getHGB() 383 | + "\nMCH:" + blood.getMCH() 384 | + "\nMCHC:" + blood.getMCHC() 385 | + "\nWBC:" + blood.getWBC() 386 | + "\nMONO%:" + blood.getMONO_per() 387 | + "\nNEUT:" + blood.getNEUT() 388 | + "\nNEUT%:" + blood.getNEUT_per() 389 | + "\nLY:" + blood.getLY() 390 | + "\nLY%:" + blood.getLY_per() 391 | + "\nPLT:" + blood.getPLT() 392 | + "\nPDW:" + blood.getPDW() 393 | + "\nMPV:" + blood.getMPV() 394 | + "\nP-LCR:" + blood.getP_LCR() 395 | + "\nPCT:" + blood.getPCT() 396 | + "\n检验医师工号:" + blood.getCPno(); 397 | checkBloodArea.setText(bloodTxt); 398 | }else { 399 | checkBloodArea.setText("暂无结果!"); 400 | } 401 | if(urine != null) { 402 | String urineTxt = "检查号:" + urine.getCno() 403 | + "\n病历号:" + urine.getPno() 404 | + "\nPH:" + urine.getPH() 405 | + "\nSG:" + urine.getSG() 406 | + "\nURO:" + urine.getURO() 407 | + "\nBLD:" + urine.getBLD() 408 | + "\nWBC:" + urine.getWBC() 409 | + "\nPRO:" + urine.getPRO() 410 | + "\nGLU:" + urine.getGLU() 411 | + "\nBIL:" + urine.getBIL() 412 | + "\nKET:" + urine.getKET() 413 | + "\nRBC:" + urine.getRBC() 414 | + "\nGOL:" + urine.getGOL() 415 | + "\n检验医师工号:" + urine.getCPno(); 416 | checkUrineArea.setText(urineTxt); 417 | }else { 418 | checkUrineArea.setText("暂无结果!"); 419 | } 420 | if(stool != null) { 421 | String stoolTxt = "检查号:" + stool.getCno() 422 | + "\n病历号:" + stool.getPno() 423 | + "\nColor:" + stool.getColor() 424 | + "\nTraits:" + stool.getTraits() 425 | + "\nWBC:" + stool.getWBC() 426 | + "\nphagocyte:" + stool.getPhagocyte() 427 | + "\nRBC:" + stool.getRBC() 428 | + "\nHB:" + stool.getHB() 429 | + "\nParasite:" + stool.getParasite() 430 | + "\nFG:" + stool.getFG() 431 | + "\n检验医师工号:" + stool.getCPno(); 432 | checkStoolArea.setText(stoolTxt); 433 | }else { 434 | checkStoolArea.setText("暂无结果!"); 435 | } 436 | } 437 | } 438 | //确定提交病情描述按钮监听器 439 | class YesDescribeButton implements ActionListener { 440 | public void actionPerformed(ActionEvent e) { 441 | String des = describeArea.getText(); 442 | if(dtp.cmtDescribe(dtNo, nowPatientNo, des)) { 443 | JOptionPane.showMessageDialog(frame,"提交成功!","提交提示",JOptionPane.PLAIN_MESSAGE); 444 | }else { 445 | JOptionPane.showMessageDialog(frame, "提交失败!","提交提示",JOptionPane.ERROR_MESSAGE); 446 | } 447 | } 448 | } 449 | //确定提交诊断结果按钮监听器 450 | class YesDiagButton implements ActionListener { 451 | public void actionPerformed(ActionEvent e) { 452 | String diagnosis = diagArea.getText(); 453 | if(dtp.cmtDiagnosis(nowPatientNo, diagnosis)) { 454 | JOptionPane.showMessageDialog(frame,"提交成功!","提交提示",JOptionPane.PLAIN_MESSAGE); 455 | }else { 456 | JOptionPane.showMessageDialog(frame, "提交失败!","提交提示",JOptionPane.ERROR_MESSAGE); 457 | } 458 | } 459 | } 460 | //确定提交治疗方案按钮监听器 461 | class YesTreatmentButton implements ActionListener { 462 | public void actionPerformed(ActionEvent e) { 463 | String tre = treatmentArea.getText(); 464 | if(dtp.cmtTreat(nowPatientNo, tre)) { 465 | JOptionPane.showMessageDialog(frame,"提交成功!","提交提示",JOptionPane.PLAIN_MESSAGE); 466 | }else { 467 | JOptionPane.showMessageDialog(frame, "提交失败!","提交提示",JOptionPane.ERROR_MESSAGE); 468 | } 469 | } 470 | } 471 | 472 | SelButton selButton = new SelButton(); 473 | selBtn.addActionListener(selButton); 474 | 475 | NextPButton nextPButton = new NextPButton(); 476 | nextPBtn.addActionListener(nextPButton); 477 | 478 | IsBlood isBloodBox = new IsBlood(); 479 | isBlood.addActionListener(isBloodBox); 480 | 481 | IsUrine isUrineBox = new IsUrine(); 482 | isUrine.addActionListener(isUrineBox); 483 | 484 | IsStool isStoolBox = new IsStool(); 485 | isStool.addActionListener(isStoolBox); 486 | 487 | IsOk isOkBox = new IsOk(); 488 | isOk.addActionListener(isOkBox); 489 | 490 | CheckBtn checkButton = new CheckBtn(); 491 | checkBtn.addActionListener(checkButton); 492 | 493 | YesDescribeButton yesDescribeButton = new YesDescribeButton(); 494 | yesDescribeBtn.addActionListener(yesDescribeButton); 495 | 496 | YesDiagButton yesDiagButton = new YesDiagButton(); 497 | yesDiagBtn.addActionListener(yesDiagButton); 498 | 499 | YesTreatmentButton yesTreatmentButton = new YesTreatmentButton(); 500 | yesTreatmentBtn.addActionListener(yesTreatmentButton); 501 | 502 | frame.pack(); 503 | frame.setResizable(false); 504 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 505 | frame.setVisible(true); 506 | frame.setLocationRelativeTo(null); 507 | } 508 | } 509 | -------------------------------------------------------------------------------- /java源码/cn/linyer/gui/patientGui/PatientRegistGui.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.gui.patientGui; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Color; 5 | import java.awt.Font; 6 | import java.awt.GridLayout; 7 | import java.awt.event.ActionEvent; 8 | import java.awt.event.ActionListener; 9 | 10 | import javax.swing.JButton; 11 | import javax.swing.JComboBox; 12 | import javax.swing.JFrame; 13 | import javax.swing.JLabel; 14 | import javax.swing.JOptionPane; 15 | import javax.swing.JPanel; 16 | import javax.swing.JPasswordField; 17 | import javax.swing.JTextField; 18 | 19 | import cn.linyer.dao.impl.PatientRegist; 20 | import cn.linyer.entity.Patient; 21 | import cn.linyer.gui.LoginGui; 22 | 23 | /** 24 | * @author Linyer 25 | * 患者注册界面 26 | * 27 | */ 28 | public class PatientRegistGui { 29 | //主面板 30 | private JFrame frame = new JFrame("患者注册"); 31 | private JPanel panelNorth = new JPanel(); 32 | private JPanel panelCenter = new JPanel(); 33 | 34 | private JLabel label = new JLabel("患者注册"); 35 | //输入患者信息 36 | private JLabel pNameLabel = new JLabel("姓名:"); 37 | private JTextField pName = new JTextField(8); 38 | private JLabel pSexLabel = new JLabel("性别:"); 39 | private JComboBox pSex = new JComboBox(); 40 | private JLabel pAgeLabel = new JLabel("年龄:"); 41 | private JTextField pAge = new JTextField(2); 42 | private JLabel pPhoneLabel = new JLabel("联系电话:"); 43 | private JTextField pPhone = new JTextField(11); 44 | private JLabel pAddressLabel = new JLabel("住址:"); 45 | private JTextField pAddress = new JTextField(300); 46 | private JLabel pEmpLabel = new JLabel("职业:"); 47 | private JTextField pEmp = new JTextField(60); 48 | private JLabel pIDnoLabel = new JLabel("身份证号:"); 49 | private JTextField pIDno = new JTextField(18); 50 | private JLabel pPwdLabel = new JLabel("密码:"); 51 | private JPasswordField pPwd = new JPasswordField(12); 52 | private JLabel pYesPwdLabel = new JLabel("确认密码:"); 53 | private JPasswordField pYesPwd = new JPasswordField(12); 54 | 55 | private JButton yesBtn = new JButton("确定注册"); 56 | //字体定义 57 | private Font fontMid = new Font("华文楷体",Font.PLAIN,24); 58 | 59 | public PatientRegistGui() { 60 | //布局 61 | frame.setLayout(new BorderLayout()); 62 | panelCenter.setLayout(new GridLayout(9,2)); 63 | //设置字体、颜色 64 | label.setFont(new Font("华文琥珀",Font.PLAIN,36)); 65 | label.setForeground(new Color(220, 118, 51)); 66 | yesBtn.setFont(fontMid); 67 | pNameLabel.setFont(fontMid); 68 | pName.setFont(fontMid); 69 | pSexLabel.setFont(fontMid); 70 | pSex.setFont(fontMid); 71 | pAgeLabel.setFont(fontMid); 72 | pAge.setFont(fontMid); 73 | pPhoneLabel.setFont(fontMid); 74 | pPhone.setFont(fontMid); 75 | pAddressLabel.setFont(fontMid); 76 | pAddress.setFont(fontMid); 77 | pEmpLabel.setFont(fontMid); 78 | pEmp.setFont(fontMid); 79 | pIDnoLabel.setFont(fontMid); 80 | pIDno.setFont(fontMid); 81 | pPwdLabel.setFont(fontMid); 82 | pPwd.setFont(fontMid); 83 | pYesPwdLabel.setFont(fontMid); 84 | pYesPwd.setFont(fontMid); 85 | //添加模块 86 | frame.add(panelNorth,BorderLayout.NORTH); 87 | frame.add(panelCenter,BorderLayout.CENTER); 88 | frame.add(yesBtn,BorderLayout.SOUTH); 89 | panelNorth.add(label); 90 | panelCenter.add(pNameLabel); 91 | panelCenter.add(pName); 92 | panelCenter.add(pSexLabel); 93 | panelCenter.add(pSex); 94 | panelCenter.add(pAgeLabel); 95 | panelCenter.add(pAge); 96 | panelCenter.add(pPhoneLabel); 97 | panelCenter.add(pPhone); 98 | panelCenter.add(pAddressLabel); 99 | panelCenter.add(pAddress); 100 | panelCenter.add(pEmpLabel); 101 | panelCenter.add(pEmp); 102 | panelCenter.add(pIDnoLabel); 103 | panelCenter.add(pIDno); 104 | panelCenter.add(pPwdLabel); 105 | panelCenter.add(pPwd); 106 | panelCenter.add(pYesPwdLabel); 107 | panelCenter.add(pYesPwd); 108 | 109 | pSex.addItem(null); 110 | pSex.addItem("男"); 111 | pSex.addItem("女"); 112 | //确定注册按钮监听器 113 | class YesBtn implements ActionListener { 114 | public void actionPerformed(ActionEvent e) { 115 | Patient patient = new Patient(); 116 | patient.setPname(pName.getText()); 117 | patient.setPsex((String)pSex.getSelectedItem()); 118 | patient.setPage(pAge.getText()); 119 | patient.setPphone(pPhone.getText()); 120 | patient.setPaddress(pAddress.getText()); 121 | patient.setPemployer(pEmp.getText()); 122 | patient.setPIDno(pIDno.getText()); 123 | String patientPwd = String.valueOf(pPwd.getPassword()); 124 | String yesPwd = String.valueOf(pYesPwd.getPassword()); 125 | if(patient != null && patientPwd.length() != 0 && yesPwd.length() != 0) { 126 | if(patientPwd.equals(yesPwd)) { 127 | patient.setPpwd(yesPwd); 128 | PatientRegist pr = new PatientRegist(); 129 | String selPno = pr.selPatient(patient.getPIDno()); 130 | if(selPno==null) { 131 | if(pr.addPatient(patient)) { 132 | JOptionPane.showMessageDialog(frame,patient.getPname() + ",欢迎您!\n您已注册成功!您的病历号为:" + pr.selPatient(patient.getPIDno()) + "!\n请登录 ","注册成功提示",JOptionPane.PLAIN_MESSAGE); 133 | LoginGui.frame.setVisible(true); 134 | frame.setVisible(false); 135 | }else { 136 | JOptionPane.showMessageDialog(frame, "注册失败!信息可能有误!请重试!","注册失败提示",JOptionPane.ERROR_MESSAGE); 137 | } 138 | }else { 139 | JOptionPane.showMessageDialog(frame, "您的身份证号已注册!\n您的身份证号为:" + patient.getPIDno() + "\n您的病历号为:" + selPno,"已注册提示",JOptionPane.ERROR_MESSAGE); 140 | } 141 | }else { 142 | JOptionPane.showMessageDialog(frame, "您两次输入的密码不一致!请重新输入!","密码不一致提示",JOptionPane.ERROR_MESSAGE); 143 | pPwd.setText(null); 144 | pYesPwd.setText(null); 145 | } 146 | }else { 147 | JOptionPane.showMessageDialog(frame, "请输入您的注册信息!","输入错误提示",JOptionPane.ERROR_MESSAGE); 148 | } 149 | } 150 | } 151 | 152 | YesBtn yes = new YesBtn(); 153 | yesBtn.addActionListener(yes); 154 | 155 | frame.setSize(400, 500); 156 | frame.setResizable(false); 157 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 158 | frame.setVisible(true); 159 | frame.setLocationRelativeTo(null); 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /java源码/cn/linyer/gui/patientGui/PatientSeeDoctorGui.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.gui.patientGui; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Color; 5 | import java.awt.Font; 6 | import java.awt.GridLayout; 7 | import java.awt.event.ActionEvent; 8 | import java.awt.event.ActionListener; 9 | 10 | import javax.swing.JButton; 11 | import javax.swing.JFrame; 12 | import javax.swing.JLabel; 13 | import javax.swing.JPanel; 14 | import javax.swing.JTextArea; 15 | 16 | import cn.linyer.dao.impl.PatientSeeDoctor; 17 | 18 | /** 19 | * @author Linyer 20 | * 患者就诊界面 21 | * 22 | */ 23 | public class PatientSeeDoctorGui { 24 | private JFrame frame = new JFrame("患者就诊"); 25 | private JPanel panelCenter = new JPanel(); 26 | private JPanel panelSouth = new JPanel(); 27 | private JPanel paneldiag = new JPanel(); 28 | private JPanel paneltreat = new JPanel(); 29 | private JLabel label; 30 | //显示就诊信息 31 | private JLabel dNameLabel; 32 | private JLabel dpLocaLabel; 33 | //查询诊断结果 34 | private JButton diagBtn = new JButton("查看诊断结果"); 35 | private JTextArea diag = new JTextArea(6,12); 36 | //查询治疗方案 37 | private JButton treatBtn = new JButton("查看治疗方案"); 38 | private JTextArea treat = new JTextArea(6,12); 39 | //字体颜色 40 | private Color ftColor = new Color(220, 118, 51); 41 | private Color myBlue = new Color(52, 152, 219); 42 | private Font fontBig = new Font("华文琥珀",Font.BOLD,36); 43 | private Font fontMid = new Font("华文楷体",Font.PLAIN,24); 44 | 45 | public PatientSeeDoctorGui(String dName,String dpLoca,String ptNo,String ptName) { 46 | //欢迎患者 47 | label = new JLabel("患者:" + ptName + ",欢迎您!"); 48 | //医师姓名、科室位置 49 | dNameLabel = new JLabel("您的主治医师为:" + dName + " 医师"); 50 | dpLocaLabel = new JLabel("请到:" + dpLoca + " 就诊"); 51 | //布局 52 | frame.setLayout(new BorderLayout()); 53 | panelCenter.setLayout(new GridLayout(2,1)); 54 | panelSouth.setLayout(new BorderLayout()); 55 | paneldiag.setLayout(new BorderLayout()); 56 | paneltreat.setLayout(new BorderLayout()); 57 | //设置字体颜色 58 | label.setForeground(ftColor); 59 | label.setFont(fontBig); 60 | dNameLabel.setForeground(myBlue); 61 | dNameLabel.setFont(fontMid); 62 | dpLocaLabel.setForeground(myBlue); 63 | dpLocaLabel.setFont(fontMid); 64 | diagBtn.setFont(fontMid); 65 | diag.setFont(fontMid); 66 | treatBtn.setFont(fontMid); 67 | treat.setFont(fontMid); 68 | //添加模块 69 | frame.add(label,BorderLayout.NORTH); 70 | frame.add(panelCenter,BorderLayout.CENTER); 71 | frame.add(panelSouth,BorderLayout.SOUTH); 72 | panelCenter.add(dNameLabel); 73 | panelCenter.add(dpLocaLabel); 74 | panelSouth.add(paneldiag,BorderLayout.NORTH); 75 | panelSouth.add(paneltreat,BorderLayout.SOUTH); 76 | paneldiag.add(diagBtn,BorderLayout.NORTH); 77 | paneldiag.add(diag,BorderLayout.SOUTH); 78 | paneltreat.add(treatBtn,BorderLayout.NORTH); 79 | paneltreat.add(treat,BorderLayout.SOUTH); 80 | 81 | PatientSeeDoctor psd = new PatientSeeDoctor(); 82 | 83 | //查询诊断结果按钮监听器 84 | class DiagMsg implements ActionListener { 85 | public void actionPerformed(ActionEvent e) { 86 | String diagMsg0 = psd.selDiag(ptNo); 87 | StringBuffer diagMsg = new StringBuffer(); 88 | if(diagMsg0 != null) { 89 | for(int i=0; i selDep = new JComboBox(); 39 | //选择普通、专家 40 | private JLabel selDLLabel = new JLabel("医师类型:"); 41 | private JComboBox selDL = new JComboBox(); 42 | //显示信息面板 43 | private JTextArea showInfo = new JTextArea(18,28); 44 | private JScrollPane scrollPane = new JScrollPane(showInfo); 45 | //选择医师 46 | private JLabel selDocLabel = new JLabel("选择医师(工号):"); 47 | private JComboBox selDoc = new JComboBox(); 48 | //科室链表 49 | List depList; 50 | //医师链表 51 | List docInfoList; 52 | //确定按钮 53 | private JButton yesBtn = new JButton("确定就诊"); 54 | //科室编号、名称、位置 55 | String dpNo = null; 56 | String dpName = null; 57 | String dpLocaToNext = null; 58 | //医师类型、姓名 59 | int dL = 0; 60 | String dNameToNext = null; 61 | //字体颜色 62 | private Color ftColor = new Color(220, 118, 51); 63 | private Font fontBig = new Font("华文华文琥珀",Font.BOLD,36); 64 | private Font fontMid = new Font("华文楷体",Font.PLAIN,24); 65 | 66 | public PatientSelDoctorGui(String ptName,String Pno) { 67 | //欢迎患者 68 | label = new JLabel("患者:" + ptName + ",欢迎您!"); 69 | //布局 70 | frame.setLayout(new BorderLayout()); 71 | panelCenter.setLayout(new BorderLayout()); 72 | panelSelDoc.setLayout(new GridLayout(2,2)); 73 | panelYesDoc.setLayout(new GridLayout(1,2)); 74 | //设置字体、颜色 75 | label.setFont(fontBig); 76 | label.setForeground(ftColor); 77 | selDepLabel.setFont(fontMid); 78 | selDep.setFont(fontMid); 79 | selDLLabel.setFont(fontMid); 80 | selDL.setFont(fontMid); 81 | showInfo.setFont(fontMid); 82 | selDocLabel.setFont(fontMid); 83 | selDoc.setFont(fontMid); 84 | yesBtn.setFont(fontMid); 85 | 86 | showInfo.setEditable(false); 87 | 88 | //添加模块 89 | frame.add(panelNorth,BorderLayout.NORTH); 90 | frame.add(panelCenter,BorderLayout.CENTER); 91 | frame.add(yesBtn,BorderLayout.SOUTH); 92 | panelNorth.add(label); 93 | panelCenter.add(panelSelDoc,BorderLayout.NORTH); 94 | panelCenter.add(scrollPane,BorderLayout.CENTER); 95 | panelCenter.add(panelYesDoc,BorderLayout.SOUTH); 96 | panelSelDoc.add(selDepLabel); 97 | panelSelDoc.add(selDep); 98 | panelSelDoc.add(selDLLabel); 99 | panelSelDoc.add(selDL); 100 | panelYesDoc.add(selDocLabel); 101 | panelYesDoc.add(selDoc); 102 | 103 | selDep.addItem(null); 104 | 105 | selDL.addItem(null); 106 | selDL.addItem("普通门诊"); 107 | selDL.addItem("专家门诊"); 108 | 109 | PatientSelDoctor psd = new PatientSelDoctor(); 110 | //先查询出所有科室 111 | depList = psd.selDep(); 112 | for(int i = 0; i < depList.size(); i ++) { 113 | dpName = depList.get(i).getDPname(); 114 | selDep.addItem(dpName); 115 | } 116 | //选择科室监听器 117 | class SelDepBox implements ActionListener { 118 | public void actionPerformed(ActionEvent e) { 119 | showInfo.setText(null); 120 | int no = selDep.getSelectedIndex()-1; 121 | if(no >= 0) { 122 | Department depInfo = depList.get(no); 123 | dpLocaToNext = depInfo.getDPloca(); 124 | dpNo = depInfo.getDPno(); 125 | String show = "科室编号:" + depInfo.getDPno() + 126 | "\n科室名称:" + depInfo.getDPname() + 127 | "\n科室位置:" + depInfo.getDPloca() + 128 | "\n科室简介:" + depInfo.getDPbrief(); 129 | selDL.setSelectedIndex(0); 130 | showInfo.setText(show); 131 | }else { 132 | showInfo.setText(null); 133 | } 134 | } 135 | } 136 | //选择医师类型监听器 137 | class SelDLBox implements ActionListener { 138 | public void actionPerformed(ActionEvent e) { 139 | showInfo.setText(null); 140 | dL = selDL.getSelectedIndex(); 141 | //判断医师类型是否选择 142 | if(dL > 0) { 143 | if(dpNo != null) { 144 | docInfoList = psd.selDoc(dpNo, dL); 145 | StringBuffer dovInfoBuffer = new StringBuffer(); 146 | selDoc.removeAllItems(); 147 | selDoc.addItem(null); 148 | for(int j = 0; j < docInfoList.size(); j ++) { 149 | selDoc.addItem(docInfoList.get(j).getDno()); 150 | DocInfo aDoc = docInfoList.get(j); 151 | dovInfoBuffer.append("医师工号:" + aDoc.getDno() + 152 | "\n医师姓名:" + aDoc.getDname() + 153 | "\n医师性别:" + aDoc.getDsex() + 154 | "\n医师邮箱:" + aDoc.getDemail() + 155 | "\n医师职称:" + aDoc.getLname() + 156 | "\n医师学历:" + aDoc.getDxl() + 157 | "\n医师年资:" + aDoc.getDyear() + 158 | "\n所属科室:" + aDoc.getDPname() + 159 | "\n医师简介:" + aDoc.getDbrief() + 160 | "\n=================================\n"); 161 | } 162 | showInfo.setText(dovInfoBuffer.toString()); 163 | }else { 164 | showInfo.setText("请先选择科室,再选择医师类型!"); 165 | JOptionPane.showMessageDialog(frame, "请先选择科室,再选择医师类型!","选择顺序错误提示",JOptionPane.ERROR_MESSAGE); 166 | } 167 | } 168 | } 169 | } 170 | //确定就诊按钮监听器 171 | class YesButton implements ActionListener { 172 | public void actionPerformed(ActionEvent e) { 173 | if(selDoc.getSelectedIndex() > 0) { 174 | psd.addDocForPatient((String) selDoc.getSelectedItem(),Pno); 175 | dNameToNext = docInfoList.get(selDoc.getSelectedIndex()-1).getDname(); 176 | new PatientSeeDoctorGui(dNameToNext,dpLocaToNext,Pno,ptName); 177 | frame.setVisible(false); 178 | }else { 179 | JOptionPane.showMessageDialog(frame, "请选择就诊医师!","未选择医师提示",JOptionPane.ERROR_MESSAGE); 180 | } 181 | } 182 | } 183 | 184 | SelDepBox selDepBox = new SelDepBox(); 185 | selDep.addActionListener(selDepBox); 186 | 187 | SelDLBox selDLBox = new SelDLBox(); 188 | selDL.addActionListener(selDLBox); 189 | 190 | YesButton yesButton = new YesButton(); 191 | yesBtn.addActionListener(yesButton); 192 | 193 | frame.pack(); 194 | frame.setResizable(false); 195 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 196 | frame.setVisible(true); 197 | frame.setLocationRelativeTo(null); 198 | } 199 | } 200 | -------------------------------------------------------------------------------- /java源码/cn/linyer/run/Run.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.run; 2 | 3 | import cn.linyer.gui.SelectUserGui; 4 | /** 5 | * @author Linyer 6 | * 运行程序 7 | * 8 | */ 9 | public class Run { 10 | public static void main(String[] args) { 11 | new SelectUserGui(); 12 | } 13 | } -------------------------------------------------------------------------------- /java源码/cn/linyer/util/BaseDao.java: -------------------------------------------------------------------------------- 1 | package cn.linyer.util; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.sql.Connection; 6 | import java.sql.DriverManager; 7 | import java.sql.PreparedStatement; 8 | import java.sql.ResultSet; 9 | import java.sql.SQLException; 10 | import java.util.Properties; 11 | /** 12 | * @author Linyer 13 | * 数据库连接、增删改通用功能 14 | * 15 | */ 16 | public class BaseDao { 17 | 18 | private static String driver; 19 | private static String url; 20 | private static String user; 21 | private static String password; 22 | 23 | static{ 24 | init(); 25 | } 26 | 27 | private static void init() { 28 | Properties pro = new Properties(); 29 | 30 | InputStream is = BaseDao.class.getClassLoader().getResourceAsStream("database.properties"); 31 | try { 32 | pro.load(is); 33 | } catch (IOException e) { 34 | e.printStackTrace(); 35 | } 36 | driver = pro.getProperty("driver"); 37 | url = pro.getProperty("url"); 38 | user = pro.getProperty("user"); 39 | password = pro.getProperty("password"); 40 | } 41 | 42 | //获取连接 43 | public Connection getConnection(){ 44 | Connection conn = null; 45 | try { 46 | Class.forName(driver); 47 | conn = DriverManager.getConnection(url, user, password); 48 | } catch (ClassNotFoundException e) { 49 | e.printStackTrace(); 50 | } catch (SQLException e) { 51 | e.printStackTrace(); 52 | } 53 | return conn; 54 | } 55 | 56 | //关闭所有资源 57 | public void closeAll(Connection conn, PreparedStatement pstmt, ResultSet rs){ 58 | try { 59 | if(rs != null){ 60 | rs.close(); 61 | } 62 | } catch (SQLException e) { 63 | e.printStackTrace(); 64 | } finally { 65 | try { 66 | if(pstmt != null){ 67 | pstmt.close(); 68 | } 69 | } catch (SQLException e) { 70 | e.printStackTrace(); 71 | } finally { 72 | try { 73 | if(conn != null){ 74 | conn.close(); 75 | } 76 | } catch (SQLException e) { 77 | e.printStackTrace(); 78 | } 79 | } 80 | } 81 | } 82 | 83 | //增删改通用 84 | public int exeUpdate(String sql, Object[] params){ 85 | Connection conn = getConnection(); 86 | PreparedStatement pstmt = null; 87 | int result = 0; 88 | try { 89 | pstmt = conn.prepareStatement(sql); 90 | for (int i = 0; i < params.length; i++) { 91 | pstmt.setObject(i+1, params[i]); 92 | } 93 | result = pstmt.executeUpdate(); 94 | } catch (SQLException e) { 95 | e.printStackTrace(); 96 | } 97 | return result; 98 | } 99 | } -------------------------------------------------------------------------------- /java源码/database.properties: -------------------------------------------------------------------------------- 1 | driver=oracle.jdbc.driver.OracleDriver 2 | url=jdbc:oracle:thin:@test.linyer.cn:9999:orcl 3 | user=xxx 4 | password=xxxxxx 5 | -------------------------------------------------------------------------------- /关系模型.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GtLinyer/OracleDatbaseCourseDisign/3ae4a91854942e12bb2f58de3229f1e1da1b7581/关系模型.png --------------------------------------------------------------------------------