体检套餐系统

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 体检项目
{
   public class CheckSet
    {
        public string Name { get; set; }
        public int Price { get; set; }
        public List<Health> items { get; set; }
        public CheckSet()
        {
            items = new List<Health>();
        }
        public CheckSet(string name,List<Health> item)
        {
            this.Name = name;
            this.items = item;
        }
        public void CalPrice() 
        {
            int total = 0;
            foreach (Health h in items)
            {
                total = total + h.Price;
            }
            this.Price = total;
        }
    }
}





using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 体检项目
{
    //检查项目类
  public  class Health
    {
        public string Name { get; set; }
        public string Description { get; set; }
        public int Price { get; set; }
        public Health()
        {

        }
        public Health(string name,string ds,int price)
        {
            this.Name = name;
            this.Description = ds;
            this.Price = price;
        }
    }
}




using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 体检项目
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        //采用泛型集合保存 所有 的体检项目
        List<Health> AllItems = new List<Health>();
        //采用泛型集合保存 套餐 中的的体检项目
        List<Health> items = new List<Health>();
       //使用字典保存套餐集合
    public  Dictionary<string, CheckSet> HealthSet = new Dictionary<string, CheckSet>();
        Health sg, ti, gan, B,shili;

        CheckSet set = new CheckSet();
        private void Form1_Load(object sender, EventArgs e)
        {
            this.label5.Text = "";
            this.label7.Text = "";
            ADD();
            Student();
        }
        public void ADD() 
        {
          
                sg = new Health("身高", "用于检查身高", 5);
                ti = new Health("体重", "用于检查体重", 5);
                gan = new Health("肝功能", "用于检查肝功能", 50);
                B = new Health("B超", "用于检查B超", 30);
                shili = new Health("视力", "用于检查视力", 50);
                AllItems.Add(sg);
                AllItems.Add(ti);
                AllItems.Add(gan);
                AllItems.Add(B);
                AllItems.Add(shili);
            //    this.dataGridView1.DataSource = new BindingList<Health>(AllItems); 
                this.comboBox2.Items.Add("请选择");
                foreach (Health item in AllItems)
                {
                    comboBox2.Items.Add(item.Name);
                }
                this.comboBox2.SelectedIndex = 0;
         
        }
        //设置入学套餐
        public void Student() 
        {
            items = new List<Health>();
            items.Add(sg);
            items.Add(ti);
            items.Add(gan);
            set = new CheckSet("入学体检",items);
            //计算套餐价格
            set.CalPrice();
            this.HealthSet.Add("入学体检",set);
            //清空套餐下拉列表
            this.comboBox1.Items.Clear();
            //添加请选择
            this.comboBox1.Items.Add("请选择");
            //将 Dictionary的Key值 绑定到COMBOX1
            foreach (string key in HealthSet.Keys)
            {
                this.comboBox1.Items.Add(key);
            }
            //默认选择第一项
            this.comboBox1.SelectedIndex = 0;
           // this.dataGridView1.DataSource = new BindingList<Health>(items);
        }
        public void UpdateSet(CheckSet set) 
        {
            this.dataGridView1.DataSource = new BindingList<Health>(set.items);
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string sNAME = this.comboBox1.Text;
            if (sNAME == "请选择")
            {
                this.dataGridView1.DataSource = null;
                this.label5.Text = "";
                this.label7.Text = "";
                return;
            }
            //设置套餐名称
            this.label5.Text = this.HealthSet[sNAME].Name;
            //设置套餐总价
            this.label7.Text = this.HealthSet[sNAME].Price.ToString();
            UpdateSet(HealthSet[sNAME]);
        }
        /// <summary>
        /// 添加 套餐 检查的项目 方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            if (this.comboBox2.SelectedIndex==0)
            {
                MessageBox.Show("请选择一个项目");
              return;
            }
            //声明一个套餐来接受  套餐 列表的文字
            string CBO = comboBox1.Text;
            if (CBO=="请选择")
            {
                MessageBox.Show("请选择套餐!");
                return;
            }
           // 判断现有套餐是否存在
            int index = this.comboBox2.SelectedIndex-1;
            if (! this.HealthSet[CBO].items.Contains(AllItems[index]))
            {
                this.HealthSet[CBO].items.Add(AllItems[index]);
                this.HealthSet[CBO].CalPrice();
                UpdateSet(this.HealthSet[CBO]);
                //刷新窗体集合名称
                this.label5.Text = this.HealthSet[CBO].Name;
                //刷新窗体集合的 价格
                this.label7.Text = this.HealthSet[CBO].Price.ToString();
                MessageBox.Show("添加成功!!!","提示");
            }
            else
            {
                MessageBox.Show("该项目已存在","提示");
            }
        }
        //删除项目
        private void button3_Click(object sender, EventArgs e)
        {
            string setName = this.comboBox1.Text;
            if (this.dataGridView1.SelectedRows.Count==0)
            {
                MessageBox.Show("没有选择删除项");
                return;
            }
            //获取选中的索引
           int index =this.dataGridView1.SelectedRows[0].Index;
            this.HealthSet[setName].items.RemoveAt(index);
            //重新计算价格
            this.HealthSet[setName].CalPrice();
            UpdateSet(HealthSet[setName]);
            this.label5.Text=set.Name;
            this.label7.Text=set.Price.ToString();
            MessageBox.Show("删除成功");
          }
        /// <summary>
        /// 添加套餐
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.textBox1.Text=="")
            {
                MessageBox.Show("请输入要添加的套餐名称");
                return;
            }
            CheckSet se = new CheckSet();
            this.HealthSet.Add(this.textBox1.Text, se);
            this.AddSet();
           // this.comboBox1.Items.Clear();
           //this.comboBox1.Items.Add("请选择");
           // foreach (string item in HealthSet.Keys)
           // {
           //     this.comboBox1.Items.Add(item);
           // }
           this.comboBox1.SelectedIndex = this.HealthSet.Count;
            MessageBox.Show("添加成功");
        }
        public void AddSet() 
        {
            this.comboBox1.Items.Clear();
            this.comboBox1.Items.Add("请选择");
            foreach (string item in HealthSet.Keys)
            {
                this.comboBox1.Items.Add(item);
            }
            this.comboBox1.SelectedIndex = 0;
        }
        }
    }



  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
体检套餐管理系统是基于Java开发的一个应用程序,旨在帮助医疗机构或体检中心更好地管理和维护体检套餐信息。 首先,体检套餐管理系统将通过一个用户友好的界面提供操作体检套餐信息的功能。管理员可以登录系统,查看和编辑已有的体检套餐,也可以添加和删除套餐。同时,管理员还可以对每个套餐设置价格、审核状态等。用户可以通过系统查询和选择适合自己的体检套餐,也可以根据个人需求定制套餐系统会根据用户的选择生成详细的体检套餐单,方便用户参考和预约体检。 其次,体检套餐管理系统会通过数据库来存储和管理套餐相关的信息。数据库将包含不同套餐的名称、价格、内容、适用人群等。系统将根据用户的选择从数据库中查询相应的数据,以便用户更方便地选择和使用套餐。 此外,体检套餐管理系统还会包含一些其他功能。比如,系统会提供一个预约体检的功能,用户可以在系统中选择合适的时间和地点进行预约。系统还会提供一个报告查询功能,用户可以在体检后通过系统查询和下载自己的体检报告。 总之,体检套餐管理系统将通过提供方便的操作界面和丰富的功能,帮助医疗机构更好地管理体检套餐信息,也为用户提供了方便快捷的体检服务。通过Java的开发,系统将具有稳定性、安全性和易扩展性,能够适应不同规模的医疗机构的需求。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值