city_data_uoload_service.go 37KB

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