⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 petcasehistory.java~2~

📁 一个基于JAVA的BS结构的宠物诊所管理系统.是当年在学校时写的,大家指点一下.
💻 JAVA~2~
字号:
package petclinicmanagesystem.guoneng_wei.actionform;

import java.sql.*;
import java.util.*;
import javax.servlet.http.*;

import org.apache.struts.action.*;
import petclinicmanagesystem.guoneng_wei.jdbc.*;

public class PetCaseHistory
    extends ActionForm {

//  ID CHAR(8) NOT NULL PRIMARY KEY,			--病历编号
//        PetID CHAR(8) NOT NULL,					--宠物编号
//        IllnessInfo NVARCHAR(500) NOT NULL,			--疾病/生病信息
//        Prescription 	NVARCHAR(100) NOT NULL,			--处方 药方
//        Outlay	MONEY	NOT NULL,				--费用
//        InTime DATETIME NOT NULL				--就诊时间

  private String id;
  private String petID;
  private String illnessInfo;
  private String prescription;
  private String outlay;
  private String inTime;
  private Vector petCaseHistorys=new Vector();
  public ActionErrors validate(ActionMapping actionMapping,
                               HttpServletRequest httpServletRequest) {
    /** @todo: finish this method, this is just the skeleton.*/
    return null;
  }

  public void reset(ActionMapping actionMapping,
                    HttpServletRequest servletRequest) {
    id = "";
    petID = "";
    illnessInfo = "";
    prescription = "";
    outlay = "";
    inTime = "";

  }

  public void setId(String id) {
    this.id = id;
  }

  public void setPetID(String petID) {
    this.petID = petID;
  }

  public void setIllnessInfo(String illnessInfo) {
    this.illnessInfo = illnessInfo;
  }

  public void setPrescription(String prescription) {
    this.prescription = prescription;
  }

  public void setOutlay(String outlay) {
    this.outlay = outlay;
  }

  public void setInTime(String inTime) {
    this.inTime = inTime;
  }

  public void setPetCaseHistorys(Vector petCaseHistorys) {
    this.petCaseHistorys = petCaseHistorys;
  }

  public String getId() {
    return id;
  }

  public String getPetID() {
    return petID;
  }

  public String getIllnessInfo() {
    return illnessInfo;
  }

  public String getPrescription() {
    return prescription;
  }

  public String getOutlay() {
    return outlay;
  }

  public String getInTime() {
    return inTime;
  }

  public Vector getPetCaseHistorys() {
    return petCaseHistorys;
  }

  public boolean addPetCaseHistory() {
    Connection con = DataBaseAccess.getConnection();
    CallableStatement cst = null;
    String petId = "";
    try {
      // --EXEC proc_insertPetCaseHistory '59512671','严重感冒','三副感冒药',10
      cst = con.prepareCall("{call proc_insertPetCaseHistory(?,?,?,?)}");
      cst.setString(1, this.getPetID());
      cst.setString(2, this.getIllnessInfo());
      cst.setString(3, this.getPrescription());
      cst.setFloat (4, Float.parseFloat(this.getOutlay()));
      return!cst.execute();
    }
    catch (SQLException ex) {
      System.out.println("-------------出现异常在添加宠物 病历 信息时---------------");
    }
    finally {
      DataBaseAccess.closeStatement(cst);
      DataBaseAccess.closeConnection(con);
    }
    return false;
  }

  public boolean searchPetCaseHistorys() {
    Connection con = DataBaseAccess.getConnection();
    PreparedStatement pst = null;
    ResultSet rs = null;
    boolean flag = false;
    try {
//    ID       PetID    IllnessInfo    Prescription Outlay InTime
      pst = con.prepareStatement("SELECT * FROM PetCaseHistory WHERE PetID=?");
      pst.setString(1, this.getPetID());
      rs = pst.executeQuery();

      while (rs.next()) {
        flag=true;
        PetCaseHistory pch = new PetCaseHistory();
        pch.setId(rs.getString("ID"));
        pch.setPetID(rs.getString("PetID"));
        pch.setIllnessInfo(rs.getString("IllnessInfo"));
        pch.setPrescription(rs.getString("Prescription"));
        pch.setOutlay(rs.getString("Outlay"));
        pch.setInTime(rs.getString("InTime"));
        petCaseHistorys.addElement(pch);
      }

    }
    catch (SQLException ex) {
      System.out.println("-------------出现异常在selectPetInfo()---------------");
    }
    finally {
      DataBaseAccess.closeResultSet(rs);
      DataBaseAccess.closeStatement(pst);
      DataBaseAccess.closeConnection(con);
    }
    return flag;
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -