doctors_api_controller.go 41KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155
  1. package controllers
  2. import (
  3. "XT_New/enums"
  4. "XT_New/models"
  5. "XT_New/service"
  6. "XT_New/utils"
  7. "encoding/json"
  8. "fmt"
  9. "github.com/astaxie/beego"
  10. "github.com/jinzhu/gorm"
  11. "strconv"
  12. "strings"
  13. "time"
  14. )
  15. type DoctorsApiController struct {
  16. BaseAuthAPIController
  17. }
  18. func DoctorApiRegistRouters() {
  19. beego.Router("/api/alldoctors", &DoctorsApiController{}, "get:GetAllDoctorAndNurse")
  20. beego.Router("/api/admin/users", &DoctorsApiController{}, "get:GetAllAdminUsers")
  21. beego.Router("/api/patient/getdryweightdata", &DoctorsApiController{}, "Get:GetDryWeightData")
  22. beego.Router("/api/patient/getAllDoctor", &DoctorsApiController{}, "Get:GetAllDoctor")
  23. beego.Router("/api/patient/updatedryweightdata", &DoctorsApiController{}, "Post:UpdatedDryWeightData")
  24. beego.Router("/api/patient/getalldata", &DoctorsApiController{}, "Get:GetAllData")
  25. beego.Router("/api/paients/getdryweightdetail", &DoctorsApiController{}, "Get:GetDryWeightDetail")
  26. beego.Router("/api/patients/modifydryweightdata", &DoctorsApiController{}, "Get:ModifydryWeightData")
  27. beego.Router("/api/patient/deletedryweight", &DoctorsApiController{}, "Delete:DeleteDryWeight")
  28. beego.Router("/api/schedule/advices", &DoctorsApiController{}, "Get:ScheduleAdvices")
  29. beego.Router("/api/schedule/getdoctoradvicecount", &DoctorsApiController{}, "Get:GetDoctorAdviceCount")
  30. beego.Router("/api/patient/savevasularaccess", &DoctorsApiController{}, "Get:SaveVasularAccess")
  31. beego.Router("/api/patient/getallvascualraccesslist", &DoctorsApiController{}, "Get:GetAllVacualAccessList")
  32. beego.Router("/api/patient/getvascularaccessbydetial", &DoctorsApiController{}, "Get:GetVascularAccessByDetail")
  33. beego.Router("/api/patient/updatevasularaccess", &DoctorsApiController{}, "Get:UpdateVasularAccess")
  34. beego.Router("/api/patient/deletevascularaccess", &DoctorsApiController{}, "Get:DeleteVasularAccess")
  35. beego.Router("/api/patient/savepasswayassessment", &DoctorsApiController{}, "Get:SavePassWayAssessment")
  36. beego.Router("/api/patient/getallpasswayassessment", &DoctorsApiController{}, "Get:GetAllPassWayAssessment")
  37. beego.Router("/api/patient/getpasswayassmentbyid", &DoctorsApiController{}, "Get:GetPasswayAssesmentById")
  38. beego.Router("/api/patient/updatepasswayassesment", &DoctorsApiController{}, "Get:UpdatePassWayAssesment")
  39. beego.Router("/api/patient/deletepasswayassessment", &DoctorsApiController{}, "Get:DeleteWayAssessment")
  40. beego.Router("/api/patient/getaccesslist", &DoctorsApiController{}, "Get:GetAccessList")
  41. //阶段小结路由
  42. beego.Router("/api/patient/getinspectionmajoritem", &DoctorsApiController{}, "Get:GetInspectionMajorItem")
  43. beego.Router("/api/patient/getinspectiondetail", &DoctorsApiController{}, "Get:GetInspectionDetailByProject")
  44. beego.Router("/api/patient/getinspectionitemlist", &DoctorsApiController{}, "Get:GetInspectionItemlist")
  45. beego.Router("/api/patient/getinitdatelist", &DoctorsApiController{}, "Get:GetInitDateList")
  46. beego.Router("/api/patient/savecreationinspection", &DoctorsApiController{}, "Post:SaveCreationInspection")
  47. beego.Router("/api/patient/getemlatesummarylist", &DoctorsApiController{}, "Get:GetTemplateSummaryList")
  48. beego.Router("/api/patient/gettemplatesummarydetail", &DoctorsApiController{}, "Get:GetTemplateSummaryDetail")
  49. beego.Router("/api/patient/gettemplatesummaryprintdetail", &DoctorsApiController{}, "Get:GetTemplateSummaryPrintDetail")
  50. beego.Router("/api/patient/updatetemplatesummary", &DoctorsApiController{}, "Post:UpdateTempalteSummary")
  51. beego.Router("/api/patient/deletesummary", &DoctorsApiController{}, "Get:DeleteSummary")
  52. }
  53. func (c *DoctorsApiController) ScheduleAdvices() {
  54. schedualDate := c.GetString("date")
  55. adviceType, _ := c.GetInt("advice_type")
  56. patientType, _ := c.GetInt("patient_type")
  57. delivery_way := c.GetString("delivery_way")
  58. schedule_type, _ := c.GetInt64("schedule_type")
  59. partition_type, _ := c.GetInt64("partition_type")
  60. if adviceType != 1 && adviceType != 3 && adviceType != 2 {
  61. adviceType = 0
  62. }
  63. if patientType != 1 && patientType != 2 {
  64. patientType = 0
  65. }
  66. date, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", schedualDate)
  67. if parseDateErr != nil {
  68. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  69. return
  70. }
  71. adminUserInfo := c.GetAdminUserInfo()
  72. orgID := adminUserInfo.CurrentOrgId
  73. scheduals, err := service.MobileGetScheduleDoctorAdvicesOne(orgID, date.Unix(), adviceType, patientType, adminUserInfo.AdminUser.Id, delivery_way, schedule_type, partition_type)
  74. hisAdvices, _ := service.GetHisDoctorAdvicesOne(orgID, date.Unix(), delivery_way, schedule_type, partition_type)
  75. project, _ := service.GetPCHisPrescriptionProject(orgID, date.Unix(), delivery_way, patientType, partition_type)
  76. //获取所有的患者
  77. patients, _ := service.GetAllPatientListByListTwo(orgID)
  78. //获取所有床位
  79. numberList, _ := service.GetAllDeviceNumberByListOne(orgID)
  80. //获取透析处方
  81. prescriptions, _ := service.GetAllPrescriptionByListOne(orgID, date.Unix())
  82. //获取上机
  83. dialysisOrders, _ := service.GetAllDialysisOrdersByListTwo(orgID, date.Unix())
  84. for key, item := range project {
  85. for _, patient := range patients {
  86. if item.PatientId == patient.ID {
  87. project[key].SchedualPatient = patient
  88. break
  89. }
  90. }
  91. // 获取床位信息
  92. for _, it := range numberList {
  93. if item.BedId == it.ID {
  94. project[key].DeviceNumber = it
  95. break
  96. }
  97. }
  98. // 获取处方
  99. for _, it := range prescriptions {
  100. if item.PatientId == it.PatientId {
  101. project[key].Prescription = it
  102. break
  103. }
  104. }
  105. //获取上机
  106. for _, it := range dialysisOrders {
  107. if item.PatientId == it.PatientId {
  108. project[key].DialysisOrder = it
  109. break
  110. }
  111. }
  112. }
  113. config, _ := service.GetHisDoctorConfig(orgID)
  114. project_config, _ := service.GetHisProjectConfig(orgID)
  115. adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
  116. if err != nil {
  117. c.ErrorLog("获取排班信息失败:%v", err)
  118. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  119. } else {
  120. filtedScheduals := []*service.MScheduleDoctorAdviceVM{}
  121. for _, schedual := range scheduals {
  122. if len(schedual.DoctorAdvices) > 0 {
  123. filtedScheduals = append(filtedScheduals, schedual)
  124. }
  125. }
  126. c.ServeSuccessJSON(map[string]interface{}{
  127. "scheduals": filtedScheduals,
  128. "adminUser": adminUser,
  129. "hisAdvices": hisAdvices,
  130. "config": config,
  131. "project_config": project_config,
  132. "project": project,
  133. })
  134. }
  135. }
  136. func (c *DoctorsApiController) GetAllDoctorAndNurse() {
  137. adminUserInfo := c.GetAdminUserInfo()
  138. doctors, nursers, _ := service.GetAllDoctorAndNurse(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
  139. c.ServeSuccessJSON(map[string]interface{}{
  140. "doctors": doctors,
  141. "nursers": nursers,
  142. })
  143. return
  144. }
  145. func (c *DoctorsApiController) GetAllAdminUsers() {
  146. adminUserInfo := c.GetAdminUserInfo()
  147. users, _ := service.GetAllAdminUsersTwo(adminUserInfo.CurrentOrgId)
  148. c.ServeSuccessJSON(map[string]interface{}{
  149. "users": users,
  150. })
  151. return
  152. }
  153. func (c *DoctorsApiController) GetDryWeightData() {
  154. adminUserInfo := c.GetAdminUserInfo()
  155. orgid := adminUserInfo.CurrentOrgId
  156. patientid, _ := c.GetInt64("patientid")
  157. fmt.Println("patientid", patientid)
  158. id := adminUserInfo.AdminUser.Id
  159. fmt.Println("id", id)
  160. recordDateStr := time.Now().Format("2006-01-02")
  161. recordDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
  162. fmt.Scan("parseDateErr", parseDateErr)
  163. nowtime := recordDate.Unix()
  164. fmt.Println("nowtime", nowtime)
  165. pre, err := service.GetDryWeightByPatientId(patientid, orgid)
  166. fmt.Println("错误", err)
  167. c.ServeSuccessJSON(map[string]interface{}{
  168. "pre": pre,
  169. })
  170. }
  171. func (c *DoctorsApiController) GetAllDoctor() {
  172. adminUserInfo := c.GetAdminUserInfo()
  173. orgid := adminUserInfo.CurrentOrgId
  174. appid := adminUserInfo.CurrentAppId
  175. fmt.Println("appid", appid)
  176. appRole, err := service.GetAllDoctor(orgid, appid)
  177. fmt.Println("appRole", appRole)
  178. fmt.Println("错误", err)
  179. c.ServeSuccessJSON(map[string]interface{}{
  180. "appRole": appRole,
  181. })
  182. }
  183. func (c *DoctorsApiController) UpdatedDryWeightData() {
  184. adminUserInfo := c.GetAdminUserInfo()
  185. orgid := adminUserInfo.CurrentOrgId
  186. userid := adminUserInfo.AdminUser.Id
  187. fmt.Println("userid", userid)
  188. dry_weight, _ := c.GetFloat("dry_weight")
  189. fmt.Println("dry_weight", dry_weight)
  190. doctors, _ := c.GetInt64("doctors")
  191. fmt.Println("doctors", doctors)
  192. remarks := c.GetString("remarks")
  193. fmt.Println("remarks", remarks)
  194. patientid, _ := c.GetInt64("patient_id")
  195. fmt.Println("patientid", patientid)
  196. //透前数据
  197. dryweight, _ := c.GetFloat("dryweight")
  198. fmt.Println("dryweight", dryweight)
  199. var weight = dryweight - dry_weight
  200. weights := fmt.Sprintf("%.1f", weight)
  201. //weights := strconv.FormatFloat(sprintf, 'E', -1, 64)
  202. fmt.Println("weight", weights)
  203. fmt.Println("weight", weight)
  204. var sum string
  205. dryWeight, errcode := service.QueryDryWeight(orgid, patientid)
  206. fmt.Println("errcode", errcode)
  207. fmt.Println("dryWeight", dryWeight)
  208. if errcode == gorm.ErrRecordNotFound {
  209. sum = "/"
  210. patientDryweight := models.SgjPatientDryweight{
  211. DryWeight: dry_weight,
  212. Creator: doctors,
  213. Remakes: remarks,
  214. AdjustedValue: sum,
  215. PatientId: patientid,
  216. Ctime: time.Now().Unix(),
  217. UserOrgId: orgid,
  218. Status: 1,
  219. UserId: userid,
  220. }
  221. err := service.CreatePatientWeight(&patientDryweight)
  222. fmt.Println("err", err)
  223. c.ServeSuccessJSON(map[string]interface{}{
  224. "patientDryweight": patientDryweight,
  225. })
  226. return
  227. }
  228. fmt.Println("sum", sum)
  229. if weight == 0 {
  230. sum = "/"
  231. }
  232. if weight > 0 {
  233. sum = weights + "(" + "下调" + ")"
  234. }
  235. if weight < 0 {
  236. var sums = dry_weight - dryweight
  237. float := fmt.Sprintf("%.1f", sums)
  238. //float := strconv.FormatFloat(sums, 'E', -1, 64)
  239. sum = float + "(" + "上调" + ")"
  240. }
  241. patientDryweight := models.SgjPatientDryweight{
  242. DryWeight: dry_weight,
  243. Creator: doctors,
  244. Remakes: remarks,
  245. AdjustedValue: sum,
  246. PatientId: patientid,
  247. Ctime: time.Now().Unix(),
  248. UserOrgId: orgid,
  249. Status: 1,
  250. UserId: userid,
  251. }
  252. err := service.CreatePatientWeight(&patientDryweight)
  253. //sgjPatientDryweight, _ := service.GetLastData(orgid)
  254. recordDateStr := time.Now().Format("2006-01-02")
  255. recordDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
  256. fmt.Scan("parseDateErr", parseDateErr)
  257. nowtime := recordDate.Unix()
  258. fmt.Println("nowtime", nowtime)
  259. //prescription := models.PredialysisEvaluation{
  260. // DryWeight: dryweight,
  261. //}
  262. //errors := service.UpdateDialysisPrescription( sgjPatientDryweight.PatientId, sgjPatientDryweight.UserOrgId, sgjPatientDryweight.DryWeight, prescription)
  263. //fmt.Println("error",errors)
  264. fmt.Println("err", err)
  265. fmt.Println("patientdryweight", patientDryweight)
  266. c.ServeSuccessJSON(map[string]interface{}{
  267. "patientDryweight": patientDryweight,
  268. })
  269. }
  270. func (c *DoctorsApiController) GetAllData() {
  271. id, _ := c.GetInt64("id")
  272. page, _ := c.GetInt64("page")
  273. fmt.Println("page", page)
  274. limit, _ := c.GetInt64("limit")
  275. fmt.Println("limit", limit)
  276. fmt.Println("id", id)
  277. adminUserInfo := c.GetAdminUserInfo()
  278. orgid := adminUserInfo.CurrentOrgId
  279. dry, total, _ := service.GetAllData(orgid, id, page, limit)
  280. c.ServeSuccessJSON(map[string]interface{}{
  281. "dry": dry,
  282. "total": total,
  283. })
  284. }
  285. func (c *DoctorsApiController) GetDryWeightDetail() {
  286. id, _ := c.GetInt64("id")
  287. dryweight, _ := service.GetDryWeightDetailById(id)
  288. c.ServeSuccessJSON(map[string]interface{}{
  289. "dryweight": dryweight,
  290. })
  291. }
  292. func (c *DoctorsApiController) ModifydryWeightData() {
  293. adjustvalue := c.GetString("adjustvalue")
  294. creator, _ := c.GetInt64("creator")
  295. dryweight, _ := c.GetInt64("dryweight")
  296. dry := strconv.FormatInt(dryweight, 10)
  297. dry_weight, _ := strconv.ParseFloat(dry, 64)
  298. id, _ := c.GetInt64("id")
  299. remark := c.GetString("remark")
  300. patientDryweight := models.SgjPatientDryweight{
  301. AdjustedValue: adjustvalue,
  302. Creator: creator,
  303. DryWeight: dry_weight,
  304. Remakes: remark,
  305. }
  306. service.ModifyDryWeightData(&patientDryweight, id)
  307. c.ServeSuccessJSON(map[string]interface{}{
  308. "patientDryweight": patientDryweight,
  309. })
  310. }
  311. func (c *DoctorsApiController) DeleteDryWeight() {
  312. id, _ := c.GetInt64("id")
  313. service.DeleteDryWeight(id)
  314. returnData := make(map[string]interface{}, 0)
  315. returnData["msg"] = "ok"
  316. c.ServeSuccessJSON(returnData)
  317. return
  318. }
  319. func (c *DoctorsApiController) GetDoctorAdviceCount() {
  320. timeLayout := "2006-01-02"
  321. loc, _ := time.LoadLocation("Local")
  322. start_time := c.GetString("start_time")
  323. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  324. end_time := c.GetString("end_time")
  325. endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
  326. delive_way := c.GetString("delive_way")
  327. adminUserInfo := c.GetAdminUserInfo()
  328. orgId := adminUserInfo.CurrentOrgId
  329. list, _ := service.GetDoctorAdviceCount(startTime.Unix(), endTime.Unix(), delive_way, orgId)
  330. if len(list) == 0 {
  331. list, _ := service.GetHisDoctorAdviceCount(startTime.Unix(), endTime.Unix(), delive_way, orgId)
  332. c.ServeSuccessJSON(map[string]interface{}{
  333. "list": list,
  334. })
  335. } else {
  336. c.ServeSuccessJSON(map[string]interface{}{
  337. "list": list,
  338. })
  339. }
  340. }
  341. func (this *DoctorsApiController) SaveVasularAccess() {
  342. access_project, _ := this.GetInt64("access_project")
  343. blood_access_part_id := this.GetString("blood_access_part_id")
  344. blood_access_part_opera_id := this.GetString("blood_access_part_opera_id")
  345. first_start_time := this.GetString("first_start_time")
  346. timeLayout := "2006-01-02"
  347. loc, _ := time.LoadLocation("Local")
  348. firstStartTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", first_start_time+" 00:00:00", loc)
  349. inflow_pass := this.GetString("inflow_pass")
  350. remark := this.GetString("remark")
  351. start_time := this.GetString("start_time")
  352. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  353. stop_reason := this.GetString("stop_reason")
  354. user_status, _ := this.GetInt64("user_status")
  355. stop_time := this.GetString("stop_time")
  356. stopTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", stop_time+" 00:00:00", loc)
  357. patient_id, _ := this.GetInt64("patient_id")
  358. other_vascular := this.GetString("other_vascular")
  359. ci_type, _ := this.GetInt64("ci_type")
  360. blood_cultupe, _ := this.GetInt64("blood_cultupe")
  361. sequelae_type, _ := this.GetInt64("sequelae_type")
  362. adminUserInfo := this.GetAdminUserInfo()
  363. orgId := adminUserInfo.CurrentOrgId
  364. creator := adminUserInfo.AdminUser.Id
  365. //查询改日期是否存在
  366. access := models.XtPatientVascularAccess{
  367. AccessProject: access_project,
  368. BloodAccessPartId: blood_access_part_id,
  369. BloodAccessPartOperaId: blood_access_part_opera_id,
  370. FirstStartTime: firstStartTime.Unix(),
  371. InflowPass: inflow_pass,
  372. Remark: remark,
  373. StartTime: startTime.Unix(),
  374. StopReason: stop_reason,
  375. UserStatus: user_status,
  376. Creator: creator,
  377. UserOrgId: orgId,
  378. Status: 1,
  379. Ctime: time.Now().Unix(),
  380. StopTime: stopTime.Unix(),
  381. PatientId: patient_id,
  382. OtherVascular: other_vascular,
  383. CiType: ci_type,
  384. BloodCultupe: blood_cultupe,
  385. SequelaeType: sequelae_type,
  386. }
  387. err := service.SaveVascularAccess(&access)
  388. if err == nil {
  389. this.ServeSuccessJSON(map[string]interface{}{
  390. "access": access,
  391. })
  392. return
  393. //_, errcode := service.GetDialysisDateByDate(startTime.Unix(), patient_id, orgId)
  394. //if errcode == gorm.ErrRecordNotFound {
  395. // access := models.XtPatientVascularAccess{
  396. // AccessProject: access_project,
  397. // BloodAccessPartId: blood_access_part_id,
  398. // BloodAccessPartOperaId: blood_access_part_opera_id,
  399. // FirstStartTime: firstStartTime.Unix(),
  400. // InflowPass: inflow_pass,
  401. // Remark: remark,
  402. // StartTime: startTime.Unix(),
  403. // StopReason: stop_reason,
  404. // UserStatus: user_status,
  405. // Creator: creator,
  406. // UserOrgId: orgId,
  407. // Status: 1,
  408. // Ctime: time.Now().Unix(),
  409. // StopTime: stopTime.Unix(),
  410. // PatientId: patient_id,
  411. // OtherVascular: other_vascular,
  412. // CiType: ci_type,
  413. // BloodCultupe: blood_cultupe,
  414. // SequelaeType: sequelae_type,
  415. // }
  416. // err := service.SaveVascularAccess(&access)
  417. // if err == nil {
  418. // this.ServeSuccessJSON(map[string]interface{}{
  419. // "access": access,
  420. // })
  421. // return
  422. // }
  423. //} else if errcode == nil {
  424. // this.ServeFailJSONWithSGJErrorCode(enums.ErrorDialysisOrderRepeatBed)
  425. // return
  426. }
  427. }
  428. func (this *DoctorsApiController) GetAllVacualAccessList() {
  429. limit, _ := this.GetInt64("limit")
  430. page, _ := this.GetInt64("page")
  431. patient_id, _ := this.GetInt64("patient_id")
  432. orgId := this.GetAdminUserInfo().CurrentOrgId
  433. appId := this.GetAdminUserInfo().CurrentAppId
  434. list, total, err := service.GetAllVacualAccessList(orgId, limit, page, patient_id)
  435. doctor, err := service.GetAllDoctor(orgId, appId)
  436. if err == nil {
  437. this.ServeSuccessJSON(map[string]interface{}{
  438. "list": list,
  439. "total": total,
  440. "doctor": doctor,
  441. })
  442. return
  443. }
  444. }
  445. func (this *DoctorsApiController) GetVascularAccessByDetail() {
  446. id, _ := this.GetInt64("id")
  447. accessDetail, err := service.GetVasularAccessByDetail(id)
  448. orgId := this.GetAdminUserInfo().CurrentOrgId
  449. appId := this.GetAdminUserInfo().CurrentAppId
  450. doctor, err := service.GetAllDoctor(orgId, appId)
  451. if err == nil {
  452. this.ServeSuccessJSON(map[string]interface{}{
  453. "accessDetail": accessDetail,
  454. "doctor": doctor,
  455. })
  456. return
  457. }
  458. }
  459. func (this *DoctorsApiController) UpdateVasularAccess() {
  460. id, _ := this.GetInt64("id")
  461. access_project, _ := this.GetInt64("access_project")
  462. blood_access_part_id := this.GetString("blood_access_part_id")
  463. blood_access_part_opera_id := this.GetString("blood_access_part_opera_id")
  464. first_start_time := this.GetString("first_start_time")
  465. timeLayout := "2006-01-02"
  466. loc, _ := time.LoadLocation("Local")
  467. firstStartTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", first_start_time+" 00:00:00", loc)
  468. inflow_pass := this.GetString("inflow_pass")
  469. remark := this.GetString("remark")
  470. start_time := this.GetString("start_time")
  471. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  472. stop_reason := this.GetString("stop_reason")
  473. user_status, _ := this.GetInt64("user_status")
  474. stop_time := this.GetString("stop_time")
  475. stopTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", stop_time+" 00:00:00", loc)
  476. adminUserInfo := this.GetAdminUserInfo()
  477. orgId := adminUserInfo.CurrentOrgId
  478. creator := adminUserInfo.AdminUser.Id
  479. patientId, _ := this.GetInt64("patient_id")
  480. other_vascular := this.GetString("other_vascular")
  481. ci_type, _ := this.GetInt64("ci_type")
  482. blood_cultupe, _ := this.GetInt64("blood_cultupe")
  483. sequelae_type, _ := this.GetInt64("sequelae_type")
  484. access := models.XtPatientVascularAccess{
  485. AccessProject: access_project,
  486. BloodAccessPartId: blood_access_part_id,
  487. BloodAccessPartOperaId: blood_access_part_opera_id,
  488. FirstStartTime: firstStartTime.Unix(),
  489. InflowPass: inflow_pass,
  490. Remark: remark,
  491. StartTime: startTime.Unix(),
  492. StopReason: stop_reason,
  493. UserStatus: user_status,
  494. Modify: creator,
  495. UserOrgId: orgId,
  496. Status: 1,
  497. StopTime: stopTime.Unix(),
  498. OtherVascular: other_vascular,
  499. CiType: ci_type,
  500. BloodCultupe: blood_cultupe,
  501. SequelaeType: sequelae_type,
  502. PatientId: patientId,
  503. }
  504. err := service.UpdateVascularAccess(&access, id)
  505. if err == nil {
  506. this.ServeSuccessJSON(map[string]interface{}{
  507. "access": access,
  508. })
  509. return
  510. }
  511. //_, errcode := service.GetDialysisDateByDateOne(startTime.Unix(), patientId, orgId, id)
  512. //if errcode == gorm.ErrRecordNotFound {
  513. // err := service.UpdateVascularAccess(&access, id)
  514. // if err == nil {
  515. // this.ServeSuccessJSON(map[string]interface{}{
  516. // "access": access,
  517. // })
  518. // return
  519. // }
  520. //} else if errcode == nil {
  521. // this.ServeFailJSONWithSGJErrorCode(enums.ErrorDialysisOrderRepeatBed)
  522. // return
  523. //}
  524. }
  525. func (this *DoctorsApiController) DeleteVasularAccess() {
  526. id, _ := this.GetInt64("id")
  527. err := service.DeleteVasularAccess(id)
  528. fmt.Println(err)
  529. returnData := make(map[string]interface{}, 0)
  530. returnData["msg"] = "ok"
  531. this.ServeSuccessJSON(returnData)
  532. return
  533. }
  534. func (this *DoctorsApiController) SavePassWayAssessment() {
  535. blood_dealwidth := this.GetString("blood_dealwith")
  536. blood_project := this.GetString("blood_project")
  537. blood_result := this.GetString("blood_result")
  538. creator, _ := this.GetInt64("creator")
  539. parent_id, _ := this.GetInt64("parent_id")
  540. patient_id, _ := this.GetInt64("patient_id")
  541. start_time := this.GetString("start_time")
  542. timeLayout := "2006-01-02"
  543. loc, _ := time.LoadLocation("Local")
  544. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  545. modify := this.GetAdminUserInfo().AdminUser.Id
  546. orgId := this.GetAdminUserInfo().CurrentOrgId
  547. assessment := models.XtPatientPasswayAssessment{
  548. StartTime: startTime.Unix(),
  549. BloodDealwith: blood_dealwidth,
  550. BloodProject: blood_project,
  551. BloodResult: blood_result,
  552. Creator: creator,
  553. PatientId: patient_id,
  554. ParentId: parent_id,
  555. Modify: modify,
  556. UserOrgId: orgId,
  557. Status: 1,
  558. Ctime: time.Now().Unix(),
  559. }
  560. err := service.CreatePatientWayAssessment(&assessment)
  561. if err == nil {
  562. this.ServeSuccessJSON(map[string]interface{}{
  563. "assessment": assessment,
  564. })
  565. return
  566. }
  567. }
  568. func (this *DoctorsApiController) GetAllPassWayAssessment() {
  569. patient_id, _ := this.GetInt64("patient_id")
  570. parent_id, _ := this.GetInt64("parent_id")
  571. page, _ := this.GetInt64("page")
  572. limit, _ := this.GetInt64("limit")
  573. adminUserInfo := this.GetAdminUserInfo()
  574. list, total, err := service.GetAllPassWayAssessment(parent_id, patient_id, page, limit, adminUserInfo.CurrentOrgId)
  575. if err == nil {
  576. this.ServeSuccessJSON(map[string]interface{}{
  577. "list": list,
  578. "total": total,
  579. })
  580. return
  581. }
  582. }
  583. func (this *DoctorsApiController) GetPasswayAssesmentById() {
  584. id, _ := this.GetInt64("id")
  585. assessment, err := service.GetPasswayAssesmentById(id)
  586. if err == nil {
  587. this.ServeSuccessJSON(map[string]interface{}{
  588. "assessment": assessment,
  589. })
  590. return
  591. }
  592. }
  593. func (this *DoctorsApiController) UpdatePassWayAssesment() {
  594. id, _ := this.GetInt64("id")
  595. blood_dealwidth := this.GetString("blood_dealwith")
  596. blood_project := this.GetString("blood_project")
  597. blood_result := this.GetString("blood_result")
  598. creator, _ := this.GetInt64("creator")
  599. start_time := this.GetString("start_time")
  600. timeLayout := "2006-01-02"
  601. loc, _ := time.LoadLocation("Local")
  602. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  603. modify := this.GetAdminUserInfo().AdminUser.Id
  604. assessment := models.XtPatientPasswayAssessment{
  605. BloodResult: blood_result,
  606. BloodDealwith: blood_dealwidth,
  607. BloodProject: blood_project,
  608. Creator: creator,
  609. StartTime: startTime.Unix(),
  610. Modify: modify,
  611. }
  612. err := service.UpdatePassWayAssesment(&assessment, id)
  613. if err == nil {
  614. this.ServeSuccessJSON(map[string]interface{}{
  615. "assessment": assessment,
  616. })
  617. return
  618. }
  619. }
  620. func (this *DoctorsApiController) DeleteWayAssessment() {
  621. id, _ := this.GetInt64("id")
  622. err := service.DeleteWayAssessment(id)
  623. fmt.Println(err)
  624. returnData := make(map[string]interface{}, 0)
  625. returnData["msg"] = "ok"
  626. this.ServeSuccessJSON(returnData)
  627. return
  628. }
  629. func (this *DoctorsApiController) GetAccessList() {
  630. adminUserInfo := this.GetAdminUserInfo()
  631. orgId := adminUserInfo.CurrentOrgId
  632. //血管通路
  633. list, err := service.GetAccessList(orgId)
  634. blood_access_part_opera, err := service.GetParentAccessList(orgId, list.ID)
  635. //血管通路部位
  636. access, err := service.GetBloodAccess(orgId)
  637. blood_access_part, err := service.GetParentAccessList(orgId, access.ID)
  638. if err == nil {
  639. this.ServeSuccessJSON(map[string]interface{}{
  640. "blood_access_part_opera": blood_access_part_opera,
  641. "blood_access_part": blood_access_part,
  642. })
  643. return
  644. }
  645. }
  646. func (this *DoctorsApiController) GetInspectionMajorItem() {
  647. other_start_time := this.GetString("other_start_time")
  648. last_time := this.GetString("last_time")
  649. timeLayout := "2006-01-02"
  650. loc, _ := time.LoadLocation("Local")
  651. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", other_start_time+" 23:59:59", loc)
  652. lastTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", last_time+" 00:00:00", loc)
  653. patient_id, _ := this.GetInt64("patient_id")
  654. adminUserInfo := this.GetAdminUserInfo()
  655. orgId := adminUserInfo.CurrentOrgId
  656. list, err := service.GetInspectionMajorItem(startTime.Unix(), lastTime.Unix(), orgId, patient_id)
  657. if err == nil {
  658. this.ServeSuccessJSON(map[string]interface{}{
  659. "list": list,
  660. })
  661. return
  662. }
  663. }
  664. func (this *DoctorsApiController) GetInspectionDetailByProject() {
  665. project_id, _ := this.GetInt64("project_id")
  666. patient_id, _ := this.GetInt64("patient_id")
  667. inspect_date, _ := this.GetInt64("inspect_date")
  668. orgId := this.GetAdminUserInfo().CurrentOrgId
  669. list, err := service.GetInspectionDetailByProject(project_id, patient_id, inspect_date, orgId)
  670. if err == nil {
  671. this.ServeSuccessJSON(map[string]interface{}{
  672. "list": list,
  673. })
  674. return
  675. }
  676. }
  677. func (this *DoctorsApiController) GetInspectionItemlist() {
  678. patient_id, _ := this.GetInt64("patient_id")
  679. ids := this.GetString("ids")
  680. inspect_date := this.GetString("inspect_date")
  681. idSplit := strings.Split(ids, ",")
  682. indateSplit := strings.Split(inspect_date, ",")
  683. list, err := service.GetInspectionItemlist(patient_id, indateSplit, idSplit)
  684. if err == nil {
  685. this.ServeSuccessJSON(map[string]interface{}{
  686. "list": list,
  687. })
  688. return
  689. }
  690. }
  691. func (this *DoctorsApiController) GetInitDateList() {
  692. patient_id, _ := this.GetInt64("patient_id")
  693. start_time := this.GetString("start_time")
  694. timeLayout := "2006-01-02"
  695. loc, _ := time.LoadLocation("Local")
  696. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  697. end_time := this.GetString("end_time")
  698. endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  699. fmt.Println("endtime2323232233223232332", endTime)
  700. prescription_list, _ := service.GetDialysisPrescriptionDataList(patient_id, startTime.Unix(), endTime.Unix())
  701. befor_list, err := service.GetDialysisBeforInitDateList(patient_id, startTime.Unix(), endTime.Unix())
  702. after_list, err := service.GetDialysisAssementAfter(patient_id, startTime.Unix(), endTime.Unix())
  703. orgId := this.GetAdminUserInfo().CurrentOrgId
  704. //统计透析次数
  705. modelist, err := service.GetDialysisDialysisMode(patient_id, startTime.Unix(), endTime.Unix(), orgId)
  706. docList, _ := service.GetAllDoctorThree(orgId)
  707. stockType, err := service.GetStockType(orgId)
  708. summaryList, err := service.GetTemplateSummary(orgId)
  709. planList, err := service.GetTemplatePlan(orgId)
  710. if err == nil {
  711. this.ServeSuccessJSON(map[string]interface{}{
  712. "beforlist": befor_list,
  713. "prescription_list": prescription_list,
  714. "after_list": after_list,
  715. "modelist": modelist,
  716. "docList": docList,
  717. "stockType": stockType,
  718. "summaryList": summaryList,
  719. "planList": planList,
  720. })
  721. return
  722. }
  723. }
  724. func (this *DoctorsApiController) SaveCreationInspection() {
  725. dataBody := make(map[string]interface{}, 0)
  726. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  727. if err != nil {
  728. utils.ErrorLog(err.Error())
  729. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  730. return
  731. }
  732. title := dataBody["title"].(string)
  733. dryWeight := dataBody["dry_weight"].(string)
  734. dry_weight, _ := strconv.ParseFloat(dryWeight, 64)
  735. dialysis_count := int64(dataBody["dialysis_count"].(float64))
  736. hd_count := int64(dataBody["hd_count"].(float64))
  737. hdf_count := int64(dataBody["hdf_count"].(float64))
  738. hp_count := int64(dataBody["hp_count"].(float64))
  739. other_count := int64(dataBody["other_count"].(float64))
  740. dialzer_apparatus := dataBody["dialzer_apparatus"].(string)
  741. perfusion_apparatus := dataBody["perfusion_apparatus"].(string)
  742. anticoagulant := int64(dataBody["anticoagulant"].(float64))
  743. kaliumstr := dataBody["kalium"].(string)
  744. kalium, _ := strconv.ParseFloat(kaliumstr, 64)
  745. autunitestr := dataBody["autunite"].(string)
  746. autunite, _ := strconv.ParseFloat(autunitestr, 64)
  747. natriumstr := dataBody["natrium"].(string)
  748. natrium, _ := strconv.ParseFloat(natriumstr, 64)
  749. hour := int64(dataBody["hour"].(float64))
  750. minute := int64(dataBody["minute"].(float64))
  751. beforWeight := dataBody["befor_weight"].(string)
  752. befor_weight, _ := strconv.ParseFloat(beforWeight, 64)
  753. afterWeight := dataBody["after_weight"].(string)
  754. after_weight, _ := strconv.ParseFloat(afterWeight, 64)
  755. befor_pressure := dataBody["befor_pressure"].(string)
  756. template_summary_content := dataBody["template_summary_content"].(string)
  757. template_plan_content := dataBody["template_plan_content"].(string)
  758. admin_user_id := int64(dataBody["admin_user_id"].(float64))
  759. record_time := dataBody["record_time"].(string)
  760. timeLayout := "2006-01-02"
  761. loc, _ := time.LoadLocation("Local")
  762. recordTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_time, loc)
  763. after_pressure := dataBody["after_pressure"].(string)
  764. template_summary_id := int64(dataBody["template_summary_id"].(float64))
  765. template_plan_id := int64(dataBody["template_plan_id"].(float64))
  766. patient_id := int64(dataBody["patient_id"].(float64))
  767. orgId := this.GetAdminUserInfo().CurrentOrgId
  768. inspect_date := dataBody["inspect_date"].(string)
  769. project_id := dataBody["project_id"].(string)
  770. template_inspection_id := int64(dataBody["template_inspection_id"].(float64))
  771. //title := this.GetString("title")
  772. //dryWeight := this.GetString("dry_weight")
  773. //dry_weight, _ := strconv.ParseFloat(dryWeight, 64)
  774. //dialysis_count, _ := this.GetInt64("dialysis_count")
  775. //hd_count, _ := this.GetInt64("hd_count")
  776. //hdf_count, _ := this.GetInt64("hdf_count")
  777. //hp_count, _ := this.GetInt64("hp_count")
  778. //other_count, _ := this.GetInt64("other_count")
  779. //dialzer_apparatus := this.GetString("dialzer_apparatus")
  780. //perfusion_apparatus := this.GetString("perfusion_apparatus")
  781. //anticoagulant, _ := this.GetInt64("anticoagulant")
  782. //kaliumstr := this.GetString("kalium")
  783. //kalium, _ := strconv.ParseFloat(kaliumstr, 64)
  784. //
  785. //autunitestr := this.GetString("autunite")
  786. //autunite, _ := strconv.ParseFloat(autunitestr, 64)
  787. //natriumstr := this.GetString("natrium")
  788. //natrium, _ := strconv.ParseFloat(natriumstr, 64)
  789. //hour, _ := this.GetInt64("hour")
  790. //minute, _ := this.GetInt64("minute")
  791. //beforWeight := this.GetString("befor_weight")
  792. //befor_weight, _ := strconv.ParseFloat(beforWeight, 64)
  793. //afterWeight := this.GetString("after_weight")
  794. //after_weight, _ := strconv.ParseFloat(afterWeight, 64)
  795. //befor_pressure := this.GetString("befor_pressure")
  796. //template_summary_content := this.GetString("template_summary_content")
  797. //template_plan_content := this.GetString("template_plan_content")
  798. //admin_user_id, _ := this.GetInt64("admin_user_id")
  799. //record_time := this.GetString("record_time")
  800. //timeLayout := "2006-01-02"
  801. //loc, _ := time.LoadLocation("Local")
  802. //recordTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_time, loc)
  803. //after_pressure := this.GetString("after_pressure")
  804. //template_summary_id, _ := this.GetInt64("template_summary_id")
  805. //template_plan_id, _ := this.GetInt64("template_plan_id")
  806. //template_inspection_id, _ := this.GetInt64("template_inspection_id")
  807. //patient_id, _ := this.GetInt64("patient_id")
  808. //fmt.Println("patient_id", patient_id)
  809. //orgId := this.GetAdminUserInfo().CurrentOrgId
  810. //inspect_date := this.GetString("inspect_date")
  811. //project_id := this.GetString("project_id")
  812. summary := models.XtTemplateSummary{
  813. StartYear: 0,
  814. StartMonth: 0,
  815. Radio: 0,
  816. Quarter: 0,
  817. DryWeight: dry_weight,
  818. DialysisCount: dialysis_count,
  819. HdCount: hd_count,
  820. HdfCount: hdf_count,
  821. HpCount: hp_count,
  822. OtherCount: other_count,
  823. DialzerApparatus: dialzer_apparatus,
  824. PerfusionApparatus: perfusion_apparatus,
  825. Anticoagulant: anticoagulant,
  826. Kalium: kalium,
  827. Autunite: autunite,
  828. Natrium: natrium,
  829. Hour: hour,
  830. Minute: minute,
  831. BeforWeight: befor_weight,
  832. AfterWeight: after_weight,
  833. BeforPressure: befor_pressure,
  834. AfterPressure: after_pressure,
  835. TemplateSummaryId: template_summary_id,
  836. TemplateSummaryContent: template_summary_content,
  837. TemplatePlanId: template_plan_id,
  838. TemplatePlanContent: template_plan_content,
  839. TemplateInspectionId: template_inspection_id,
  840. AdminUserId: admin_user_id,
  841. RecordTime: recordTime.Unix(),
  842. PatientId: patient_id,
  843. UserOrgId: orgId,
  844. Status: 1,
  845. Ctime: time.Now().Unix(),
  846. Mtime: 0,
  847. Title: title,
  848. InspectDate: inspect_date,
  849. ProjectId: project_id,
  850. }
  851. err = service.CreateSummary(&summary)
  852. if err == nil {
  853. this.ServeSuccessJSON(map[string]interface{}{
  854. "summary": summary,
  855. })
  856. return
  857. }
  858. }
  859. func (this *DoctorsApiController) GetTemplateSummaryList() {
  860. patient_id, _ := this.GetInt64("patient_id")
  861. start_time := this.GetString("start_time")
  862. timeLayout := "2006-01-02"
  863. loc, _ := time.LoadLocation("Local")
  864. end_time := this.GetString("end_time")
  865. orgId := this.GetAdminUserInfo().CurrentOrgId
  866. startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  867. endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  868. fmt.Println("hhhhhhhhhhhhhh777777", endTime.Unix())
  869. list, err := service.GetTemplateSummaryList(patient_id, orgId, startTime.Unix(), endTime.Unix())
  870. if err == nil {
  871. this.ServeSuccessJSON(map[string]interface{}{
  872. "list": list,
  873. })
  874. return
  875. }
  876. }
  877. func (this *DoctorsApiController) GetTemplateSummaryDetail() {
  878. id, _ := this.GetInt64("id")
  879. list, err := service.GetTemplateSummaryDetail(id)
  880. ids := strings.Split(list.ProjectId, ",")
  881. datelist := strings.Split(list.InspectDate, ",")
  882. inspectlist, err := service.GetInspectionItemlist(list.PatientId, datelist, ids)
  883. if err == nil {
  884. this.ServeSuccessJSON(map[string]interface{}{
  885. "list": list,
  886. "inspectlist": inspectlist,
  887. })
  888. return
  889. }
  890. }
  891. func (this *DoctorsApiController) GetTemplateSummaryPrintDetail() {
  892. id, _ := this.GetInt64("id")
  893. list, err := service.GetTemplateSummaryPrintDetail(id)
  894. ids := strings.Split(list.ProjectId, ",")
  895. datelist := strings.Split(list.InspectDate, ",")
  896. inspectlist, err := service.GetInspectionItemlist(list.PatientId, datelist, ids)
  897. orgId := this.GetAdminUserInfo().CurrentOrgId
  898. doctorList, _ := service.GetAllDoctorThree(orgId)
  899. if err == nil {
  900. this.ServeSuccessJSON(map[string]interface{}{
  901. "list": list,
  902. "doctorList": doctorList,
  903. "inspectlist": inspectlist,
  904. })
  905. return
  906. }
  907. }
  908. func (this *DoctorsApiController) UpdateTempalteSummary() {
  909. dataBody := make(map[string]interface{}, 0)
  910. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  911. if err != nil {
  912. utils.ErrorLog(err.Error())
  913. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  914. return
  915. }
  916. id := int64(dataBody["id"].(float64))
  917. title := dataBody["title"].(string)
  918. dryWeight := dataBody["dry_weight"].(string)
  919. dry_weight, _ := strconv.ParseFloat(dryWeight, 64)
  920. dialysis_count := int64(dataBody["dialysis_count"].(float64))
  921. hd_count := int64(dataBody["hd_count"].(float64))
  922. hdf_count := int64(dataBody["hdf_count"].(float64))
  923. hp_count := int64(dataBody["hp_count"].(float64))
  924. other_count := int64(dataBody["other_count"].(float64))
  925. dialzer_apparatus := dataBody["dialzer_apparatus"].(string)
  926. perfusion_apparatus := dataBody["perfusion_apparatus"].(string)
  927. anticoagulant := int64(dataBody["anticoagulant"].(float64))
  928. kaliumstr := dataBody["kalium"].(string)
  929. kalium, _ := strconv.ParseFloat(kaliumstr, 64)
  930. autunitestr := dataBody["autunite"].(string)
  931. autunite, _ := strconv.ParseFloat(autunitestr, 64)
  932. natriumstr := dataBody["natrium"].(string)
  933. natrium, _ := strconv.ParseFloat(natriumstr, 64)
  934. hour := int64(dataBody["hour"].(float64))
  935. minute := int64(dataBody["minute"].(float64))
  936. beforWeight := dataBody["befor_weight"].(string)
  937. befor_weight, _ := strconv.ParseFloat(beforWeight, 64)
  938. afterWeight := dataBody["after_weight"].(string)
  939. after_weight, _ := strconv.ParseFloat(afterWeight, 64)
  940. befor_pressure := dataBody["befor_pressure"].(string)
  941. template_summary_content := dataBody["template_summary_content"].(string)
  942. template_plan_content := dataBody["template_plan_content"].(string)
  943. admin_user_id := int64(dataBody["admin_user_id"].(float64))
  944. record_time := dataBody["record_time"].(string)
  945. timeLayout := "2006-01-02"
  946. loc, _ := time.LoadLocation("Local")
  947. recordTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_time, loc)
  948. after_pressure := dataBody["after_pressure"].(string)
  949. template_summary_id := int64(dataBody["template_summary_id"].(float64))
  950. template_plan_id := int64(dataBody["template_plan_id"].(float64))
  951. patient_id := int64(dataBody["patient_id"].(float64))
  952. orgId := this.GetAdminUserInfo().CurrentOrgId
  953. inspect_date := dataBody["inspect_date"].(string)
  954. project_id := dataBody["project_id"].(string)
  955. template_inspection_id := int64(dataBody["template_inspection_id"].(float64))
  956. //id, _ := this.GetInt64("id")
  957. //title := this.GetString("title")
  958. //
  959. //dryWeight := this.GetString("dry_weight")
  960. //dry_weight, _ := strconv.ParseFloat(dryWeight, 64)
  961. //dialysis_count, _ := this.GetInt64("dialysis_count")
  962. //hd_count, _ := this.GetInt64("hd_count")
  963. //hdf_count, _ := this.GetInt64("hdf_count")
  964. //hp_count, _ := this.GetInt64("hp_count")
  965. //other_count, _ := this.GetInt64("other_count")
  966. //dialzer_apparatus := this.GetString("dialzer_apparatus")
  967. //perfusion_apparatus := this.GetString("perfusion_apparatus")
  968. //anticoagulant, _ := this.GetInt64("anticoagulant")
  969. //kaliumstr := this.GetString("kalium")
  970. //kalium, _ := strconv.ParseFloat(kaliumstr, 64)
  971. //
  972. //autunitestr := this.GetString("autunite")
  973. //autunite, _ := strconv.ParseFloat(autunitestr, 64)
  974. //natriumstr := this.GetString("natrium")
  975. //natrium, _ := strconv.ParseFloat(natriumstr, 64)
  976. //hour, _ := this.GetInt64("hour")
  977. //minute, _ := this.GetInt64("minute")
  978. //beforWeight := this.GetString("befor_weight")
  979. //befor_weight, _ := strconv.ParseFloat(beforWeight, 64)
  980. //afterWeight := this.GetString("after_weight")
  981. //after_weight, _ := strconv.ParseFloat(afterWeight, 64)
  982. //befor_pressure := this.GetString("befor_pressure")
  983. //template_summary_content := this.GetString("template_summary_content")
  984. //template_plan_content := this.GetString("template_plan_content")
  985. //admin_user_id, _ := this.GetInt64("admin_user_id")
  986. //record_time := this.GetString("record_time")
  987. //timeLayout := "2006-01-02"
  988. //loc, _ := time.LoadLocation("Local")
  989. //recordTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_time, loc)
  990. //after_pressure := this.GetString("after_pressure")
  991. //template_summary_id, _ := this.GetInt64("template_summary_id")
  992. //template_plan_id, _ := this.GetInt64("template_plan_id")
  993. //template_inspection_id, _ := this.GetInt64("template_inspection_id")
  994. //patient_id, _ := this.GetInt64("patient_id")
  995. //fmt.Println("patient_id", patient_id)
  996. //orgId := this.GetAdminUserInfo().CurrentOrgId
  997. //inspect_date := this.GetString("inspect_date")
  998. //project_id := this.GetString("project_id")
  999. summary := models.XtTemplateSummary{
  1000. ID: id,
  1001. StartYear: 0,
  1002. StartMonth: 0,
  1003. Radio: 0,
  1004. Quarter: 0,
  1005. DryWeight: dry_weight,
  1006. DialysisCount: dialysis_count,
  1007. HdCount: hd_count,
  1008. HdfCount: hdf_count,
  1009. HpCount: hp_count,
  1010. OtherCount: other_count,
  1011. DialzerApparatus: dialzer_apparatus,
  1012. PerfusionApparatus: perfusion_apparatus,
  1013. Anticoagulant: anticoagulant,
  1014. Kalium: kalium,
  1015. Autunite: autunite,
  1016. Natrium: natrium,
  1017. Hour: hour,
  1018. Minute: minute,
  1019. BeforWeight: befor_weight,
  1020. AfterWeight: after_weight,
  1021. BeforPressure: befor_pressure,
  1022. AfterPressure: after_pressure,
  1023. TemplateSummaryId: template_summary_id,
  1024. TemplateSummaryContent: template_summary_content,
  1025. TemplatePlanId: template_plan_id,
  1026. TemplatePlanContent: template_plan_content,
  1027. TemplateInspectionId: template_inspection_id,
  1028. AdminUserId: admin_user_id,
  1029. RecordTime: recordTime.Unix(),
  1030. PatientId: patient_id,
  1031. UserOrgId: orgId,
  1032. Status: 1,
  1033. Ctime: time.Now().Unix(),
  1034. Mtime: 0,
  1035. Title: title,
  1036. ProjectId: project_id,
  1037. InspectDate: inspect_date,
  1038. }
  1039. err = service.UpdateTempalteSummary(&summary)
  1040. if err == nil {
  1041. this.ServeSuccessJSON(map[string]interface{}{
  1042. "list": summary,
  1043. })
  1044. return
  1045. }
  1046. }
  1047. func (this *DoctorsApiController) DeleteSummary() {
  1048. ids := this.GetString("ids")
  1049. idsplit := strings.Split(ids, ",")
  1050. err := service.DeleteSummary(idsplit)
  1051. fmt.Println(err)
  1052. returnData := make(map[string]interface{}, 0)
  1053. returnData["msg"] = "ok"
  1054. this.ServeSuccessJSON(returnData)
  1055. return
  1056. }