doctors_api_controller.go 41KB

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