zoukankan      html  css  js  c++  java
  • 第五章 体验套餐管理系统

    体检套餐管理系统

    套餐含义:体检套餐是一种形象的说法,体检的项目有很多,常规的项目就有几十种,个人体质、疾病的种类、体检者对体检项目的要求各不相同,全部的体检项目大概要几百种。普通的消费者不具备医学专业知识,所以也就无法从众多的体检项目中选择适合自己的体检项目。如果选择的项目过多,则浪费体检费用,选择的项目过少,又不能对需要检测的症状进行全面检测,很容易造成漏检。经过有多年经验的专家在对疾病预防经验的综合整理后,对体检项目进行科学分组,针对人群的年龄、体质、疾病类型、健康要求而制定的科学的体检项目组合方案,同时根据客户的需要和对体检项目的综合研究,制定出的符合不同客户人群的一套体检项目的组合。

        *创建体检项目维护系统中的检查项目类,体检套餐类

    public class HealthCheckSet

    {
    //每个套餐包括要检查的项目、套餐名称、总价
    public HealthCheckSet()
    {
    items = new List<HealthCheckItem>();
    }
    public HealthCheckSet(string name,List<HealthCheckItem>items)
    {
    this.Name = name;
    this.items = items;
    }
    //套餐价格
    private int price;
    //检查项目
    private List<HealthCheckItem> items;
    private string name;

    public string Name
    {
    get { return name; }
    set { name = value; }
    }

    public List<HealthCheckItem> Items
    {
    get { return items; }
    set { items = value; }
    }

    public int Price
    {
    get { return price; }
    set { price = value; }
    }

    public class HealthCheckItem
    {
    //项目描述
    private string description;

    public string Description
    {
    get { return description; }
    set { description = value; }
    }
    //项目名称
    private string name;

    public string Name
    {
    get { return name; }
    set { name = value; }
    }
    //项目价格
    private int price;

    public int Price
    {
    get { return price; }
    set { price = value; }
    }

          *系统默认体重一种套餐“入学体检”填充对象到窗体

      

    //定义1个系统默认检查套餐"入学体检"
    HealthCheckSet setA;

    //生成默认套餐数据
    private void InitSets()
    {
    //创建1种默认套餐对象
    items = new List<HealthCheckItem>();
    items.Add(height);
    items.Add(weight);
    items.Add(liver);

    setA = new HealthCheckSet("入学体检", items);
    //计算套餐价格
    setA.CalcPrice();
    this.HealthSet.Add("入学体检", setA);
    }

        *从DataGridView控件中选中一项,点击“删除”按钮,将选中项从套餐中删除

    //删除
    private void btnDel_Click(object sender, EventArgs e)
    {
    string setName = this.cboSets.Text;
    if (this.dgvHealthList.SelectedRows.Count == 0)
    {
    MessageBox.Show("没有选择删除项。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
    return;
    }
    //获取选中项目的索引
    int index = this.dgvHealthList.SelectedRows[0].Index;
    //删除检查项
    this.HealthSet[setName].Items.RemoveAt(index);
    //重新计算价格
    this.HealthSet[setName].CalcPrice();
    //更新DataGridView显示
    UpdateSet(HealthSet[setName]);
    //重设标签显示
    lblSetName.Text = setA.Name;
    string cboSetText = this.cboSets.Text;
    lblSetPrice.Text = this.HealthSet[cboSetText].Price.ToString();
    MessageBox.Show("删除成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
    }

        *添加套餐检查项目信息

      

    //添加检查项目
    private void btnAdd_Click(object sender, EventArgs e)
    {
    if (this.cboItems.SelectedIndex == 0)
    {
    MessageBox.Show("请选择一个项目");
    return;
    }
    string cboSetText = this.cboSets.Text;
    if (cboSetText == "请选择")
    {
    MessageBox.Show("请选择套餐!");
    return;
    }
    int index = this.cboItems.SelectedIndex;
    if (!this.HealthSet[cboSetText].Items.Contains(allCheckItems[index]))
    {
    this.HealthSet[cboSetText].Items.Add(allCheckItems[index]);
    this.HealthSet[cboSetText].CalcPrice();
    UpdateSet(this.HealthSet[cboSetText]);
    this.lblSetName.Text = this.HealthSet[cboSetText].Name; //刷新窗体集合A名称
    this.lblSetPrice.Text = this.HealthSet[cboSetText].Price.ToString(); //刷新集合A价格
    MessageBox.Show("添加成功。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
    }
    else
    {
    MessageBox.Show("该项目存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    }

          *新建套餐

    //将新的套餐名称添加到套餐列表里面
    private void btnOK_Click(object sender, EventArgs e)
    {
    if (string.IsNullOrEmpty(txtHealthName.Text))
    {
    MessageBox.Show("请输入套餐名称", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
    return;//结束方法
    }
    else
    {
    //声明一个套餐对象
    HealthCheckSet Hch = new HealthCheckSet();
    //将套餐对对象添加到Dictionary中
    this.HealthSet.Add(this.txtHealthName.Text, Hch);
    this.InitHealthSetList();
    //下拉框显示刚添加的内容
    this.cboSets.SelectedIndex = this.HealthSet.Count;
    lblSetName.Text = cboSets.Text;
    Hch.Name = cboSets.Text;

    MessageBox.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
    this.btnAdd.Enabled = true;
    this.btnDel.Enabled = true;
    }
    }

  • 相关阅读:
    概率算法_二项分布和泊松分布
    数据库_存储过程简介(oracle版)
    机器学习算法_knn(福利)
    统计算法_概率基础
    统计算法_数值/线性关系度量
    Python总结
    Python 冒泡排序法分析
    Oracle练习详解
    LINUX基础了解
    LINUX下OA搭建
  • 原文地址:https://www.cnblogs.com/gaoweixiao99/p/4620172.html
Copyright © 2011-2022 走看看