city_data_uoload_service.go 38KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950
  1. // 统计后台的 service
  2. package service
  3. import (
  4. "Data_Upload_Api/models"
  5. "Data_Upload_Api/models/sz"
  6. "github.com/jinzhu/gorm"
  7. "strings"
  8. )
  9. func GetSyncTimeByOrgId(org_id int64, sync_type int64) (sync_info models.XTSyncInfo, err error) {
  10. err = readDb.Model(&models.XTSyncInfo{}).Where("org_id = ? and sync_type = ? ", org_id, sync_type).Last(&sync_info).Error
  11. return
  12. }
  13. func FindAllDataUploadConfigOrgInfo(province_id int64, city_id int64, config_type int64) (data []*sz.DataUploadConfig, err error) {
  14. err = readDb.Model(&sz.DataUploadConfig{}).Where("status = 1 AND province_id = ? AND city_id = ? AND config_type = ?", province_id, city_id, config_type).Find(&data).Error
  15. return
  16. }
  17. func FindDataUploadOrgInfo(org_id int64, module_type int64) (data sz.DataUpload, err error) {
  18. err = readDb.Model(&sz.DataUpload{}).Where(" org_id = ? AND module_type = ?", org_id, module_type).Last(&data).Error
  19. return
  20. }
  21. func FindOrgData(org_id int64, sync_time int64) (org models.UserOrg, err error) {
  22. err = readUserDb.Model(&models.UserOrg{}).Where("status = 1 AND id = ? AND ctime > ?", org_id, sync_time).Preload("DeviceNumber", func(db *gorm.DB) *gorm.DB {
  23. return readDb.Where("status = 1")
  24. }).Find(&org).Error
  25. return
  26. }
  27. func FindOrgRolesData(org_id int64, lastUploadTime int64, nowTime int64) (role []*models.UserAdminRole, err error) {
  28. db := readUserDb.Model(&models.UserAdminRole{}).Where("status = 1 AND org_id = ? ", org_id)
  29. db = db.Where("ctime >= ? AND ctime <= ?", lastUploadTime, nowTime)
  30. err = db.Find(&role).Error
  31. return
  32. }
  33. func FindOrgPatientData(org_id int64, lastUploadTime int64, nowTime int64) (patient []*models.Patients, err error) {
  34. db := readDb.Model(&models.Patients{}).Where("status = 1 AND user_org_id = ?", org_id)
  35. db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
  36. err = db.Find(&patient).Error
  37. return
  38. }
  39. func FindOrgPatientDataOne(org_id int64) (patient []*models.Patients, err error) {
  40. db := readDb.Model(&models.Patients{}).Where("status = 1 AND user_org_id = ?", org_id)
  41. err = db.Find(&patient).Error
  42. return
  43. }
  44. func FindOrgPatientInfectious(org_id int64, lastUploadTime int64, nowTime int64) (patient []*models.Patients, err error) {
  45. db := readDb.Model(&models.Patients{}).Where("status = 1 AND user_org_id = ? AND lapseto = 2 ", org_id)
  46. db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
  47. err = db.Find(&patient).Error
  48. return
  49. }
  50. func FindOrgDeviceNumber(org_id int64, lastUploadTime int64, nowTime int64) (devices []*models.DeviceNumber, err error) {
  51. db := readDb.Model(&models.DeviceNumber{}).Where("status = 1 AND org_id = ?", org_id)
  52. db = db.Where("ctime >= ? AND ctime <= ?", lastUploadTime, nowTime)
  53. err = db.Find(&devices).Error
  54. return
  55. }
  56. func FindOrgPatientOutData(org_id int64, lastUploadTime int64, nowTime int64) (patient []*models.Patients, err error) {
  57. db := readDb.Model(&models.Patients{}).Where("status = 1 AND user_org_id = ? AND lapseto = 2 ", org_id).Preload("PatientLapseto", "status = 1")
  58. db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
  59. err = db.Find(&patient).Error
  60. return
  61. }
  62. func FindOrgScheduleData(org_id int64, lastUploadTime int64, nowTime int64) (sch []*models.Schedule, err error) {
  63. db := readDb.Model(&models.Schedule{}).Where("status = 1 AND user_org_id = ?", org_id).Preload("DeviceNumber", "status = 1")
  64. if lastUploadTime != 0 && nowTime != 0 {
  65. db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
  66. }
  67. err = db.Find(&sch).Error
  68. return
  69. }
  70. func FindOrgDialysisPrescriptionData(org_id int64, lastUploadTime int64, nowTime int64) (ps []*models.DialysisPrescription, err error) {
  71. db := readDb.Model(&models.DialysisPrescription{}).Where("status = 1 AND user_org_id = ?", org_id).Preload("DialysisOrder", "status = 1")
  72. db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
  73. err = db.Find(&ps).Error
  74. return
  75. }
  76. func FindOrgDoctorAdviceTemplateData(org_id int64, lastUploadTime int64, nowTime int64) (advice []*models.DoctorAdviceTemplate, err error) {
  77. db := readDb.Model(&models.DoctorAdviceTemplate{}).Where("status = 1 AND org_id = ? and advice_type = 0 ", org_id)
  78. db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
  79. err = db.Find(&advice).Error
  80. return
  81. }
  82. func FindAssessmentBeforeDislysis(org_id int64, patient_id int64) (before models.AssessmentBeforeDislysis, err error) {
  83. db := readDb.Model(&models.AssessmentBeforeDislysis{}).Where("status = 1 AND user_org_id = ? and patient_id = ? ", org_id,patient_id)
  84. err = db.Last(&before).Error
  85. return
  86. }
  87. func FindOrgMonitorRecordData(org_id int64, lastUploadTime int64, nowTime int64) (monitor []*models.MonitoringRecord, err error) {
  88. db := readDb.Model(&models.MonitoringRecord{}).Where("status = 1 AND user_org_id = ?", org_id).Preload("DialysisOrder", "status = 1")
  89. db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
  90. err = db.Find(&monitor).Error
  91. return
  92. }
  93. func FindOrgMonitorRecordByLike(org_id int64, keyword string, lastUploadTime int64, nowTime int64) (monitor []*models.MonitoringRecord, err error) {
  94. db := readDb.Model(&models.MonitoringRecord{}).Where("status = 1 AND user_org_id = ? AND symptom like ?", org_id,keyword)
  95. db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
  96. err = db.Find(&monitor).Error
  97. return
  98. }
  99. func FindOrgInspection(org_id int64, lastUploadTime int64, nowTime int64) (inspection []*models.XtInspection, err error) {
  100. db := readDb.Model(&models.XtInspection{}).Where("status = 1 AND org_id = ? ", org_id).Preload("Patients", "status = 1")
  101. db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
  102. err = db.Find(&inspection).Error
  103. return
  104. }
  105. // 传染病查询
  106. func FindOrgInspectionGroupOne(org_id int64, lastUploadTime int64, nowTime int64,patient_id int64) (inspection []*models.XtInspection, err error) {
  107. db := readDb.Model(&models.XtInspection{}).Where("status = 1 AND org_id = ? and project_id = 14 and patient_id = ?", org_id,patient_id)
  108. db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime).Group("inspect_date")
  109. err = db.Find(&inspection).Error
  110. return
  111. }
  112. // 传染病查询
  113. func FindOrgInspectionGroupTwo(org_id int64, inspect_date int64,patient_id int64) (inspection []*models.XtInspection, err error) {
  114. db := readDb.Model(&models.XtInspection{}).Where("status = 1 AND org_id = ? and project_id = 14 and patient_id = ? and inspect_date = ?", org_id,patient_id,inspect_date)
  115. err = db.Find(&inspection).Error
  116. return
  117. }
  118. func FindOrgInspectionReference(org_id int64, lastUploadTime int64, nowTime int64) (inspection []*models.XtInspection, err error) {
  119. db := readDb.Model(&models.XtInspection{}).Where("status = 1 AND org_id = ? ", org_id).Preload("XtInspectionReference", "status = 1")
  120. db = db.Where("created_time >= ? AND created_time <= ?", lastUploadTime, nowTime)
  121. err = db.Find(&inspection).Error
  122. return
  123. }
  124. func CreateOrgRecord(rdb *gorm.DB, hospital *sz.TempHdHospital) (err error) {
  125. err = rdb.Model(&sz.TempHdHospital{}).Create(&hospital).Error
  126. return
  127. }
  128. func CreateUploadRecord(upload *sz.DataUpload) (err error) {
  129. err = writeDb.Model(&sz.DataUpload{}).Create(&upload).Error
  130. return
  131. }
  132. func FindOrgDialysisData(org_id int64, lastUploadTime int64, nowTime int64) (ps []*models.VMDialysisOrder, err error) {
  133. db := readDb.Model(&models.VMDialysisOrder{}).Where("status = 1 AND user_org_id = ? AND stage = 2 ", org_id).
  134. Preload("DeviceNumber", "status = 1").
  135. Preload("VMDialysisPrescription", "status = 1").
  136. Preload("AssessmentBeforeDislysis", "status = 1").
  137. Preload("AssessmentAfterDislysis", "status = 1").
  138. Preload("Schedule", "status = 1").
  139. Preload("MonitoringRecord", "status = 1")
  140. if lastUploadTime != 0 && nowTime != 0 {
  141. db = db.Where("updated_time >= ? AND updated_time <= ?", lastUploadTime, nowTime)
  142. }
  143. err = db.Find(&ps).Error
  144. return
  145. }
  146. func FindOrgDeviceZoneRecordData(org_id int64, lastUploadTime int64, nowTime int64) (zone []*models.DeviceZone, err error) {
  147. db := readDb.Model(&models.DeviceZone{}).Where("status = 1 AND org_id = ?", org_id)
  148. if lastUploadTime != 0 && nowTime != 0 {
  149. db = db.Where("ctime >= ? AND ctime <= ?", lastUploadTime, nowTime)
  150. }
  151. err = db.Find(&zone).Error
  152. return
  153. }
  154. func FindOrgWaterMachineData(org_id int64, lastUploadTime int64, nowTime int64) (waterMachine []*models.VMDeviceAddmacher, err error) {
  155. db := readUserDb.Model(&models.VMDeviceAddmacher{}).Where("status = 1 AND user_org_id = ? AND device_type = 2", org_id)
  156. db = db.Where("ctime >= ? AND ctime <= ?", lastUploadTime, nowTime)
  157. err = db.Find(&waterMachine).Error
  158. return
  159. }
  160. func BatchCreateWMsRecord(wms []*sz.TempHdWm, rdb *gorm.DB) (err error) {
  161. if len(wms) > 0 {
  162. utx := rdb
  163. if len(wms) > 0 {
  164. thisSQL := "INSERT INTO t_hd_wm (hospital_id, equipment_id, equipment_brand, equipment_model, enable_time,discarded_time,equipment_type,xgbz,create_time,update_time,sjscsj) VALUES "
  165. insertParams := make([]string, 0)
  166. insertData := make([]interface{}, 0)
  167. for _, wm := range wms {
  168. insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?)")
  169. insertData = append(insertData, wm.HospitalId)
  170. insertData = append(insertData, wm.EquipmentId)
  171. insertData = append(insertData, wm.EquipmentBrand)
  172. insertData = append(insertData, wm.EquipmentModel)
  173. insertData = append(insertData, wm.EnableTime)
  174. insertData = append(insertData, wm.DiscardedTime)
  175. insertData = append(insertData, wm.EquipmentType)
  176. insertData = append(insertData, wm.Xgbz)
  177. insertData = append(insertData, wm.CreateTime)
  178. insertData = append(insertData, wm.UpdateTime)
  179. insertData = append(insertData, wm.Sjscsj)
  180. }
  181. thisSQL += strings.Join(insertParams, ", ")
  182. // err = utx.Exec(thisSQL, insertData...).Error
  183. // if err != nil {
  184. // utx.Rollback()
  185. // return
  186. // }
  187. utx.Exec(thisSQL, insertData...)
  188. }
  189. utx.Commit()
  190. }
  191. return
  192. }
  193. func BatchCreateStaffRecord(staffs []*sz.TempHdStaff, rdb *gorm.DB) (err error) {
  194. if len(staffs) > 0 {
  195. utx := rdb
  196. if len(staffs) > 0 {
  197. id_no := 429001198701091670
  198. for _, info := range staffs {
  199. thisSQL := "INSERT INTO t_hd_staff (hospital_id,staff_id, id_no,id_type,staff_name, position, staff_status, staff_no, permanent_type, in_date ,create_time, update_time, sjscsj, xgbz) VALUES "
  200. insertParams := make([]string, 0)
  201. insertData := make([]interface{}, 0)
  202. insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
  203. insertData = append(insertData, info.HospitalId)
  204. insertData = append(insertData, info.StaffId)
  205. insertData = append(insertData, id_no)
  206. insertData = append(insertData, "01")
  207. insertData = append(insertData, info.StaffName)
  208. insertData = append(insertData, info.Position)
  209. insertData = append(insertData, "0")
  210. insertData = append(insertData, info.StaffId)
  211. insertData = append(insertData, info.PermanentType)
  212. insertData = append(insertData, "2019-09-01")
  213. insertData = append(insertData, info.CreateTime)
  214. insertData = append(insertData, info.UpdateTime)
  215. insertData = append(insertData, info.Sjscsj)
  216. insertData = append(insertData, info.Xgbz)
  217. thisSQL += strings.Join(insertParams, ", ")
  218. utx.Exec(thisSQL, insertData...)
  219. id_no++
  220. }
  221. }
  222. // utx.Commit()
  223. }
  224. return
  225. }
  226. func BatchCreatePatinet(patients []*sz.TempHdPatient, rdb *gorm.DB) (err error) {
  227. if len(patients) > 0 {
  228. utx := rdb
  229. if len(patients) > 0 {
  230. for _, info := range patients {
  231. thisSQL := "INSERT INTO t_hd_patient ( hospital_id, patient_nk, card_no, card_type, id_no, id_type, patient_name, gender, born_date, diagnosis_summary, is_crf, pay_method, local_insurance, dialysis_start_time, local_start_time, outpatient_no, hospitalized_no, xgbz, create_time, update_time, sjscsj) VALUES "
  232. insertParams := make([]string, 0)
  233. insertData := make([]interface{}, 0)
  234. insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
  235. insertData = append(insertData, info.HospitalId)
  236. insertData = append(insertData, info.PatientNk)
  237. insertData = append(insertData, info.CardNo)
  238. insertData = append(insertData, info.CardType)
  239. insertData = append(insertData, info.IdNo)
  240. insertData = append(insertData, info.IdType)
  241. insertData = append(insertData, info.PatientName)
  242. insertData = append(insertData, info.Gender)
  243. insertData = append(insertData, info.BornDate)
  244. insertData = append(insertData, info.DiagnosisSummary)
  245. insertData = append(insertData, info.IsCrf)
  246. insertData = append(insertData, "02")
  247. insertData = append(insertData, "1")
  248. insertData = append(insertData, info.DialysisStartTime)
  249. insertData = append(insertData, info.LocalStartTime)
  250. insertData = append(insertData, info.OutpatientNo)
  251. insertData = append(insertData, info.HospitalizedNo)
  252. insertData = append(insertData, info.Xgbz)
  253. insertData = append(insertData, info.CreateTime)
  254. insertData = append(insertData, info.UpdateTime)
  255. insertData = append(insertData, info.Sjscsj)
  256. thisSQL += strings.Join(insertParams, ", ")
  257. utx.Exec(thisSQL, insertData...)
  258. }
  259. }
  260. // utx.Commit()
  261. }
  262. return
  263. }
  264. func BatchCreateSchedual(patients []*sz.TempHdShift, rdb *gorm.DB) (err error) {
  265. if len(patients) > 0 {
  266. utx := rdb
  267. if len(patients) > 0 {
  268. for _, info := range patients {
  269. thisSQL := "INSERT INTO t_hd_shift (ps_id, hospital_id, patient_nk, schedule_date, shift_type,sickbed_no,schedule_status,create_time,sjscsj,xgbz) VALUES "
  270. insertParams := make([]string, 0)
  271. insertData := make([]interface{}, 0)
  272. insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?)")
  273. insertData = append(insertData, info.PsId)
  274. insertData = append(insertData, info.HospitalId)
  275. insertData = append(insertData, info.PatientNk)
  276. insertData = append(insertData, info.ScheduleDate)
  277. insertData = append(insertData, info.ShiftType)
  278. insertData = append(insertData, info.SickbedNo)
  279. insertData = append(insertData, info.ScheduleStatus)
  280. insertData = append(insertData, info.CreateTime)
  281. insertData = append(insertData, info.Sjscsj)
  282. insertData = append(insertData, info.Xgbz)
  283. thisSQL += strings.Join(insertParams, ", ")
  284. utx.Exec(thisSQL, insertData...)
  285. }
  286. }
  287. // utx.Commit()
  288. }
  289. return
  290. }
  291. func BatchCreatePs(patients []*sz.TempHdPs, rdb *gorm.DB) (err error) {
  292. if len(patients) > 0 {
  293. utx := rdb
  294. if len(patients) > 0 {
  295. thisSQL := "INSERT INTO t_hd_ps (prescribe_id,hospital_id,patient_nk,rrt_type,rrt_type_name,dialysis_frequency,frequency_unit,prescribe_time,create_time,sjscsj,xgbz) VALUES "
  296. insertParams := make([]string, 0)
  297. insertData := make([]interface{}, 0)
  298. for _, info := range patients {
  299. insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?)")
  300. insertData = append(insertData, info.PrescribeId)
  301. insertData = append(insertData, info.HospitalId)
  302. insertData = append(insertData, info.PatientNk)
  303. insertData = append(insertData, info.RrtType)
  304. insertData = append(insertData, info.RrtTypeName)
  305. insertData = append(insertData, info.DialysisFrequency)
  306. insertData = append(insertData, info.FrequencyUnit)
  307. insertData = append(insertData, info.PrescribeTime)
  308. insertData = append(insertData, info.CreateTime)
  309. insertData = append(insertData, info.Sjscsj)
  310. insertData = append(insertData, info.Xgbz)
  311. }
  312. thisSQL += strings.Join(insertParams, ", ")
  313. // err = utx.Exec(thisSQL, insertData...).Error
  314. // if err != nil {
  315. // utx.Rollback()
  316. // return
  317. // }
  318. utx.Exec(thisSQL, insertData...)
  319. }
  320. // utx.Commit()
  321. }
  322. return
  323. }
  324. func BatchCreatePsOther(ps *sz.TempHdPs, rdb *gorm.DB)(err error){
  325. err = rdb.Create(&ps).Error
  326. return err
  327. }
  328. func BatchCreatePsm(psms []*sz.TempHdPsMedicine, rdb *gorm.DB) (err error) {
  329. if len(psms) > 0 {
  330. utx := rdb
  331. if len(psms) > 0 {
  332. for _, psm := range psms {
  333. thisSQL := "INSERT INTO t_hd_ps_medicine (hospital_id, medicine_type_id,medicine_id,create_time,sjscsj,xgbz,sn) VALUES "
  334. insertParams := make([]string, 0)
  335. insertData := make([]interface{}, 0)
  336. insertParams = append(insertParams, "(?,?,?,?,?,?,?)")
  337. insertData = append(insertData, psm.HospitalId)
  338. insertData = append(insertData, psm.MedicineTypeId)
  339. insertData = append(insertData, psm.MedicineId)
  340. insertData = append(insertData, psm.CreateTime)
  341. insertData = append(insertData, psm.Sjscsj)
  342. insertData = append(insertData, psm.Xgbz)
  343. insertData = append(insertData, psm.Sn)
  344. thisSQL += strings.Join(insertParams, ", ")
  345. // err = utx.Exec(thisSQL, insertData...).Error
  346. utx.Exec(thisSQL, insertData...)
  347. }
  348. // if err != nil {
  349. // utx.Rollback()
  350. // return
  351. // }
  352. }
  353. // utx.Commit()
  354. }
  355. return
  356. }
  357. func BatchCreateDialysis(psms []*sz.TempHdDialysis, rdb *gorm.DB) (err error) {
  358. if len(psms) > 0 {
  359. utx := rdb
  360. if len(psms) > 0 {
  361. for _, psm := range psms {
  362. thisSQL := "INSERT INTO t_hd_dialysis (dialysis_id,hospital_id,patient_nk,ps_id,dialysis_date,sickbed_no,division_id,equipment_id,mix_dialysis,ufv,total_treat_duration,is_hospitalization,is_emergency,is_perioperative_period,before_sbp,before_dbp,after_sbp,after_dbp,before_weight,after_weight,up_nurse_id,down_nurse_id,check_nurse_id,puncture_nurse_id,start_time,end_time,create_time,sjscsj,xgbz) VALUES "
  363. insertParams := make([]string, 0)
  364. insertData := make([]interface{}, 0)
  365. insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
  366. insertData = append(insertData, psm.DialysisId)
  367. insertData = append(insertData, psm.HospitalId)
  368. insertData = append(insertData, psm.PatientNk)
  369. insertData = append(insertData, psm.PsId)
  370. insertData = append(insertData, psm.DialysisDate)
  371. insertData = append(insertData, psm.SickbedNo)
  372. insertData = append(insertData, psm.DivisionId)
  373. insertData = append(insertData, psm.EquipmentId)
  374. insertData = append(insertData, psm.MixDialysis)
  375. insertData = append(insertData, psm.Ufv)
  376. insertData = append(insertData, psm.TotalTreatDuration)
  377. insertData = append(insertData, psm.IsHospitalization)
  378. insertData = append(insertData, psm.IsEmergency)
  379. insertData = append(insertData, psm.IsPerioperativePeriod)
  380. insertData = append(insertData, psm.BeforeSbp)
  381. insertData = append(insertData, psm.BeforeDbp)
  382. insertData = append(insertData, psm.AfterSbp)
  383. insertData = append(insertData, psm.AfterDbp)
  384. insertData = append(insertData, psm.BeforeWeight)
  385. insertData = append(insertData, psm.AfterWeight)
  386. insertData = append(insertData, psm.UpNurseId)
  387. insertData = append(insertData, psm.DownNurseId)
  388. insertData = append(insertData, psm.CheckNurseId)
  389. insertData = append(insertData, psm.PunctureNurseId)
  390. insertData = append(insertData, psm.StartTime)
  391. insertData = append(insertData, psm.EndTime)
  392. insertData = append(insertData, psm.CreateTime)
  393. insertData = append(insertData, psm.Sjscsj)
  394. insertData = append(insertData, psm.Xgbz)
  395. thisSQL += strings.Join(insertParams, ", ")
  396. utx.Exec(thisSQL, insertData...)
  397. }
  398. // if err != nil {
  399. // utx.Rollback()
  400. // return
  401. // }
  402. }
  403. // utx.Commit()
  404. }
  405. return
  406. }
  407. func BatchCreatePatientOut(patientOuts []*sz.TempHdPatientOut, rdb *gorm.DB) (err error) {
  408. if len(patientOuts) > 0 {
  409. utx := rdb
  410. if len(patientOuts) > 0 {
  411. thisSQL := "INSERT INTO t_hd_patient_quit (sn,hospital_id,patient_nk,sequelae_date,sequelae_type,create_time,death_reason,ext_reason,sjscsj,xgbz) VALUES "
  412. insertParams := make([]string, 0)
  413. insertData := make([]interface{}, 0)
  414. for _, out := range patientOuts {
  415. insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?)")
  416. insertData = append(insertData, out.Sn)
  417. insertData = append(insertData, out.HospitalId)
  418. insertData = append(insertData, out.PatientNk)
  419. insertData = append(insertData, out.SequelaeDate)
  420. insertData = append(insertData, out.SequelaeType)
  421. insertData = append(insertData, out.CreateTime)
  422. insertData = append(insertData, out.DeathReason)
  423. insertData = append(insertData, out.ExtReason)
  424. insertData = append(insertData, out.Sjscsj)
  425. insertData = append(insertData, out.Xgbz)
  426. }
  427. thisSQL += strings.Join(insertParams, ", ")
  428. utx.Exec(thisSQL, insertData...)
  429. // if err != nil {
  430. // utx.Rollback()
  431. // return
  432. // }
  433. }
  434. // utx.Commit()
  435. }
  436. return
  437. }
  438. func BatchCreateDoctorsAdvice(advices []*sz.TempHdDoctorsAdvice, rdb *gorm.DB) (err error) {
  439. if len(advices) > 0 {
  440. utx := rdb
  441. if len(advices) > 0 {
  442. for _, advice := range advices {
  443. thisSQL := "INSERT INTO t_hd_doctors_advice (medical_order_id, hospital_id,dialysis_id,order_type,patient_nk,dialysis_duration,blood_vol,anticoagulant,create_time,sjscsj,xgbz,rrt_type,rrt_type_name,dry_weight) VALUES "
  444. insertParams := make([]string, 0)
  445. insertData := make([]interface{}, 0)
  446. insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
  447. insertData = append(insertData, advice.MedicalOrderId)
  448. insertData = append(insertData, advice.HospitalId)
  449. insertData = append(insertData, advice.DialysisId)
  450. insertData = append(insertData, advice.OrderType)
  451. insertData = append(insertData, advice.PatientNk)
  452. insertData = append(insertData, advice.DialysisDuration)
  453. insertData = append(insertData, advice.BloodVol)
  454. insertData = append(insertData, advice.Anticoagulant)
  455. insertData = append(insertData, advice.CreateTime)
  456. insertData = append(insertData, advice.Sjscsj)
  457. insertData = append(insertData, advice.Xgbz)
  458. insertData = append(insertData, advice.RrtType)
  459. insertData = append(insertData, advice.RrtTypeName)
  460. insertData = append(insertData, advice.DryWeight)
  461. thisSQL += strings.Join(insertParams, ", ")
  462. utx.Exec(thisSQL, insertData...)
  463. }
  464. // if err != nil {
  465. // utx.Rollback()
  466. // return
  467. // }
  468. }
  469. // utx.Commit()
  470. }
  471. return
  472. }
  473. func BatchCreateMonitor(advices []*sz.TempHdMiddle, rdb *gorm.DB) (err error) {
  474. if len(advices) > 0 {
  475. utx := rdb
  476. if len(advices) > 0 {
  477. for _, advice := range advices {
  478. thisSQL := "INSERT INTO t_hd_middle (sn,hospital_id, patient_nk,dialysis_id,monitor_time,sbp,dbp,create_time,sjscsj,xgbz) VALUES "
  479. insertParams := make([]string, 0)
  480. insertData := make([]interface{}, 0)
  481. insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?)")
  482. insertData = append(insertData, advice.Sn)
  483. insertData = append(insertData, advice.HospitalId)
  484. insertData = append(insertData, advice.PatientNk)
  485. insertData = append(insertData, advice.DialysisId)
  486. insertData = append(insertData, advice.MonitorTime)
  487. insertData = append(insertData, advice.Sbp)
  488. insertData = append(insertData, advice.Dbp)
  489. insertData = append(insertData, advice.CreateTime)
  490. insertData = append(insertData, advice.Sjscsj)
  491. insertData = append(insertData, advice.Xgbz)
  492. thisSQL += strings.Join(insertParams, ", ")
  493. utx.Exec(thisSQL, insertData...)
  494. }
  495. // if err != nil {
  496. // utx.Rollback()
  497. // return
  498. // }
  499. }
  500. // utx.Commit()
  501. }
  502. return
  503. }
  504. func FindOrgOtherMachineData(org_id int64, lastUploadTime int64, nowTime int64) (waterMachine []*models.VMDeviceAddmacher, err error) {
  505. db := readUserDb.Model(&models.VMDeviceAddmacher{}).Where("status = 1 AND user_org_id = ? AND (device_type = 1 OR device_type = 3)", org_id)
  506. db = db.Where("ctime >= ? AND ctime <= ?", lastUploadTime, nowTime)
  507. err = db.Find(&waterMachine).Error
  508. return
  509. }
  510. func FindOrgMachineRepairData(org_id int64, lastUploadTime int64, nowTime int64) (waterMachine []*models.DeviceRepair, err error) {
  511. db := readUserDb.Model(&models.DeviceRepair{}).Where("status = 1 AND user_org_id = ?", org_id).Preload("VMDeviceAddmacher", "status = 1")
  512. db = db.Where("ctime >= ? AND ctime <= ?", lastUploadTime, nowTime)
  513. err = db.Find(&waterMachine).Error
  514. return
  515. }
  516. func BatchCreateOtherMachineRecord(wms []*sz.TempHdOtherMachine, rdb *gorm.DB) (err error) {
  517. if len(wms) > 0 {
  518. utx := rdb
  519. if len(wms) > 0 {
  520. for _, wm := range wms {
  521. thisSQL := "INSERT INTO t_hd_other_machine (hospital_id, equipment_id, equipment_brand, equipment_model, enable_time,status,equipment_type,xgbz,create_time,update_time,sjscsj) VALUES "
  522. insertParams := make([]string, 0)
  523. insertData := make([]interface{}, 0)
  524. insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?)")
  525. insertData = append(insertData, wm.HospitalId)
  526. insertData = append(insertData, wm.EquipmentId)
  527. insertData = append(insertData, wm.EquipmentBrand)
  528. insertData = append(insertData, wm.EquipmentModel)
  529. insertData = append(insertData, wm.EnableTime)
  530. insertData = append(insertData, wm.Status)
  531. insertData = append(insertData, wm.EquipmentType)
  532. insertData = append(insertData, wm.Xgbz)
  533. insertData = append(insertData, wm.CreateTime)
  534. insertData = append(insertData, wm.UpdateTime)
  535. insertData = append(insertData, wm.Sjscsj)
  536. thisSQL += strings.Join(insertParams, ", ")
  537. utx.Exec(thisSQL, insertData...)
  538. }
  539. }
  540. // utx.Commit()
  541. }
  542. return
  543. }
  544. func BatchCreateMainTain(maintain []*sz.TempHdMaintain, rdb *gorm.DB) (err error) {
  545. if len(maintain) > 0 {
  546. utx := rdb
  547. if len(maintain) > 0 {
  548. thisSQL := "INSERT INTO t_hd_maintain (hospital_id, equipment_id, equipment_type, repair_time, xgbz,create_time,sjscsj) VALUES "
  549. insertParams := make([]string, 0)
  550. insertData := make([]interface{}, 0)
  551. for _, wm := range maintain {
  552. insertParams = append(insertParams, "(?,?,?,?,?,?,?)")
  553. insertData = append(insertData, wm.HospitalId)
  554. insertData = append(insertData, wm.EquipmentId)
  555. insertData = append(insertData, wm.EquipmentType)
  556. insertData = append(insertData, wm.RepairTime)
  557. insertData = append(insertData, wm.Xgbz)
  558. insertData = append(insertData, wm.CreateTime)
  559. insertData = append(insertData, wm.Sjscsj)
  560. }
  561. thisSQL += strings.Join(insertParams, ", ")
  562. utx.Exec(thisSQL, insertData...)
  563. // if err != nil {
  564. // utx.Rollback()
  565. // return
  566. // }
  567. }
  568. // utx.Commit()
  569. }
  570. return
  571. }
  572. func FindOrgMachineData(org_id int64, lastUploadTime int64, nowTime int64) (waterMachine []*models.VMDeviceAddmacher, err error) {
  573. db := readUserDb.Model(&models.VMDeviceAddmacher{}).Where("status = 1 AND user_org_id = ?", org_id).Preload("DeviceNumber",func(db *gorm.DB) *gorm.DB {
  574. return readDb.Model(&models.DeviceNumber{}).Where("status = 1")
  575. } )
  576. db = db.Where("ctime >= ? AND ctime <= ?", lastUploadTime, nowTime)
  577. err = db.Find(&waterMachine).Error
  578. return
  579. }
  580. func BatchCreateHDMRecord(wms []*sz.TempHdDm, rdb *gorm.DB) (err error) {
  581. if len(wms) > 0 {
  582. utx := rdb
  583. if len(wms) > 0 {
  584. for _, wm := range wms {
  585. thisSQL := "INSERT INTO t_hd_dm (hospital_id, equipment_id,sickbed_no,sickbed_type ,equipment_brand, equipment_model, enable_time,status,equipment_type, xgbz,bbp,create_time,update_time,sjscsj) VALUES "
  586. insertParams := make([]string, 0)
  587. insertData := make([]interface{}, 0)
  588. insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
  589. insertData = append(insertData, wm.HospitalId)
  590. insertData = append(insertData, wm.EquipmentId)
  591. insertData = append(insertData, wm.SickbedNo)
  592. insertData = append(insertData, wm.SickbedType)
  593. insertData = append(insertData, wm.EquipmentBrand)
  594. insertData = append(insertData, wm.EquipmentModel)
  595. insertData = append(insertData, wm.EnableTime)
  596. insertData = append(insertData, wm.Status)
  597. insertData = append(insertData, wm.EquipmentType)
  598. insertData = append(insertData, wm.Xgbz)
  599. insertData = append(insertData, wm.Bbp)
  600. insertData = append(insertData, wm.CreateTime)
  601. insertData = append(insertData, wm.UpdateTime)
  602. insertData = append(insertData, wm.Sjscsj)
  603. thisSQL += strings.Join(insertParams, ", ")
  604. utx.Exec(thisSQL, insertData...)
  605. }
  606. // if err != nil {
  607. // utx.Rollback()
  608. // return
  609. // }
  610. }
  611. // utx.Commit()
  612. }
  613. return
  614. }
  615. func CreateHDDivision(wms []*sz.TempHdDivision, rdb *gorm.DB) (err error) {
  616. if len(wms) > 0 {
  617. utx := rdb
  618. if len(wms) > 0 {
  619. for _, wm := range wms {
  620. thisSQL := "INSERT INTO t_hd_division (division_id,hospital_id, division_name,division_type, xgbz,create_time,update_time,sjscsj) VALUES "
  621. insertParams := make([]string, 0)
  622. insertData := make([]interface{}, 0)
  623. insertParams = append(insertParams, "(?,?,?,?,?,?,?,?)")
  624. insertData = append(insertData, wm.DivisionId)
  625. insertData = append(insertData, wm.HospitalId)
  626. insertData = append(insertData, wm.DivisionName)
  627. insertData = append(insertData, wm.DivisionType)
  628. insertData = append(insertData, wm.Xgbz)
  629. insertData = append(insertData, wm.CreateTime)
  630. insertData = append(insertData, wm.UpdateTime)
  631. insertData = append(insertData, wm.Sjscsj)
  632. thisSQL += strings.Join(insertParams, ", ")
  633. utx.Exec(thisSQL, insertData...)
  634. }
  635. }
  636. }
  637. return
  638. }
  639. func CreateAccess(wms []*sz.TempHdAccess, rdb *gorm.DB) (err error) {
  640. if len(wms) > 0 {
  641. utx := rdb
  642. if len(wms) > 0 {
  643. for _, wm := range wms {
  644. thisSQL := "INSERT INTO t_hd_access (access_id,hospital_id,patient_nk,access_type,access_type_name,access_status,setup_date,first_use_time,xgbz,create_time,update_time,sjscsj) VALUES "
  645. insertParams := make([]string, 0)
  646. insertData := make([]interface{}, 0)
  647. insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?)")
  648. insertData = append(insertData, wm.AccessId)
  649. insertData = append(insertData, wm.HospitalId)
  650. insertData = append(insertData, wm.PatientNk)
  651. insertData = append(insertData, wm.AccessType)
  652. insertData = append(insertData, wm.AccessTypeName)
  653. insertData = append(insertData, wm.AccessStatus)
  654. insertData = append(insertData, wm.SetupDate)
  655. insertData = append(insertData, wm.FirstUseTime)
  656. insertData = append(insertData, wm.Xgbz)
  657. insertData = append(insertData, wm.CreateTime)
  658. insertData = append(insertData, wm.UpdateTime)
  659. insertData = append(insertData, wm.Sjscsj)
  660. thisSQL += strings.Join(insertParams, ", ")
  661. utx.Exec(thisSQL, insertData...)
  662. }
  663. }
  664. }
  665. return
  666. }
  667. func CreateSickbed(wms []*sz.TempHdSickbed, rdb *gorm.DB) (err error) {
  668. if len(wms) > 0 {
  669. utx := rdb
  670. if len(wms) > 0 {
  671. for _, wm := range wms {
  672. thisSQL := "INSERT INTO t_hd_sickbed (sickbed_no,hospital_id,division_id,sickbed_code,sickbed_type,xgbz,create_time,update_time,sjscsj) VALUES "
  673. insertParams := make([]string, 0)
  674. insertData := make([]interface{}, 0)
  675. insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?)")
  676. insertData = append(insertData, wm.SickbedNo)
  677. insertData = append(insertData, wm.HospitalId)
  678. insertData = append(insertData, wm.DivisionId)
  679. insertData = append(insertData, wm.SickbedCode)
  680. insertData = append(insertData, wm.SickbedType)
  681. insertData = append(insertData, wm.Xgbz)
  682. insertData = append(insertData, wm.CreateTime)
  683. insertData = append(insertData, wm.UpdateTime)
  684. insertData = append(insertData, wm.Sjscsj)
  685. thisSQL += strings.Join(insertParams, ", ")
  686. utx.Exec(thisSQL, insertData...)
  687. }
  688. }
  689. }
  690. return
  691. }
  692. func CreateDiagnosis(wms []*sz.TempHdDiagnosis, rdb *gorm.DB) (err error) {
  693. if len(wms) > 0 {
  694. utx := rdb
  695. if len(wms) > 0 {
  696. for _, wm := range wms {
  697. thisSQL := "INSERT INTO t_hd_diagnosis (diagnosis_id,hospital_id,patient_nk,diagnosis_time,diagnosis_type,diagnosis_type_item,diagnosis_type_detail,xgbz,create_time,update_time,sjscsj) VALUES "
  698. insertParams := make([]string, 0)
  699. insertData := make([]interface{}, 0)
  700. insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?)")
  701. insertData = append(insertData, wm.DiagnosisId)
  702. insertData = append(insertData, wm.HospitalId)
  703. insertData = append(insertData, wm.PatientNk)
  704. insertData = append(insertData, wm.DiagnosisTime)
  705. insertData = append(insertData, wm.DiagnosisType)
  706. insertData = append(insertData, wm.DiagnosisTypeItem)
  707. insertData = append(insertData, wm.DiagnosisTypeDetail)
  708. insertData = append(insertData, wm.Xgbz)
  709. insertData = append(insertData, wm.CreateTime)
  710. insertData = append(insertData, wm.UpdateTime)
  711. insertData = append(insertData, wm.Sjscsj)
  712. thisSQL += strings.Join(insertParams, ", ")
  713. utx.Exec(thisSQL, insertData...)
  714. }
  715. }
  716. }
  717. return
  718. }
  719. func CreateInfection(wms []*sz.TempHdInfection, rdb *gorm.DB) (err error) {
  720. if len(wms) > 0 {
  721. utx := rdb
  722. if len(wms) > 0 {
  723. for _, wm := range wms {
  724. thisSQL := "INSERT INTO t_hd_infection (sn,hospital_id,patient_nk,hbv,hcv,rpr,hiv,hbsag,hbsab,hbeag,hbeab,hbcab,check_date,doctor_id,xgbz,create_time,sjscsj) VALUES "
  725. insertParams := make([]string, 0)
  726. insertData := make([]interface{}, 0)
  727. insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
  728. insertData = append(insertData, wm.Sn)
  729. insertData = append(insertData, wm.HospitalId)
  730. insertData = append(insertData, wm.PatientNk)
  731. insertData = append(insertData, wm.Hbv)
  732. insertData = append(insertData, wm.Hcv)
  733. insertData = append(insertData, wm.Rpr)
  734. insertData = append(insertData, wm.Hiv)
  735. insertData = append(insertData, wm.Hbsag)
  736. insertData = append(insertData, wm.Hbsab)
  737. insertData = append(insertData, wm.Hbeag)
  738. insertData = append(insertData, wm.Hbeab)
  739. insertData = append(insertData, wm.Hbcab)
  740. insertData = append(insertData, wm.CheckDate)
  741. insertData = append(insertData, wm.DoctorId)
  742. insertData = append(insertData, wm.Xgbz)
  743. insertData = append(insertData, wm.CreateTime)
  744. insertData = append(insertData, wm.Sjscsj)
  745. thisSQL += strings.Join(insertParams, ", ")
  746. utx.Exec(thisSQL, insertData...)
  747. }
  748. }
  749. }
  750. return
  751. }
  752. func CreateComplication(wms []*sz.TempHdComplication, rdb *gorm.DB) (err error) {
  753. if len(wms) > 0 {
  754. utx := rdb
  755. if len(wms) > 0 {
  756. for _, wm := range wms {
  757. thisSQL := "INSERT INTO t_hd_complication (sn,hospital_id,patient_nk,dialysis_id,monitor_id,neopathy_time,neopathy_type,neopathy_desc,xgbz,create_time,sjscsj) VALUES "
  758. insertParams := make([]string, 0)
  759. insertData := make([]interface{}, 0)
  760. insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?)")
  761. insertData = append(insertData, wm.Sn)
  762. insertData = append(insertData, wm.HospitalId)
  763. insertData = append(insertData, wm.PatientNk)
  764. insertData = append(insertData, wm.DialysisId)
  765. insertData = append(insertData, wm.MonitorId)
  766. insertData = append(insertData, wm.NeopathyTime)
  767. insertData = append(insertData, wm.NeopathyType)
  768. insertData = append(insertData, wm.NeopathyDesc)
  769. insertData = append(insertData, wm.Xgbz)
  770. insertData = append(insertData, wm.CreateTime)
  771. insertData = append(insertData, wm.Sjscsj)
  772. thisSQL += strings.Join(insertParams, ", ")
  773. utx.Exec(thisSQL, insertData...)
  774. }
  775. }
  776. }
  777. return
  778. }
  779. func CreateLisReport(wms []*sz.TempHdLisReport, rdb *gorm.DB) (err error) {
  780. if len(wms) > 0 {
  781. utx := rdb
  782. if len(wms) > 0 {
  783. for _, wm := range wms {
  784. thisSQL := "INSERT INTO t_hd_lis_report (lab_sno,hospital_id,patient_nk,report_date,check_date,jz_no,mz_flag,zy_no,mz_no,department_code,department_name,card_no,card_type,patient_name,dep_code,dep_name,inspected_type,report_categry,application_name,application_type,check_name,check_item_name,check_item_code,record_ccount,check_result,diagnose_name,xgbz,create_time,sjscsj) VALUES "
  785. insertParams := make([]string, 0)
  786. insertData := make([]interface{}, 0)
  787. insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
  788. insertData = append(insertData, wm.LabSno)
  789. insertData = append(insertData, wm.HospitalId)
  790. insertData = append(insertData, wm.PatientNk)
  791. insertData = append(insertData, wm.ReportDate)
  792. insertData = append(insertData, wm.CheckDate)
  793. insertData = append(insertData, wm.JzNo)
  794. insertData = append(insertData, wm.MzFlag)
  795. insertData = append(insertData, wm.ZyNo)
  796. insertData = append(insertData, wm.MzNo)
  797. insertData = append(insertData, wm.DepartmentCode)
  798. insertData = append(insertData, wm.DepartmentName)
  799. insertData = append(insertData, wm.CardNo)
  800. insertData = append(insertData, wm.CardType)
  801. insertData = append(insertData, wm.PatientName)
  802. insertData = append(insertData, wm.DepCode)
  803. insertData = append(insertData, wm.DepName)
  804. insertData = append(insertData, wm.InspectedType)
  805. insertData = append(insertData, wm.ReportCategry)
  806. insertData = append(insertData, wm.ApplicationName)
  807. insertData = append(insertData, wm.ApplicationType)
  808. insertData = append(insertData, wm.CheckName)
  809. insertData = append(insertData, wm.CheckItemName)
  810. insertData = append(insertData, wm.CheckItemCode)
  811. insertData = append(insertData, wm.RecordCcount)
  812. insertData = append(insertData, wm.CheckResult)
  813. insertData = append(insertData, wm.DiagnoseName)
  814. insertData = append(insertData, wm.Xgbz)
  815. insertData = append(insertData, wm.CreateTime)
  816. insertData = append(insertData, wm.Sjscsj)
  817. thisSQL += strings.Join(insertParams, ", ")
  818. utx.Exec(thisSQL, insertData...)
  819. }
  820. }
  821. }
  822. return
  823. }
  824. func CreateLisIndicators(wms []*sz.TempHdLisIndicators, rdb *gorm.DB) (err error) {
  825. if len(wms) > 0 {
  826. utx := rdb
  827. if len(wms) > 0 {
  828. for _, wm := range wms {
  829. thisSQL := "INSERT INTO t_hd_lis_indicators (inspected_result_no,hospital_id,lab_sno,report_date,check_date,inspected_indicate,inspected_item_en_name,inspected_item_cn_name,inspected_result_desc,inspected_result_value,inspected_result_unit,ref_range,unit_type,inspected_result,xgbz,create_time,sjscsj) VALUES "
  830. insertParams := make([]string, 0)
  831. insertData := make([]interface{}, 0)
  832. insertParams = append(insertParams, "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)")
  833. insertData = append(insertData, wm.InspectedResultNo)
  834. insertData = append(insertData, wm.HospitalId)
  835. insertData = append(insertData, wm.LabSno)
  836. insertData = append(insertData, wm.ReportDate)
  837. insertData = append(insertData, wm.CheckDate)
  838. insertData = append(insertData, wm.InspectedIndicate)
  839. insertData = append(insertData, wm.InspectedItemEnName)
  840. insertData = append(insertData, wm.InspectedItemCnName)
  841. insertData = append(insertData, wm.InspectedResultDesc)
  842. insertData = append(insertData, wm.InspectedResultValue)
  843. insertData = append(insertData, wm.InspectedResultUnit)
  844. insertData = append(insertData, wm.RefRange)
  845. insertData = append(insertData, wm.UnitType)
  846. insertData = append(insertData, wm.InspectedResult)
  847. insertData = append(insertData, wm.Xgbz)
  848. insertData = append(insertData, wm.CreateTime)
  849. insertData = append(insertData, wm.Sjscsj)
  850. thisSQL += strings.Join(insertParams, ", ")
  851. utx.Exec(thisSQL, insertData...)
  852. }
  853. }
  854. }
  855. return
  856. }