📄 psearch.java
字号:
package com.hospital.web;
import java.sql.*;
import java.text.SimpleDateFormat;
import com.hospital.util.*;
import com.hospital.web.*;
import java.util.Vector;
import java.util.Date;
import java.util.Calendar;;
/**
* psearch
*/
public class psearch extends DataBase {
private String ic; //身份证号
private String passwd; //登录密码
private String name=""; //真实姓名
private String sex="";
private int age;
private String address="";
private String phone="";
private String email="";
private String did="";
private String level="";
private String section="";
private int spa;
private int pid;
public Vector searchlist_2=new Vector();
public Vector searchlist_3=new Vector();
public Vector searchlist_4=new Vector();
public int day;
public int isam;
public int week;
public int wd;
private int x_suna,x_sunp,x_sata,x_satp,x_mona,x_monp,x_tuea,x_tuep,x_weda,x_wedp,x_thua,x_thup,x_fria,x_frip;
private int y_suna,y_sunp,y_sata,y_satp,y_mona,y_monp,y_tuea,y_tuep,y_weda,y_wedp,y_thua,y_thup,y_fria,y_frip;
public psearch() throws Exception{
super();
this.pid=0;
this.ic = "";
this.passwd = "";
this.name=""; //真实姓名
this.sex="";
this.age=0;
this.address="";
this.phone="";
this.email="";
this.did="";
this.day=-1;
this.week=-1;
this.isam=-1;
this.spa=-1;
}
public int getXsuna() {
return this.x_suna;
}
public void setXsuna(int newxsuna) {
this.x_suna = newxsuna;
}
public int getXsunp() {
return this.x_sunp;
}
public void setXsunp(int newxsunp) {
this.x_sunp = newxsunp;
}
public String getIc() {
return this.ic;
}
public void setIc(String newic) {
this.ic = newic;
}
public String getName() {
return this.name;
}
public void setName(String newname) {
this.name = newname;
}
public String getPasswd() {
return this.passwd;
}
public void setPasswd(String newpasswd) {
this.passwd = newpasswd;
}
public String getSex() {
return this.sex;
}
public void setSex(String newsex) {
this.sex = newsex;
}
public String getAddress() {
return this.address;
}
public void setAddress(String newaddress) {
this.address = newaddress;
}
public String getPhone() {
return this.phone;
}
public void setPhone(String newphone) {
this.phone = newphone;
}
public String getEmail() {
return this.email;
}
public void setEmail(String newemail) {
this.email = newemail;
}
public int getAge() {
return this.age;
}
public void setAge(int newage) {
this.age = newage;
}
public String getSection() {
return this.section;
}
public void setSection(String newsection) {
this.section = newsection;
}
public String getLevel() {
return this.level;
}
public void setLevel(String newlevel) {
this.level = newlevel;
}
public int getSpa() {
return this.spa;
}
public void setSpa(int newspa) {
this.spa = newspa;
}
public int getPid() {
return this.pid;
}
public void setPid(int newpid) {
this.pid = newpid;
}
public void setWeek(int newweek) {
this.week = newweek;
}
public void setDay(int newday) {
this.day = newday;
}
public void setDid(String newdid) {
this.did = newdid;
}
public void setIsam(int newisam) {
this.isam = newisam;
}
public String getDid() {
return this.did;
}
public int getDay() {
return this.day;
}
public int getIsam() {
return this.isam;
}
public int getWeek() {
return this.week;
}
public int getWd() {
return this.wd;
}
public Vector getSearchlist_2() {
return searchlist_2;
}
protected int getPid(String newic){
try{
sqlStr="select * from patient where ic='"+ic+"'";
rs = stmt.executeQuery(sqlStr);
if(rs.next()){
int i=rs.getInt("pid");
return i;
}
}
catch (SQLException e)
{
return -2;
}
return -1;
}
public String getSql(int n1,String n2,String s1,String l1,int sp1){
String st1="",st2="",st3="",st4=" ",a1=" ",a2=" ",a3=" ",sql="";
if(n1==1){
st1=" name like'"+n2+"%' ";
}
if(n1==2){
st1=" name ='"+n2+"' ";
}
if(!s1.equals("0")){
st2=" section='"+s1+"' ";
}
if(!l1.equals("0")){
st3=" level='"+l1+"' ";
}
if(sp1!=0){
int spa1=sp1-1;
st4=" specialist='"+spa1+"' ";
}
if(n1!=0&&(!s1.equals("0")||!l1.equals("0")||sp1!=0))
a1=" and ";
if(!s1.equals("0")&&(!l1.equals("0")||sp1!=0))
a2=" and ";
if(!l1.equals("0")&&sp1!=0)
a3=" and ";
sql="select * from doctor where"+st1+a1+st2+a2+st3+a3+st4;
return sql;
}
public String doctorsearch(int n1,String n2,String s1,String l1,int sp1) throws Exception{
try{
searchlist_2=new Vector();
pid=getPid(ic);
sqlStr=getSql(n1,n2,s1,l1,sp1);
rs = stmt.executeQuery(sqlStr);
searchlist_2.removeAllElements();
if(!rs.next())
return "cant find";
else{
do{
psearch d1=new psearch();
d1.setDid(rs.getString("did"));
d1.setSection(rs.getString("section"));
d1.setLevel(rs.getString("level"));
d1.setName(rs.getString("name"));
d1.setSpa(rs.getInt("specialist"));
d1.setSex(rs.getString("sex"));
searchlist_2.addElement(d1);
}while(rs.next());
}
}
catch (SQLException e)
{
return e.toString();
}
return "";
}
public int datetime(){
Calendar c=Calendar.getInstance();
return c.get(Calendar.DAY_OF_WEEK);
}
public String showdapp() throws Exception{
if(!showdapp0())
return "读取本周预约表出错";
if(!showdapp1())
return "读取下周预约表出错";
return "";
}
public boolean showdapp0() throws Exception{
try{
searchlist_3=new Vector();
sqlStr="select * from app_real_this X,app_max_this Y where X.did='"+did+"' and Y.did='"+did+"'";
rs = stmt.executeQuery(sqlStr);
searchlist_3.removeAllElements();
if(!rs.next())
return false;
else{
do{
psearch d1=new psearch();
d1.setDid(rs.getString("did"));
d1.setSection(rs.getString("section"));
d1.setLevel(rs.getString("level"));
d1.setName(rs.getString("name"));
d1.setSpa(rs.getInt("specialist"));
d1.setSex(rs.getString("sex"));
searchlist_3.addElement(d1);
}while(rs.next());
}
}
catch (SQLException e)
{
return false;
}
return true;
}
public boolean showdapp1() throws Exception{
try{
searchlist_4=new Vector();
pid=getPid(ic);
rs = stmt.executeQuery(sqlStr);
searchlist_4.removeAllElements();
if(!rs.next())
return false;
else{
do{
psearch d1=new psearch();
d1.setDid(rs.getString("did"));
d1.setSection(rs.getString("section"));
d1.setLevel(rs.getString("level"));
d1.setName(rs.getString("name"));
d1.setSpa(rs.getInt("specialist"));
d1.setSex(rs.getString("sex"));
searchlist_4.addElement(d1);
}while(rs.next());
}
}
catch (SQLException e)
{
return false;
}
return true;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -