SQLiteLogic.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Reflection.Emit;
  5. using System.Text;
  6. using WpfTest1.SQLite;
  7. namespace WpfTest1.SQLite
  8. {
  9. public class SQLiteLogic
  10. {
  11. static void Main_1(string[] args)
  12. { /*
  13. //CreateTable();
  14. //InsertData();
  15. Console.WriteLine("开始创建数据表!");
  16. SQLiteModel.CreatePatientTable();
  17. Console.WriteLine("插入数据!");
  18. SQLiteModel.InsertPatientData("620523199509051700", "张三", 175.1, 68.5, 144, 2, 3, DateTime.Now.Date,"13718141455", "护士", "北京市海淀区", "1", "1", "ZS", "状态良好", new DateTime(111111), false);
  19. SQLiteModel.InsertPatientData("620523199509051720", "李四", 145.1, 58.5, 134, 1, 3,DateTime.Now.Date, "12718141455", "教授", "西安市海淀区", "4", "1", "LS", "状态一般", new DateTime(111111), false);
  20. SQLiteModel.InsertPatientData("620523199509051702", "古丽 ", 165.1, 88.5, 154, 1, 3, DateTime.Now.Date,"15718141455", "司机", "上海市海淀区", "3", "1", "GL", "差", new DateTime(111111), false);
  21. Console.WriteLine("更新数据!");
  22. SQLiteModel.UpdatePatientData("620523199509051702", "张丽 ", 195.1, 98.5, 154, 1, 3, DateTime.Now.Date,"25718141455", "学生", "上海市海淀区", "3", "1", "ZL", "差", new DateTime(111111), false);
  23. Console.WriteLine("删除数据!");
  24. Console.WriteLine(SQLiteModel.DeletePatientItem("620523199509051702"));
  25. Console.WriteLine("获取数据!");
  26. //查询的一个问题是怎么返回值
  27. //根据姓名或者简写模糊查询
  28. SQLiteModel.getPatientByPY("G");
  29. SQLiteModel.getPatientByName("张");
  30. //根据条件进行查询 每个条件前面加AND
  31. //姓名name 身份证号 病例编号 孕次pregnancy_times 产次birth_times 身高height 体重weight 心率base_heartrate
  32. SQLiteModel.getPatientByCondition("AND name like\'%张丽%\'");
  33. Console.WriteLine("操作完毕!");
  34. Console.ReadLine();
  35. */
  36. }
  37. public SQLiteLogic(){}
  38. public static void createDBAndTables() {
  39. if (!System.IO.File.Exists(System.Environment.CurrentDirectory + "\\Junde.db3"))
  40. {
  41. SQLiteModel.CreatePatientTable();
  42. SQLiteModel.CreateRecordTable();
  43. SQLiteModel.CreateDoctorTable();
  44. SQLiteModel.CreateExpressionTable();
  45. SQLiteModel.CreateCommonWordsTable();
  46. SQLiteModel.CreateTreatmentTable();
  47. SQLiteModel.CreateTreatmentRecordTable();
  48. }
  49. }
  50. }
  51. }