JF_view_medicine.java
上传用户:whbcdz
上传日期:2008-08-04
资源大小:7683k
文件大小:25k
源码类别:

JavaScript

开发平台:

Java

  1. package appjxc.view;
  2. import java.awt.BorderLayout;
  3. import javax.swing.JFrame;
  4. import javax.swing.JTabbedPane;
  5. import javax.swing.JPanel;
  6. import javax.swing.JButton;
  7. import java.awt.FlowLayout;
  8. import java.awt.GridLayout;
  9. import javax.swing.JLabel;
  10. import javax.swing.JTextField;
  11. import javax.swing.*;
  12. import java.awt.Dimension;
  13. import appjxc.constrol.JTkeyAdapter;
  14. import java.awt.event.ActionEvent;
  15. import java.awt.event.ActionListener;
  16. import javax.swing.JInternalFrame;
  17. import appjxc.dao.AdapterDao;
  18. import java.awt.*;
  19. import java.awt.event.KeyAdapter;
  20. import java.awt.event.KeyEvent;
  21. import appjxc.model.obj_medicine;
  22. import javax.swing.table.DefaultTableModel;
  23. import appjxc.constrol.BuildTable;
  24. import java.awt.Font;
  25. public class JF_view_medicine extends JInternalFrame {
  26.     BorderLayout borderLayout1 = new BorderLayout();
  27.     JTabbedPane jTabbedPane1 = new JTabbedPane();
  28.     JPanel jPanel1 = new JPanel();
  29.     JPanel jPanel2 = new JPanel();
  30.     BorderLayout borderLayout2 = new BorderLayout();
  31.     JPanel jPanel3 = new JPanel();
  32.     JButton jBmodi = new JButton();
  33.     JButton jBsave = new JButton();
  34.     JButton jBadd = new JButton();
  35.     JButton jBexit = new JButton();
  36.     FlowLayout flowLayout2 = new FlowLayout();
  37.     JPanel jPanel4 = new JPanel();
  38.     GridLayout gridLayout1 = new GridLayout();
  39.     JLabel jLabel1 = new JLabel();
  40.     JTextField jTextField1 = new JTextField();
  41.     JLabel jLabel2 = new JLabel();
  42.     JTextField jTextField2 = new JTextField();
  43.     JLabel jLabel3 = new JLabel();
  44.     JTextField jTextField3 = new JTextField();
  45.     JLabel jLabel4 = new JLabel();
  46.     JTextField jTextField4 = new JTextField();
  47.     JLabel jLabel5 = new JLabel();
  48.     JTextField jTextField5 = new JTextField();
  49.     JLabel jLabel6 = new JLabel();
  50.     JLabel jLabel7 = new JLabel();
  51.     JTextField jTextField7 = new JTextField();
  52.     JLabel jLabel8 = new JLabel();
  53.     JLabel jLabel9 = new JLabel();
  54.     JTextField jTextField9 = new JTextField();
  55.     JLabel jLabel10 = new JLabel();
  56.     JTextField jTextField10 = new JTextField();
  57.     JLabel jLabel11 = new JLabel();
  58.     JLabel jLabel12 = new JLabel();
  59.     JLabel jLabel13 = new JLabel();
  60.     JLabel jLabel14 = new JLabel();
  61.     JTextField jTextField14 = new JTextField();
  62.     JLabel jLabel15 = new JLabel();
  63.     JTextField jTextField15 = new JTextField();
  64.     JLabel jLabel16 = new JLabel();
  65.     JTextField jTextField16 = new JTextField();
  66.     JLabel jLabel17 = new JLabel();
  67.     JTextField jTextField17 = new JTextField();
  68.     JLabel jLabel18 = new JLabel();
  69.     JLabel jLabel19 = new JLabel();
  70.     JTextField jTextField19 = new JTextField();
  71.     Object[] dw = {"盒","包","袋","个","罐","粒","片","瓶"};
  72.     Object[] jyfs = {"经销","代销"};
  73.     Object[] zlbz = {"中国药典","卫生部药品标准","地方药品标准","进口国药标准","企业标准"};
  74.     Object[] jx = {"针剂","片剂","胶囊","口服液","冲剂","丸剂"};
  75.     Object[] yxq = {"半年","一年","一年半","二年","二年半","三年","三年以上"};
  76.     Object[] lb = {"西药","中药","中成药","中成药(外用)","消毒","参茸"};
  77.     JComboBox jCdw = new JComboBox(dw);
  78.     JComboBox jCzlbz = new JComboBox(zlbz);
  79.     JComboBox jCjyfs = new JComboBox(jyfs);
  80.     JComboBox jCyj = new JComboBox(jx);
  81.     JComboBox jCyxq = new JComboBox(yxq);
  82.     JComboBox jClb = new JComboBox(lb);
  83.     BorderLayout borderLayout3 = new BorderLayout();
  84.     JScrollPane jScrollPane1 = new JScrollPane();
  85.     JTable jTable1 = new JTable();
  86.     JLabel jLabel21 = new JLabel();
  87.     JTextField jTbh = new JTextField();
  88.     JPanel jPanel5 = new JPanel();
  89.     FlowLayout flowLayout1 = new FlowLayout();
  90.     JLabel jLabel22 = new JLabel();
  91.     JTextField jTvalue = new JTextField();
  92.     JComboBox jCysf = new JComboBox();
  93.     JLabel jLabel23 = new JLabel();
  94.     JLabel jLabel24 = new JLabel();
  95.     JComboBox jCzd = new JComboBox();
  96.     JButton jBquery = new JButton();
  97.     JButton jBlookall = new JButton();
  98.     JButton jButton3 = new JButton();
  99.     public JF_view_medicine() {
  100.         try {
  101.             jbInit();
  102.         } catch (Exception exception) {
  103.             exception.printStackTrace();
  104.         }
  105.     }
  106.     private void jbInit() throws Exception {
  107.         jCzd.addItem("药品编号");
  108.         jCzd.addItem("拼音编码");
  109.         jCysf.addItem("like");
  110.         jCysf.addItem(">");
  111.         jCysf.addItem("=");
  112.         jCysf.addItem("<");
  113.         jCdw.setEditable(true);
  114.         jCdw.configureEditor(jCdw.getEditor(),"盒");
  115.         jCzlbz.setEditable(true);
  116.         jCzlbz.configureEditor(jCzlbz.getEditor(),"中国药典");
  117.         jCjyfs.setEditable(true);
  118.         jCjyfs.configureEditor(jCjyfs.getEditor(),"经销");
  119.         jCyj.setEditable(true);
  120.         jCyj.configureEditor(jCyj.getEditor(),"针剂");
  121.         jCyxq.setEditable(true);
  122.         jCyxq.configureEditor(jCyxq.getEditor(),"半年");
  123.         jClb.setEditable(true);
  124.         jClb.configureEditor(jClb.getEditor(),"西药");
  125.         getContentPane().setLayout(borderLayout1);
  126.         jPanel1.setLayout(borderLayout2);
  127.         jBmodi.setText("修改");
  128.         jBmodi.addActionListener(new JF_view_medicine_jBmodi_actionAdapter(this));
  129.         jBsave.setText("保存");
  130.         jBsave.addActionListener(new JF_view_medicine_jBsave_actionAdapter(this));
  131.         jBadd.setText("添加");
  132.         jBadd.addActionListener(new JF_view_medicine_jBadd_actionAdapter(this));
  133.         jBexit.setText("退出");
  134.         jBexit.addActionListener(new JF_view_medicine_jBexit_actionAdapter(this));
  135.         jPanel2.setLayout(borderLayout3);
  136.         jPanel3.setLayout(flowLayout2);
  137.         jPanel4.setLayout(gridLayout1);
  138.         gridLayout1.setColumns(4);
  139.         gridLayout1.setRows(10);
  140.         jLabel1.setText("药品编号");
  141.         jTextField1.setText("");
  142.         jLabel2.setText("药品名称");
  143.         jTextField2.setText("");
  144.         jLabel3.setText("药品条码");
  145.         jTextField3.setText("");
  146.         jLabel4.setText("通用名称");
  147.         jTextField4.setText("");
  148.         jLabel5.setText("拼音码");
  149.         jTextField5.setText("");
  150.         jLabel6.setText("单位");
  151.         jLabel7.setText("规格");
  152.         jTextField7.setText("");
  153.         jLabel8.setText("剂型");
  154.         jLabel9.setText("产地");
  155.         jTextField9.setText("");
  156.         jLabel10.setText("包装数量");
  157.         jTextField10.setText("");
  158.         jLabel11.setText("有效期");
  159.         jLabel12.setText("质量标准");
  160.         jLabel13.setText("经营方式");
  161.         jLabel14.setText("批号");
  162.         jTextField14.setText("");
  163.         jLabel15.setText("零售价格");
  164.         jTextField15.setText("");
  165.         jLabel16.setText("进货价格");
  166.         jTextField16.setText("");
  167.         jLabel17.setText("批发价格");
  168.         jTextField17.setText("");
  169.         jLabel18.setText("药品类名");
  170.         jLabel19.setText("医疗保险编号");
  171.         jTextField19.setText("");
  172.         flowLayout2.setAlignment(FlowLayout.RIGHT);
  173.         jLabel21.setText("药品编号");
  174.         jTbh.setPreferredSize(new Dimension(126, 29));
  175.         jTbh.setText("");
  176.         jPanel1.setBorder(null);
  177.         jPanel4.setBorder(BorderFactory.createLoweredBevelBorder());
  178.         jPanel3.setBorder(BorderFactory.createLineBorder(Color.black));
  179.         jPanel5.setLayout(flowLayout1);
  180.         jLabel22.setText("数值:");
  181.         jTvalue.setPreferredSize(new Dimension(110, 22));
  182.         jTvalue.setText("");
  183.         jLabel23.setText("运算符:");
  184.         jLabel24.setText("类别:");
  185.         jBquery.setText("检索");
  186.         jBquery.addActionListener(new JF_view_medicine_jBquery_actionAdapter(this));
  187.         jBlookall.setText("全部查看");
  188.         jBlookall.addActionListener(new
  189.                                     JF_view_medicine_jBlookall_actionAdapter(this));
  190.         jButton3.setText("关闭");
  191.         jButton3.addActionListener(new JF_view_medicine_jButton3_actionAdapter(this));
  192.         jPanel5.setBorder(BorderFactory.createLoweredBevelBorder());
  193.         jScrollPane1.setBorder(BorderFactory.createLineBorder(Color.black));
  194.         jCzd.setPreferredSize(new Dimension(99, 22));
  195.         jCysf.setPreferredSize(new Dimension(59, 22));
  196.         jTable1.setAutoscrolls(false);
  197.         jTable1.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
  198.         this.getContentPane().add(jTabbedPane1, java.awt.BorderLayout.CENTER);
  199.         jTabbedPane1.add(jPanel1, "基本录入");
  200.         jTabbedPane1.add(jPanel2, "数据浏览");
  201.         jPanel3.add(jLabel21);
  202.         jPanel3.add(jTbh);
  203.         jPanel3.add(jBmodi);
  204.         jPanel3.add(jBadd);
  205.         jPanel3.add(jBsave);
  206.         jPanel3.add(jBexit);
  207.         jPanel1.add(jPanel4, java.awt.BorderLayout.CENTER);
  208.         jPanel4.add(jLabel1);
  209.         jPanel4.add(jTextField1);
  210.         jPanel4.add(jLabel2);
  211.         jPanel4.add(jTextField2);
  212.         jPanel4.add(jLabel3);
  213.         jPanel4.add(jTextField3);
  214.         jPanel4.add(jLabel4);
  215.         jPanel4.add(jTextField4);
  216.         jPanel4.add(jLabel5);
  217.         jPanel4.add(jTextField5);
  218.         jPanel4.add(jLabel6);
  219.         jPanel4.add(jCdw);
  220.         jPanel4.add(jLabel7);
  221.         jPanel4.add(jTextField7);
  222.         jPanel4.add(jLabel8);
  223.         jPanel4.add(jCyj);
  224.         jPanel4.add(jLabel9);
  225.         jPanel4.add(jTextField9);
  226.         jPanel4.add(jLabel10);
  227.         jPanel4.add(jTextField10);
  228.         jPanel4.add(jLabel11);
  229.         jPanel4.add(jCyxq);
  230.         jPanel4.add(jLabel12);
  231.         jPanel4.add(jCzlbz);
  232.         jPanel4.add(jLabel13);
  233.         jPanel4.add(jCjyfs);
  234.         jPanel4.add(jLabel14);
  235.         jPanel4.add(jTextField14);
  236.         jPanel4.add(jLabel15);
  237.         jPanel4.add(jTextField15);
  238.         jPanel4.add(jLabel16);
  239.         jPanel4.add(jTextField16);
  240.         jPanel4.add(jLabel17);
  241.         jPanel4.add(jTextField17);
  242.         jPanel4.add(jLabel18);
  243.         jPanel4.add(jClb);
  244.         jPanel4.add(jLabel19);
  245.         jPanel4.add(jTextField19);
  246.         jPanel1.add(jPanel3, java.awt.BorderLayout.SOUTH);
  247.         jPanel2.add(jScrollPane1, java.awt.BorderLayout.CENTER); //JLabel ss = (JLabel)jPanel4.getComponent(0);
  248.         jPanel2.add(jPanel5, java.awt.BorderLayout.NORTH);
  249.         jPanel5.add(jLabel24);
  250.         jPanel5.add(jCzd);
  251.         jPanel5.add(jLabel23);
  252.         jPanel5.add(jCysf);
  253.         jPanel5.add(jLabel22);
  254.         jPanel5.add(jTvalue);
  255.         jPanel5.add(jBquery);
  256.         jPanel5.add(jBlookall);
  257.         jPanel5.add(jButton3);
  258.         jScrollPane1.getViewport().add(jTable1); //System.out.println(ss.getText());
  259.         jTextField1.addKeyListener(new JTkeyAdapter(jTextField2));
  260.         jTextField2.addKeyListener(new JTkeyAdapter(jTextField3));
  261.         jTextField3.addKeyListener(new JTkeyAdapter(jTextField4));
  262.         jTextField4.addKeyListener(new JTkeyAdapter(jTextField5));
  263.         jTextField5.addKeyListener(new JTkeyAdapter(jTextField7));
  264.         jCdw.addKeyListener(new JTkeyAdapter(jTextField7));
  265.         jTextField7.addKeyListener(new JTkeyAdapter(jTextField9));
  266.         jTextField9.addKeyListener(new JTkeyAdapter(jTextField10));
  267.         jTextField10.addKeyListener(new JTkeyAdapter(jTextField14));
  268.         jTextField14.addKeyListener(new JTkeyAdapter(jTextField15));
  269.         jTextField15.addKeyListener(new JTkeyAdapter(jTextField16));
  270.         jTextField16.addKeyListener(new JTkeyAdapter(jTextField17));
  271.         jTextField17.addKeyListener(new JTkeyAdapter(jTextField19));
  272.         jTbh.addKeyListener(new JF_view_medicine_jTbh_keyAdapter(this));
  273.        /* UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
  274.         SwingUtilities.updateComponentTreeUI(this);*/
  275.         setVisible(true);
  276.         setSize(new Dimension(782, 502));
  277.         this.setClosable(true);
  278.         this.setMaximizable(true);
  279.         this.setTitle("药品基本信息情况");
  280.         getGys();
  281.     }
  282.     public void jBsave_actionPerformed(ActionEvent e) {
  283.         int result = JOptionPane.showOptionDialog(null,"是否进行药品基本信息情况存盘?","系统提示",
  284.                                    JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,
  285.                                    null,new String[]  {"是","否"},"否");
  286.        if (result == JOptionPane.NO_OPTION) return;
  287.         JTextField jText = null;
  288.         String className = null;
  289.         for (int i = 0 ; i <= 37 ; i++){
  290.             //System.out.println("class = " + jPanel4.getComponent(i).getClass().getName());
  291.             className = jPanel4.getComponent(i).getClass().getName();
  292.             if (className.equals("javax.swing.JTextField")){
  293.                 jText = (JTextField)jPanel4.getComponent(i);
  294.                 if(jText.getText().length() <= 0){
  295.                     JLabel jLstr = null;
  296.                     jLstr = (JLabel)jPanel4.getComponent(i - 1);
  297.                     JOptionPane.showMessageDialog(null,jLstr.getText() + "不允许为空,请录入!!!", "系统提示",
  298.                                                   JOptionPane.ERROR_MESSAGE);
  299.                     jText.requestFocus();
  300.                     return;
  301.                 }
  302.             }
  303.         }
  304.         appjxc.model.obj_medicine medicine = new appjxc.model.obj_medicine();
  305.         medicine.setYpbh(jTextField1.getText().trim());
  306.         medicine.setYpmc(jTextField2.getText().trim());
  307.         medicine.setYptm(jTextField3.getText().trim());
  308.         medicine.setTym(jTextField4.getText().trim());
  309.         medicine.setPym(jTextField5.getText().trim());
  310.         medicine.setDw(jCdw.getSelectedItem().toString());
  311.         medicine.setGg(jTextField7.getText().trim());
  312.         medicine.setJx(jCyj.getSelectedItem().toString());
  313.         medicine.setCd(jTextField9.getText().trim());
  314.         int bzsl;
  315.         Double lsjg,jhjg,pfjg;
  316.         try{
  317.             bzsl = Integer.parseInt(jTextField10.getText().trim());
  318.             lsjg = Double.valueOf(jTextField15.getText().trim());
  319.             jhjg = Double.valueOf(jTextField16.getText().trim());
  320.             pfjg = Double.valueOf(jTextField17.getText().trim());
  321.         }catch(java.lang.NumberFormatException format){
  322.            JOptionPane.showMessageDialog(null, "输入的数据格式有误,请重新录入!!n" + format.getMessage(), "系统提示",JOptionPane.ERROR_MESSAGE);
  323.            System.out.println(format.getMessage());
  324.            return;
  325.        }
  326.        medicine.setBzsl(bzsl);
  327.        medicine.setYxq(jCyxq.getSelectedItem().toString());
  328.         /*java.sql.Date yxq;
  329.         try{
  330.             yxq = java.sql.Date.valueOf(jCyxq.getSelectedItem().toString().trim());
  331.         }catch(java.lang.IllegalArgumentException argument){
  332.             JOptionPane.showMessageDialog(null, "输入的日期数据格式有误,请重新录入!!n" + argument.getMessage(), "系统提示",JOptionPane.ERROR_MESSAGE);
  333.             jCyxq.requestFocus();
  334.             return;
  335.        }
  336.        System.out.println("dw :" + jCdw.getSelectedItem().toString());
  337.        System.out.println("jCzlbz :" + jCzlbz.getSelectedItem().toString());
  338.        System.out.println("jCjyfs :" + jCjyfs.getSelectedItem().toString());
  339.        System.out.println("jClb :" + jClb.getSelectedItem().toString());
  340.        System.out.println("jCyxq :" + jCyxq.getSelectedItem().toString());*/
  341.        medicine.setZlbz(jCzlbz.getSelectedItem().toString());
  342.        medicine.setJyfs(jCjyfs.getSelectedItem().toString());
  343.        medicine.setPh(jTextField14.getText().trim());
  344.        medicine.setLsjg(lsjg);
  345.        medicine.setJhjg(jhjg);
  346.        medicine.setPfjg(pfjg);
  347.        medicine.setYplb(jClb.getSelectedItem().toString());
  348.        medicine.setYlbh(jTextField19.getText().trim());
  349.      //  medicine.setGysbh(.toString());
  350.     //  AdapterDao dao = new AdapterDao();
  351.       appjxc.model.Obj_Stock objstock = new appjxc.model.Obj_Stock();
  352.       objstock.setYpbh(jTextField1.getText().trim());
  353.       objstock.setRksl(0);
  354.       objstock.setXssl(0);
  355.       objstock.setKcsl(0);
  356.       objstock.setPdsl(0);
  357.       objstock.setPdrq(null);
  358.       if(AdapterDao.insertmedicine(medicine) && AdapterDao.InsertStock(objstock)){
  359.           JOptionPane.showMessageDialog(null,"药品基本数据存盘成功","系统提示",JOptionPane.INFORMATION_MESSAGE);
  360.       }else{
  361.           JOptionPane.showMessageDialog(null,"药品基本数据存盘失败","系统提示",JOptionPane.ERROR_MESSAGE);
  362.       }
  363.     }
  364.     public void jTbh_keyPressed(KeyEvent e) {
  365.         if (e.getKeyCode() == KeyEvent.VK_ENTER) {
  366.             if (e.getSource().equals(jTbh)){
  367.                 String bh = jTbh.getText().trim();
  368.                 if (bh.length() <= 0) {
  369.                     JOptionPane.showMessageDialog(null, "编号不允许为空!!!", "系统提示",
  370.                                                   JOptionPane.ERROR_MESSAGE);
  371.                     jTbh.requestFocus();
  372.                     return;
  373.                 }
  374.                 String QueryStr = null;
  375.                 java.util.List list = null;
  376.                 java.util.Iterator iterator = null;
  377.                 QueryStr = " from obj_medicine where ypbh = '" + bh + "'";
  378.                 list = AdapterDao.QueryObject(QueryStr);
  379.                 if (list.isEmpty()) {
  380.                     JOptionPane.showMessageDialog(null, "编号不存在请重新输入!!!", "系统提示",
  381.                                                   JOptionPane.ERROR_MESSAGE);
  382.                     jTbh.requestFocus();
  383.                     return;
  384.                 }
  385.                 iterator = list.iterator();
  386.                 while (iterator.hasNext()) {
  387.                     obj_medicine objmdedi = (obj_medicine) iterator.next();
  388.                     jTextField1.setText(objmdedi.getYpbh());
  389.                     jTextField2.setText(objmdedi.getYpmc());
  390.                     jTextField3.setText(objmdedi.getYptm());
  391.                     jTextField4.setText(objmdedi.getTym());
  392.                     jTextField5.setText(objmdedi.getPym());
  393.                     jCdw.setSelectedItem(objmdedi.getDw());
  394.                     jTextField7.setText(objmdedi.getGg());
  395.                     jCyj.setSelectedItem(objmdedi.getJx());
  396.                     jTextField9.setText(objmdedi.getCd());
  397.                     jTextField10.setText(String.valueOf(objmdedi.getBzsl()));
  398.                     jCyxq.setSelectedItem(objmdedi.getYxq());
  399.                     jCzlbz.setSelectedItem(objmdedi.getZlbz());
  400.                     jCjyfs.setSelectedItem(objmdedi.getJyfs());
  401.                     jTextField14.setText(objmdedi.getPh());
  402.                     jTextField15.setText(objmdedi.getLsjg().toString());
  403.                     jTextField16.setText(objmdedi.getJhjg().toString());
  404.                     jTextField17.setText(objmdedi.getPfjg().toString());
  405.                     jClb.setSelectedItem(objmdedi.getYplb());
  406.                     jTextField19.setText(objmdedi.getYlbh());
  407.                 }
  408.                 jTextField1.setEnabled(false);
  409.                 jTextField2.requestFocus();
  410.             }
  411.         }
  412.     }
  413.     public void jBexit_actionPerformed(ActionEvent e) {
  414.         javax.swing.DefaultDesktopManager manger = new DefaultDesktopManager();
  415.         int result = JOptionPane.showOptionDialog(null,"是否真的退出药品基本信息情况?","系统提示",
  416.                                    JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,
  417.                                    null,new String[]  {"是","否"},"否");
  418.         if (result == JOptionPane.YES_OPTION) {
  419.             /*try{
  420.                 UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
  421.                 SwingUtilities.updateComponentTreeUI(this);
  422.             }catch(Exception ex){
  423.                 ex.printStackTrace();
  424.             }*/
  425.            manger.closeFrame(this);
  426.         }
  427.     }
  428.     public void jBmodi_actionPerformed(ActionEvent e) {
  429.         KeyEvent ke = new KeyEvent(jTbh,0,0,0,KeyEvent.VK_ENTER,'e',0);
  430.         jTbh_keyPressed(ke);
  431.     }
  432.     public void getGys(){
  433.         String QueryGys = null;
  434.         QueryGys = "from Obj_gys";
  435.         java.util.List gyslist = AdapterDao.QueryObject(QueryGys);
  436.         java.util.Iterator iteragys = gyslist.iterator();
  437.         while(iteragys.hasNext()){
  438.             appjxc.model.Obj_gys gys = (appjxc.model.Obj_gys)iteragys.next();
  439.         }
  440.     }
  441.     public void jBadd_actionPerformed(ActionEvent e) {
  442.         String QueryStr = null;
  443.         QueryStr = "Select max(m.ypbh) from obj_medicine m";
  444.         java.util.List list = null;
  445.         list = AdapterDao.QueryObject(QueryStr);
  446.         String bh=null;
  447.         bh = String.valueOf(list.get(0));
  448.         System.out.println("bh =" + bh);
  449.         if (bh.equals("null")){
  450.             bh = "10000";
  451.         }else{
  452.             int max = Integer.parseInt(list.get(0).toString()) + 1;
  453.             bh = String.valueOf(max);
  454.         }
  455.         jTextField1.setText(bh);
  456.         jTextField2.setText("");
  457.         jTextField3.setText("");
  458.         jTextField4.setText("");
  459.         jTextField5.setText("");
  460.         jTextField7.setText("");
  461.         jTextField9.setText("");
  462.         jTextField10.setText("");
  463.         jTextField14.setText("");
  464.         jTextField15.setText("");
  465.         jTextField16.setText("");
  466.         jTextField17.setText("");
  467.         jTextField19.setText("");
  468.         jTextField1.setEnabled(false);
  469.         jTextField2.requestFocus();
  470.     }
  471.     public void jBlookall_actionPerformed(ActionEvent e) {
  472.         DefaultTableModel defaultModel ;
  473.         BuildTable buildTable = new BuildTable();
  474.         defaultModel = buildTable.getmedicineTableModel(" from obj_medicine ");
  475.         jTable1.setModel(defaultModel);
  476.         if (defaultModel==null){
  477.             JOptionPane.showMessageDialog(null,"没有查询到该条件下的数据","系统提示",JOptionPane.ERROR_MESSAGE);
  478.             return;
  479.         }
  480.         jTable1.setRowHeight(22);
  481.         jTabbedPane1.setSelectedIndex(1);
  482.     }
  483.     public void jBquery_actionPerformed(ActionEvent e) {
  484.         if (jTvalue.getText().trim().length() <= 0 ){
  485.             JOptionPane.showMessageDialog(null,"查询数值不能为空,请输入!!!","系统提示",JOptionPane.ERROR_MESSAGE);
  486.             jTvalue.requestFocus();
  487.             return;
  488.         }
  489.         String queryName,queryYsf,queryValue;
  490.         String[] queryName1 = {"ypbh","pym"};
  491.         int index1 = jCzd.getSelectedIndex();
  492.         queryName = queryName1[index1];
  493.         queryYsf = jCysf.getSelectedItem().toString().trim();
  494.         if (queryYsf.equals("like") || queryYsf == "like"){
  495.             queryValue = "%" + jTvalue.getText().trim() + "%";
  496.         }else{
  497.             queryValue = jTvalue.getText().trim();
  498.         }
  499.         String queryStr ;
  500.         queryStr = " from obj_medicine  where " +  queryName + " " + queryYsf + " '" +  queryValue + "'";
  501.         DefaultTableModel defaultModel = null;
  502.         BuildTable buildTable = new BuildTable();
  503.         defaultModel = buildTable.getmedicineTableModel(queryStr);
  504.         //System.out.println("defaultModel:" + defaultModel);
  505.         jTable1.setModel(defaultModel);
  506.         if (defaultModel.getRowCount() <= 0 ){
  507.             JOptionPane.showMessageDialog(null,"没有查询到该条件下的数据","系统提示",JOptionPane.ERROR_MESSAGE);
  508.             jTextField1.requestFocus();
  509.             return;
  510.         }
  511.         jTable1.setRowHeight(22);
  512.         jTabbedPane1.setSelectedIndex(1);
  513.     }
  514.     public void jButton3_actionPerformed(ActionEvent e) {
  515.         jBexit_actionPerformed(e);
  516.     }
  517. }
  518. class JF_view_medicine_jButton3_actionAdapter implements ActionListener {
  519.     private JF_view_medicine adaptee;
  520.     JF_view_medicine_jButton3_actionAdapter(JF_view_medicine adaptee) {
  521.         this.adaptee = adaptee;
  522.     }
  523.     public void actionPerformed(ActionEvent e) {
  524.         adaptee.jButton3_actionPerformed(e);
  525.     }
  526. }
  527. class JF_view_medicine_jBquery_actionAdapter implements ActionListener {
  528.     private JF_view_medicine adaptee;
  529.     JF_view_medicine_jBquery_actionAdapter(JF_view_medicine adaptee) {
  530.         this.adaptee = adaptee;
  531.     }
  532.     public void actionPerformed(ActionEvent e) {
  533.         adaptee.jBquery_actionPerformed(e);
  534.     }
  535. }
  536. class JF_view_medicine_jBlookall_actionAdapter implements ActionListener {
  537.     private JF_view_medicine adaptee;
  538.     JF_view_medicine_jBlookall_actionAdapter(JF_view_medicine adaptee) {
  539.         this.adaptee = adaptee;
  540.     }
  541.     public void actionPerformed(ActionEvent e) {
  542.         adaptee.jBlookall_actionPerformed(e);
  543.     }
  544. }
  545. class JF_view_medicine_jBadd_actionAdapter implements ActionListener {
  546.     private JF_view_medicine adaptee;
  547.     JF_view_medicine_jBadd_actionAdapter(JF_view_medicine adaptee) {
  548.         this.adaptee = adaptee;
  549.     }
  550.     public void actionPerformed(ActionEvent e) {
  551.         adaptee.jBadd_actionPerformed(e);
  552.     }
  553. }
  554. class JF_view_medicine_jBmodi_actionAdapter implements ActionListener {
  555.     private JF_view_medicine adaptee;
  556.     JF_view_medicine_jBmodi_actionAdapter(JF_view_medicine adaptee) {
  557.         this.adaptee = adaptee;
  558.     }
  559.     public void actionPerformed(ActionEvent e) {
  560.         adaptee.jBmodi_actionPerformed(e);
  561.     }
  562. }
  563. class JF_view_medicine_jTbh_keyAdapter extends KeyAdapter {
  564.     private JF_view_medicine adaptee;
  565.     JF_view_medicine_jTbh_keyAdapter(JF_view_medicine adaptee) {
  566.         this.adaptee = adaptee;
  567.     }
  568.     public void keyPressed(KeyEvent e) {
  569.         adaptee.jTbh_keyPressed(e);
  570.     }
  571. }
  572. class JF_view_medicine_jBexit_actionAdapter implements ActionListener {
  573.     private JF_view_medicine adaptee;
  574.     JF_view_medicine_jBexit_actionAdapter(JF_view_medicine adaptee) {
  575.         this.adaptee = adaptee;
  576.     }
  577.     public void actionPerformed(ActionEvent e) {
  578.         adaptee.jBexit_actionPerformed(e);
  579.     }
  580. }
  581. class JF_view_medicine_jBsave_actionAdapter implements ActionListener {
  582.     private JF_view_medicine adaptee;
  583.     JF_view_medicine_jBsave_actionAdapter(JF_view_medicine adaptee) {
  584.         this.adaptee = adaptee;
  585.     }
  586.     public void actionPerformed(ActionEvent e) {
  587.         adaptee.jBsave_actionPerformed(e);
  588.     }
  589. }