116 lines
3.4 KiB
C#
116 lines
3.4 KiB
C#
using log4net;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace JJServer
|
|
{
|
|
public class MyServer
|
|
{
|
|
public static ILog logger = LogManager.GetLogger("WebLogger");
|
|
bool ServerStatus = false;
|
|
public Patient_Info Curpatient_Info;
|
|
public SqlHelper mSqlHelper = new SqlHelper();
|
|
static List<PatientDatail> spatientDatails = new List<PatientDatail>();
|
|
|
|
|
|
|
|
|
|
public void Init()
|
|
{
|
|
mSqlHelper.initDB();
|
|
}
|
|
|
|
public void Start()
|
|
{
|
|
}
|
|
|
|
public bool GetServerStatus()
|
|
{
|
|
return ServerStatus;
|
|
}
|
|
|
|
public void Stop()
|
|
{
|
|
ServerStatus = false;
|
|
}
|
|
|
|
|
|
|
|
public void GetTranData(ref List<PatientDatail> mpatientDatails)
|
|
{
|
|
mpatientDatails = spatientDatails;
|
|
spatientDatails = null;
|
|
}
|
|
|
|
public void SetTranData( List<PatientDatail> mpatientDatails)
|
|
{
|
|
spatientDatails = mpatientDatails;
|
|
}
|
|
|
|
public DataTable GetHistory()
|
|
{
|
|
return mSqlHelper.GetRecord();
|
|
}
|
|
|
|
public void ParseData(PatientDatail INData)
|
|
{
|
|
List<PatientDatail> patientDatails = new List<PatientDatail>();
|
|
patientDatails.Add(INData);
|
|
//foreach(jyData jd in INData.jyDatas)
|
|
//{
|
|
// mSqlHelper.InsertARecord(INData.PatientInfo.CardNo, INData.PatientInfo.Name, jd.Barcode, jd.itemInfo, jd.sgname, jd.sgxx, 1, INData.PatientInfo.Memo);
|
|
//}
|
|
foreach(OrginData orginData in INData.OrginDatas)
|
|
{
|
|
mSqlHelper.InsertARecord(orginData.PatID, orginData.PatName, orginData.PatAge, orginData.PatSex, orginData.Barcode, orginData.Tuble, orginData.ItemName, orginData.ItemCount, orginData.ItemType, orginData.DoDept, orginData.OprDept, orginData.OprTime, orginData.PrintTime, orginData.ItemStatus, orginData.ItemsDetails, orginData.PrinterDev);
|
|
}
|
|
spatientDatails = patientDatails;
|
|
}
|
|
|
|
public string Candispensestr = "";
|
|
public string GetDaylyCountInfo(List<string> Candispense)
|
|
{
|
|
if(Candispensestr=="")
|
|
{
|
|
foreach(string str in Candispense)
|
|
{
|
|
if(Candispensestr=="")
|
|
{
|
|
Candispensestr = "\'"+str+"\'";
|
|
}
|
|
else
|
|
{
|
|
Candispensestr = Candispensestr + ",\'" + str+"\'";
|
|
}
|
|
|
|
}
|
|
}
|
|
string Sql = "SELECT COUNT(DISTINCT CardNo) AS UniqueCardNoCount,COUNT(CASE WHEN Tube in("+ Candispensestr + ") THEN 1 END) AS SGCount,COUNT(CASE WHEN Tube not in("+ Candispensestr + ") THEN 1 END) AS BQCount FROM TranList; ";
|
|
DataTable dataTable = mSqlHelper.ExecQuery(Sql);
|
|
if(dataTable.Rows.Count<=0)
|
|
{
|
|
return "0|0|0";
|
|
}
|
|
return dataTable.Rows[0]["UniqueCardNoCount"].ToString() + "|" + dataTable.Rows[0]["SGCount"].ToString() + "|" + dataTable.Rows[0]["BQCount"].ToString();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|