精神类药品处方单打印

This commit is contained in:
leomon 2023-03-30 11:34:46 +08:00
parent 6f9078ba79
commit 39b4542f70
6 changed files with 239 additions and 58 deletions

View File

@ -724,13 +724,29 @@ namespace AIMS.PublicUI.UI
if (tabDrugs.SelectedTab.Name != "P3")
{
PrintDocument DModel = DocumentDAL.GetDocumentbyName("第二类精神药品处方笺", _record.PatientId.Value, record.Id.Value);
if (DModel != null && DModel.Id > 0)
string docname = "";
if (record.FeeTypeId == "精神II类")
{
DialogResult dialogResult = MessageBox.Show("该药品已存在处方单 是否删除?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dialogResult == DialogResult.No) return;
else
DocumentDAL.DeletePrintDocument2(DModel);
docname = "第二类精神药品处方笺";
}
else if (record.FeeTypeId == "精神I类")
{
docname = "第一类精神药品处方笺";
}
else if (record.FeeTypeId == "麻醉药")
{
docname = "麻醉药品处方笺";
}
if (docname != "")
{
PrintDocument DModel = DocumentDAL.GetDocumentbyName(docname, _record.PatientId.Value, record.Id.Value);
if (DModel != null && DModel.Id > 0)
{
DialogResult dialogResult = MessageBox.Show("该药品已存在处方单 是否删除?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dialogResult == DialogResult.No) return;
else
DocumentDAL.DeletePrintDocument2(DModel);
}
}
}
BFeesRecord.Delete(record);
@ -1502,7 +1518,10 @@ namespace AIMS.PublicUI.UI
dgvDrugs.Rows.Clear();
FeesRecordList = BFeesRecord.Select(" FeeType='" + FeeType + "' and OperationRecordId=" + _record.Id, null, RecursiveType.None, 0);
BFeesRecord.Delete(" FeeIsDrug =1 and FeeType='" + FeeType + "' and OperationRecordId=" + _record.Id, null);
DocumentDAL.DeletePrintDocument3("第二类精神药品处方笺", _record.PatientId.Value, PublicMethod.OperatorNo);
DocumentDAL.DeletePrintDocument3("第一类精神药品处方笺", _record.PatientId.Value, PublicMethod.OperatorNo);
DocumentDAL.DeletePrintDocument3("麻醉药", _record.PatientId.Value, PublicMethod.OperatorNo);
LoadRecordDrugs();
}
}

View File

@ -9,9 +9,11 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Linq;
@ -73,8 +75,21 @@ namespace AIMS.OperationAanesthesia
panelDrug.Visible = false;
toolStrip1.Visible = true;
Patient = PatientRecord.GetPatientRecord(PatientId);
DModel = DocumentDAL.GetDocumentbyName("第二类精神药品处方笺", Patient.PatientId, fee.Id.Value);
LoadDocument();
if (fee.FeeTypeId == "精神II类")
{
DModel = DocumentDAL.GetDocumentbyName("第二类精神药品处方笺", Patient.PatientId, fee.Id.Value);
LoadDocument();
}
else if (fee.FeeTypeId == "精神I类")
{
DModel = DocumentDAL.GetDocumentbyName("第一类精神药品处方笺", Patient.PatientId, fee.Id.Value);
LoadDocument();
}
else if (fee.FeeTypeId == "麻醉药")
{
DModel = DocumentDAL.GetDocumentbyName("麻醉药品处方笺", Patient.PatientId, fee.Id.Value);
LoadDocument();
}
}
else
{
@ -114,13 +129,13 @@ namespace AIMS.OperationAanesthesia
{
x = cols * 150 + 20;
CheckBox chkYes = new CheckBox();
chkYes.AutoSize = true;
chkYes.AutoSize = true;
chkYes.Text = ade.Length > 14 ? ade.Substring(0, 13) : ade;
chkYes.UseVisualStyleBackColor = true;
chkYes.Tag = ade;
chkYes.CheckedChanged += new EventHandler(cb_CheckedChanged);
chkYes.Tag = ade;
chkYes.CheckedChanged += new EventHandler(cb_CheckedChanged);
chkYes.Location = new Point(x, rows * (chkYes.Height + 2) + 4);
panel.Controls.Add(chkYes);
panel.Controls.Add(chkYes);
rows++;
if (rows == 3)
{
@ -163,9 +178,24 @@ namespace AIMS.OperationAanesthesia
{
if (!SelChargName.Contains(item.ChargName)) continue;
Patient = PatientRecord.GetPatientRecord(item.PatientId.Value);
DModel = DocumentDAL.GetDocumentbyName("第二类精神药品处方笺", Patient.PatientId, item.Id.Value);
LoadDocument();
myEditControl.ExecuteCommand("FilePrint", false, null);
if (item.FeeTypeId == "精神II类")
{
DModel = DocumentDAL.GetDocumentbyName("第二类精神药品处方笺", Patient.PatientId, item.Id.Value);
LoadDocument();
myEditControl.ExecuteCommand("FilePrint", false, null);
}
else if (item.FeeTypeId == "精神I类")
{
DModel = DocumentDAL.GetDocumentbyName("第一类精神药品处方笺", Patient.PatientId, item.Id.Value);
LoadDocument();
myEditControl.ExecuteCommand("FilePrint", false, null);
}
else if (item.FeeTypeId == "麻醉药")
{
DModel = DocumentDAL.GetDocumentbyName("麻醉药品处方笺", Patient.PatientId, item.Id.Value);
LoadDocument();
myEditControl.ExecuteCommand("FilePrint", false, null);
}
}
}
@ -201,7 +231,7 @@ namespace AIMS.OperationAanesthesia
}
else
{
fee.Extend4 = BFeesRecord.GetOrderNum().ToString();
fee.Extend4 = BFeesRecord.GetOrderNum(fee.FeeTypeId).ToString();
//无文档则加载模板
TModel = DocumentDAL.GetTemplatebyId(DModel.TemplateId);
if (TModel.XmlFile == null || TModel.XmlFile.Trim().Equals(string.Empty))
@ -214,6 +244,7 @@ namespace AIMS.OperationAanesthesia
}
DModel.XmlFileName = TModel.XmlFileName;
DModel.TemplateId = TModel.Id;
DModel.OrderNo =fee.Extend4 ;
//患者基本信息赋值
var query = from XTextElement in myEditControl.Document.Fields.ToArray()
where XTextElement is XTextInputFieldElement
@ -246,7 +277,7 @@ namespace AIMS.OperationAanesthesia
var Text2 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == "规格").FirstOrDefault();
if (Text2 != null)
Text2.Text = fee.ChargSpec + "*" + fee.FeeNum + fee.Unit;
Text2.Text = GetChina(fee.ChargSpec) + "*" + NumToChinese(fee.FeeNum) + GetChina(fee.Unit);
var Text3 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == "剂量").FirstOrDefault();
if (Text3 != null)
@ -254,15 +285,15 @@ namespace AIMS.OperationAanesthesia
var Text4 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == "单位").FirstOrDefault();
if (Text4 != null)
Text4.Text = fee.Extend1;
var Text5 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == "途径").FirstOrDefault();
if (Text5 != null)
Text5.Text = fee.Extend3;
Text4.Text = GetChina(fee.Extend1);
//var Text5 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
// && (x as XTextInputFieldElement).Name == "途径").FirstOrDefault();
//if (Text5 != null)
// Text5.Text = fee.Extend3;
var Text6 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == "药价").FirstOrDefault();
if (Text6 != null)
Text6.Text = fee.ChargePrice;
Text6.Text = " " + fee.ChargePrice;
var Text7 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == "医师").FirstOrDefault();
if (Text7 != null)
@ -270,7 +301,7 @@ namespace AIMS.OperationAanesthesia
var Text8 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == "处方单号").FirstOrDefault();
if (Text8 != null)
Text8.Text = "000" + fee.Extend4;
Text8.Text = "00" + fee.Extend4;
DocumentExtension.SetDocumentDefaultValue(TModel.XmlFileName, myEditControl.Document, Patient);
}
string xmlStatic = DocumentDAL.GetEventXml(DModel.TemplateId);
@ -293,12 +324,114 @@ namespace AIMS.OperationAanesthesia
}
#endregion
//dizuoxin
//曲马多
public string NumToChinese(string x)
{
//数字转换为中文后的数组 //转载请注明来自 http://www.shang11.com
string[] P_array_num = new string[] { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
//为数字位数建立一个位数组
string[] P_array_digit = new string[] { "", "拾", "佰", "仟" };
//为数字单位建立一个单位数组
string[] P_array_units = new string[] { "", "万", "亿", "万亿" };
string P_str_returnValue = ""; //返回值
int finger = 0; //字符位置指针
int P_int_m = x.Length % 4; //取模
int P_int_k = 0;
if (P_int_m > 0)
P_int_k = x.Length / 4 + 1;
else
P_int_k = x.Length / 4;
//外层循环,四位一组,每组最后加上单位: ",万亿,",",亿,",",万,"
for (int i = P_int_k; i > 0; i--)
{
int P_int_L = 4;
if (i == P_int_k && P_int_m != 0)
P_int_L = P_int_m;
//得到一组四位数
string four = x.Substring(finger, P_int_L);
int P_int_l = four.Length;
//内层循环在该组中的每一位数上循环
for (int j = 0; j < P_int_l; j++)
{
//处理组中的每一位数加上所在的位
int n = Convert.ToInt32(four.Substring(j, 1));
if (n == 0)
{
if (j < P_int_l - 1 && Convert.ToInt32(four.Substring(j + 1, 1)) > 0 && !P_str_returnValue.EndsWith(P_array_num[n]))
P_str_returnValue += P_array_num[n];
}
else
{
if (!(n == 1 && (P_str_returnValue.EndsWith(P_array_num[0]) | P_str_returnValue.Length == 0) && j == P_int_l - 2))
P_str_returnValue += P_array_num[n];
P_str_returnValue += P_array_digit[P_int_l - j - 1];
}
}
finger += P_int_L;
//每组最后加上一个单位:",万,",",亿," 等
if (i < P_int_k) //如果不是最高位的一组
{
if (Convert.ToInt32(four) != 0)
//如果所有4位不全是0则加上单位",万,",",亿,"等
P_str_returnValue += P_array_units[i - 1];
}
else
{
//处理最高位的一组,最后必须加上单位
P_str_returnValue += P_array_units[i - 1];
}
}
return P_str_returnValue;
}
public string GetChina(string str)
{
string value = str;
if (value.Contains(""))
{
List<string> strs = value.Split(':').ToList();
if (strs.Count == 2)
value = strs[1];
}
else if (value.Contains(":"))
{
List<string> strs = value.Split(':').ToList();
if (strs.Count == 2)
value = strs[1];
}
else if (value.Contains(""))
{
List<string> strs = value.Split('').ToList();
if (strs.Count == 2)
value = strs[1];
}
if (value.Contains("mg"))
{
value = value.Replace("mg", "毫克");
}
else if (value.Contains("ug"))
{
value = value.Replace("ug", "微克");
}
else if (value.Contains("ml"))
{
value = value.Replace("ml", "毫升");
}
else if (value.Contains("g"))
{
value = value.Replace("g", "克");
}
else if (value.Contains("l"))
{
value = value.Replace("l", "毫升");
}
return value;
}
private void tsbAdd_Click(object sender, EventArgs e)
{
tsbSava_Click(null, null);
myEditControl.ExecuteCommand("FilePrint", true, null);
}
private void tsbExit_Click(object sender, EventArgs e)
{
@ -309,14 +442,14 @@ namespace AIMS.OperationAanesthesia
{
if (DModel.Id == 0)
{
int orderno = BFeesRecord.GetOrderNum();
int orderno = BFeesRecord.GetOrderNum(fee.FeeTypeId);
if (int.Parse(fee.Extend4) < orderno)
{
fee.Extend4 = orderno.ToString();
var Text8 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == "处方单号").FirstOrDefault();
if (Text8 != null)
Text8.Text = "000" + fee.Extend4;
Text8.Text = "00" + fee.Extend4;
}
}
BFeesRecord.Update(fee);
@ -336,6 +469,7 @@ namespace AIMS.OperationAanesthesia
DModel.OperatorNo = AIMSExtension.PublicMethod.OperatorNo;
DModel.RecordId = fee.Id.Value.ToString();
DModel.Remark = fee.ChargName;
DModel.OrderNo = fee.Extend4;
XmlDocument doc = new XmlDocument();
XmlElement rootNode = doc.CreateElement("Root");
doc.AppendChild(rootNode);

View File

@ -28,9 +28,9 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
this.panel1 = new System.Windows.Forms.Panel();
this.button2 = new System.Windows.Forms.Button();
this.cboRoom = new DevComponents.DotNetBar.Controls.ComboBoxEx();
@ -505,19 +505,19 @@
//
this.dgvOperation.AllowUserToAddRows = false;
this.dgvOperation.AllowUserToDeleteRows = false;
dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(239)))), ((int)(((byte)(247)))), ((int)(((byte)(255)))));
this.dgvOperation.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle4;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(239)))), ((int)(((byte)(247)))), ((int)(((byte)(255)))));
this.dgvOperation.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.dgvOperation.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dgvOperation.BackgroundColor = System.Drawing.Color.Snow;
this.dgvOperation.BorderStyle = System.Windows.Forms.BorderStyle.None;
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 10F);
dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgvOperation.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 10F);
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgvOperation.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.dgvOperation.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvOperation.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.OpeationId,
@ -576,14 +576,14 @@
this.hisOrdersn,
this.Hiscount,
this.hisState});
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle6.Font = new System.Drawing.Font("微软雅黑", 10.5F);
dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvtEMPOperationInfos.DefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 10.5F);
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvtEMPOperationInfos.DefaultCellStyle = dataGridViewCellStyle3;
this.dgvtEMPOperationInfos.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvtEMPOperationInfos.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
this.dgvtEMPOperationInfos.GridColor = System.Drawing.Color.Black;
@ -970,6 +970,7 @@
this.OperationRoom.FillWeight = 73.7823F;
this.OperationRoom.HeaderText = "手术间";
this.OperationRoom.Name = "OperationRoom";
this.OperationRoom.ReadOnly = true;
//
// InHospitalNo
//
@ -977,6 +978,7 @@
this.InHospitalNo.FillWeight = 69.32275F;
this.InHospitalNo.HeaderText = "住院号";
this.InHospitalNo.Name = "InHospitalNo";
this.InHospitalNo.ReadOnly = true;
//
// PatientName
//
@ -984,6 +986,7 @@
this.PatientName.FillWeight = 54.2445F;
this.PatientName.HeaderText = "姓名";
this.PatientName.Name = "PatientName";
this.PatientName.ReadOnly = true;
//
// Sex
//
@ -1031,6 +1034,7 @@
this.AnesthesiaDoctor.FillWeight = 73.7823F;
this.AnesthesiaDoctor.HeaderText = "麻醉医生";
this.AnesthesiaDoctor.Name = "AnesthesiaDoctor";
this.AnesthesiaDoctor.ReadOnly = true;
//
// Inroomtime
//

View File

@ -10,17 +10,35 @@ namespace AIMSBLL
{
public partial class BFeesRecord
{
public static int GetOrderNum()
public static int GetOrderNum(string FeeTypeId)
{
string docname = "";
if (FeeTypeId == "精神II类")
{
docname = "第二类精神药品处方笺";
}
else if (FeeTypeId == "精神I类")
{
docname = "第一类精神药品处方笺";
}
else if (FeeTypeId == "麻醉药")
{
docname = "麻醉药品处方笺";
}
int num = 0;
string sql = "select max(Extend4) from FeesRecord";
string sql = "select max(OrderNo) from PrintDocument where XmlFileName='" + docname + "'";
string nums = DBHelper.ExecuteScalar(sql).ToString();
if (nums != null && nums != "")
num = int.Parse(nums);
if (num == 0)
num = 3520;
else
num++;
if (num == 0 && FeeTypeId == "精神II类")
num = 10000;
else if (num == 0 && FeeTypeId == "精神I类")
num = 10000;
else if (num == 0 && FeeTypeId == "麻醉药")
num = 10000;
else if (num < 10000)
num = 10000;
num++;
return num;
}

View File

@ -901,7 +901,8 @@ namespace DocumentManagement
sb.Append(" pd.OperatorNo,");
sb.Append(" pd.OperatorDate,");
sb.Append(" pd.RecordId,");
sb.Append(" pd.Remark");
sb.Append(" pd.Remark,");
sb.Append(" pd.OrderNo");
sb.Append(" from PrintDocument pd");
sb.Append(" where ");
sb.Append(" pd.PatientId = " + patientId);
@ -920,6 +921,7 @@ namespace DocumentManagement
sb.Append(" null,");
sb.Append(" null,");
sb.Append(" null,");
sb.Append(" null,");
sb.Append(" null");
sb.Append(" from PrintTemplate pt");
sb.Append(" where pt.IsValid = 1");
@ -937,6 +939,7 @@ namespace DocumentManagement
//model.OperatorDate = DateTime.Parse(dt.Rows[0]["OperatorDate"].ToString(""));
model.RecordId = dt.Rows[0]["RecordId"].ToString();
model.Remark = dt.Rows[0]["Remark"].ToString();
model.OrderNo = dt.Rows[0]["OrderNo"].ToString();
}
}
catch (Exception ex)
@ -965,7 +968,8 @@ namespace DocumentManagement
strSql.Append("'" + model.OperatorNo + "',");
strSql.Append(" getdate(), ");
strSql.Append("'" + model.RecordId + "',");
strSql.Append("'" + model.Remark + "'");
strSql.Append("'" + model.Remark + "',");
strSql.Append("'" + model.OrderNo + "'");
strSql.Append(")");
strSql.Append(" select Id from [PrintDocument] where Id = @@Identity");
DataTable dt = DbHelperSQL.GetDataTable(strSql.ToString());
@ -994,7 +998,8 @@ namespace DocumentManagement
strSql.Append(" OperatorNo='" + model.OperatorNo + "',");
strSql.Append(" OperatorDate= getdate(),");
strSql.Append(" RecordId='" + model.RecordId + "',");
strSql.Append(" Remark='" + model.Remark + "'");
strSql.Append(" Remark='" + model.Remark + "',");
strSql.Append(" OrderNo='" + model.OrderNo + "'");
strSql.Append(" where Id=" + model.Id + " ");
DbHelperSQL.ExecNonQuery(strSql.ToString());
}

View File

@ -2146,5 +2146,6 @@ namespace DocumentManagement
public DateTime OperatorDate { get; set; }
public string RecordId { get; set; }
public string Remark { get; set; }
public string OrderNo { get; set; }
}
}