📄 rkxzlsave.java
字号:
package com.chis.model.person;
import com.chis.util.GUIDKeyGen;
import com.chis.util.GetTime;
import com.stframe.dao.DaoUtil;
import com.stframe.form.ActionForm;
import com.stframe.form.DataForm;
import com.stframe.servlet.ActionInstance;
/**
* 人口学资料保存
*
* @author 翟昌强
*
*/
public class RkxzlSave extends ActionInstance {
public int execute(ActionForm af) throws Exception {
DataForm df = new DataForm("DA_RKXZL");
String corp_code=af.getHttpSession().getAttribute("CORP_CODE").toString();
StringBuffer judge1 = new StringBuffer();
judge1.append("select * from DA_RKXZL \n");
judge1.append(" where CORP_CODE='"+corp_code+"' and JMJKDAH='"+af.getHttpRequest().getParameter("JMJKDAH")+"'");
DataForm rkxzlinfo1[] = DaoUtil.getDFListBySQL(af.getConnection(),judge1.toString());
if (rkxzlinfo1.length > 0)
{
af.getHttpRequest().setAttribute("result", "居民健康档案号已存在,信息添加");
return 0;
}
StringBuffer judge2 = new StringBuffer();
judge2.append("select * from DA_RKXZL \n");
judge2.append("where CORP_CODE='"+corp_code+"' and JMXM='"+af.getHttpRequest().getParameter("JMXM")+"'\n");
judge2.append(" and JT_ID='"+af.getHttpRequest().getParameter("JT_ID")+"'\n");
DataForm rkxzlinfo2[]= DaoUtil.getDFListBySQL(af.getConnection(), judge2.toString());
if(rkxzlinfo2.length>0)
{
af.getHttpRequest().setAttribute("result", "同一个家庭出现了相同的姓名,信息添加");
return 0;
}
// String username = af.getHttpSession().getAttribute("USER_NAME").toString();
// String corp_code = af.getHttpSession().getAttribute("CORP_CODE").toString();
String time = GetTime.getShotTime();
/*
int id=0;
String sql = "select max(ID) MAXID from DA_RKXZL where CORP_CODE='"+corp_code+"'";
try {
DataForm df1 = (DataForm)DaoUtil.select(af.getConnection(), sql, new DataForm("DA_RKXZL")).get(0);
id= Integer.parseInt(df1.get("MAXID").toString())+1;
} catch (Exception e) { }
*/
try {
df.setValues(af.getHttpRequest());
df.setCmd("A");
df.set("ID", GUIDKeyGen.getGUIDKey(af.getConnection()));
df.set("CORP_CODE", corp_code);
int i=DaoUtil.DFOperate(af.getConnection(), df);
af.getHttpRequest().setAttribute("result","健康档案基本信息添加");
return i;
} catch (Exception e) {
e.printStackTrace();
af.getHttpRequest().setAttribute("result", "健康档案基本信息添加");
return 0;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -