check_weight_api_controller.go 52KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348
  1. package mobile_api_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/astaxie/beego"
  11. "github.com/jinzhu/gorm"
  12. "net/http"
  13. "net/url"
  14. "strconv"
  15. _ "strings"
  16. // "fmt"
  17. _ "reflect"
  18. "time"
  19. )
  20. type CheckWeightApiController struct {
  21. MobileBaseAPIAuthController
  22. }
  23. func (c *CheckWeightApiController) SaveBloodPressure() {
  24. id, _ := c.GetInt64("patient", 0)
  25. dialysistype, _ := c.GetInt64("dialysistype", 0)
  26. systolic_blood_pressure, _ := c.GetFloat("systolic_blood_pressure", 0) //收缩压
  27. diastolic_blood_pressure, _ := c.GetFloat("diastolic_blood_pressure", 0) //舒张压
  28. pulse_frequency, _ := c.GetFloat("pulse_frequency", 0) //脉率
  29. if id <= 0 {
  30. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  31. return
  32. }
  33. if dialysistype <= 0 {
  34. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  35. return
  36. }
  37. if systolic_blood_pressure <= 0 {
  38. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  39. return
  40. }
  41. if diastolic_blood_pressure <= 0 {
  42. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  43. return
  44. }
  45. adminUserInfo := c.GetMobileAdminUserInfo()
  46. patient, _ := service.FindPatientByIdWithDiseases(adminUserInfo.Org.Id, id)
  47. if patient.ID == 0 {
  48. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  49. return
  50. }
  51. thisTime := time.Now()
  52. scheduleDateStart := thisTime.Format("2006-01-02") + " 00:00:00"
  53. timeLayout := "2006-01-02 15:04:05"
  54. loc, _ := time.LoadLocation("Local")
  55. theStartTime, _ := time.ParseInLocation(timeLayout, scheduleDateStart, loc)
  56. theAssessmentDateTime := theStartTime.Unix()
  57. if dialysistype == 1 {
  58. theEvaluation, getPEErr := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
  59. if getPEErr != nil {
  60. c.ErrorLog("获取透前评估失败:%v", getPEErr)
  61. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  62. return
  63. }
  64. var evaluation models.PredialysisEvaluation
  65. if theEvaluation != nil {
  66. evaluation = *theEvaluation
  67. }
  68. // 如果今天没有透前评估,则插入新的数据
  69. if theEvaluation == nil {
  70. evaluation.CreatedTime = time.Now().Unix()
  71. evaluation.Status = 1
  72. evaluation.AssessmentDate = theAssessmentDateTime
  73. evaluation.PatientId = id
  74. evaluation.UserOrgId = adminUserInfo.Org.Id
  75. // 获取上一次透前评估信息,部分数据是需要从上一次透前评估继承
  76. lastPredialysisEvaluation, _ := service.MobileGetLastTimePredialysisEvaluationOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
  77. // 获取上一次透后评估,插入本次透前评估的上次透后体重(weight_after_last_transparency)字段
  78. assessmentAfterDislysis, getAADErr := service.MobileGetLastTimeAssessmentAfterDislysisOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
  79. if getAADErr != nil {
  80. c.ErrorLog("获取透后评估失败:%v", getAADErr)
  81. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  82. return
  83. }
  84. // 获取干体重,先从干体重配置里去读,如果没有,则读取上一次透前评估的干体重
  85. weight, err := service.FindLastDryWeightAdjust(adminUserInfo.Org.Id, id)
  86. if err == gorm.ErrRecordNotFound {
  87. if lastPredialysisEvaluation != nil {
  88. evaluation.DryWeight = lastPredialysisEvaluation.DryWeight
  89. } else {
  90. evaluation.DryWeight = 0
  91. }
  92. } else {
  93. evaluation.DryWeight = weight.DryWeight
  94. }
  95. if assessmentAfterDislysis != nil {
  96. evaluation.WeightAfterLastTransparency = assessmentAfterDislysis.WeightAfter
  97. }
  98. if lastPredialysisEvaluation != nil {
  99. evaluation.BloodAccessPartId = lastPredialysisEvaluation.BloodAccessPartId
  100. evaluation.BloodAccessPartOperaId = lastPredialysisEvaluation.BloodAccessPartOperaId
  101. evaluation.AdditionalWeight = lastPredialysisEvaluation.AdditionalWeight // 衣物重
  102. //从化益达 备注默认上一次数据
  103. if adminUserInfo.Org.Id == 10318 {
  104. evaluation.Remark = lastPredialysisEvaluation.Remark
  105. }
  106. }
  107. } else {
  108. evaluation.UpdatedTime = time.Now().Unix()
  109. }
  110. evaluation.SystolicBloodPressure = systolic_blood_pressure // 收缩压
  111. evaluation.DiastolicBloodPressure = diastolic_blood_pressure // 舒张压
  112. evaluation.PulseFrequency = pulse_frequency // 脉率
  113. evaluation.AssessmentTime = time.Now().Unix()
  114. err := service.UpadatePredialysisEvaluation(&evaluation)
  115. assessdateDateStart := thisTime.Format("2006-01-02")
  116. key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":assessment_before_dislysis"
  117. redis := service.RedisClient()
  118. defer redis.Close()
  119. //清空key 值
  120. redis.Set(key, "", time.Second)
  121. keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":assessment_befores_list_all"
  122. redis.Set(keyOne, "", time.Second)
  123. keyTwo := "scheduals_" + assessdateDateStart + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
  124. redis.Set(keyTwo, "", time.Second)
  125. redis.Close()
  126. if err != nil {
  127. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBUpdate)
  128. return
  129. }
  130. c.ServeSuccessJSON(map[string]interface{}{
  131. "msg": "ok",
  132. "evaluation": evaluation,
  133. })
  134. return
  135. } else {
  136. // 保存透后相关数据
  137. assessmentAfterDislysis, getAADErr := service.MobileGetAssessmentAfterDislysisOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
  138. if getAADErr != nil {
  139. c.ErrorLog("获取透后评估失败:%v", getAADErr)
  140. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  141. return
  142. }
  143. var afterevaluation models.AssessmentAfterDislysis
  144. if assessmentAfterDislysis != nil {
  145. afterevaluation = *assessmentAfterDislysis
  146. }
  147. if assessmentAfterDislysis == nil {
  148. afterevaluation.CreatedTime = time.Now().Unix()
  149. afterevaluation.Status = 1
  150. afterevaluation.AssessmentDate = theAssessmentDateTime
  151. afterevaluation.PatientId = id
  152. afterevaluation.UserOrgId = adminUserInfo.Org.Id
  153. } else {
  154. afterevaluation.UpdatedTime = time.Now().Unix()
  155. }
  156. afterevaluation.SystolicBloodPressure = systolic_blood_pressure // 收缩压
  157. afterevaluation.DiastolicBloodPressure = diastolic_blood_pressure // 舒张压
  158. afterevaluation.PulseFrequency = pulse_frequency // 脉率
  159. if adminUserInfo.Org.Id == 10138 {
  160. afterevaluation.LeaveOfficeMethod = assessmentAfterDislysis.LeaveOfficeMethod //离科方式
  161. afterevaluation.Lapse = assessmentAfterDislysis.Lapse //转归
  162. afterevaluation.Consciousness = assessmentAfterDislysis.Consciousness //意识
  163. afterevaluation.Fallrisk = assessmentAfterDislysis.Fallrisk //跌倒风险
  164. }
  165. err := service.UpdateAssessmentAfterDislysisRecord(&afterevaluation)
  166. key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":assessment_after_dislysis"
  167. redis := service.RedisClient()
  168. //清空key 值
  169. redis.Set(key, "", time.Second)
  170. keyThree := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":assessment_after_dislysis_list_all"
  171. redis.Set(keyThree, "", time.Second)
  172. assessdateDateStart := thisTime.Format("2006-01-02")
  173. keyTwo := "scheduals_" + assessdateDateStart + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
  174. redis.Set(keyTwo, "", time.Second)
  175. defer redis.Close()
  176. if err == nil {
  177. c.ServeSuccessJSON(map[string]interface{}{
  178. "assessmentAfterDislysis": afterevaluation,
  179. })
  180. }
  181. }
  182. }
  183. func (c *CheckWeightApiController) SavePatientInfoDialysis() {
  184. id, _ := c.GetInt64("patient", 0)
  185. dialysistype, _ := c.GetInt64("dialysistype", 0)
  186. if id <= 0 {
  187. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  188. return
  189. }
  190. if dialysistype <= 0 {
  191. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  192. return
  193. }
  194. adminUserInfo := c.GetMobileAdminUserInfo()
  195. patient, _ := service.FindPatientByIdWithDiseases(adminUserInfo.Org.Id, id)
  196. if patient.ID == 0 {
  197. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  198. return
  199. }
  200. thisTime := time.Now()
  201. scheduleDateStart := thisTime.Format("2006-01-02") + " 00:00:00"
  202. // scheduleDateEnd := thisTime.Format("2006-01-02") + " 23:59:59"
  203. timeLayout := "2006-01-02 15:04:05"
  204. loc, _ := time.LoadLocation("Local")
  205. theStartTime, _ := time.ParseInLocation(timeLayout, scheduleDateStart, loc)
  206. // theEndTime, _ := time.ParseInLocation(timeLayout, scheduleDateEnd, loc)
  207. theAssessmentDateTime := theStartTime.Unix()
  208. // endTime := theEndTime.Unix()
  209. // dry_weight,_ := c.GetFloat("dry_weight",0) // 干体重
  210. weighing_before, _ := c.GetFloat("weighing_before", 0) // 透前体重
  211. dewater_amount, _ := c.GetFloat("dewater_amount", 0) // 目标脱水量(L)
  212. weight_after, _ := c.GetFloat("weight_after", 0) // 透后体重
  213. weight_loss, _ := c.GetFloat("weight_loss", 0) // 体重减少
  214. schedual, _ := service.MobileGetSchedualDetail(adminUserInfo.Org.Id, patient.ID, theStartTime.Unix())
  215. //dialysisSolution,_ := service.MobileGetDialysisSolutionByModeId(adminUserInfo.Org.Id,patient.ID,schedual.ModeId)
  216. //dialysisPrescribe, _ := service.MobileGetDialysisPrescribeByModeId(adminUserInfo.Org.Id, patient.ID, theStartTime.Unix(),schedual.ModeId)
  217. //dialysisPrescribe, _ := service.MobileGetDialysisPrescribeByModeId(adminUserInfo.Org.Id, patient.ID, theStartTime.Unix(),schedual.ModeId)
  218. //dialysisPrescribe, _ := service.MobileGetDialysisPrescribeByModeId(adminUserInfo.Org.Id, patient.ID, theStartTime.Unix(),schedual.ModeId)
  219. // 查询当前用户今天有没有排班,没有排班,则不处理
  220. // daySchedule, _ := service.GetPatientScheduleFormDay(adminUserInfo.Org.Id, theAssessmentDateTime, endTime, id)
  221. // if(len(daySchedule) <= 0) {
  222. // c.ServeSuccessJSON(map[string]interface{}{
  223. // "msg": "ok",
  224. // })
  225. // return
  226. // }
  227. template, _ := service.GetOrgInfoTemplate(adminUserInfo.Org.Id)
  228. if template.TemplateId == 22 || template.TemplateId == 17 || template.TemplateId == 21 || template.TemplateId == 26 || template.TemplateId == 27 || template.TemplateId == 34 || template.TemplateId == 30 || template.TemplateId == 32 || template.TemplateId == 36 || template.TemplateId == 40 || template.TemplateId == 38 || template.TemplateId == 43 || template.TemplateId == 46 || template.TemplateId == 53 || template.TemplateId == 48 || adminUserInfo.Org.Id == 10345 || adminUserInfo.Org.Id == 10432 || adminUserInfo.Org.Id == 10441 || adminUserInfo.Org.Id == 10445 || adminUserInfo.Org.Id == 10138 || adminUserInfo.Org.Id == 10278 || adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10440 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 10471 {
  229. if adminUserInfo.Org.Id != 10447 {
  230. dewater_amount = dewater_amount * 1000
  231. }
  232. }
  233. if dewater_amount < 0 {
  234. dewater_amount = 0
  235. }
  236. if dialysistype == 1 {
  237. // 保存透前相关数据
  238. // 获取透析处方
  239. var lastDialysisPrescribe *models.DialysisPrescription
  240. var dialysisSolution *models.DialysisSolution
  241. var dialysisPrescribe *models.DialysisPrescription
  242. var system_dialysisPrescribe *models.SystemPrescription
  243. var mode_id int64
  244. //weightfirst, _ := service.FindLastDryWeightAdjust(adminUserInfo.Org.Id, id)
  245. //if weightfirst.DryWeight > weighing_before {
  246. // return
  247. //}
  248. dialysisPrescribe, _ = service.MobileGetDialysisPrescribe(adminUserInfo.Org.Id, id, theAssessmentDateTime)
  249. if schedual != nil {
  250. // 获取透析模版
  251. dialysisSolution, _ = service.MobileGetDialysisSolutionByModeIdSix(adminUserInfo.Org.Id, id, schedual.ModeId)
  252. system_dialysisPrescribe, _ = service.MobileGetSystemDialysisPrescribeByModeIdSix(adminUserInfo.Org.Id, schedual.ModeId)
  253. lastDialysisPrescribe, _ = service.MobileGetLastDialysisPrescribeByModeIdSix(adminUserInfo.Org.Id, id, schedual.ModeId)
  254. //判断透析模式,针对河间咸的
  255. if adminUserInfo.Org.Id == 10090 {
  256. if dialysisSolution.ModeId != 2 && dialysisSolution.ModeId != 5 && dialysisSolution.ModeId != 12 {
  257. dialysisSolution.DisplaceLiquiPart = 0
  258. dialysisSolution.DisplaceLiquiValue = 0
  259. }
  260. if lastDialysisPrescribe.ModeId != 2 && lastDialysisPrescribe.ModeId != 5 && lastDialysisPrescribe.ModeId != 12 {
  261. dialysisSolution.DisplaceLiquiPart = 0
  262. dialysisSolution.DisplaceLiquiValue = 0
  263. }
  264. }
  265. mode_id = schedual.ModeId
  266. } else {
  267. // 获取透析模版
  268. dialysisSolution, _ = service.MobileGetDialysisSolution(adminUserInfo.Org.Id, id)
  269. if dialysisPrescribe == nil && dialysisSolution != nil {
  270. mode_id = dialysisSolution.ModeId
  271. }
  272. if dialysisPrescribe == nil && dialysisSolution == nil {
  273. mode_id = 0
  274. }
  275. }
  276. // 插入透析处方
  277. if dialysisPrescribe == nil && dialysisSolution != nil {
  278. var newprescribe models.DialysisPrescription
  279. newprescribe.UserOrgId = dialysisSolution.UserOrgId
  280. newprescribe.PatientId = dialysisSolution.PatientId
  281. newprescribe.Anticoagulant = dialysisSolution.Anticoagulant
  282. newprescribe.AnticoagulantShouji = dialysisSolution.AnticoagulantShouji
  283. newprescribe.AnticoagulantWeichi = dialysisSolution.AnticoagulantWeichi
  284. newprescribe.AnticoagulantZongliang = dialysisSolution.AnticoagulantZongliang
  285. newprescribe.AnticoagulantGaimingcheng = dialysisSolution.AnticoagulantGaimingcheng
  286. newprescribe.AnticoagulantGaijiliang = dialysisSolution.AnticoagulantGaijiliang
  287. newprescribe.ModeId = dialysisSolution.ModeId
  288. newprescribe.DialysisDuration = dialysisSolution.DialysisDuration
  289. newprescribe.ReplacementWay = dialysisSolution.ReplacementWay
  290. newprescribe.HemodialysisMachine = dialysisSolution.HemodialysisMachine
  291. newprescribe.BloodFilter = dialysisSolution.BloodFilter
  292. newprescribe.PerfusionApparatus = dialysisSolution.PerfusionApparatus
  293. newprescribe.BloodFlowVolume = dialysisSolution.BloodFlowVolume
  294. newprescribe.DisplaceLiqui = dialysisSolution.DisplaceLiqui
  295. newprescribe.Glucose = dialysisSolution.Glucose
  296. newprescribe.DialysateFlow = dialysisSolution.DialysateFlow
  297. newprescribe.Kalium = dialysisSolution.Kalium
  298. newprescribe.Sodium = dialysisSolution.Sodium
  299. newprescribe.Calcium = dialysisSolution.Calcium
  300. newprescribe.Bicarbonate = dialysisSolution.Bicarbonate
  301. newprescribe.DialysateTemperature = dialysisSolution.DialysateTemperature
  302. newprescribe.Conductivity = dialysisSolution.Conductivity
  303. newprescribe.BodyFluid = dialysisSolution.BodyFluid
  304. newprescribe.SpecialMedicine = dialysisSolution.SpecialMedicine
  305. newprescribe.SpecialMedicineOther = dialysisSolution.SpecialMedicineOther
  306. newprescribe.DisplaceLiquiPart = dialysisSolution.DisplaceLiquiPart
  307. newprescribe.DisplaceLiquiValue = dialysisSolution.DisplaceLiquiValue
  308. newprescribe.BloodAccess = dialysisSolution.BloodAccess
  309. newprescribe.Ultrafiltration = dialysisSolution.Ultrafiltration
  310. newprescribe.DialysisDurationHour = dialysisSolution.DialysisDurationHour
  311. newprescribe.DialysisDurationMinute = dialysisSolution.DialysisDurationMinute
  312. newprescribe.TargetUltrafiltration = dialysisSolution.TargetUltrafiltration
  313. newprescribe.DialysateFormulation = dialysisSolution.DialysateFormulation
  314. newprescribe.Dialyzer = dialysisSolution.Dialyzer
  315. newprescribe.ReplacementTotal = dialysisSolution.ReplacementTotal
  316. newprescribe.DialyzerPerfusionApparatus = dialysisSolution.DialyzerPerfusionApparatus
  317. newprescribe.DialysisIrrigation = dialysisSolution.DialysisIrrigation
  318. newprescribe.DialysisDialyszers = dialysisSolution.DialysisDialyszers
  319. newprescribe.BodyFluidOther = dialysisSolution.BodyFluidOther
  320. newprescribe.TargetKtv = dialysisSolution.TargetKtv
  321. newprescribe.CreatedTime = time.Now().Unix()
  322. newprescribe.UpdatedTime = time.Now().Unix()
  323. newprescribe.RecordDate = theAssessmentDateTime
  324. newprescribe.DewaterAmount = dewater_amount
  325. newprescribe.TargetUltrafiltration = dewater_amount
  326. newprescribe.PrescriptionWater = dewater_amount
  327. newprescribe.Chaptalization = dialysisSolution.Chaptalization
  328. newprescribe.PrescribingNumber = 1
  329. newprescribe.Status = 1
  330. if adminUserInfo.Org.Id != 10013 && adminUserInfo.Org.Id != 10014 {
  331. newprescribe.Remark = dialysisSolution.Remark
  332. }
  333. if adminUserInfo.Org.Id == 10340 {
  334. newprescribe.TargetUltrafiltration = 0
  335. newprescribe.Sodium = 138
  336. newprescribe.Bicarbonate = 31.1
  337. newprescribe.DialysateFlow = 500
  338. }
  339. // 针对新化博翔
  340. if adminUserInfo.Org.Id == 10447 {
  341. newprescribe.DisplaceLiquiPart = 1
  342. newprescribe.DisplaceLiquiValue = 32
  343. newprescribe.DialysateFlow = 500
  344. }
  345. if adminUserInfo.Org.Id == 10121 {
  346. newprescribe.DialysisDurationHour = 4
  347. newprescribe.DialysisDurationMinute = 0
  348. newprescribe.BloodAccess = dialysisSolution.BloodAccess
  349. }
  350. //插入透析处方
  351. err := service.AddSigleRecord(&newprescribe)
  352. key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
  353. redis := service.RedisClient()
  354. //清空key 值
  355. redis.Set(key, "", time.Second)
  356. keyTwo := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":prescriptions_list_all"
  357. redis.Set(keyTwo, "", time.Second)
  358. scheduleDateStartOne := thisTime.Format("2006-01-02")
  359. keyThree := "scheduals_" + scheduleDateStartOne + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
  360. redis.Set(keyThree, "", time.Second)
  361. defer redis.Close()
  362. if err != nil {
  363. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
  364. }
  365. }
  366. if dialysisPrescribe == nil && dialysisSolution == nil {
  367. if lastDialysisPrescribe != nil {
  368. var newprescribe models.DialysisPrescription
  369. newprescribe.UserOrgId = lastDialysisPrescribe.UserOrgId
  370. newprescribe.PatientId = lastDialysisPrescribe.PatientId
  371. newprescribe.Anticoagulant = lastDialysisPrescribe.Anticoagulant
  372. newprescribe.AnticoagulantShouji = lastDialysisPrescribe.AnticoagulantShouji
  373. newprescribe.AnticoagulantWeichi = lastDialysisPrescribe.AnticoagulantWeichi
  374. newprescribe.AnticoagulantZongliang = lastDialysisPrescribe.AnticoagulantZongliang
  375. newprescribe.AnticoagulantGaimingcheng = lastDialysisPrescribe.AnticoagulantGaimingcheng
  376. newprescribe.AnticoagulantGaijiliang = lastDialysisPrescribe.AnticoagulantGaijiliang
  377. newprescribe.ModeId = lastDialysisPrescribe.ModeId
  378. newprescribe.DialysisDuration = lastDialysisPrescribe.DialysisDuration
  379. newprescribe.ReplacementWay = lastDialysisPrescribe.ReplacementWay
  380. newprescribe.HemodialysisMachine = lastDialysisPrescribe.HemodialysisMachine
  381. newprescribe.BloodFilter = lastDialysisPrescribe.BloodFilter
  382. newprescribe.PerfusionApparatus = lastDialysisPrescribe.PerfusionApparatus
  383. newprescribe.BloodFlowVolume = lastDialysisPrescribe.BloodFlowVolume
  384. newprescribe.DisplaceLiqui = lastDialysisPrescribe.DisplaceLiqui
  385. newprescribe.Glucose = lastDialysisPrescribe.Glucose
  386. newprescribe.DialysateFlow = lastDialysisPrescribe.DialysateFlow
  387. newprescribe.Kalium = lastDialysisPrescribe.Kalium
  388. newprescribe.Sodium = lastDialysisPrescribe.Sodium
  389. newprescribe.Calcium = lastDialysisPrescribe.Calcium
  390. newprescribe.Bicarbonate = lastDialysisPrescribe.Bicarbonate
  391. newprescribe.DialysateTemperature = lastDialysisPrescribe.DialysateTemperature
  392. newprescribe.Conductivity = lastDialysisPrescribe.Conductivity
  393. newprescribe.BodyFluid = lastDialysisPrescribe.BodyFluid
  394. newprescribe.SpecialMedicine = lastDialysisPrescribe.SpecialMedicine
  395. newprescribe.SpecialMedicineOther = lastDialysisPrescribe.SpecialMedicineOther
  396. newprescribe.DisplaceLiquiPart = lastDialysisPrescribe.DisplaceLiquiPart
  397. newprescribe.DisplaceLiquiValue = lastDialysisPrescribe.DisplaceLiquiValue
  398. newprescribe.BloodAccess = lastDialysisPrescribe.BloodAccess
  399. newprescribe.Ultrafiltration = lastDialysisPrescribe.Ultrafiltration
  400. newprescribe.DialysisDurationHour = lastDialysisPrescribe.DialysisDurationHour
  401. newprescribe.DialysisDurationMinute = lastDialysisPrescribe.DialysisDurationMinute
  402. newprescribe.DialysateFormulation = lastDialysisPrescribe.DialysateFormulation
  403. newprescribe.Dialyzer = lastDialysisPrescribe.Dialyzer
  404. newprescribe.ReplacementTotal = lastDialysisPrescribe.ReplacementTotal
  405. newprescribe.DialyzerPerfusionApparatus = lastDialysisPrescribe.DialyzerPerfusionApparatus
  406. newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
  407. newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
  408. newprescribe.BodyFluidOther = lastDialysisPrescribe.BodyFluidOther
  409. newprescribe.TargetKtv = lastDialysisPrescribe.TargetKtv
  410. newprescribe.CreatedTime = time.Now().Unix()
  411. newprescribe.UpdatedTime = time.Now().Unix()
  412. newprescribe.RecordDate = theAssessmentDateTime
  413. newprescribe.DewaterAmount = dewater_amount
  414. newprescribe.TargetUltrafiltration = dewater_amount
  415. newprescribe.PrescriptionWater = dewater_amount
  416. newprescribe.Status = 1
  417. if adminUserInfo.Org.Id != 10490 {
  418. newprescribe.Remark = lastDialysisPrescribe.Remark
  419. } else {
  420. newprescribe.Remark = ""
  421. }
  422. newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
  423. newprescribe.PrescribingNumber = 1
  424. if adminUserInfo.Org.Id == 10340 {
  425. newprescribe.TargetUltrafiltration = 0
  426. }
  427. if adminUserInfo.Org.Id == 10121 {
  428. newprescribe.DialysisDurationHour = 4
  429. newprescribe.DialysisDurationMinute = 0
  430. newprescribe.BloodAccess = dialysisSolution.BloodAccess
  431. }
  432. err := service.AddSigleRecord(&newprescribe)
  433. key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
  434. redis := service.RedisClient()
  435. //清空key 值
  436. redis.Set(key, "", time.Second)
  437. keyTwo := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":prescriptions_list_all"
  438. redis.Set(keyTwo, "", time.Second)
  439. scheduleDateStartOne := thisTime.Format("2006-01-02")
  440. keyThree := "scheduals_" + scheduleDateStartOne + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
  441. redis.Set(keyThree, "", time.Second)
  442. defer redis.Close()
  443. if err != nil {
  444. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
  445. }
  446. } else if system_dialysisPrescribe != nil {
  447. var newprescribe models.DialysisPrescription
  448. newprescribe.UserOrgId = system_dialysisPrescribe.UserOrgId
  449. newprescribe.PatientId = id
  450. newprescribe.Anticoagulant = system_dialysisPrescribe.Anticoagulant
  451. newprescribe.AnticoagulantShouji = system_dialysisPrescribe.AnticoagulantShouji
  452. newprescribe.AnticoagulantWeichi = system_dialysisPrescribe.AnticoagulantWeichi
  453. newprescribe.AnticoagulantZongliang = system_dialysisPrescribe.AnticoagulantZongliang
  454. newprescribe.AnticoagulantGaimingcheng = system_dialysisPrescribe.AnticoagulantGaimingcheng
  455. newprescribe.AnticoagulantGaijiliang = system_dialysisPrescribe.AnticoagulantGaijiliang
  456. newprescribe.ModeId = system_dialysisPrescribe.ModeId
  457. newprescribe.DialysisDuration = system_dialysisPrescribe.DialysisDuration
  458. newprescribe.ReplacementWay = system_dialysisPrescribe.ReplacementWay
  459. newprescribe.HemodialysisMachine = system_dialysisPrescribe.HemodialysisMachine
  460. newprescribe.BloodFilter = system_dialysisPrescribe.BloodFilter
  461. newprescribe.PerfusionApparatus = system_dialysisPrescribe.PerfusionApparatus
  462. newprescribe.BloodFlowVolume = system_dialysisPrescribe.BloodFlowVolume
  463. newprescribe.DisplaceLiqui = system_dialysisPrescribe.DisplaceLiqui
  464. newprescribe.Glucose = system_dialysisPrescribe.Glucose
  465. newprescribe.DialysateFlow = system_dialysisPrescribe.DialysateFlow
  466. newprescribe.Kalium = system_dialysisPrescribe.Kalium
  467. newprescribe.Sodium = system_dialysisPrescribe.Sodium
  468. newprescribe.Calcium = system_dialysisPrescribe.Calcium
  469. newprescribe.Bicarbonate = system_dialysisPrescribe.Bicarbonate
  470. newprescribe.DialysateTemperature = system_dialysisPrescribe.DialysateTemperature
  471. newprescribe.Conductivity = system_dialysisPrescribe.Conductivity
  472. newprescribe.BodyFluid = system_dialysisPrescribe.BodyFluid
  473. newprescribe.SpecialMedicine = system_dialysisPrescribe.SpecialMedicine
  474. newprescribe.SpecialMedicineOther = system_dialysisPrescribe.SpecialMedicineOther
  475. newprescribe.DisplaceLiquiPart = system_dialysisPrescribe.DisplaceLiquiPart
  476. newprescribe.DisplaceLiquiValue = system_dialysisPrescribe.DisplaceLiquiValue
  477. newprescribe.BloodAccess = system_dialysisPrescribe.BloodAccess
  478. newprescribe.Ultrafiltration = system_dialysisPrescribe.Ultrafiltration
  479. newprescribe.DialysisDurationHour = system_dialysisPrescribe.DialysisDurationHour
  480. newprescribe.DialysisDurationMinute = system_dialysisPrescribe.DialysisDurationMinute
  481. newprescribe.DialysateFormulation = system_dialysisPrescribe.DialysateFormulation
  482. newprescribe.Dialyzer = system_dialysisPrescribe.Dialyzer
  483. newprescribe.ReplacementTotal = system_dialysisPrescribe.ReplacementTotal
  484. newprescribe.DialyzerPerfusionApparatus = system_dialysisPrescribe.DialyzerPerfusionApparatus
  485. newprescribe.DialysisIrrigation = system_dialysisPrescribe.DialysisIrrigation
  486. newprescribe.DialysisDialyszers = system_dialysisPrescribe.DialysisDialyszers
  487. newprescribe.BodyFluidOther = system_dialysisPrescribe.BodyFluidOther
  488. newprescribe.TargetKtv = system_dialysisPrescribe.TargetKtv
  489. newprescribe.CreatedTime = time.Now().Unix()
  490. newprescribe.UpdatedTime = time.Now().Unix()
  491. newprescribe.RecordDate = theAssessmentDateTime
  492. newprescribe.DewaterAmount = dewater_amount
  493. newprescribe.TargetUltrafiltration = dewater_amount
  494. newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
  495. newprescribe.Status = 1
  496. newprescribe.PrescribingNumber = 1
  497. if adminUserInfo.Org.Id == 10340 {
  498. newprescribe.TargetUltrafiltration = 0
  499. }
  500. if adminUserInfo.Org.Id == 10121 {
  501. newprescribe.DialysisDurationHour = 4
  502. newprescribe.DialysisDurationMinute = 0
  503. newprescribe.BloodAccess = dialysisSolution.BloodAccess
  504. }
  505. err := service.AddSigleRecord(&newprescribe)
  506. key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
  507. redis := service.RedisClient()
  508. //清空key 值
  509. redis.Set(key, "", time.Second)
  510. keyTwo := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":prescriptions_list_all"
  511. redis.Set(keyTwo, "", time.Second)
  512. scheduleDateStartOne := thisTime.Format("2006-01-02")
  513. keyThree := "scheduals_" + scheduleDateStartOne + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
  514. redis.Set(keyThree, "", time.Second)
  515. defer redis.Close()
  516. if err != nil {
  517. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
  518. }
  519. } else {
  520. var newprescribe models.DialysisPrescription
  521. newprescribe.UserOrgId = adminUserInfo.Org.Id
  522. newprescribe.PatientId = id
  523. newprescribe.ModeId = mode_id
  524. newprescribe.CreatedTime = time.Now().Unix()
  525. newprescribe.UpdatedTime = time.Now().Unix()
  526. newprescribe.RecordDate = theAssessmentDateTime
  527. newprescribe.DewaterAmount = dewater_amount
  528. newprescribe.TargetUltrafiltration = dewater_amount
  529. newprescribe.Status = 1
  530. err := service.AddSigleRecord(&newprescribe)
  531. key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
  532. redis := service.RedisClient()
  533. //清空key 值
  534. redis.Set(key, "", time.Second)
  535. keyTwo := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":prescriptions_list_all"
  536. redis.Set(keyTwo, "", time.Second)
  537. scheduleDateStartOne := thisTime.Format("2006-01-02")
  538. keyThree := "scheduals_" + scheduleDateStartOne + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
  539. redis.Set(keyThree, "", time.Second)
  540. defer redis.Close()
  541. if err != nil {
  542. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
  543. }
  544. }
  545. }
  546. if dialysisPrescribe != nil && dialysisPrescribe.TargetUltrafiltration == 0 {
  547. dialysisPrescribe.UpdatedTime = time.Now().Unix()
  548. dialysisPrescribe.RecordDate = theAssessmentDateTime
  549. dialysisPrescribe.DewaterAmount = dewater_amount
  550. dialysisPrescribe.TargetUltrafiltration = dewater_amount
  551. dialysisPrescribe.Status = 1
  552. if adminUserInfo.Org.Id == 10340 {
  553. dialysisPrescribe.TargetUltrafiltration = 0
  554. }
  555. updateErr := service.UpDateDialysisPrescription(dialysisPrescribe)
  556. key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
  557. redis := service.RedisClient()
  558. //清空key 值
  559. redis.Set(key, "", time.Second)
  560. keyTwo := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":prescriptions_list_all"
  561. redis.Set(keyTwo, "", time.Second)
  562. scheduleDateStartOne := thisTime.Format("2006-01-02")
  563. keyThree := "scheduals_" + scheduleDateStartOne + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
  564. redis.Set(keyThree, "", time.Second)
  565. defer redis.Close()
  566. if updateErr != nil {
  567. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCommitFail)
  568. }
  569. }
  570. theEvaluation, getPEErr := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
  571. if getPEErr != nil {
  572. c.ErrorLog("获取透前评估失败:%v", getPEErr)
  573. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  574. return
  575. }
  576. var evaluation models.PredialysisEvaluation
  577. if theEvaluation != nil {
  578. evaluation = *theEvaluation
  579. }
  580. // 如果今天没有透前评估,则插入新的数据
  581. if theEvaluation == nil {
  582. evaluation.CreatedTime = time.Now().Unix()
  583. evaluation.Status = 1
  584. evaluation.AssessmentDate = theAssessmentDateTime
  585. evaluation.PatientId = id
  586. evaluation.UserOrgId = adminUserInfo.Org.Id
  587. // 获取上一次透前评估信息,部分数据是需要从上一次透前评估继承
  588. lastPredialysisEvaluation, _ := service.MobileGetLastTimePredialysisEvaluationOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
  589. // 获取上一次透后评估,插入本次透前评估的上次透后体重(weight_after_last_transparency)字段
  590. assessmentAfterDislysis, getAADErr := service.MobileGetLastTimeAssessmentAfterDislysisOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
  591. if getAADErr != nil {
  592. c.ErrorLog("获取透后评估失败:%v", getAADErr)
  593. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  594. return
  595. }
  596. // 获取干体重,先从干体重配置里去读,如果没有,则读取上一次透前评估的干体重
  597. weight, err := service.FindLastDryWeightAdjust(adminUserInfo.Org.Id, id)
  598. if err == gorm.ErrRecordNotFound {
  599. if lastPredialysisEvaluation != nil {
  600. evaluation.DryWeight = lastPredialysisEvaluation.DryWeight
  601. } else {
  602. evaluation.DryWeight = 0
  603. }
  604. } else {
  605. evaluation.DryWeight = weight.DryWeight
  606. }
  607. if assessmentAfterDislysis != nil {
  608. evaluation.WeightAfterLastTransparency = assessmentAfterDislysis.WeightAfter
  609. }
  610. if lastPredialysisEvaluation != nil {
  611. evaluation.BloodAccessPartId = lastPredialysisEvaluation.BloodAccessPartId
  612. evaluation.BloodAccessPartOperaId = lastPredialysisEvaluation.BloodAccessPartOperaId
  613. evaluation.AdditionalWeight = lastPredialysisEvaluation.AdditionalWeight
  614. evaluation.Temperature = lastPredialysisEvaluation.Temperature
  615. evaluation.BreathingRate = lastPredialysisEvaluation.BreathingRate
  616. evaluation.Catheter = lastPredialysisEvaluation.Catheter
  617. evaluation.InternalFistula = lastPredialysisEvaluation.InternalFistula
  618. evaluation.PulseFrequency = lastPredialysisEvaluation.PulseFrequency
  619. evaluation.Complication = lastPredialysisEvaluation.Complication
  620. evaluation.LastPostDialysis = lastPredialysisEvaluation.LastPostDialysis
  621. evaluation.DialysisInterphase = lastPredialysisEvaluation.DialysisInterphase
  622. evaluation.SymptomBeforeDialysis = lastPredialysisEvaluation.SymptomBeforeDialysis
  623. evaluation.PunctureNeedle = lastPredialysisEvaluation.PunctureNeedle
  624. evaluation.PunctureWay = lastPredialysisEvaluation.PunctureWay
  625. evaluation.InternalFistulaSkin = lastPredialysisEvaluation.InternalFistulaSkin //血透通路皮肤情况
  626. evaluation.CatheterBend = lastPredialysisEvaluation.CatheterBend //导管打折
  627. evaluation.IsHemorrhage = lastPredialysisEvaluation.IsHemorrhage //出血
  628. evaluation.IsInfect = lastPredialysisEvaluation.IsInfect //感染
  629. evaluation.Exposed = lastPredialysisEvaluation.Exposed // 外漏
  630. evaluation.DialysisCount = lastPredialysisEvaluation.DialysisCount //呼吸频次
  631. evaluation.Phinholing = lastPredialysisEvaluation.Phinholing //针眼
  632. evaluation.Remark = lastPredialysisEvaluation.Remark
  633. if adminUserInfo.Org.Id == 10318 || adminUserInfo.Org.Id == 10490 {
  634. evaluation.Remark = ""
  635. }
  636. if adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10447 {
  637. evaluation.BreathingRate = "20"
  638. }
  639. if adminUserInfo.Org.Id == 10445 {
  640. evaluation.VenousCatheterization = lastPredialysisEvaluation.VenousCatheterization
  641. }
  642. if adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10469 || adminUserInfo.Org.Id == 10471 {
  643. evaluation.PulseFrequency = 80
  644. }
  645. if adminUserInfo.Org.Id == 10440 {
  646. evaluation.Temperature = 36.5
  647. }
  648. if adminUserInfo.Org.Id == 10469 {
  649. evaluation.Temperature = 36.5
  650. }
  651. if adminUserInfo.Org.Id == 10471 {
  652. evaluation.Temperature = 36.5
  653. }
  654. }
  655. } else {
  656. evaluation.UpdatedTime = time.Now().Unix()
  657. }
  658. evaluation.WeightBefore = weighing_before
  659. evaluation.AssessmentTime = time.Now().Unix()
  660. err := service.UpadatePredialysisEvaluation(&evaluation)
  661. key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":assessment_before_dislysis"
  662. redis := service.RedisClient()
  663. //清空key 值
  664. redis.Set(key, "", time.Second)
  665. keyOne := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":assessment_befores_list_all"
  666. redis.Set(keyOne, "", time.Second)
  667. assessdateDateStart := thisTime.Format("2006-01-02")
  668. keyTwo := "scheduals_" + assessdateDateStart + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
  669. redis.Set(keyTwo, "", time.Second)
  670. redis.Close()
  671. if err != nil {
  672. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBUpdate)
  673. return
  674. }
  675. c.ServeSuccessJSON(map[string]interface{}{
  676. "msg": "ok",
  677. "evaluation": evaluation,
  678. })
  679. return
  680. } else {
  681. // 保存透后相关数据
  682. assessmentAfterDislysis, getAADErr := service.MobileGetAssessmentAfterDislysisOne(adminUserInfo.Org.Id, id, theAssessmentDateTime)
  683. if getAADErr != nil {
  684. c.ErrorLog("获取透后评估失败:%v", getAADErr)
  685. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  686. return
  687. }
  688. var afterevaluation models.AssessmentAfterDislysis
  689. if assessmentAfterDislysis != nil {
  690. afterevaluation = *assessmentAfterDislysis
  691. }
  692. if assessmentAfterDislysis == nil {
  693. afterevaluation.CreatedTime = time.Now().Unix()
  694. afterevaluation.Status = 1
  695. afterevaluation.AssessmentDate = theAssessmentDateTime
  696. afterevaluation.PatientId = id
  697. afterevaluation.UserOrgId = adminUserInfo.Org.Id
  698. } else {
  699. afterevaluation.UpdatedTime = time.Now().Unix()
  700. }
  701. afterevaluation.WeightAfter = weight_after
  702. afterevaluation.WeightLoss = weight_loss
  703. if adminUserInfo.Org.Id == 10138 {
  704. afterevaluation.LeaveOfficeMethod = assessmentAfterDislysis.LeaveOfficeMethod //离科方式
  705. afterevaluation.Lapse = assessmentAfterDislysis.Lapse //转归
  706. afterevaluation.Consciousness = assessmentAfterDislysis.Consciousness //意识
  707. afterevaluation.Fallrisk = assessmentAfterDislysis.Fallrisk
  708. }
  709. if adminUserInfo.Org.Id == 10307 || adminUserInfo.Org.Id == 10445 {
  710. afterevaluation.ActualUltrafiltration = weight_loss * 1000 //中能建的计量单位是毫升(ml)
  711. }
  712. //北方营口
  713. if adminUserInfo.Org.Id == 10445 {
  714. prescribe, _ := service.MobileGetDialysisPrescribe(adminUserInfo.Org.Id, id, theAssessmentDateTime)
  715. afterevaluation.ActualDisplacement = prescribe.DisplaceLiquiValue
  716. }
  717. //蓬安济民
  718. if adminUserInfo.Org.Id == 9829 || adminUserInfo.Org.Id == 10469 {
  719. afterevaluation.PulseFrequency = 80
  720. }
  721. err := service.UpdateAssessmentAfterDislysisRecord(&afterevaluation)
  722. key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":assessment_after_dislysis"
  723. redis := service.RedisClient()
  724. //清空key 值
  725. redis.Set(key, "", time.Second)
  726. keyThree := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":assessment_after_dislysis_list_all"
  727. redis.Set(keyThree, "", time.Second)
  728. assessdateDateStart := thisTime.Format("2006-01-02")
  729. keyTwo := "scheduals_" + assessdateDateStart + "_" + strconv.FormatInt(adminUserInfo.Org.Id, 10)
  730. redis.Set(keyTwo, "", time.Second)
  731. redis.Close()
  732. if err == nil {
  733. c.ServeSuccessJSON(map[string]interface{}{
  734. "assessmentAfterDislysis": afterevaluation,
  735. })
  736. }
  737. }
  738. }
  739. func (c *CheckWeightApiController) SetSyncTime() {
  740. sn := c.GetString("sn")
  741. if len(sn) > 0 {
  742. redis := service.RedisClient()
  743. defer redis.Close()
  744. redis.Set(sn, 0, 0)
  745. }
  746. serviceTime := time.Now().Unix()
  747. c.ServeSuccessJSON(map[string]interface{}{
  748. "status": 1,
  749. "servicetime": serviceTime,
  750. })
  751. }
  752. func (c *CheckWeightApiController) GetPatientList() {
  753. ftype, _ := c.GetInt64("type", 0)
  754. sn := c.GetString("sn")
  755. syncTime := int64(0)
  756. redis := service.RedisClient()
  757. defer redis.Close()
  758. if len(sn) > 0 {
  759. syncTimeStr, _ := redis.Get(sn).Result()
  760. syncTime, _ = strconv.ParseInt(syncTimeStr, 10, 64)
  761. }
  762. if ftype == 1 {
  763. timeNow := time.Now().Unix()
  764. redis.Set(sn, timeNow, 0)
  765. }
  766. adminUserInfo := c.GetMobileAdminUserInfo()
  767. patientList, total, error := service.GetPatientListByUpdateTime(adminUserInfo.Org.Id, int64(syncTime))
  768. need_update := 0
  769. if syncTime == 0 {
  770. need_update = 1
  771. }
  772. if error != nil {
  773. c.ErrorLog("获取病人列表失败:%v", error)
  774. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  775. return
  776. }
  777. serviceTime := time.Now().Unix()
  778. c.ServeSuccessJSON(map[string]interface{}{
  779. "need_update": need_update,
  780. "patientlist": patientList,
  781. "total": total,
  782. "servicetime": serviceTime,
  783. })
  784. }
  785. func (c *CheckWeightApiController) GetPatientListForSchedules() {
  786. thisTime := time.Now()
  787. scheduleDateStart := thisTime.Format("2006-01-02") + " 00:00:00"
  788. timeLayout := "2006-01-02 15:04:05"
  789. loc, _ := time.LoadLocation("Local")
  790. theStartTime, _ := time.ParseInLocation(timeLayout, scheduleDateStart, loc)
  791. syncTime := theStartTime.Unix()
  792. adminUserInfo := c.GetMobileAdminUserInfo()
  793. patientList, total, error := service.GetPatientListBySchedules(adminUserInfo.Org.Id, syncTime)
  794. patientSchedule := make([]map[string]interface{}, 0)
  795. for _, item := range patientList {
  796. patientTemp := make(map[string]interface{})
  797. patientTemp["patient_id"] = item.PatientId
  798. patientTemp["patient_name"] = item.Patient.Name
  799. patientTemp["schedule_type"] = item.ScheduleType
  800. patientSchedule = append(patientSchedule, patientTemp)
  801. }
  802. if error != nil {
  803. c.ErrorLog("获取病人列表失败:%v", error)
  804. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  805. return
  806. }
  807. serviceTime := time.Now().Unix()
  808. c.ServeSuccessJSON(map[string]interface{}{
  809. "patientlist": patientSchedule,
  810. "total": total,
  811. "servicetime": serviceTime,
  812. })
  813. }
  814. func (c *CheckWeightApiController) GetPatientListForSchedulesFind() {
  815. patient_name := c.GetString("patient_name") //脉率
  816. thisTime := time.Now()
  817. scheduleDateStart := thisTime.Format("2006-01-02") + " 00:00:00"
  818. timeLayout := "2006-01-02 15:04:05"
  819. loc, _ := time.LoadLocation("Local")
  820. theStartTime, _ := time.ParseInLocation(timeLayout, scheduleDateStart, loc)
  821. syncTime := theStartTime.Unix()
  822. adminUserInfo := c.GetMobileAdminUserInfo()
  823. if len(patient_name) == 0 {
  824. patientList, total, error := service.GetPatientListBySchedules(adminUserInfo.Org.Id, syncTime)
  825. patientSchedule := make([]map[string]interface{}, 0)
  826. for _, item := range patientList {
  827. patientTemp := make(map[string]interface{})
  828. patientTemp["patient_id"] = item.PatientId
  829. patientTemp["patient_name"] = item.Patient.Name
  830. patientTemp["schedule_type"] = item.ScheduleType
  831. patientSchedule = append(patientSchedule, patientTemp)
  832. }
  833. if error != nil {
  834. c.ErrorLog("获取病人列表失败:%v", error)
  835. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  836. return
  837. }
  838. serviceTime := time.Now().Unix()
  839. c.ServeSuccessJSON(map[string]interface{}{
  840. "patientlist": patientSchedule,
  841. "total": total,
  842. "servicetime": serviceTime,
  843. })
  844. } else {
  845. patientList, total, error := service.GetPatientListBySchedulesFind(adminUserInfo.Org.Id, syncTime, patient_name)
  846. patientSchedule := make([]map[string]interface{}, 0)
  847. for _, item := range patientList {
  848. if item.Patient.ID > 0 {
  849. patientTemp := make(map[string]interface{})
  850. patientTemp["patient_id"] = item.PatientId
  851. patientTemp["patient_name"] = item.Patient.Name
  852. patientTemp["schedule_type"] = item.ScheduleType
  853. patientSchedule = append(patientSchedule, patientTemp)
  854. }
  855. }
  856. if error != nil {
  857. c.ErrorLog("获取病人列表失败:%v", error)
  858. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  859. return
  860. }
  861. serviceTime := time.Now().Unix()
  862. c.ServeSuccessJSON(map[string]interface{}{
  863. "patientlist": patientSchedule,
  864. "total": total,
  865. "servicetime": serviceTime,
  866. })
  867. }
  868. }
  869. func (c *CheckWeightApiController) GetPatientListById() {
  870. patientId, _ := c.GetInt64("patient_id", 0)
  871. if patientId <= 0 {
  872. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  873. return
  874. }
  875. adminUserInfo := c.GetMobileAdminUserInfo()
  876. patient, error := service.GetPatientListById(adminUserInfo.Org.Id, patientId)
  877. if error != nil {
  878. c.ErrorLog("获取病人详情失败:%v", error)
  879. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  880. return
  881. }
  882. c.ServeSuccessJSON(map[string]interface{}{
  883. "patientinfo": patient,
  884. })
  885. }
  886. func (c *CheckWeightApiController) GetPatientInfoDialysis() {
  887. id, _ := c.GetInt64("patient", 0)
  888. if id <= 0 {
  889. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  890. return
  891. }
  892. adminUserInfo := c.GetMobileAdminUserInfo()
  893. patient, _ := service.FindPatientByIdWithDiseases(adminUserInfo.Org.Id, id)
  894. if patient.ID <= 0 {
  895. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  896. return
  897. }
  898. var dialysisinfo map[string]interface{}
  899. dialysisinfo = make(map[string]interface{})
  900. dialysisinfo["id"] = patient.ID
  901. dialysisinfo["name"] = patient.Name
  902. dialysisinfo["dialysis_no"] = patient.DialysisNo
  903. thisTime := time.Now()
  904. scheduleDateStart := thisTime.Format("2006-01-02") + " 00:00:00"
  905. scheduleDateEnd := thisTime.Format("2006-01-02") + " 23:59:59"
  906. timeLayout := "2006-01-02 15:04:05"
  907. loc, _ := time.LoadLocation("Local")
  908. theStartTime, _ := time.ParseInLocation(timeLayout, scheduleDateStart, loc)
  909. theEndTime, _ := time.ParseInLocation(timeLayout, scheduleDateEnd, loc)
  910. startTime := theStartTime.Unix()
  911. endTime := theEndTime.Unix()
  912. // 判断当前用户是透析前还是透析后
  913. var dialysistype int
  914. _, dialysisOrder := service.FindDialysisRecordById(adminUserInfo.Org.Id, id, startTime)
  915. if dialysisOrder == nil {
  916. dialysistype = 1
  917. } else {
  918. dialysistype = 2
  919. }
  920. // 获取当前或者下次排班信息
  921. var sc map[string]interface{}
  922. sc = make(map[string]interface{})
  923. if dialysistype == 1 {
  924. daySchedule, _ := service.GetPatientScheduleFormDay(adminUserInfo.Org.Id, startTime, endTime, id)
  925. if len(daySchedule) <= 0 {
  926. sc["code"] = 1
  927. sc["msg"] = "抱歉,您今天没有排版!"
  928. sc["mode"] = 0
  929. sc["data"] = daySchedule
  930. } else {
  931. if daySchedule[0].Schedule.ID > 0 {
  932. sc["code"] = 0
  933. sc["msg"] = ""
  934. sc["mode"] = daySchedule[0].Schedule.ModeId
  935. sc["data"] = daySchedule
  936. } else {
  937. sc["code"] = 1
  938. sc["msg"] = "抱歉,您今天没有排版!"
  939. sc["mode"] = 0
  940. sc["data"] = daySchedule
  941. }
  942. }
  943. // 排队叫号的签到
  944. go func() {
  945. ssoDomain := beego.AppConfig.String("call_domain")
  946. api := ssoDomain + "/index/patientsign/" + strconv.FormatInt(adminUserInfo.Org.Id, 10) + "/" + strconv.FormatInt(id, 10)
  947. values := make(url.Values)
  948. http.PostForm(api, values)
  949. }()
  950. } else {
  951. nextSchedule, _ := service.GetNextSchedule(adminUserInfo.Org.Id, endTime, id)
  952. if len(nextSchedule) <= 0 {
  953. sc["code"] = 1
  954. sc["msg"] = "抱歉,您后续没有排版!"
  955. sc["mode"] = 0
  956. sc["data"] = nextSchedule
  957. } else {
  958. if nextSchedule[0].Schedule.ID > 0 {
  959. sc["code"] = 0
  960. sc["msg"] = ""
  961. sc["mode"] = nextSchedule[0].Schedule.ModeId
  962. sc["data"] = nextSchedule
  963. } else {
  964. sc["code"] = 1
  965. sc["msg"] = "抱歉,您后续没有排版!"
  966. sc["mode"] = 0
  967. sc["data"] = nextSchedule
  968. }
  969. }
  970. }
  971. switch sc["mode"] {
  972. case 1:
  973. sc["mode"] = "HD"
  974. case 2:
  975. sc["mode"] = "HDF"
  976. case 3:
  977. sc["mode"] = "HD+HP"
  978. case 4:
  979. sc["mode"] = "HP"
  980. case 5:
  981. sc["mode"] = "HF"
  982. case 6:
  983. sc["mode"] = "SCUF"
  984. case 7:
  985. sc["mode"] = "IUF"
  986. case 8:
  987. sc["mode"] = "HFHD"
  988. case 9:
  989. sc["mode"] = "HFHD+HP"
  990. case 10:
  991. sc["mode"] = "PHF"
  992. case 11:
  993. sc["mode"] = "HFR"
  994. case 12:
  995. sc["mode"] = "HDF+HP"
  996. case 13:
  997. sc["mode"] = "CRRT"
  998. case 14:
  999. sc["mode"] = "腹水回输"
  1000. case 15:
  1001. sc["mode"] = "HD前置换"
  1002. case 16:
  1003. sc["mode"] = "HD后置换"
  1004. case 17:
  1005. sc["mode"] = "HDF前置换"
  1006. case 18:
  1007. sc["mode"] = "HDF后置换"
  1008. default:
  1009. sc["mode"] = "HD"
  1010. }
  1011. // 获取患者透前干体重或者获取患者透前体重
  1012. var dry_weight map[string]interface{}
  1013. dry_weight = make(map[string]interface{})
  1014. var after_dry_weight map[string]interface{}
  1015. after_dry_weight = make(map[string]interface{})
  1016. if dialysistype == 1 {
  1017. lastPredialysisEvaluation, getLPEErr := service.MobileGetLastTimePredialysisEvaluation(adminUserInfo.Org.Id, id, endTime)
  1018. weight, err := service.FindLastDryWeightAdjust(adminUserInfo.Org.Id, id)
  1019. if err == gorm.ErrRecordNotFound {
  1020. if getLPEErr != nil {
  1021. dry_weight["code"] = 1
  1022. dry_weight["dry_weight"] = nil
  1023. } else {
  1024. if lastPredialysisEvaluation == nil {
  1025. dry_weight["code"] = 1
  1026. dry_weight["dry_weight"] = nil
  1027. } else {
  1028. // 传输的干体重实际为干体重加上衣服重
  1029. dry_weight["code"] = 0
  1030. dry_weight["dry_weight"] = lastPredialysisEvaluation.DryWeight + lastPredialysisEvaluation.AdditionalWeight
  1031. }
  1032. }
  1033. } else {
  1034. if err != nil {
  1035. dry_weight["code"] = 1
  1036. dry_weight["dry_weight"] = nil
  1037. } else {
  1038. dry_weight["code"] = 0
  1039. if getLPEErr != nil {
  1040. dry_weight["code"] = 0
  1041. dry_weight["dry_weight"] = weight.DryWeight
  1042. } else {
  1043. if lastPredialysisEvaluation == nil {
  1044. dry_weight["code"] = 1
  1045. dry_weight["dry_weight"] = weight.DryWeight
  1046. } else {
  1047. // 传输的干体重实际为干体重加上衣服重
  1048. dry_weight["code"] = 0
  1049. dry_weight["dry_weight"] = weight.DryWeight + lastPredialysisEvaluation.AdditionalWeight
  1050. }
  1051. }
  1052. }
  1053. }
  1054. } else {
  1055. predialysisEvaluation, getPEErr := service.MobileGetPredialysisEvaluation(adminUserInfo.Org.Id, id, startTime)
  1056. if getPEErr != nil {
  1057. dry_weight["code"] = 1
  1058. dry_weight["dry_weight"] = nil
  1059. } else {
  1060. if predialysisEvaluation == nil {
  1061. dry_weight["code"] = 1
  1062. dry_weight["dry_weight"] = nil
  1063. } else {
  1064. dry_weight["code"] = 0
  1065. dry_weight["dry_weight"] = predialysisEvaluation.WeightBefore
  1066. }
  1067. }
  1068. lastPredialysisEvaluation, getLPEErr := service.MobileGetLastTimePredialysisEvaluation(adminUserInfo.Org.Id, id, endTime)
  1069. weight, err := service.FindLastDryWeightAdjust(adminUserInfo.Org.Id, id)
  1070. if err == gorm.ErrRecordNotFound {
  1071. if getLPEErr != nil {
  1072. after_dry_weight["code"] = 1
  1073. after_dry_weight["dry_weight"] = nil
  1074. } else {
  1075. if lastPredialysisEvaluation == nil {
  1076. after_dry_weight["code"] = 1
  1077. after_dry_weight["dry_weight"] = nil
  1078. } else {
  1079. // 传输的干体重实际为干体重加上衣服重
  1080. after_dry_weight["code"] = 0
  1081. after_dry_weight["dry_weight"] = lastPredialysisEvaluation.DryWeight + lastPredialysisEvaluation.AdditionalWeight
  1082. }
  1083. }
  1084. } else {
  1085. if err != nil {
  1086. after_dry_weight["code"] = 1
  1087. after_dry_weight["dry_weight"] = nil
  1088. } else {
  1089. after_dry_weight["code"] = 0
  1090. if getLPEErr != nil {
  1091. after_dry_weight["code"] = 0
  1092. after_dry_weight["dry_weight"] = weight.DryWeight
  1093. } else {
  1094. if lastPredialysisEvaluation == nil {
  1095. after_dry_weight["code"] = 1
  1096. after_dry_weight["dry_weight"] = weight.DryWeight
  1097. } else {
  1098. // 传输的干体重实际为干体重加上衣服重
  1099. after_dry_weight["code"] = 0
  1100. after_dry_weight["dry_weight"] = weight.DryWeight + lastPredialysisEvaluation.AdditionalWeight
  1101. }
  1102. }
  1103. }
  1104. }
  1105. }
  1106. c.ServeSuccessJSON(map[string]interface{}{
  1107. "dialysistype": dialysistype,
  1108. "patient": dialysisinfo,
  1109. "schedule": sc,
  1110. "dryweight": dry_weight,
  1111. "after_dry_weight": after_dry_weight,
  1112. })
  1113. return
  1114. }
  1115. func (c *CheckWeightApiController) GetPatientInfoBeforeDialysis() {
  1116. id, _ := c.GetInt64("patient", 0)
  1117. if id <= 0 {
  1118. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  1119. return
  1120. }
  1121. adminUserInfo := c.GetMobileAdminUserInfo()
  1122. patient, _ := service.FindPatientByIdWithDiseases(adminUserInfo.Org.Id, id)
  1123. if patient.ID == 0 {
  1124. c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  1125. return
  1126. }
  1127. var dialysisinfo map[string]interface{}
  1128. dialysisinfo = make(map[string]interface{})
  1129. dialysisinfo["id"] = patient.ID
  1130. dialysisinfo["name"] = patient.Name
  1131. dialysisinfo["dialysis_no"] = patient.DialysisNo
  1132. thisTime := time.Now()
  1133. scheduleDateStart := thisTime.Format("2006-01-02") + " 00:00:00"
  1134. scheduleDateEnd := thisTime.Format("2006-01-02") + " 23:59:59"
  1135. fmt.Println(scheduleDateStart, scheduleDateEnd)
  1136. timeLayout := "2006-01-02 15:04:05"
  1137. loc, _ := time.LoadLocation("Local")
  1138. theStartTime, _ := time.ParseInLocation(timeLayout, scheduleDateStart, loc)
  1139. theEndTime, _ := time.ParseInLocation(timeLayout, scheduleDateEnd, loc)
  1140. fmt.Println(theStartTime, theEndTime)
  1141. startTime := theStartTime.Unix()
  1142. endTime := theEndTime.Unix()
  1143. var sc map[string]interface{}
  1144. sc = make(map[string]interface{})
  1145. //一天只有排班一次
  1146. daySchedule, _ := service.GetDaySchedule(adminUserInfo.Org.Id, startTime, endTime, id)
  1147. if daySchedule.ID > 0 {
  1148. switch daySchedule.ModeId {
  1149. case 1:
  1150. sc["mode"] = "HD"
  1151. case 2:
  1152. sc["mode"] = "HDF"
  1153. case 3:
  1154. sc["mode"] = "HD+HP"
  1155. case 4:
  1156. sc["mode"] = "HP"
  1157. case 5:
  1158. sc["mode"] = "HF"
  1159. case 6:
  1160. sc["mode"] = "SCUF"
  1161. case 7:
  1162. sc["mode"] = "IUF"
  1163. case 8:
  1164. sc["mode"] = "HFHD"
  1165. case 9:
  1166. sc["mode"] = "HFHD+HP"
  1167. case 10:
  1168. sc["mode"] = "PHF"
  1169. case 11:
  1170. sc["mode"] = "HFR"
  1171. case 12:
  1172. sc["mode"] = "HDF+HP"
  1173. case 13:
  1174. sc["mode"] = "CRRT"
  1175. case 14:
  1176. sc["mode"] = "腹水回输"
  1177. case 15:
  1178. sc["mode"] = "HD前置换"
  1179. case 16:
  1180. sc["mode"] = "HD后置换"
  1181. case 17:
  1182. sc["mode"] = "HDF前置换"
  1183. case 18:
  1184. sc["mode"] = "HDF后置换"
  1185. default:
  1186. sc["mode"] = "HD"
  1187. }
  1188. sc["code"] = 0
  1189. sc["msg"] = ""
  1190. sc["data"] = daySchedule
  1191. } else {
  1192. sc["code"] = 1
  1193. sc["msg"] = "抱歉,您今天没有排版!"
  1194. sc["mode"] = ""
  1195. sc["data"] = daySchedule
  1196. }
  1197. fmt.Println(sc)
  1198. type dryWeight struct {
  1199. code int
  1200. dry_weight float64
  1201. }
  1202. var dry_weight map[string]interface{}
  1203. dry_weight = make(map[string]interface{})
  1204. lastPredialysisEvaluation, getLPEErr := service.MobileGetLastTimePredialysisEvaluation(adminUserInfo.Org.Id, id, startTime)
  1205. if getLPEErr != nil {
  1206. dry_weight["code"] = 1
  1207. dry_weight["dry_weight"] = nil
  1208. } else {
  1209. if lastPredialysisEvaluation == nil {
  1210. dry_weight["code"] = 1
  1211. dry_weight["dry_weight"] = nil
  1212. } else {
  1213. dry_weight["code"] = 0
  1214. dry_weight["dry_weight"] = lastPredialysisEvaluation.DryWeight
  1215. }
  1216. }
  1217. c.ServeSuccessJSON(map[string]interface{}{
  1218. "patient": dialysisinfo,
  1219. "schedule": sc,
  1220. "dryweight": dry_weight,
  1221. })
  1222. return
  1223. }