public bool DeleteEmrNote(int series) { XmlNode emrNote = GetEmrNoteBySeries(series); if (emrNote == null) { return(Return.Failed); } string registryID = emrDoc.DocumentElement.GetAttribute(AttributeNames.RegistryID); string noteID = emrNote.Attributes[AttributeNames.NoteID].Value; if (!Globals.offline) { if (ThisAddIn.DeleteOneEmrNote(registryID, noteID, series) == Return.Failed) { return(Return.Failed); } } /* Update the local storage. */ string LastWriteTime = ThisAddIn.Today().ToFileTime().ToString(); emrDoc.DocumentElement.SetAttribute(AttributeNames.LastWriteTime, LastWriteTime); emrDoc.DocumentElement.RemoveChild(emrNote); emrDoc.Save(emrDocFile); udt.jj.EncodeEmrDocument(emrDocFile); string wdDocName = udt.MakeWdDocumentFileName(registryID, noteID, series, Globals.workFolder); File.Delete(wdDocName); return(Return.Successful); }
private void btnOK_Click(object sender, EventArgs e) { if (cboCertificate.Text.Trim() == "") { MessageBox.Show("确认提交者已插入u-Key!", ErrorMessage.Warning); return; } if (MessageBox.Show("确认保存接收文档!", ErrorMessage.Warning, MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) == DialogResult.Cancel) { return; } using (gjtEmrService.emrServiceXml es = new gjtEmrService.emrServiceXml()) { foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells[2].Value == null) { continue; } if (!udt.jj.IsNumaric(row.Cells[2].Value.ToString())) { MessageBox.Show("输入格式不正确!"); return; } bool selected = (bool)row.Cells[0].FormattedValue; if (!selected) { continue; } int count = Convert.ToInt32(row.Cells[2].Value.ToString()); if (es.UpdateTransferInfo(registryID, row.Cells[1].Value.ToString(), row.Cells[3].Value.ToString(), Globals.DoctorID, cboCertificate.Text.Trim(), ThisAddIn.Today(), count) == 0) { es.PutTransferInfo(registryID, row.Cells[1].Value.ToString(), "", row.Cells[3].Value.ToString(), Globals.DoctorID, cboCertificate.Text.Trim(), ThisAddIn.Today(), count, true); } } } OpDone op = new OpDone("接收成功"); op.Show(); this.Close(); }
public Trust(EmrConstant.Trust mode) { InitializeComponent(); trusMode = mode; if (mode == EmrConstant.Trust.Deputed) { lbPrompt.Text = EmrConstant.TrustText.Deputed; } else { lbPrompt.Text = EmrConstant.TrustText.Deputing; } LoadDoctorList(); TimeSpan oneday = TimeSpan.FromDays(1); dtpEnd.Value = ThisAddIn.Today().Add(oneday); }
/* ----------------------------------------------------------------------------------------------------*/ public void BecomeNormalNote() { AuthorInfo authorInfo = new AuthorInfo(); authorInfo.Writer = Globals.DoctorName; authorInfo.WrittenDate = ThisAddIn.Today().ToString(StringGeneral.DateFormat); authorInfo.Checker = ""; authorInfo.CheckedDate = ""; authorInfo.FinalChecker = ""; authorInfo.FinalCheckedDate = ""; authorInfo.TemplateType = StringGeneral.NoneTemplate; authorInfo.TemplateName = ""; authorInfo.NoteID = ""; authorInfo.NoteName = ""; authorInfo.WriterLable = emrTaskPane.currentNote.author.writerLable; authorInfo.CheckerLable = emrTaskPane.currentNote.author.checkerLable; authorInfo.FinalCheckerLable = emrTaskPane.currentNote.author.finalCheckerLable; //DrawAuthor(authorInfo); }
private void btnRefer_Click(object sender, EventArgs e) { if (MessageBox.Show("请确认提交文档!", ErrorMessage.Warning, MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) == DialogResult.Cancel) { return; } using (gjtEmrService.emrServiceXml es = new gjtEmrService.emrServiceXml()) { es.DelTransferInfo(registryID, Globals.DoctorID); foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells[2].Value == null) { continue; } if (!udt.jj.IsNumaric(row.Cells[2].Value.ToString())) { MessageBox.Show("输入格式不正确!"); return; } bool selected = (bool)row.Cells[0].FormattedValue; if (!selected) { continue; } int count = Convert.ToInt32(row.Cells[2].Value.ToString()); es.PutTransferInfo(registryID, row.Cells[1].Value.ToString(), Globals.DoctorID, Globals.DoctorName, "", "", ThisAddIn.Today(), count, false); } } OpDone op = new OpDone("提交成功"); op.Show(); this.Close(); }
public bool UncommitEmrNote(int series, XmlNode reasion) { XmlNode emrNote = GetEmrNoteBySeries(series); if (emrNote == null) { return(Return.Failed); } int status = Convert.ToInt32(emrNote.Attributes[AttributeNames.NoteStatus].Value) - 1; if (ThisAddIn.UncommitEmrNote( emrDoc.DocumentElement.GetAttribute(AttributeNames.RegistryID), emrNote.Attributes[AttributeNames.NoteID].Value, series, reasion, (NoteStatus)status) == Return.Failed) { return(Return.Failed); } //XmlElement noteDoc = emrDoc.CreateElement(ElementNames.EmrNote); if (ThisAddIn.CanOption(ElementNames.chxTrace) == true && emrNote.Attributes["fanxiu"] == null) { ThisAddIn.fanxiu(emrDoc.DocumentElement.GetAttribute(AttributeNames.RegistryID), series); XmlAttribute fanxiu = emrNote.OwnerDocument.CreateAttribute("fanxiu"); emrNote.Attributes.Append(fanxiu); emrNote.Attributes["fanxiu"].Value = "Yes"; } emrNote.Attributes[AttributeNames.NoteStatus].Value = status.ToString(); string LastWriteTime = ThisAddIn.Today().ToFileTime().ToString(); emrNote.Attributes[AttributeNames.LastWriteTime].Value = LastWriteTime; emrDoc.DocumentElement.SetAttribute(AttributeNames.LastWriteTime, LastWriteTime); emrNote.OwnerDocument.Save(emrDocFile); udt.jj.EncodeEmrDocument(emrDocFile); return(Return.Successful); }
public bool UpdateEmrNote(int series, NoteStatus noteStatus, ref NoteStatus noteStatusEnd, bool CommitFlag) { noteStatusEnd = noteStatus; /* Confirm the note exists. */ XmlNode emrNote = GetEmrNoteBySeries(series); if (emrNote == null) { return(Return.Failed); } /* word window to word document */ string tmpfile = Path.Combine(Globals.currentDirectory, ResourceName.Mytmp); //udt.jj.SaveWordDoc(ThisAddIn.Application.ActiveDocument, tmpfile, false); #region Update the emrDocument in dadabase /* Package the word document into a xml elelement. */ XmlNode noteDoc = emrDoc.CreateElement(ElementNames.EmrNote); noteDoc.InnerText = udt.jj.WordDocumentToString(tmpfile); string registryID = emrDoc.DocumentElement.GetAttribute(AttributeNames.RegistryID); /* Update the dadabase. */ if (!Globals.offline) { using (gjtEmrService.emrServiceXml es = new gjtEmrService.emrServiceXml()) { try { string strResult = es.IsEnabledCommit(registryID, series); if (strResult == "0") { noteStatusEnd = NoteStatus.Draft; if (CommitFlag == true) { MessageBox.Show("已经超时提交过的文档不能再次提交,请与质管部门联系!", ErrorMessage.Warning, MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk); } } else { emrNote.Attributes["NoteStatus"].Value = (Convert.ToInt32(noteStatusEnd)).ToString(); if ((Convert.ToInt32(noteStatusEnd)).ToString() == "1" && ThisAddIn.CanOption(ElementNames.CommitTime)) { if (emrNote.Attributes["fanxiu"] == null || emrNote.Attributes["fanxiu"].Value == "No") { emrNote.Attributes[AttributeNames.WrittenDate].Value = ThisAddIn.Today().ToString(); } } } } catch (Exception ex) { Globals.logAdapter.Record("EX741852968", ex.Message + ">>" + ex.ToString(), true); } } if (ThisAddIn.UpdateOneEmrNote(registryID, emrNote, noteDoc) == Return.Failed) { return(Return.Failed); } } else { OpDone opDone = new OpDone("离线,寄存失败!"); opDone.Show(); return(Return.Failed); } #endregion #region Update the local storage string noteID = emrNote.Attributes[AttributeNames.NoteID].Value; string wdDocName = udt.MakeWdDocumentFileName(registryID, noteID, series, Globals.workFolder); File.Copy(tmpfile, wdDocName, true); if (Globals.localDocumentEncode) { udt.jj.EncodeEmrDocument(wdDocName); } string LastWriteTime = ThisAddIn.Today().ToFileTime().ToString(); emrNote.Attributes[AttributeNames.NoteStatus].Value = noteStatus.ToString("d"); emrNote.Attributes[AttributeNames.LastWriteTime].Value = LastWriteTime; emrDoc.DocumentElement.SetAttribute(AttributeNames.LastWriteTime, LastWriteTime); emrDoc.Save(emrDocFile); udt.jj.EncodeEmrDocument(emrDocFile); #endregion return(Return.Successful); }
public int AddEmrNote(XmlNode notePattern, XmlElement emrNote, NoteStatus status, bool sexOption, XmlNode wordXml) { int series = -1; string registryID = emrDoc.DocumentElement.GetAttribute(AttributeNames.RegistryID); string noteID = notePattern.Attributes[AttributeNames.NoteID].Value; #region Set attributes for emr note string sequence = null; #region Treat attribute StartTime switch (notePattern.Attributes[AttributeNames.StartTime].Value) { case StartTime.Routine: if (Globals.offline) { emrNote.SetAttribute(AttributeNames.Start, ThisAddIn.Today().ToString()); } else { emrNote.SetAttribute(AttributeNames.Start, ThisAddIn.LastDegreeOrderTime(registryID).ToString()); } break; case StartTime.Operation: sequence = OperationSequence(registryID, noteID); if (sequence == null) { return(series); } emrNote.SetAttribute(AttributeNames.Sequence, sequence); break; case StartTime.Rescued: sequence = RescueSequence(registryID, noteID); if (sequence == null) { return(series); } emrNote.SetAttribute(AttributeNames.RescueSequence, sequence); break; case StartTime.TransferIn: sequence = TransferInSequence(registryID, noteID); if (sequence == null) { return(series); } emrNote.SetAttribute(AttributeNames.TransferInSequence, sequence); break; case StartTime.TransferOut: sequence = TransferOutSequence(registryID, noteID); if (sequence == null) { return(series); } emrNote.SetAttribute(AttributeNames.TransferOutSequence, sequence); break; case StartTime.TakeOver: sequence = TakeoverSequence(registryID, noteID); if (sequence == null) { return(series); } emrNote.SetAttribute(AttributeNames.TakeOverSequence, sequence); break; case StartTime.Consult: sequence = ConsultSequence(registryID, noteID); if (sequence == null) { // MessageBox.Show("此次会诊记录已经书写完成!"); return(series); } emrNote.SetAttribute(AttributeNames.Sequence, sequence); break; } #endregion int sign = 0; //try //{ // foreach (Microsoft.Office.Interop.Word.XMLNode xn in ActiveDocumentManager.getDefaultAD().XMLNodes) // { // if (xn.BaseName == "电子病历") // { // for (int i = 1; i <= xn.ChildNodes.Count; i++) // { // if (xn.ChildNodes[i].Text == null) continue; // if (xn.ChildNodes[i].BaseName == "医护签名") // { // sign = xn.ChildNodes[i].ChildNodes.Count; // break; // } // } // } // else break; // } //} //catch (Exception ex) //{ // MessageBox.Show(ex.Message, "EmrDocument 的317行"); //} emrNote.SetAttribute(AttributeNames.NoteID, noteID); emrNote.SetAttribute(AttributeNames.NoteName, notePattern.Attributes[AttributeNames.NoteName].Value); emrNote.SetAttribute(AttributeNames.Header, notePattern.Attributes[AttributeNames.Header].Value); emrNote.SetAttribute(AttributeNames.Unique, notePattern.Attributes[AttributeNames.Unique].Value); emrNote.SetAttribute(AttributeNames.NoteStatus, status.ToString("d")); emrNote.SetAttribute(AttributeNames.WriterID, Globals.DoctorID); emrNote.SetAttribute(AttributeNames.Writer, Globals.DoctorName); DateTime now = ThisAddIn.Today(); /* because allow the operator to choose commit time */ emrNote.SetAttribute(AttributeNames.CheckerID, ""); emrNote.SetAttribute(AttributeNames.Checker, ""); emrNote.SetAttribute(AttributeNames.CheckedDate, ""); emrNote.SetAttribute(AttributeNames.FinalCheckerID, ""); emrNote.SetAttribute(AttributeNames.FinalChecker, ""); emrNote.SetAttribute(AttributeNames.FinalCheckedDate, ""); emrNote.SetAttribute("sign", sign.ToString()); /* 2007-07-11 add sign lables */ if (notePattern.Attributes[AttributeNames.Sign1] != null) { emrNote.SetAttribute(AttributeNames.Sign1, notePattern.Attributes[AttributeNames.Sign1].Value); } if (notePattern.Attributes[AttributeNames.Sign2] != null) { emrNote.SetAttribute(AttributeNames.Sign2, notePattern.Attributes[AttributeNames.Sign2].Value); } if (notePattern.Attributes[AttributeNames.Sign3] != null) { emrNote.SetAttribute(AttributeNames.Sign3, notePattern.Attributes[AttributeNames.Sign3].Value); } emrNote.SetAttribute(AttributeNames.LastWriteTime, now.ToFileTime().ToString()); /* add merge property */ emrNote.SetAttribute(AttributeNames.Merge, notePattern.Attributes[AttributeNames.Merge].Value); emrNote.SetAttribute(AttributeNames.StartTime, notePattern.Attributes[AttributeNames.StartTime].Value); /* add sex feature for it to be as a template */ if (sexOption) { emrNote.SetAttribute(AttributeNames.Sex, StringGeneral.Yes); } else { emrNote.SetAttribute(AttributeNames.Sex, StringGeneral.No); } if (emrNote.Attributes[AttributeNames.SingleContinue] == null) { XmlAttribute newAttribute = emrNote.OwnerDocument.CreateAttribute(AttributeNames.SingleContinue); emrNote.Attributes.Append(newAttribute); } if (notePattern.Attributes[AttributeNames.SingleContinue] != null) { emrNote.SetAttribute(AttributeNames.SingleContinue, notePattern.Attributes[AttributeNames.SingleContinue].Value); } else { emrNote.SetAttribute(AttributeNames.SingleContinue, "no"); } /*----------------------------------------------------------------------------*/ /* Make a new series as unique id for the EmrNote. */ #endregion /* word window to word document */ //string tmpfile = Path.GetFullPath("病程记录.dotx"); string tmpfile = Path.Combine(Globals.currentDirectory, ResourceName.Mytmp); //udt.jj.SaveWordDoc(ThisAddIn.Application.ActiveDocument, tmpfile, false); #region Save document into database if (!Globals.offline) { XmlElement noteDoc = emrDoc.CreateElement(ElementNames.EmrNote); noteDoc.InnerText = udt.jj.WordDocumentToString(tmpfile); emrNote.SetAttribute(AttributeNames.Series, "0"); series = ThisAddIn.NewOneEmrNote(registryID, archiveNum, emrNote, noteDoc, wordXml); if (series < 0) { return(series); } } else { series = Convert.ToInt32(emrDoc.DocumentElement.GetAttribute(AttributeNames.Series)) + 1; return(-100); } #endregion #region Save document into local storage string wdDocName = udt.MakeWdDocumentFileName(registryID, noteID, series, Globals.workFolder); File.Copy(tmpfile, wdDocName, true); if (Globals.localDocumentEncode) { udt.jj.EncodeEmrDocument(wdDocName); } emrNote.SetAttribute(AttributeNames.Series, series.ToString("d")); emrDoc.DocumentElement.AppendChild(emrNote); emrDoc.DocumentElement.SetAttribute(AttributeNames.LastWriteTime, now.ToFileTime().ToString()); emrDoc.DocumentElement.SetAttribute(AttributeNames.Series, series.ToString("d")); emrDoc.Save(emrDocFile); udt.jj.EncodeEmrDocument(emrDocFile); #endregion return(series); }