?? frmzycf.java
字號:
//顯示金額
float je = dj*sl;
item.setText(3,String.valueOf(je));
//顯示自費(fèi)金額
float zfje = je*(zfbl/100);
item.setText(8,String.valueOf(zfje));
i++;
}
}catch(SQLException se){}
}
else shwErrMsgBox_Query();
//改變當(dāng)前中間表格是否費(fèi)用明細(xì)信息flag的值
isCurrentFYMX = true;
}
});
//給費(fèi)用合計(jì)文本框添加失去焦點(diǎn)事件監(jiān)聽器
//以清除中間表格的繳費(fèi)明細(xì)信息,返回原來的輸入狀態(tài)
txtFYHJ.addListener(SWT.FocusOut,new Listener(){
public void handleEvent(Event event){
//如果當(dāng)前中間表格顯示的繳費(fèi)明細(xì)信息
if(isCurrentFYMX){
//如果上次輸入的藥品
if(isYPRadioSelected)
//返回到藥品信息輸入狀態(tài)
backToYPXX();
//如果上次輸入的醫(yī)療服務(wù)
else
//返回到醫(yī)療服務(wù)輸入狀態(tài)
backToYLFW();
}
}
});
//科室
Label lblKS = new Label(shell,SWT.NONE);
lblKS.setText("科室");
grdData = new GridData();
grdData.widthHint = 62;
lblKS.setLayoutData(grdData);
grdData = new GridData();
txtKS = new Text(shell,SWT.BORDER);
grdData.widthHint = 112;
txtKS.setLayoutData(grdData);
//空行
lblNone = new Label(shell,SWT.NONE);
grdData = new GridData();
grdData.widthHint = 62;
grdData.horizontalSpan = 6;
lblNone.setLayoutData(grdData);
//提示信息
lblMsg = new Label(shell,SWT.NONE);
lblMsg.setForeground(colRed);
lblMsg.setText("這里是提示信息\n請輸入住院號");
grdData = new GridData();
grdData.horizontalSpan = 3;
grdData.verticalSpan = 2;
grdData.widthHint = 250;
lblMsg.setLayoutData(grdData);
//按鍵
comBtnGrpDown = new Composite(shell,SWT.NONE);
grdData = new GridData(GridData.HORIZONTAL_ALIGN_END);
grdData.horizontalSpan = 3;
grdData.verticalSpan = 2;
comBtnGrpDown.setLayoutData(grdData);
grdLtCmpDown = new GridLayout(3,false);
grdLtCmpDown.horizontalSpacing = 0;
comBtnGrpDown.setLayout(grdLtCmpDown);
//保存
btnSave = new Button(comBtnGrpDown,SWT.NONE);
btnSave.setText("保存");
grdData = new GridData();
grdData.widthHint = 60;
btnSave.setLayoutData(grdData);
//添加保存按鍵單擊事件
btnSave.addSelectionListener(new SelectionAdapter(){
public void widgetSelected(SelectionEvent event){
//如果信息未登錄完提示是否放棄
if(isInfGrpChanged){
msgBox = new MessageBox(shell,SWT.YES | SWT.ICON_QUESTION |
SWT.NO);
msgBox.setText("提示");
if(isYPRadioSelected)
msgBox.setMessage("是否放棄當(dāng)前未登錄完的藥品數(shù)據(jù)?");
else
msgBox.setMessage("是否放棄當(dāng)前未登錄完的醫(yī)療服務(wù)數(shù)據(jù)?");
switch(msgBox.open()){
case SWT.YES:
resetGroupYPXX();
break;
case SWT.NO:
btnYLFW.setSelection(false);
btnYP.setSelection(true);
return;
}
}
//提示是否保存
msgBox = new MessageBox(shell,SWT.YES |SWT.NO |SWT.ICON_QUESTION);
msgBox.setText("確認(rèn)");
msgBox.setMessage("您確實(shí)要保存這條記錄嗎?");
switch(msgBox.open()){
case SWT.YES:
//如果選擇是則繼續(xù)下面的操作
break;
case SWT.NO:
//選擇否則返回
return;
}
//向處方表中插入一條新記錄
String strCFRQ = txtCFRQ.getText().trim();
String strZYKS = txtKS.getText().trim();
String strCFYS = txtCFYS.getText().trim();
strSQL = "INSERT INTO [CFD] VALUES('" +
strZYH + "','" +
strCFRQ + "','" +
strZYKS + "','" +
strCFYS + "',NULL)";
//如果插入錯誤則彈出錯誤消息框
if(db.executeUpdate(strSQL) == 0){
System.out.println("Program ERROR@\n" + strSQL);
shwErrMsgBox_Update();
return;
}
//如果有藥費(fèi)則逐條插入藥費(fèi)明細(xì)表
String strYF = txtYF.getText().trim();
if(!strYF.equals("")){
for(int i = 0;i < tblItemIndex_YP;i++){
String strMXSX = saYPXXData[i][0];
String strYM = saYPXXData[i][1];
String strDJ = saYPXXData[i][2];
String strJJDW = saYPXXData[i][3];
String strSL = saYPXXData[i][4];
String strZFBL = saYPXXData[i][6];
String strGG = saYPXXData[i][8];
String strXMFL = saYPXXData[i][9];
String strCD = saYPXXData[i][10];
String strCJ = saYPXXData[i][11];
strSQL = "INSERT INTO [ZYYF] VALUES('" +
strZYH +"','" +
strCFRQ + "','" +
strMXSX + "','" +
strXMFL + "','" +
strYM + "',CONVERT(money,'" +
strDJ + "'),'" +
strJJDW + "','" +
strSL + "','" +
strZFBL + "','" +
strGG + "','" +
strCD + "','" +
strCJ + "')";
if(db.executeUpdate(strSQL) == 0){
System.out.println("ERROR@\n" + strSQL);
shwErrMsgBox_Update();
return;
}
}
}
//如果有醫(yī)療服務(wù)費(fèi)則逐條插入醫(yī)療服務(wù)費(fèi)明細(xì)表
String strYLFWF = txtYLFWF.getText().trim();
if( !strYLFWF.equals("") ){
for(int i = 0;i < tblItemIndex_YLFW;i++){
String strMXSX = saYLFWData[i][0];
String strSFXM = saYLFWData[i][1];
String strDJ = saYLFWData[i][2];
String strJJDW = saYLFWData[i][3];
String strSL = saYLFWData[i][4];
String strZFBL = saYLFWData[i][6];
String strXMFL = saYLFWData[i][8];
strSQL = "INSERT INTO [ZYYL] VALUES('" +
strZYH + "','" +
strCFRQ + "','" +
strMXSX + "','" +
strXMFL + "','" +
strSFXM + "','" +
strJJDW + "',CONVERT(money,'" +
strDJ + "'),'" +
strZFBL + "','" +
strSL + "')";
if(db.executeUpdate(strSQL) == 0){
System.out.println("ERROR@\n" + strSQL);
shwErrMsgBox_Update();
return;
}
}
}
//如果有診斷信息則插入診斷記錄表
String strJBDM = txtJBDM.getText().trim();
if(!strJBDM.equals("") ){
String strZD = txtZD.getText().trim();
strSQL = "INSERT INTO [ZDJL] VALUES('" +
strBLH + "','" +
strCFRQ + "','" +
strJBDM + "','" +
strCFYS + "','" +
strZD + "','0')";
if(db.executeUpdate(strSQL) == 0){
System.out.println("ERROR@\n" + strSQL);
shwErrMsgBox_Update();
return;
}
}
initWidgets();
}
});
//重輸
btnReInput = new Button(comBtnGrpDown,SWT.NONE);
btnReInput.setText("重輸");
grdData = new GridData();
grdData.widthHint = 60;
btnReInput.setLayoutData(grdData);
//Add btnReInput Clicked handler
btnReInput.addSelectionListener(new SelectionAdapter(){
public void widgetSelected(SelectionEvent event){
initWidgets();
}
});
//返回
btnBack = new Button(comBtnGrpDown,SWT.NONE);
btnBack.setText("返回");
grdData = new GridData();
grdData.widthHint = 60;
btnBack.setLayoutData(grdData);
//Add btnBack Clicked handler
btnBack.addSelectionListener(new SelectionAdapter(){
public void widgetSelected(SelectionEvent event){
//btnBack exit all
shell.getDisplay().dispose();
shell.dispose();
FrmMenu.main();
return;
}
});
}
/**
* name:initWidgets
* author:pizi
* function:set initial text value,enable and editable
* 當(dāng)初始運(yùn)行和點(diǎn)擊重輸按鍵時(shí)會調(diào)用此方法
*/
private void initWidgets(){
//設(shè)置控件不可用
btnYP.setEnabled(false);
btnYLFW.setEnabled(false);
cmbYPDM.setEnabled(false);
btnOK.setEnabled(false);
btnCancel.setEnabled(false);
btnSave.setEnabled(false);
btnReInput.setEnabled(false);
comGrpRight.setVisible(false);
//選擇"藥"
btnYP.setSelection(true);
isYPRadioSelected = true;
isCurrentJFMX = false;
isCurrentFYMX = false;
//中間表格的行索引值設(shè)置為0
tblItemIndex_YP = 0;
tblItemIndex_YLFW = 0;
//清空保存藥品信息和醫(yī)療服務(wù)信息的二維數(shù)組
saYPXXData = new String[100][12];
saYLFWData = new String[100][9];
//住院號字符串設(shè)置為空
strZYH = "";
//總藥費(fèi)和醫(yī)療服務(wù)費(fèi)設(shè)置為0
fYFSum = 0;
fQZZF1Sum = 0;
fYLFWSum = 0;
fQZZF2Sum = 0;
//設(shè)置控件為不可用
txtCFYS.setEditable(false);
txtCFRQ.setEditable(false);
txtBRXM.setEditable(false);
txtCSRQ.setEditable(false);
txtBLH.setEditable(false);
txtYF.setEditable(false);
txtQZZF1.setEditable(false);
txtYLFWF.setEditable(false);
txtQZZF2.setEditable(false);
txtJBDM.setEditable(false);
txtBM.setEditable(false);
txtZD.setEditable(false);
txtDJ.setEditable(false);
txtJJDW.setEditable(false);
txtSL.setEditable(false);
txtJE.setEditable(false);
txtZFBL.setEditable(false);
txtZFJE.setEditable(false);
txtGG.setEditable(false);
txtCD.setEditable(false);
txtCJ.setEditable(false);
txtJFHJ.setEditable(false);
txtFYHJ.setEditable(false);
txtKS.setEditable(false);
//清空組件內(nèi)的文本內(nèi)容
txtZYH.removeVerifyListener(lsnVrfy);
txtJBDM.removeVerifyListener(lsnVrfyJBDM);
txtZYH.setText("");
txtBRXM.setText("");
txtCSRQ.setText("");
txtBLH.setText("");
txtYF.setText("");
txtYLFWF.setText("");
txtQZZF1.setText("");
txtQZZF2.setText("");
txtJBDM.setText("");
txtBM.setText("");
txtZD.setText("");
cmbYPDM.setText("");
txtDJ.setText("");
txtJJDW.setText("");
txtSL.setText("");
txtJE.setText("");
txtZFBL.setText("");
txtZFJE.setText("");
txtGG.setText("");
txtCD.setText("");
txtCJ.setText("");
txtJFHJ.setText("");
txtFYHJ.setText("");
txtKS.setText("");
tblMiddle.removeAll();
//住院號文本框設(shè)置為可用
txtZYH.setEditable(true);
txtZYH.setFocus();
//Set txtCFYS with current user name
strSQL = "SELECT * FROM [SFUser] WHERE DQBJ='1'";
if(db.executeQuery(strSQL)){
try{
if(db.rs.next()){
txtCFYS.setText(db.rs.getString("UserID"));
}
}catch(SQLException se){}
}
else shwErrMsgBox_Query();
//Set txtCFRQ with current system datetime
txtCFRQ.setText( db.getSysDate() );
//給住院號文本框添加輸入驗(yàn)證監(jiān)聽器
txtZYH.addVerifyListener(lsnVrfy);
}
/**
* 將中間表格的列和行內(nèi)容返回到上次輸入藥品信息的狀態(tài)
* @see
* "藥"單選鈕點(diǎn)擊事件
* "繳費(fèi)合計(jì)"文本框丟失焦點(diǎn)事件,
* "費(fèi)用合計(jì)"文本框丟失焦點(diǎn)事件調(diào)用此方法
*/
private void backToYPXX(){
int i,j;
//如果表格顯示的繳費(fèi)明細(xì)信息
//則改變中間表格當(dāng)前是否繳費(fèi)明細(xì)的flag值
if(isCurrentJFMX) isCurrentJFMX = false;
//如果表格顯示的費(fèi)用明細(xì)信息則改變flag值
if(isCurrentFYMX) isCurrentFYMX = false;
final String[] COLUMN_NAMES_YPXX = {" ",
"藥名",
"單價(jià)",
"計(jì)價(jià)單位",
"數(shù)量",
"金額",
"自費(fèi)比例",
"自費(fèi)金額",
"規(guī)格"};
//清空中間表格行內(nèi)容
tblMiddle.removeAll();
j = tblMiddle.getColumnCount();
//釋放掉當(dāng)前中間表格的所有列
for(i = 0;i < j;i++)
colYPXX[i].dispose();
colYPXX = new TableColumn[COLUMN_NAMES_YPXX.length];
for (i = 0;i < 9; i++){
//新申請列
colYPXX[i] = new TableColumn(tblMiddle,SWT
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -