<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="gb2312"%>
<%@ page import="java.io.*"%>
<%@ page import="jxl.Workbook"%>
<%@ page import="jxl.write.*"%>
<%@ page import="javax.servlet.http.HttpServletRequest"%>
<%@ page import="java.text.SimpleDateFormat"%>
<%@ page import="java.util.Date"%>
<%!static String getStringGBK(HttpServletRequest request, String name) throws Exception {
String result = new String(request.getParameter(name).getBytes("iso-8859-1"),
"gbk");
return result;
}%>
<%!static String getStringGBK(String str) throws Exception {
String result = new String(str.getBytes("iso-8859-1"),
"gbk");
return result;
}%>
<%
String msg = "调查报告已经提交成功。";
try {
String txrq = getStringGBK(request, "txrq"); // 填写日期
String yycode = getStringGBK(request, "yycode"); // 医院组织机构代码
String yyname = getStringGBK(request, "yyname"); // 医院全称:
String cldate_year = getStringGBK(request, "cldate_year"); // 成立日期:
String cldate_month = getStringGBK(request, "cldate_month"); // 成立日期:
String yydj = getStringGBK(request, "yydj"); // 医院级别:
String yyxz = getStringGBK(request, "yyxz"); // 医院性质:
String yyfl = getStringGBK(request, "yyfl"); // 医院分类:
String yydz_sheng = getStringGBK(request, "yydz_sheng"); // 医院地址:
String yydz_si = getStringGBK(request, "yydz_si"); // 医院地址:
String yydz_quxian = getStringGBK(request, "yydz_quxian"); // 医院地址:
String yydz_jie = getStringGBK(request, "yydz_jie"); // 医院地址:
String yydz_hao = getStringGBK(request, "yydz_hao"); // 医院地址:
String yzbm = getStringGBK(request, "yzbm"); // 邮 编
String zzxm = getStringGBK(request, "zzxm"); // 现任主任(或者联系人)姓名
String lxdh = getStringGBK(request, "lxdh"); // 联系电话
String sjhm = getStringGBK(request, "sjhm"); // 手机号码
String email = getStringGBK(request, "email"); // 手机号码
String clrq_year = getStringGBK(request, "clrq_year"); // 内分泌科(内科内分泌专业组)成立日期
String clrq_mon = getStringGBK(request, "clrq_mon"); // 内分泌科(内科内分泌专业组)成立日期
String szqk = getStringGBK(request, "szqk"); // 内分泌科室的设置情况
String nfmrs = getStringGBK(request, "nfmrs"); // 内分泌专业医生人数
String nfmcs = getStringGBK(request, "nfmcs"); // 内分泌科床位数
String rmzl = getStringGBK(request, "rmzl"); // 日门诊量
String nmzl = getStringGBK(request, "nmzl"); // 年门诊量
String nszrl = getStringGBK(request, "nszrl"); // 年收治病人量
String[] ysxx_names = request.getParameterValues("ysxx_name"); // 姓名
String[] ysxx_sexs = request.getParameterValues("ysxx_sex"); // 性别
String[] ysxx_nls = request.getParameterValues("ysxx_nl"); //年龄
String[] ysxx_zcs = request.getParameterValues("ysxx_zc"); //职称
String[] ysxx_xls = request.getParameterValues("ysxx_xl"); //学历
String[] ysxx_xws = request.getParameterValues("ysxx_xw"); //学位
String[] ysxx_byyxs = request.getParameterValues("ysxx_byyx"); //毕业院校
String[] ysxx_csnxs = request.getParameterValues("ysxx_csnx"); //从事专业年限
String[] ysxx_sjhms = request.getParameterValues("ysxx_sjhm"); //手机号码
String[] ysxx_emails = request.getParameterValues("ysxx_email"); //电子邮箱
String smzksy = getStringGBK(request, "smzksy"); //是否具有内分泌专科实验室
String[] tzwts = request.getParameterValues("tzwt"); // 目前内分泌科(专业组)发展所面临的挑战与问题
String[] bzzcs = request.getParameterValues("bzzc"); // 希望得到内分泌代谢医师分会提供哪些方面的帮助和支持
String cwhy = getStringGBK(request, "cwhy"); //是否愿意加入本分会成为会员:
String[] gzjys = request.getParameterValues("gzjy"); // 您和您的单位对本分未来工作的建议
String path = request.getRealPath("/");
int rowInsertAmount = 0;
int rowNoQuestion4 = 32;
int rowNoQuestion6 = 39;
int rowNoQuestion7 = 42;
int rowNoQuestion9 = 51;
//Excel获得文件
Workbook wb = Workbook.getWorkbook(new File(path
+ "excel\\template.xls"));
Date now = new Date();
String dateString = new SimpleDateFormat("yyyyMMddHHmmss").format(now);
//打开一个文件的副本,并且指定数据写回到原文件
WritableWorkbook book = Workbook.createWorkbook(new File(path
+ "excel\\调查报告_" + dateString + ".xls"), wb);
//WritableFont font1 = new WritableFont(WritableFont.TIMES, 16,
//WritableFont.BOLD); //或设置字体格式为excel支持的格式 WritableFont font3=new WritableFont(WritableFont.createFont("楷体_GB2312"),12,WritableFont.NO_BOLD );
//WritableCellFormat format1 = new WritableCellFormat(font1);
WritableCellFormat format1 = new WritableCellFormat();
WritableCellFormat format2 = new WritableCellFormat();
format2.setBorder(jxl.format.Border.TOP,jxl.format.BorderLineStyle.THIN);
format2.setBorder(jxl.format.Border.LEFT,jxl.format.BorderLineStyle.THIN);
format2.setBorder(jxl.format.Border.RIGHT,jxl.format.BorderLineStyle.THIN);
format2.setBorder(jxl.format.Border.BOTTOM,jxl.format.BorderLineStyle.THIN);
//把水平对齐方式指定为居中
//format1.setAlignment(jxl.format.Alignment.CENTRE);
//把垂直对齐方式指定为居中
//format1.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
//设置自动换行
//format1.setWrap(true);
//添加一个工作表
WritableSheet sheet = book.getSheet(0);
sheet.addCell(new Label(2, 6, txrq, format1)); //
sheet.addCell(new Label(11, 6, yycode, format1)); //
sheet.addCell(new Label(2, 7, yyname, format1)); //
sheet.addCell(new Label(10, 7, cldate_year, format1)); //
sheet.addCell(new Label(13, 7, cldate_month, format1)); //
sheet.addCell(new Label(2, 8, yydj, format1)); //
sheet.addCell(new Label(7, 8, yyxz, format1)); //
sheet.addCell(new Label(2, 9, yyfl, format1)); //
sheet.addCell(new Label(2, 10, yydz_sheng, format1)); //
sheet.addCell(new Label(7, 10, yydz_si, format1)); //
sheet.addCell(new Label(11, 10, yydz_quxian, format1)); //
sheet.addCell(new Label(2, 11, yydz_jie, format1)); //
sheet.addCell(new Label(6, 11, yydz_hao, format1)); //
sheet.addCell(new Label(2, 12, yzbm, format1)); //
sheet.addCell(new Label(5, 14, zzxm, format1)); //
sheet.addCell(new Label(12, 14, lxdh, format1)); //
sheet.addCell(new Label(2, 15, sjhm, format1)); //
sheet.addCell(new Label(12, 15, email, format1)); //
sheet.addCell(new Label(7, 19, clrq_year, format1)); //
sheet.addCell(new Label(11, 19, clrq_mon, format1)); //
if (!"其他".equals(szqk)) {
sheet.addCell(new Label(1, 22, szqk, format1)); //
} else {
String szqk_qtnr = new String(request.getParameter(
"szqk_qtnr").getBytes("iso-8859-1"), "gbk"); // 内分泌科室的设置情况 其它
sheet.addCell(new Label(1, 22, szqk + ":" + szqk_qtnr,
format1)); //
}
sheet.addCell(new Label(4, 25, nfmrs, format1)); //
sheet.addCell(new Label(11, 25, nfmcs, format1)); //
sheet.addCell(new Label(2, 26, rmzl, format1)); //
sheet.addCell(new Label(6, 26, nmzl, format1)); //
sheet.addCell(new Label(12, 26, nszrl, format1)); //
//4. 医生信息登记
int index0 = 1;
for (int i = 0; i < ysxx_names.length; i++) {
if("".equals(getStringGBK(ysxx_names[i]))){
continue;
}
if (index0 > 1) {
// 插入一行
sheet.insertRow(rowNoQuestion4);
rowNoQuestion4++;
rowInsertAmount++;
}
sheet.addCell(new Label(1, 30 + rowInsertAmount, getStringGBK(ysxx_names[i])
, format2)); //
sheet.addCell(new Label(2, 30 + rowInsertAmount, getStringGBK(ysxx_sexs[i])
, format2)); //
sheet.addCell(new Label(3, 30 + rowInsertAmount, getStringGBK(ysxx_nls[i])
, format2)); //
sheet.addCell(new Label(4, 30 + rowInsertAmount, getStringGBK(ysxx_zcs[i])
, format2)); //
sheet.addCell(new Label(6, 30 + rowInsertAmount, getStringGBK(ysxx_xls[i])
, format2)); //
sheet.addCell(new Label(8, 30 + rowInsertAmount, getStringGBK(ysxx_xws[i])
, format2)); //
sheet.addCell(new Label(9, 30 + rowInsertAmount, getStringGBK(ysxx_byyxs[i])
, format2)); //
sheet.addCell(new Label(11, 30 + rowInsertAmount, getStringGBK(ysxx_csnxs[i])
, format2)); //
sheet.addCell(new Label(13, 30 + rowInsertAmount, getStringGBK(ysxx_sjhms[i])
, format2)); //
sheet.addCell(new Label(15, 30 + rowInsertAmount, getStringGBK(ysxx_emails[i])
, format2)); //
index0++;
}
//5.是否具有内分泌专科实验室:
sheet.addCell(new Label(5, 32 + rowInsertAmount, smzksy, format1)); //
if("是".equals(smzksy)) {
String smzksy_gzrs = getStringGBK(request, "smzksy_gzrs"); //实验室工作人员人数
String smzksy_sbjz = getStringGBK(request, "smzksy_sbjz"); //实验室设备价值
String smzksy_rbbl = getStringGBK(request, "smzksy_rbbl"); //实验室日处理标本量
String smzksy_ysl = getStringGBK(request, "smzksy_ysl"); //实验室月收入
sheet.addCell(new Label(4, 33 + rowInsertAmount, smzksy_gzrs, format1)); //
sheet.addCell(new Label(11, 33 + rowInsertAmount, smzksy_sbjz, format1)); //
sheet.addCell(new Label(4, 34 + rowInsertAmount, smzksy_rbbl, format1)); //
sheet.addCell(new Label(11, 34 + rowInsertAmount, smzksy_ysl, format1)); //
}
//6.目前内分泌科(专业组)发展所面临的挑战与问题
int index1 = 1;
rowNoQuestion6 = rowNoQuestion6 + rowInsertAmount;
for (int i = 0; i < tzwts.length; i++) {
if("".equals(getStringGBK(tzwts[i]))){
continue;
}
if (index1 > 1) {
// 插入一行
sheet.insertRow(rowNoQuestion6);
rowNoQuestion6++;
rowInsertAmount++;
}
sheet.addCell(new Label(1, 37 + rowInsertAmount, index1++ + ". " + getStringGBK(tzwts[i])
, format1)); //
}
//7.希望得到内分泌代谢医师分会提供哪些方面的帮助和支持(可多选)
rowNoQuestion7 = rowNoQuestion7 + rowInsertAmount;
for (int i = 0; i < bzzcs.length; i++) {
if (i > 0) {
// 插入一行
sheet.insertRow(rowNoQuestion7);
rowNoQuestion7++;
rowInsertAmount++;
}
if(!"其他(请填写):".equals(getStringGBK(bzzcs[i]))){
sheet.addCell(new Label(1, 40 + rowInsertAmount, getStringGBK(bzzcs[i])
, format1)); //
} else {
String bzzc_qt = getStringGBK(request, "bzzc_qt"); //其他(请填写)
sheet.addCell(new Label(1, 40 + rowInsertAmount, getStringGBK(bzzcs[i])
+ bzzc_qt, format1)); //
}
}
// 8.是否愿意加入本分会成为会员:
sheet.addCell(new Label(6, 42 + rowInsertAmount, cwhy, format1)); //
if("是".equals(cwhy)) {
String cwhy_hf = getStringGBK(request, "cwhy_hf"); //您认为会员每年会费多少合适
String cwhy_hybl = getStringGBK(request, "cwhy_hybl"); //分会评选年度优秀内分泌代谢科医师,您认为占会员的比例多少合适
sheet.addCell(new Label(1, 44 + rowInsertAmount, cwhy_hf, format1)); //
sheet.addCell(new Label(1, 46 + rowInsertAmount, cwhy_hybl, format1)); //
}
//9.您和您的单位对本分未来工作的建议
int index2 = 1;
rowNoQuestion9 = rowNoQuestion9 + rowInsertAmount;
for (int i = 0; i < gzjys.length; i++) {
if("".equals(getStringGBK(gzjys[i]))){
continue;
}
if (index2 > 1) {
// 插入一行
sheet.insertRow(rowNoQuestion9);
rowNoQuestion9++;
rowInsertAmount++;
}
sheet.addCell(new Label(1, 49 + rowInsertAmount, index2++ + ". " + getStringGBK(gzjys[i])
, format1)); //
}
book.write();
book.close();
} catch (Exception e) {
System.out.println(e);
e.printStackTrace();
msg = "调查报告提交失败,请重新提交或者联系管理员。";
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>中国医师协会内分泌代谢医师科分会调查问卷</title>
</head>
<body style="background-color:#E0ECF9">
<table border="0" align="center">
<tr>
<td width="180" align="left"><img src="img/CEA-logo.png" style=""/></td>
<td width="550"><div align="left" style="font-size:25px"><strong>中国医师协会内分泌代谢医师科分会</strong></div></td>
</tr>
<tr>
<td height="30"></td>
</tr>
<tr>
<td colspan="2">
<div align="center"><strong><%= msg %></strong></div>
</td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<input type="button" onclick="javascript:window.close();" value="关 闭"/>
</div>
</td>
</tr>
</table>
</body>
</html>