修改专册报表中”门诊号/住院号“字段取值由order_info中的patient_no改为patient_id.修改自动退出
This commit is contained in:
		
							parent
							
								
									abae0a0d61
								
							
						
					
					
						commit
						6cb18541ab
					
				| 
						 | 
					@ -37,7 +37,7 @@
 | 
				
			||||||
		<!-- 按处方还药或者按取药记录还药 1:处方(ReturnDrugWindow2)2:药品(ReturnDrugWindow)-->
 | 
							<!-- 按处方还药或者按取药记录还药 1:处方(ReturnDrugWindow2)2:药品(ReturnDrugWindow)-->
 | 
				
			||||||
		<add key="returnDrugMode" value="1" />
 | 
							<add key="returnDrugMode" value="1" />
 | 
				
			||||||
		<!-- 自动退出时间,单位秒,为0时不自动退出 -->
 | 
							<!-- 自动退出时间,单位秒,为0时不自动退出 -->
 | 
				
			||||||
		<add key="autoExit" value="0"/>
 | 
							<add key="autoExit" value="10"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		<!-- 无操作退出录像时间,单位秒,为0时不退出录像 -->
 | 
							<!-- 无操作退出录像时间,单位秒,为0时不退出录像 -->
 | 
				
			||||||
		<add key="stopRecord" value="180"/>
 | 
							<add key="stopRecord" value="180"/>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -450,7 +450,7 @@ namespace DM_Weight.Report
 | 
				
			||||||
            string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
 | 
					            string p_machine_id = (ConfigurationManager.AppSettings["machineId"] ?? "DM1");
 | 
				
			||||||
            string SQL = $@" SELECT ac.create_time as operationTime, ac.manu_no as manuNo,
 | 
					            string SQL = $@" SELECT ac.create_time as operationTime, ac.manu_no as manuNo,
 | 
				
			||||||
	                     ac.eff_date as effDate,ac.department as dept,oi.p_name as pName,oi.sex as sex,oi.age as age,oi.id_number as idNumber,
 | 
						                     ac.eff_date as effDate,ac.department as dept,oi.p_name as pName,oi.sex as sex,oi.age as age,oi.id_number as idNumber,
 | 
				
			||||||
                         oi.patient_no as zyh,'' mkh,oi.disease as disease,ac.out_quantity as outQuantity,od.empty_bottle_batch as ftph,oi.doctor_name as doctorName,oi.order_no as orderNo,od.empty_bottle_submitter kptjr,
 | 
					                         oi.patient_id as zyh,'' mkh,oi.disease as disease,ac.out_quantity as outQuantity,od.empty_bottle_batch as ftph,oi.doctor_name as doctorName,oi.order_no as orderNo,od.empty_bottle_submitter kptjr,
 | 
				
			||||||
	                    di.drug_id as drugId,di.drug_name as drugName,di.drug_spec as drugSpec,di.big_unit AS bigUnit,u1.user_name as operatorName,u2.user_name as reviewerName,db.baseQuantity
 | 
						                    di.drug_id as drugId,di.drug_name as drugName,di.drug_spec as drugSpec,di.big_unit AS bigUnit,u1.user_name as operatorName,u2.user_name as reviewerName,db.baseQuantity
 | 
				
			||||||
	                     FROM account_book_g2 ac inner join order_info oi on ac.invoice_no=oi.order_no inner join order_detail od on oi.order_no=od.order_no 
 | 
						                     FROM account_book_g2 ac inner join order_info oi on ac.invoice_no=oi.order_no inner join order_detail od on oi.order_no=od.order_no 
 | 
				
			||||||
                   left join drug_info di on ac.drug_id=di.drug_id left join drug_base db on di.drug_id=db.DrugId and db.machine_id='DM1' 
 | 
					                   left join drug_info di on ac.drug_id=di.drug_id left join drug_base db on di.drug_id=db.DrugId and db.machine_id='DM1' 
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -467,29 +467,61 @@ namespace DM_Weight.ViewModels
 | 
				
			||||||
            int stopRecord = Convert.ToInt32(ConfigurationManager.AppSettings["stopRecord"] ?? "0");
 | 
					            int stopRecord = Convert.ToInt32(ConfigurationManager.AppSettings["stopRecord"] ?? "0");
 | 
				
			||||||
            if (autoExit > 0)
 | 
					            if (autoExit > 0)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                System.Timers.Timer timer = new System.Timers.Timer();
 | 
					                logger.Info("启动自动退出检测");
 | 
				
			||||||
                timer.Interval = 1000;
 | 
					                //int interval = autoExit * 1000;
 | 
				
			||||||
                timer.Elapsed += (sender, e) =>
 | 
					                new PromiseUtil<int>().taskAsyncLoop(1, 0, async (options, next, stop) =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    try
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                    // 串口无人操作
 | 
					 | 
				
			||||||
                        if (!_portUtil.Operate)
 | 
					                        if (!_portUtil.Operate)
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                        // 30秒内无人操作鼠标键盘
 | 
					                            // 无人操作鼠标键盘
 | 
				
			||||||
                            if ((DateTime.Now - _portUtil.dateTime).TotalSeconds > autoExit && CheckComputerFreeState.GetLastInputTime() > autoExit)
 | 
					                            if ((DateTime.Now - _portUtil.dateTime).TotalSeconds > autoExit && CheckComputerFreeState.GetLastInputTime() > autoExit)
 | 
				
			||||||
                            {
 | 
					                            {
 | 
				
			||||||
                            logger.Info($"设备30秒内无人操作,用户【{Operator?.Nickname}】自动退出登录");
 | 
					                                logger.Info($"设备{autoExit}内无人操作,用户【{Operator?.Nickname}】自动退出登录,_portUtil.Operate:{_portUtil.Operate},totalSecond:{(DateTime.Now - _portUtil.dateTime).TotalSeconds},lastInputTime:{CheckComputerFreeState.GetLastInputTime()},autoExit:{autoExit}");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                Operator = null;
 | 
					                                Operator = null;
 | 
				
			||||||
                                Reviewer = null;
 | 
					                                Reviewer = null;
 | 
				
			||||||
                            Application.Current.Dispatcher.Invoke(() =>
 | 
					                                //Application.Current.Dispatcher.Invoke(() =>
 | 
				
			||||||
 | 
					                                //{
 | 
				
			||||||
 | 
					                                stop();
 | 
				
			||||||
 | 
					                                System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
 | 
				
			||||||
                                {
 | 
					                                {
 | 
				
			||||||
 | 
					                                    if (DialogHost.IsDialogOpen("RootDialog"))
 | 
				
			||||||
 | 
					                                    {
 | 
				
			||||||
 | 
					                                        DialogHost.Close("RootDialog");
 | 
				
			||||||
 | 
					                                    }
 | 
				
			||||||
                                    _regionManager.RequestNavigate("MainRegion", "LoginWindow");
 | 
					                                    _regionManager.RequestNavigate("MainRegion", "LoginWindow");
 | 
				
			||||||
                                timer.Stop();
 | 
					                                }));
 | 
				
			||||||
 | 
					                                //});
 | 
				
			||||||
 | 
					                                //timer.Dispose();
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                            else
 | 
				
			||||||
 | 
					                            {
 | 
				
			||||||
 | 
					                                if (Operator == null)
 | 
				
			||||||
 | 
					                                {
 | 
				
			||||||
 | 
					                                    logger.Info("自动退出检测已停止");
 | 
				
			||||||
 | 
					                                    stop();
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
 | 
					                                else
 | 
				
			||||||
 | 
					                                {
 | 
				
			||||||
 | 
					                                    logger.Info($"停止操作时间{_portUtil.dateTime},自动退出时间{autoExit},运算结果{(DateTime.Now - _portUtil.dateTime).TotalSeconds},用户上次使用系统到现在的时间间隔{CheckComputerFreeState.GetLastInputTime()}");
 | 
				
			||||||
 | 
					                                    next();
 | 
				
			||||||
 | 
					                                }
 | 
				
			||||||
 | 
					                            }
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        else
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            _portUtil.dateTime = DateTime.Now;
 | 
				
			||||||
 | 
					                            next();
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    catch (Exception ex)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        logger.Info($"自动退出异常:{ex.Message}");
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                };
 | 
					 | 
				
			||||||
                timer.Start();
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            //if (stopRecord > 0)
 | 
					            //if (stopRecord > 0)
 | 
				
			||||||
            //{
 | 
					            //{
 | 
				
			||||||
            //    System.Timers.Timer timer = new System.Timers.Timer();
 | 
					            //    System.Timers.Timer timer = new System.Timers.Timer();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,6 @@
 | 
				
			||||||
using System;
 | 
					using log4net;
 | 
				
			||||||
 | 
					using log4net.Repository.Hierarchy;
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
using System.Linq;
 | 
					using System.Linq;
 | 
				
			||||||
using System.Runtime.InteropServices;
 | 
					using System.Runtime.InteropServices;
 | 
				
			||||||
| 
						 | 
					@ -9,6 +11,7 @@ namespace DM_Weight.util
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public class CheckComputerFreeState
 | 
					    public class CheckComputerFreeState
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        private static readonly ILog logger = LogManager.GetLogger(typeof(CheckComputerFreeState));
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// 创建结构体用于返回捕获时间
 | 
					        /// 创建结构体用于返回捕获时间
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
| 
						 | 
					@ -44,9 +47,25 @@ namespace DM_Weight.util
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                var count = (Environment.TickCount & Int32.MaxValue) - (long)vLastInputInfo.dwTime;
 | 
					                //var count = (Environment.TickCount & Int32.MaxValue) - (long)vLastInputInfo.dwTime;
 | 
				
			||||||
                var icount = count / 1000;
 | 
					                //var icount = count / 1000;
 | 
				
			||||||
                return icount;
 | 
					                //return icount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                // 使用 64 位 TickCount 避免回绕问题
 | 
				
			||||||
 | 
					                long currentTick = Environment.TickCount64;
 | 
				
			||||||
 | 
					                long lastInputTick = vLastInputInfo.dwTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                logger.Info($"获取用户未操作时间间隔{currentTick}-{lastInputTick}");
 | 
				
			||||||
 | 
					                // 处理可能的回绕(虽然使用 64 位后极不可能发生)
 | 
				
			||||||
 | 
					                if (currentTick < lastInputTick)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    // 发生了回绕,调整计算
 | 
				
			||||||
 | 
					                    lastInputTick -= uint.MaxValue + 1L;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                long elapsedMilliseconds = currentTick - lastInputTick;
 | 
				
			||||||
 | 
					                long seconds = elapsedMilliseconds / 1000;
 | 
				
			||||||
 | 
					                logger.Info($"获取用户未操作时间间隔{currentTick}-{lastInputTick}-{elapsedMilliseconds}-{seconds}-{Math.Max(0, seconds)}");
 | 
				
			||||||
 | 
					                return Math.Max(0, seconds);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue