<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 14,  comments - 7,  trackbacks - 0
    項目需求:1.病人來掛號時根據自己想找的醫生掛相應的醫生的號,即加到相應醫生的病人隊列中。
                       2.醫生看見自己的屏幕,點擊自己的名字,得到自己相應列表的下一位病人
    具體代碼如下:
    醫生:
    package com.dr.queue;

    import java.util.LinkedList;
    import java.util.List;
    import java.util.Queue;

    public class Doctor {
        
    private String dName;
        
    private int dNum;
        
    private Queue<Patient> patientList;
        
    private Patient p;

        
    public Patient getP() {
            
    return p;
        }


        
    public void setP(Patient p) {
            
    this.p = p;
        }


        
    public Doctor(String name, int dNum) {
            
    this.setdName(dName);
            
    this.setdNum(dNum);
            patientList 
    = new LinkedList<Patient>();
            
    // this.setPatientList(new LinkedList<Patient>());
        }


        
    public Queue<Patient> getPatientList() {
            
    return patientList;
        }


        
    // public void setPatientList(Queue<Patient> patientList) {
        
    // this.patientList = patientList;
        
    // }
        public String getdName() {
            
    return dName;
        }


        
    public void setdName(String dName) {
            
    this.dName = dName;
        }


        
    public int getdNum() {
            
    return dNum;
        }


        
    public void setdNum(int dNum) {
            
    this.dNum = dNum;
        }


        
    public void offerPatient(Patient patient) {
            
    this.patientList.offer(patient);
            
    // return patientList;
        }


        
    public void looking() {
            System.out.println(
    "I handling the " + this.p.getpNum() + " waiter");
            
    try {
                Thread.sleep(
    100);
            }
     catch (InterruptedException e) {
                e.printStackTrace();
            }

            System.out.println(
    "I have handled the patient,next ,next ,next");

        }


    }

    病人:
    package com.dr.queue;

    public class Patient {
        
    private String pName;
    package com.dr.ui;

    import java.util.Queue;

    import org.eclipse.swt.SWT;
    import org.eclipse.swt.events.SelectionAdapter;
    import org.eclipse.swt.events.SelectionEvent;
    import org.eclipse.swt.graphics.Font;
    import org.eclipse.swt.widgets.Button;
    import org.eclipse.swt.widgets.Display;
    import org.eclipse.swt.widgets.Shell;
    import org.eclipse.swt.widgets.Text;

    import com.dr.queue.Patient;
    import com.dr.queue.QueueServer;

    public class DoctorQueueUI {
        
    public static void main(String[] args) {
            
    final Display display = Display.getDefault();
            
    final Shell shell = new Shell();
            shell.setMaximized(
    true);
            shell.setText(
    "醫生使用客戶端");

            
    // final Map<Doctor,List<Patient>> m = new
            
    // HashMap<Doctor,List<Patient>>();

            
    final Text txt = new Text(shell, SWT.MULTI);
            txt.setBounds(
    35050500450);

            QueueServer qs 
    = new QueueServer();
            
    final Queue<Patient> rosePL = qs.init("rose");
            
    final Queue<Patient> xiaoPL = qs.init("xiaoxiao");
            
    final Queue<Patient> yangPL = qs.init("yangguang");

            
    final Button button1 = new Button(shell, SWT.Activate);
            button1.setBounds(
    25053020075); // 設置按鈕位置
            button1.setFont(new Font(display, "宋體"12, SWT.BOLD));
            button1.setText(
    "一號專家rose");// 設置按鈕上的文字

            button1.addSelectionListener(
    new SelectionAdapter() {
                
    public void widgetSelected(SelectionEvent e) {

                    Patient patient 
    = rosePL.poll();

                    
    if (patient != null{
                        txt.setText(
    "" + patient.getpNum() + "號病人到一號專家rose這就診!");
                    }
     else {
                        txt.setText(
    "現在沒有病人就診,您可以休息一下!");
                    }

                    
    //                    
                }

            }
    );
            
    final Button button2 = new Button(shell, SWT.Activate);
            button2.setBounds(
    50053020075); // 設置按鈕位置
            button2.setFont(new Font(display, "宋體"12, SWT.BOLD));
            button2.setText(
    "二號專家xiaoxiao");// 設置按鈕上的文字

            button2.addSelectionListener(
    new SelectionAdapter() {
                
    public void widgetSelected(SelectionEvent e) {
                    Patient patient 
    = xiaoPL.poll();
                    
    if (patient != null{
                        txt
                                .setText(
    "" + patient.getpNum()
                                        
    + "號病人到二號專家xiaoxiao這就診");
                    }
     else {
                        txt.setText(
    "現在沒有病人就診,您可以休息一下");
                    }

                    
    //                        
                }

            }
    );
            
    final Button button3 = new Button(shell, SWT.Activate);
            button3.setBounds(
    75053020075); // 設置按鈕位置
            button3.setFont(new Font(display, "宋體"12, SWT.BOLD));
            button3.setText(
    "三好專家yangguang");// 設置按鈕上的文字

            button3.addSelectionListener(
    new SelectionAdapter() {
                
    public void widgetSelected(SelectionEvent e) {

                    Patient patient 
    = yangPL.poll();

                    
    if (patient != null{
                        txt.setText(
    "" + patient.getpNum()
                                
    + "號病人到三好專家yangguang這就診");
                    }
     else {
                        txt.setText(
    "現在沒有病人就診,您可以休息一下");
                    }

                    
    //                            
                }

            }
    );

            shell.layout();
            shell.open();
            
    while (!shell.isDisposed()) {
                
    if (!display.readAndDispatch())
                    display.sleep();
            }


        }

    }


        
    private int pNum;
        
    private int frontNum;
        
    public int getFrontNum() {
            
    return frontNum;
        }

        
    public void setFrontNum(int frontNum) {
            
    this.frontNum = frontNum;
        }

        
    public String getpName() {
            
    return pName;
        }

        
    public void setpName(String pName) {
            
    this.pName = pName;
        }

        
    public int getpNum() {
            
    return pNum;
        }

        
    public void setpNum(int pNum) {
            
    this.pNum = pNum;
        }

        
    }

    病人掛號界面UI:
    package com.dr.ui;

    import java.util.HashMap;
    import java.util.LinkedList;
    import java.util.List;
    import java.util.Map;
    import java.util.Queue;

    import org.eclipse.swt.SWT;
    import org.eclipse.swt.events.SelectionAdapter;
    import org.eclipse.swt.events.SelectionEvent;
    import org.eclipse.swt.graphics.Font;
    import org.eclipse.swt.widgets.Button;
    import org.eclipse.swt.widgets.Display;
    import org.eclipse.swt.widgets.Shell;
    import org.eclipse.swt.widgets.Text;

    import com.dr.queue.Doctor;
    import com.dr.queue.Patient;
    import com.dr.queue.QueueServer;

    public class PatientQueueUI {
        
    public static void main(String[] args) {
            
    final Display display = Display.getDefault();
            
    final Shell shell = new Shell();
            shell.setMaximized(
    true);
            shell.setText(
    "醫院排隊病人使用客戶端");

            
    // final Map<Doctor,Queue<Patient>> m = new
            
    // HashMap<Doctor,Queue<Patient>>();
            QueueServer qs = new QueueServer();
            
    final Queue<Patient> rosePL = qs.init("rose");
            
    final Queue<Patient> xiaoPL = qs.init("xiaoxiao");
            
    final Queue<Patient> yangPL = qs.init("yangguang");

            
    final Text txt = new Text(shell, SWT.MULTI);
            txt.setBounds(
    35050500450);

            
    final Button button1 = new Button(shell, SWT.Activate);
            button1.setBounds(
    25053020075); // 設置按鈕位置
            button1.setFont(new Font(display, "宋體"12, SWT.BOLD));
            button1.setText(
    "一號專家rose");// 設置按鈕上的文字
            final Button button2 = new Button(shell, SWT.Activate);
            button2.setBounds(
    50053020075); // 設置按鈕位置
            button2.setFont(new Font(display, "宋體"12, SWT.BOLD));
            button2.setText(
    "二號專家xiaoxiao");// 設置按鈕上的文字
            final Button button3 = new Button(shell, SWT.Activate);
            button3.setBounds(
    75053020075); // 設置按鈕位置
            button3.setFont(new Font(display, "宋體"12, SWT.BOLD));
            button3.setText(
    "三號專家yangguang");// 設置按鈕上的文字

            button1.addSelectionListener(
    new SelectionAdapter() {
                
    public void widgetSelected(SelectionEvent e) {
                    Doctor d1 
    = new Doctor("rose"1);
                    Patient patient 
    = new Patient();
                    
    // Queue<Patient> p1=m.get("xiaoxiao");
                    
    // d1.addPatient(patient);
                    rosePL.offer(patient);

                    patient.setpNum(rosePL.size());
                    patient.setFrontNum(rosePL.size() 
    - 1);
                    
    // m.put(d1, p1);

                    
    if (rosePL.size() <= 30{
                        txt.setText(
    "一號專家為您就診,\n" + "您現在排在" + rosePL.size()
                                
    + "號,\n" + "前面人數為" + patient.getFrontNum());
                    }
     else {
                        txt
                                .setText(
    "一號專家為您就診" + "您現在排在" + rosePL.size() + ""
                                        
    + "您前面已有" + patient.getFrontNum()
                                        
    + "人,\n您可以考慮其他專家");
                    }

                    
    //                        
                }

            }
    );
            button2.addSelectionListener(
    new SelectionAdapter() {
                
    public void widgetSelected(SelectionEvent e) {
                    Doctor d2 
    = new Doctor("xiaoxiao"1);
                    Patient patient 
    = new Patient();
                    
    // d1.addPatient(patient);
                    xiaoPL.offer(patient);

                    patient.setpNum(xiaoPL.size());
                    patient.setFrontNum(xiaoPL.size() 
    - 1);
                    
    // m.put(d2, p2);

                    
    if (xiaoPL.size() <= 30{
                        txt.setText(
    "二號專家為您就診,\n" + "您現在排在" + rosePL.size()
                                
    + "號,\n" + "前面人數為" + patient.getFrontNum());
                    }
     else {
                        txt
                                .setText(
    "二號專家為您就診,\n" + "您現在排在" + rosePL.size()
                                        
    + "" + "您前面已有" + patient.getFrontNum()
                                        
    + "人,\n您可以考慮其他專家");
                    }

                    
    //                        
                }

            }
    );
            button3.addSelectionListener(
    new SelectionAdapter() {
                
    public void widgetSelected(SelectionEvent e) {
                    Doctor d3 
    = new Doctor("yangguang"1);
                    Patient patient 
    = new Patient();
                    
    // d1.addPatient(patient);
                    yangPL.offer(patient);

                    patient.setpNum(yangPL.size());
                    patient.setFrontNum(yangPL.size() 
    - 1);
                    
    // m.put(d3, yangPL);
                    
    // System.out.println(m.get(d3));

                    
    if (yangPL.size() <= 30{
                        txt.setText(
    "三號專家為您就診,\n" + "您現在排在" + yangPL.size()
                                
    + "號,\n" + "前面人數為" + patient.getFrontNum());
                    }
     else {
                        txt.setText(
    "您前面已有" + patient.getFrontNum()
                                
    + "人,\n您可以考慮其他專家");
                    }

                    
    //                        
                }

            }
    );

            shell.layout();
            shell.open();
            
    while (!shell.isDisposed()) {
                
    if (!display.readAndDispatch())
                    display.sleep();
            }

        }

    }

    醫生界面UI:
    掛號時運行界面如下,點擊相應的專家會加到相應的專家中會是相應的專家為您就診:
    醫生叫號時運行界面如下,相應的專家點擊自己相應的名字可以出現自己相應的下一個病人的名字:
    posted on 2010-11-02 16:51 迷人笑笑 閱讀(3470) 評論(1)  編輯  收藏

    FeedBack:
    # re: java-醫院病人排隊掛號醫生叫號簡潔小系統
    2012-04-16 17:33 | sss
    代碼不全 QueueServer 沒有  回復  更多評論
      

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    <2012年4月>
    25262728293031
    1234567
    891011121314
    15161718192021
    22232425262728
    293012345

    常用鏈接

    留言簿(13)

    隨筆檔案

    文章檔案

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲精品无码久久久久AV麻豆| 日本片免费观看一区二区| 日本高清免费网站| 无码国产精品一区二区免费16| 久久九九兔免费精品6| 亚洲国产精品第一区二区| 久久美女网站免费| 久久亚洲国产成人亚| 一区二区三区观看免费中文视频在线播放| 亚洲人成色7777在线观看不卡| 黄页网址大全免费观看12网站| 可以免费观看一级毛片黄a | 亚洲最大黄色网站| 91精品国产免费入口| 亚洲一区二区三区播放在线| 天天看免费高清影视| 色偷偷噜噜噜亚洲男人| 一级毛片免费观看不卡视频| 亚洲视频在线观看免费| 114一级毛片免费| 亚洲韩国—中文字幕| 免费看韩国黄a片在线观看| 亚洲午夜理论片在线观看| 免费观看国产精品| a毛片视频免费观看影院| 亚洲精品自在线拍| 国产精品无码免费视频二三区| 久久av免费天堂小草播放| 久久亚洲精品无码VA大香大香| 67194熟妇在线永久免费观看 | 亚洲精品国产成人片| 国产成人免费在线| 羞羞漫画小舞被黄漫免费| 亚洲AV无码日韩AV无码导航| 很黄很色很刺激的视频免费| 看免费毛片天天看| 四虎免费永久在线播放| 日本一道本不卡免费| 亚洲视频在线观看2018| 韩国免费一级成人毛片| 无忧传媒视频免费观看入口|