📄 totalchargeaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.nitpro.action;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import com.nitpro.dao.DAOFactory;
import com.nitpro.form.TotalChargeForm;
/**
* MyEclipse Struts
* Creation date: 12-26-2007
*
* XDoclet definition:
* @struts.action path="/totalCharge" name="totalChargeForm" parameter="method" scope="request" validate="true"
*/
public class TotalChargeAction extends DispatchAction {
/*
* Generated Methods
*/
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward totalChargeSelect(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String patient_id = request.getParameter("patient_id");
DAOFactory dao = DAOFactory.getDAOFactory(DAOFactory.MYSQL);
String check = dao.getAllMethodDAO().getMedicine(patient_id);
if(check==null){
return mapping.getInputForward();
}
else{
String medicine_id[] = dao.getAllMethodDAO().getMedicine(patient_id).split("、");
float totalprice = 0;
for(int i = 0;i<medicine_id.length;i++){
float price = dao.getAllMethodDAO().getMedicinePrice(medicine_id[i]);
totalprice += price;
}
HttpSession session = request.getSession();
session.setAttribute("totalprice", totalprice);
session.setAttribute("patient_id", patient_id);
request.setAttribute("inf", 1);
return mapping.findForward("selectOK");
}
}
public ActionForward totalChargeInput(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
HttpSession session = request.getSession();
String patient_id = (String)session.getAttribute("patient_id");
float medicine_charge = Float.parseFloat(session.getAttribute("totalprice").toString());
float registers_charge = Float.parseFloat(request.getParameter("registers_charge"));
float deal_charge = Float.parseFloat(request.getParameter("deal_charge"));
float examination_charge = Float.parseFloat(request.getParameter("examination_charge"));
DAOFactory dao = DAOFactory.getDAOFactory(DAOFactory.MYSQL);
dao.getAllMethodDAO().totalPriceInput(patient_id, medicine_charge, registers_charge, deal_charge, examination_charge);
List t_list = dao.getAllMethodDAO().getTotalPriceList(patient_id);
session.setAttribute("tlist", t_list);
return mapping.findForward("inputOK");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -