Exemple #1
0
 /// <summary>
 /// 重新查询数据
 /// </summary>
 /// <param name="patientid"></param>
 private void UpdateUi(int patientid)
 {
     if (dgvPatient.CurrentRow != null)
     {
         int currIndex = dgvPatient.CurrentRow.Index;
         foreach (DataGridViewRow row in dgvPatient.Rows)
         {
             if (row.Cells[0].Value.ToString() == patientid.ToString())
             {
                 Patient patient = MedicineLogic.QueryPatientById(patientid);
                 if ((patient.MorningStatus == TakeStatus.正常 || patient.MorningStatus == TakeStatus.未知) &&
                     (patient.NoonStatus == TakeStatus.正常 || patient.NoonStatus == TakeStatus.未知) &&
                     (patient.EveningStatus == TakeStatus.正常 || patient.EveningStatus == TakeStatus.未知) &&
                     (patient.AdditionalStatus == TakeStatus.正常 || patient.AdditionalStatus == TakeStatus.未知))
                 {
                     row.Cells[2].Value = Properties.Resources.greenlight;
                 }
                 else
                 {
                     row.Cells[2].Value = Properties.Resources.redlight;
                 }
                 if (row.Index == currIndex)
                 {
                     dgvPatient_CellClick(dgvPatient, new DataGridViewCellEventArgs(0, row.Index));
                     break;
                 }
             }
         }
     }
 }
Exemple #2
0
        /// <summary>
        /// 发送配药指令
        /// </summary>
        /// <param name="id"></param>
        private void SendDispensing(int id)
        {
            Patient    patient    = MedicineLogic.QueryPatientById(id);
            Device     device     = MedicineLogic.QueryDeviceById(patient.DeviceId);
            Dispensing dispensing = MedicineLogic.QueryFirstDispensingByPatientId(id);

            if (dispensing == null || dispensing.Id <= 0)
            {
                return;
            }
            byte[] zero     = { 0x00 };
            byte[] deviceNo = device.DeviceNo <= 255 ? zero.Concat(Common.IntToHexByte(device.DeviceNo)).ToArray() : Common.IntToHexByte(device.DeviceNo);
            byte[] funcNo   = { 0x02 };
            byte[] data     = { };
            byte[] open     = { 0x31 };
            byte[] close    = { 0x30 };
            byte[] byteflg  = dispensing.Id > 255 ? Common.IntToHexByte(dispensing.Id) : zero.Concat(Common.IntToHexByte(dispensing.Id)).ToArray();
            data = Enum.GetValues(typeof(TakeTime)).Cast <object>().Aggregate(data, (current, i) => current.Concat((Convert.ToInt32(dispensing.TakeTime) & i.GetHashCode()) != 0 ? open : close).ToArray());
            data = deviceNo.Concat(funcNo).Concat(data).Concat(byteflg).ToArray();
            AutoSendData(device.DeviceIP, data, byteflg);
        }
Exemple #3
0
        /// <summary>
        /// 单元格点击事件,查询病人信息并显示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvPatient_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex <= -1 || e.RowIndex <= -1)
            {
                return;
            }
            int     id      = Convert.ToInt32(dgvPatient.Rows[e.RowIndex].Cells[0].Value);
            Patient patient = MedicineLogic.QueryPatientById(id);
            Device  device  = MedicineLogic.QueryDeviceById(id);

            labId.Text      = id.ToString();
            labName.Text    = patient.Name;
            labSex.Text     = patient.Sex.ToString();
            labAge.Text     = patient.Age.ToString();
            labHeight.Text  = patient.Height.ToString("0.##");
            labWeight.Text  = patient.Weight.ToString("0.##");
            labIllness.Text = patient.Illness;
            labWardNo.Text  = patient.WardNo;
            labBedNo.Text   = patient.BedNo;

            labDeviceNo.Text = device.DeviceNo.ToString();

            txtMorningHour.Text   = patient.MorningHour == -1 ? string.Empty : patient.MorningHour.ToString();
            txtMorningMinute.Text = patient.MorningMinute == -1 ? string.Empty : patient.MorningMinute.ToString();
            txtNoonHour.Text      = patient.NoonHour == -1 ? string.Empty : patient.NoonHour.ToString();
            txtnoonMinute.Text    = patient.NoonMinute == -1 ? string.Empty : patient.NoonMinute.ToString();
            txtEveningHour.Text   = patient.EveningHour == -1 ? string.Empty : patient.EveningHour.ToString();
            txtEveningMinute.Text = patient.EveningMinute == -1 ? string.Empty : patient.EveningMinute.ToString();
            txtAddHour.Text       = patient.AdditionalHour == -1 ? string.Empty : patient.AdditionalHour.ToString();
            txtAddMinute.Text     = patient.AdditionalMinute == -1 ? string.Empty : patient.AdditionalMinute.ToString();

            picMorningStatus.Image = GetLight(patient.MorningStatus);
            picNoonStatus.Image    = GetLight(patient.NoonStatus);
            picEveningStatus.Image = GetLight(patient.EveningStatus);
            picAddStatus.Image     = GetLight(patient.AdditionalStatus);

            ShowDispensing(id);
        }