doctors_api_controller.go 40KB

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