/// <summary> /// 保存一个查房日志到本地 /// </summary> /// <param name="CheckLog"></param> public void SaveCheckLogToLocal(Data.DoctorCheckLog CheckLog) {//To do:修改病人的同步标志,标识需同步查房日志 using (SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(iDB.DbFile)) { string SqlCheckLog = @"Select * From [DoctorCheckLog] Where [DCLID]=?"; SQLite.SQLiteCommand cmd = conn.CreateCommand(SqlCheckLog, CheckLog.DCLID); Data.DoctorCheckLog existCheckLog = cmd.ExecuteQuery <DoctorCheckLog>().SingleOrDefault(); Data.SyncLog slCheckLog = new SyncLog() { TableName = "[DoctorCheckLog]", KeyField = "DCLID", KeyValue = CheckLog.DCLID, ChangeType = "INSERT" }; if (existCheckLog == null) { conn.Insert(CheckLog); } else { conn.Update(CheckLog); slCheckLog.ChangeType = "UPDATE"; } SaveSyncLog(conn, slCheckLog); } }
public void ExeShowCheckLogList(List <Data.DoctorCheckLog> LogList) { if (LogList.FindAll(log => log.CheckDate == iCommon.Today).Count == 0) { LogList.Insert(0, NewLog()); } var groupData = from log in LogList group log by log.CheckDate; this.cvsCheckLog.Source = groupData; var DateList = cvsCheckLog.View.CollectionGroups; (this.mmSZoom.ZoomedOutView as ListViewBase).ItemsSource = DateList; if (logParam != null) { Data.DoctorCheckLog log = LogList.Find(c => c.DCLID == logParam.DCLID); if (log != null) { gridLogList.SelectedItem = log; } } if (gridLogList.SelectedItem != null) { ShowLog(gridLogList.SelectedItem as Data.DoctorCheckLog); } PatientCheckLog = LogList; }
void View_OnUpdateCheckLog(object sender, Views.CheckLogDetailEventArgs e) { Data.DoctorCheckLog CheckLog = Model.QueryLocalCheckLog(e.DCLID); if (CheckLog != null) { View.ExeUpdateCheckLog(CheckLog); } }
private void btnDeleteCheckLog_Click(object sender, RoutedEventArgs e) { if (this.gridLogList.SelectedItem == null) { return; } Data.DoctorCheckLog log = gridLogList.SelectedItem as Data.DoctorCheckLog; OnDeleteCheckLog(null, new Views.CheckLogDetailEventArgs(iCommon.Patient.InhosID, log)); }
private void gridLogList_Tapped(object sender, TappedRoutedEventArgs e) { if (gridLogList.SelectedItem == null) { return; } Data.DoctorCheckLog log = gridLogList.SelectedItem as Data.DoctorCheckLog; ShowLog(log); }
private void gridPhotoList_Tapped(object sender, TappedRoutedEventArgs e) { if (gridPhotoList.SelectedItem == null) { return; } Data.DoctorCheckLog photo = gridPhotoList.SelectedItem as Data.DoctorCheckLog; ShowPhoto(photo); }
private async void ShowLog(Data.DoctorCheckLog log) { if (clDetail.CheckLog != null) { clDetail.CheckLog.MedicalLog = await GetImage(); OnSaveCheckLog(null, clDetail); } SetImage(log.MedicalLog); clDetail.CheckLog = log; }
private void btnDeletePhoto_Click(object sender, RoutedEventArgs e) { if (this.gridPhotoList.SelectedItem == null) { return; } Data.DoctorCheckLog photo = gridPhotoList.SelectedItem as Data.DoctorCheckLog; Views.CheckPhotoDetailEventArgs arg = new Views.CheckPhotoDetailEventArgs(); arg.InhosID = iCommon.Patient.InhosID; arg.CheckPhoto = photo; OnDeleteCheckPhoto(null, arg); }
async void SaveCheckPhoto(StorageFile ImageFile) { IBuffer fileBuffer = await FileIO.ReadBufferAsync(ImageFile); byte[] btsImage = WindowsRuntimeBufferExtensions.ToArray(fileBuffer, 0, (int)fileBuffer.Length); Data.DoctorCheckLog photo = NewPhoto(); photo.Photo = btsImage; Views.CheckPhotoDetailEventArgs cva = new Views.CheckPhotoDetailEventArgs(); cva.InhosID = iCommon.Patient.InhosID; cva.CheckPhoto = photo; OnSaveCheckPhoto(null, cva); }
private async void ShowPhoto(Data.DoctorCheckLog photo) { var bitmapImage = new BitmapImage(); using (var stream = new InMemoryRandomAccessStream()) { DataWriter datawriter = new DataWriter(stream.GetOutputStreamAt(0)); datawriter.WriteBytes(photo.Photo); await datawriter.StoreAsync(); bitmapImage.SetSource(stream); } imgCheck.Source = bitmapImage; }
Data.DoctorCheckLog NewPhoto() { Data.DoctorCheckLog nLog = new Data.DoctorCheckLog(); nLog.DCLID = Guid.NewGuid().ToString(); nLog.DeviceID = iCommon.DeviceID; nLog.DoctorID = iCommon.DoctorID; nLog.DoctorName = iCommon.DoctorName; nLog.InhosID = iCommon.Patient.InhosID; nLog.LogType = "照片"; nLog.CheckDate = iCommon.Today; nLog.CheckTime = iCommon.NowTime; nLog.LastSaveDate = iCommon.DateNow; return(nLog); }
public void DeleteCheckLog(Data.DoctorCheckLog CheckLog) { using (SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(iDB.DbFile)) { string SqlCheckLog = @"Delete From [DoctorCheckLog] Where [DCLID]=?"; SQLite.SQLiteCommand cmd = conn.CreateCommand(SqlCheckLog, CheckLog.DCLID); cmd.ExecuteNonQuery(); Data.SyncLog slCheckLog = new SyncLog() { TableName = "[DoctorCheckLog]", KeyField = "DCLID", KeyValue = CheckLog.DCLID, ChangeType = "DELETE" }; SaveSyncLog(conn, slCheckLog); } }
void iCommon_CheckLogSyncComplet(object sender, CheckLogSyncEventArgs e) { for (int i = 0; i < e.InhosID.Count; i++) { if (iCommon.Patient.InhosID == e.InhosID[i]) {//判断是否有当前病人的更新 string CurrentDCLID = ""; if (this.gridLogList.SelectedItem != null) { CurrentDCLID = (this.gridLogList.SelectedItem as Data.DoctorCheckLog).DCLID; } int Index = e.DCLID.IndexOf(CurrentDCLID); if (Index >= 0 && e.ChangeType[Index] == "UPDATE") { //判断是否有当前日志的更新,有则覆盖显示 Views.CheckLogDetailEventArgs logArg = new Views.CheckLogDetailEventArgs(); logArg.DCLID = CurrentDCLID; OnUpdateCheckLog(null, logArg); } for (int c = 0; c < e.DCLID.Count; c++) { if (e.DCLID[c] == CurrentDCLID) { continue; } Data.DoctorCheckLog checkLog = PatientCheckLog.Find(pcl => pcl.DCLID == e.DCLID[c]); if (checkLog != null) { if (e.ChangeType[c] == "UPDATE") { checkLog.MedicalLog = e.MedicalLog[c]; } else if (e.ChangeType[c] == "DELETE") { PatientCheckLog.Remove(checkLog); } } } return; } } }
public void ExeDeleteCheckLog(Data.DoctorCheckLog CheckLog) { PatientCheckLog.Remove(CheckLog); ExeShowCheckLogList(PatientCheckLog); }
public void ExeUpdateCheckLog(Data.DoctorCheckLog CheckLog) { SetImage(CheckLog.MedicalLog, true); }
public void ExeDeleteCheckPhoto(Data.DoctorCheckLog CheckPhoto) { PatientCheckPhoto.Remove(CheckPhoto); ExeShowCheckPhotoList(PatientCheckPhoto); }
public void ExeShowCheckPhoto(Data.DoctorCheckLog CheckPhoto) { PatientCheckPhoto.Insert(0, CheckPhoto); ExeShowCheckPhotoList(PatientCheckPhoto); }
public CheckLogDetailEventArgs(string inhosID, Data.DoctorCheckLog checkLog) { InhosID = inhosID; CheckLog = checkLog; }