patient_dataconfig_api_controller.go 54KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601
  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. "reflect"
  10. "strconv"
  11. "strings"
  12. "time"
  13. "github.com/astaxie/beego"
  14. )
  15. func PatientDataConfigAPIControllerRegistRouters() {
  16. beego.Router("/api/patient/courses", &PatientDataConfigAPIController{}, "get:Courses")
  17. beego.Router("/api/patient/course/create", &PatientDataConfigAPIController{}, "get:CreateCourse")
  18. beego.Router("/api/patient/course/delete", &PatientDataConfigAPIController{}, "post:DeleteCourse")
  19. beego.Router("/api/patient/course/modify", &PatientDataConfigAPIController{}, "get:ModifyCourse")
  20. beego.Router("/api/patient/rescues", &PatientDataConfigAPIController{}, "get:Rescues")
  21. beego.Router("/api/patient/rescue/create", &PatientDataConfigAPIController{}, "post:CreateRescue")
  22. beego.Router("/api/patient/rescue/delete", &PatientDataConfigAPIController{}, "post:DeleteRescue")
  23. beego.Router("/api/patient/sickhistory", &PatientDataConfigAPIController{}, "get:GetSickHistorys")
  24. beego.Router("/api/patient/sickhistory/create", &PatientDataConfigAPIController{}, "get:CreateSickHistory")
  25. beego.Router("/api/patient/sickhistory/delete", &PatientDataConfigAPIController{}, "post:DeleteSickHistory")
  26. beego.Router("/api/patient/sickhistory/modify", &PatientDataConfigAPIController{}, "get:ModifySickHistory")
  27. beego.Router("/api/patient/physiquecheck", &PatientDataConfigAPIController{}, "get:GetPhysiqueChecks")
  28. beego.Router("/api/patient/physiquecheck/create", &PatientDataConfigAPIController{}, "get:CreatePhysiqueCheck")
  29. beego.Router("/api/patient/physiquecheck/delete", &PatientDataConfigAPIController{}, "post:DeletePhysiqueCheck")
  30. beego.Router("/api/patient/physiquecheck/modify", &PatientDataConfigAPIController{}, "get:ModifyPhysiqueCheck")
  31. beego.Router("/api/patient/sickhistory/print", &PatientDataConfigAPIController{}, "get:GetSickhistoryPrints")
  32. beego.Router("/api/patient/physiquecheck/print", &PatientDataConfigAPIController{}, "get:GetPhysiquecheckPrints")
  33. beego.Router("/api/patient/getpatientdialysisinforlist", &PatientDataConfigAPIController{}, "get:GetPatientDialysisInforList")
  34. beego.Router("/api/patient/getcontextschedulelist", &PatientDataConfigAPIController{}, "Get:GetContextScheduleList")
  35. beego.Router("/api/patient/getpatientallagic", &PatientDataConfigAPIController{}, "Get:GetPatientAllagicList")
  36. beego.Router("/api/patient/savesitemap", &PatientDataConfigAPIController{}, "Post:SaveSiteMap")
  37. beego.Router("/api/patient/getpatientsitemap", &PatientDataConfigAPIController{}, "Get:GetPatientSitemap")
  38. }
  39. type PatientDataConfigAPIController struct {
  40. BaseAuthAPIController
  41. }
  42. func (this *PatientDataConfigAPIController) GetPhysiquecheckPrints() {
  43. patientID, _ := this.GetInt64("patient_id")
  44. idsStr := this.GetString("ids")
  45. if patientID <= 0 || len(idsStr) == 0 {
  46. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  47. return
  48. }
  49. recordIDStrs := strings.Split(idsStr, ",")
  50. patient, _ := service.GetPatientByID(this.GetAdminUserInfo().CurrentOrgId, patientID)
  51. sickHostory, _ := service.GetPatienttPhysiqueByIds(this.GetAdminUserInfo().CurrentOrgId, patientID, recordIDStrs)
  52. this.ServeSuccessJSON(map[string]interface{}{
  53. "patient": patient,
  54. "sickhistorys": sickHostory,
  55. })
  56. }
  57. func (this *PatientDataConfigAPIController) GetSickhistoryPrints() {
  58. patientID, _ := this.GetInt64("patient_id")
  59. idsStr := this.GetString("ids")
  60. if patientID <= 0 || len(idsStr) == 0 {
  61. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  62. return
  63. }
  64. recordIDStrs := strings.Split(idsStr, ",")
  65. patient, _ := service.GetPatientByID(this.GetAdminUserInfo().CurrentOrgId, patientID)
  66. sickHostory, _ := service.GetPatientSickHistoryByIds(this.GetAdminUserInfo().CurrentOrgId, patientID, recordIDStrs)
  67. for _, item := range sickHostory {
  68. pc, _ := service.GetLastPatientPhysiqueCheck(this.GetAdminUserInfo().CurrentOrgId, item.PatientId, item.RecordDate)
  69. item.XtPatientPhysiqueCheck = pc
  70. }
  71. this.ServeSuccessJSON(map[string]interface{}{
  72. "patient": patient,
  73. "sickhistorys": sickHostory,
  74. })
  75. }
  76. func (this *PatientDataConfigAPIController) GetSickHistorys() {
  77. patientID, _ := this.GetInt64("patient_id")
  78. startTimeYMDStr := this.GetString("start_time")
  79. endTimeYMDStr := this.GetString("end_time")
  80. if patientID <= 0 || len(startTimeYMDStr) == 0 || len(endTimeYMDStr) == 0 {
  81. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  82. return
  83. }
  84. endTimeYMDHmsStr := endTimeYMDStr + " 23:59:59"
  85. startTime, parseStartTimeErr := utils.ParseTimeStringToTime("2006-01-02", startTimeYMDStr)
  86. endTime, parseEndTimeErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
  87. if parseStartTimeErr != nil || parseEndTimeErr != nil {
  88. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamFormatWrong)
  89. return
  90. }
  91. adminUserInfo := this.GetAdminUserInfo()
  92. patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
  93. if getPatientErr != nil {
  94. this.ErrorLog("获取患者信息失败:%v", getPatientErr)
  95. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  96. return
  97. } else if patient == nil {
  98. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  99. return
  100. }
  101. records, getRecordsErr := service.GetPatientSickHistory(adminUserInfo.CurrentOrgId, patientID, startTime.Unix(), endTime.Unix())
  102. if getRecordsErr != nil {
  103. this.ErrorLog("获取患者病程记录失败:%v", getRecordsErr)
  104. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  105. return
  106. }
  107. admins, getAllAdminsErr := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
  108. if getAllAdminsErr != nil {
  109. this.ErrorLog("获取所有管理员失败:%v", getAllAdminsErr)
  110. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  111. return
  112. }
  113. this.ServeSuccessJSON(map[string]interface{}{
  114. "records": records,
  115. "doctors": admins,
  116. })
  117. }
  118. func (this *PatientDataConfigAPIController) CreateSickHistory() {
  119. patientID, _ := this.GetInt64("patient_id")
  120. content := this.GetString("content")
  121. record_time_str := this.GetString("record_time")
  122. title := this.GetString("title")
  123. is_shenyizhishi, _ := this.GetInt64("is_shenyizhishi")
  124. is_fumotouxishi, _ := this.GetInt64("is_fumotouxishi")
  125. is_guominyaowu, _ := this.GetInt64("is_guominyaowu")
  126. guominyaowu_desc := this.GetString("guominyaowu_desc")
  127. doctor_id, _ := this.GetInt64("doctor_id")
  128. if patientID <= 0 || len(content) == 0 {
  129. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  130. return
  131. }
  132. if len(record_time_str) == 0 {
  133. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  134. return
  135. }
  136. record_date := strings.Split(record_time_str, " ")
  137. checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
  138. checkDate_two, _ := utils.ParseTimeStringToTime("2006-01-02", record_date[0])
  139. adminUserInfo := this.GetAdminUserInfo()
  140. patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
  141. if getPatientErr != nil {
  142. this.ErrorLog("获取患者信息失败:%v", getPatientErr)
  143. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  144. return
  145. } else if patient == nil {
  146. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  147. return
  148. }
  149. now := time.Now().Unix()
  150. record := models.XtPatientSickHistory{
  151. OrgId: adminUserInfo.CurrentOrgId,
  152. PatientId: patientID,
  153. Recorder: adminUserInfo.AdminUser.Id,
  154. RecordTime: checkDate.Unix(),
  155. Content: content,
  156. Status: 1,
  157. Title: title,
  158. IsShenyizhiHistory: is_shenyizhishi,
  159. IsFumoDialysisHistory: is_fumotouxishi,
  160. HypersusceptibilityDesc: guominyaowu_desc,
  161. IsHypersusceptibility: is_guominyaowu,
  162. Ctime: now,
  163. Mtime: now,
  164. DoctorId: doctor_id,
  165. RecordDate: checkDate_two.Unix(),
  166. }
  167. createErr := service.CreatePatientSickHistory(&record)
  168. if createErr != nil {
  169. this.ErrorLog("创建患者病史记录失败:%v", createErr)
  170. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  171. return
  172. }
  173. this.ServeSuccessJSON(map[string]interface{}{
  174. "record": record,
  175. })
  176. }
  177. func (this *PatientDataConfigAPIController) DeleteSickHistory() {
  178. patientID, _ := this.GetInt64("patient_id")
  179. idsStr := this.GetString("ids")
  180. if patientID <= 0 || len(idsStr) == 0 {
  181. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  182. return
  183. }
  184. adminUserInfo := this.GetAdminUserInfo()
  185. patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
  186. if getPatientErr != nil {
  187. this.ErrorLog("获取患者信息失败:%v", getPatientErr)
  188. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  189. return
  190. } else if patient == nil {
  191. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  192. return
  193. }
  194. recordIDStrs := strings.Split(idsStr, ",")
  195. recordIDs := make([]int64, 0, len(recordIDStrs))
  196. for _, idStr := range recordIDStrs {
  197. id, parseErr := strconv.Atoi(idStr)
  198. if parseErr != nil {
  199. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  200. return
  201. }
  202. recordIDs = append(recordIDs, int64(id))
  203. }
  204. deleteErr := service.DeletePatientSickHistoryInBatch(adminUserInfo.CurrentOrgId, patientID, recordIDs)
  205. if deleteErr != nil {
  206. this.ErrorLog("删除患者病程记录失败:%v", deleteErr)
  207. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  208. return
  209. }
  210. this.ServeSuccessJSON(nil)
  211. }
  212. func (this *PatientDataConfigAPIController) ModifySickHistory() {
  213. patientID, _ := this.GetInt64("patient_id")
  214. content := this.GetString("content")
  215. id, _ := this.GetInt64("id", 0)
  216. record_time_str := this.GetString("record_time")
  217. title := this.GetString("title")
  218. is_shenyizhishi, _ := this.GetInt64("is_shenyizhishi")
  219. is_fumotouxishi, _ := this.GetInt64("is_fumotouxishi")
  220. is_guominyaowu, _ := this.GetInt64("is_guominyaowu")
  221. guominyaowu_desc := this.GetString("guominyaowu_desc")
  222. doctor_id, _ := this.GetInt64("doctor_id")
  223. if patientID <= 0 || len(content) == 0 || id == 0 || len(record_time_str) == 0 {
  224. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  225. return
  226. }
  227. //timeLayout := "2006-01-02"
  228. //loc, _ := time.LoadLocation("Local")
  229. checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
  230. fmt.Println("checkDate--------------", checkDate)
  231. adminUserInfo := this.GetAdminUserInfo()
  232. patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
  233. if getPatientErr != nil {
  234. this.ErrorLog("获取患者信息失败:%v", getPatientErr)
  235. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  236. return
  237. } else if patient == nil {
  238. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  239. return
  240. }
  241. now := time.Now().Unix()
  242. record := models.XtPatientSickHistory{
  243. ID: id,
  244. OrgId: adminUserInfo.CurrentOrgId,
  245. PatientId: patientID,
  246. Recorder: adminUserInfo.AdminUser.Id,
  247. Content: content,
  248. Status: 1,
  249. Ctime: now,
  250. Mtime: now,
  251. Title: title,
  252. RecordTime: checkDate.Unix(),
  253. IsShenyizhiHistory: is_shenyizhishi,
  254. IsFumoDialysisHistory: is_fumotouxishi,
  255. HypersusceptibilityDesc: guominyaowu_desc,
  256. IsHypersusceptibility: is_guominyaowu,
  257. DoctorId: doctor_id,
  258. }
  259. createErr := service.ModifyPatientSickHistory(&record)
  260. if createErr != nil {
  261. this.ErrorLog("创建患者抢救记录失败:%v", createErr)
  262. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  263. return
  264. }
  265. this.ServeSuccessJSON(map[string]interface{}{
  266. "record": record,
  267. })
  268. }
  269. func (this *PatientDataConfigAPIController) GetPhysiqueChecks() {
  270. patientID, _ := this.GetInt64("patient_id")
  271. startTimeYMDStr := this.GetString("start_time")
  272. endTimeYMDStr := this.GetString("end_time")
  273. if patientID <= 0 || len(startTimeYMDStr) == 0 || len(endTimeYMDStr) == 0 {
  274. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  275. return
  276. }
  277. endTimeYMDHmsStr := endTimeYMDStr + " 23:59:59"
  278. startTime, parseStartTimeErr := utils.ParseTimeStringToTime("2006-01-02", startTimeYMDStr)
  279. endTime, parseEndTimeErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
  280. if parseStartTimeErr != nil || parseEndTimeErr != nil {
  281. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamFormatWrong)
  282. return
  283. }
  284. adminUserInfo := this.GetAdminUserInfo()
  285. patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
  286. if getPatientErr != nil {
  287. this.ErrorLog("获取患者信息失败:%v", getPatientErr)
  288. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  289. return
  290. } else if patient == nil {
  291. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  292. return
  293. }
  294. records, getRecordsErr := service.GetPatientPhysiqueCheck(adminUserInfo.CurrentOrgId, patientID, startTime.Unix(), endTime.Unix())
  295. if getRecordsErr != nil {
  296. this.ErrorLog("获取患者病程记录失败:%v", getRecordsErr)
  297. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  298. return
  299. }
  300. admins, getAllAdminsErr := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
  301. if getAllAdminsErr != nil {
  302. this.ErrorLog("获取所有管理员失败:%v", getAllAdminsErr)
  303. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  304. return
  305. }
  306. this.ServeSuccessJSON(map[string]interface{}{
  307. "records": records,
  308. "doctors": admins,
  309. })
  310. }
  311. func (this *PatientDataConfigAPIController) CreatePhysiqueCheck() {
  312. patientID, _ := this.GetInt64("patient_id")
  313. doctor_id, _ := this.GetInt64("doctor_id")
  314. record_time_str := this.GetString("record_time")
  315. t := this.GetString("t")
  316. p := this.GetString("p")
  317. r := this.GetString("r")
  318. bp_left := this.GetString("bp_left")
  319. bp_right := this.GetString("bp_right")
  320. pinxuerongmao, _ := this.GetInt64("pinxuerongmao")
  321. tiwei, _ := this.GetInt64("tiwei")
  322. fuzhong, _ := this.GetInt64("fuzhong")
  323. chuxuedian, _ := this.GetInt64("chuxuedian")
  324. fayu, _ := this.GetInt64("fayu")
  325. yinyang, _ := this.GetInt64("yinyang")
  326. shenzhi, _ := this.GetInt64("shenzhi")
  327. pifunianmo, _ := this.GetInt64("pifunianmo")
  328. buwei := this.GetString("buwei")
  329. chengdu := this.GetString("chengdu")
  330. pixiachuxue, _ := this.GetInt64("pixiachuxue")
  331. zidian, _ := this.GetInt64("zidian")
  332. pifuwendu, _ := this.GetInt64("pifuwendu")
  333. qita := this.GetString("qita")
  334. linbazhongda, _ := this.GetInt64("linbazhongda")
  335. linbabuwei := this.GetString("linbabuwei")
  336. yanlian, _ := this.GetInt64("yanlian")
  337. tongkong, _ := this.GetInt64("tongkong")
  338. zuo := this.GetString("zuo")
  339. you := this.GetString("you")
  340. duiguangfanshe := this.GetString("duiguangfanshe")
  341. biantaoti := this.GetString("biantaoti")
  342. yanbu := this.GetString("yanbu")
  343. toubuqita := this.GetString("toubuqita")
  344. huxiyin := this.GetString("huxiyin")
  345. xiongmomocayin, _ := this.GetInt64("xiongmomocayin")
  346. feizhangbuwei, _ := this.GetInt64("feizhangbuwei")
  347. luoyin, _ := this.GetInt64("luoyin")
  348. desc := this.GetString("desc")
  349. xinzangdaxiao, _ := this.GetInt64("xinzangdaxiao")
  350. xinlv, _ := this.GetInt64("xinlv")
  351. xinbaomocasheng, _ := this.GetInt64("xinbaomocasheng")
  352. zayin, _ := this.GetInt64("zayin")
  353. fujiayin, _ := this.GetInt64("fujiayin")
  354. xinzangdesc := this.GetString("xinzangdesc")
  355. fushuizheng, _ := this.GetInt64("fushuizheng")
  356. ganjingjingmai := this.GetString("ganjingjingmai")
  357. gangzhang_yatong, _ := this.GetInt64("gangzhang_yatong")
  358. gangzhang_koutong, _ := this.GetInt64("gangzhang_koutong")
  359. pizhang_yatong, _ := this.GetInt64("pizhang_yatong")
  360. pizhang_koutong, _ := this.GetInt64("pizhang_koutong")
  361. shenzhang_yatong, _ := this.GetInt64("shenzhang_yatong")
  362. shenzhang_koutong, _ := this.GetInt64("shenzhang_koutong")
  363. fubu_desc := this.GetString("fubu_desc")
  364. oth_desc := this.GetString("oth_desc")
  365. if patientID <= 0 {
  366. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  367. return
  368. }
  369. if len(record_time_str) == 0 {
  370. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  371. return
  372. }
  373. record_date := strings.Split(record_time_str, " ")
  374. checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
  375. checkDate_two, _ := utils.ParseTimeStringToTime("2006-01-02", record_date[0])
  376. adminUserInfo := this.GetAdminUserInfo()
  377. patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
  378. if getPatientErr != nil {
  379. this.ErrorLog("获取患者信息失败:%v", getPatientErr)
  380. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  381. return
  382. } else if patient == nil {
  383. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  384. return
  385. }
  386. now := time.Now().Unix()
  387. record := models.XtPatientPhysiqueCheck{
  388. DoctorId: doctor_id,
  389. OrgId: adminUserInfo.CurrentOrgId,
  390. PatientId: patientID,
  391. Recorder: adminUserInfo.AdminUser.Id,
  392. RecordTime: checkDate.Unix(),
  393. Status: 1,
  394. Ctime: now,
  395. Mtime: now,
  396. T: t,
  397. P: p,
  398. R: r,
  399. BpRight: bp_right,
  400. BpLeft: bp_left,
  401. Pinxuerongmao: pinxuerongmao,
  402. Tiwei: tiwei,
  403. Fuzhong: fuzhong,
  404. Chuxuedian: chuxuedian,
  405. Fayu: fayu,
  406. Yinyang: yinyang,
  407. Shenzhi: shenzhi,
  408. Pifunianmo: pifunianmo,
  409. Buwei: buwei,
  410. Chengdu: chengdu,
  411. Pixiachuxue: pixiachuxue,
  412. Zidian: zidian,
  413. Pifuwendu: pifuwendu,
  414. Qita: qita,
  415. Linbazhongda: linbazhongda,
  416. Linbabuwei: linbabuwei,
  417. Yanlian: yanlian,
  418. Tongkong: tongkong,
  419. Zuo: zuo,
  420. You: you,
  421. Duiguangfanshe: duiguangfanshe,
  422. Biantaoti: biantaoti,
  423. Yanbu: yanbu,
  424. Toubuqita: toubuqita,
  425. Huxiyin: huxiyin,
  426. Xiongmomocayin: xiongmomocayin,
  427. Feizhangbuwei: feizhangbuwei,
  428. Luoyin: luoyin,
  429. Desc: desc,
  430. Xinzangdaxiao: xinzangdaxiao,
  431. Xinlv: xinlv,
  432. Xinbaomocasheng: xinbaomocasheng,
  433. Zayin: zayin,
  434. Fujiayin: fujiayin,
  435. Xinzangdesc: xinzangdesc,
  436. Fushuizheng: fushuizheng,
  437. Ganjingjingmai: ganjingjingmai,
  438. GangzhangYatong: gangzhang_yatong,
  439. GangzhangKoutong: gangzhang_koutong,
  440. PizhangKoutong: pizhang_koutong,
  441. PizhangYatong: pizhang_yatong,
  442. ShenzhangKoutong: shenzhang_koutong,
  443. ShenzhangYatong: shenzhang_yatong,
  444. FubuDesc: fubu_desc,
  445. OthDesc: oth_desc,
  446. RecordDate: checkDate_two.Unix(),
  447. }
  448. createErr := service.CreatePatientPhysiqueCheck(&record)
  449. if createErr != nil {
  450. this.ErrorLog("创建患者病史记录失败:%v", createErr)
  451. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  452. return
  453. }
  454. this.ServeSuccessJSON(map[string]interface{}{
  455. "record": record,
  456. })
  457. }
  458. func (this *PatientDataConfigAPIController) DeletePhysiqueCheck() {
  459. patientID, _ := this.GetInt64("patient_id")
  460. idsStr := this.GetString("ids")
  461. if patientID <= 0 || len(idsStr) == 0 {
  462. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  463. return
  464. }
  465. adminUserInfo := this.GetAdminUserInfo()
  466. patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
  467. if getPatientErr != nil {
  468. this.ErrorLog("获取患者信息失败:%v", getPatientErr)
  469. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  470. return
  471. } else if patient == nil {
  472. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  473. return
  474. }
  475. recordIDStrs := strings.Split(idsStr, ",")
  476. recordIDs := make([]int64, 0, len(recordIDStrs))
  477. for _, idStr := range recordIDStrs {
  478. id, parseErr := strconv.Atoi(idStr)
  479. if parseErr != nil {
  480. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  481. return
  482. }
  483. recordIDs = append(recordIDs, int64(id))
  484. }
  485. deleteErr := service.DeletePatientPhysiqueCheckInBatch(adminUserInfo.CurrentOrgId, patientID, recordIDs)
  486. if deleteErr != nil {
  487. this.ErrorLog("删除患者病程记录失败:%v", deleteErr)
  488. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  489. return
  490. }
  491. this.ServeSuccessJSON(nil)
  492. }
  493. func (this *PatientDataConfigAPIController) ModifyPhysiqueCheck() {
  494. patientID, _ := this.GetInt64("patient_id")
  495. id, _ := this.GetInt64("id", 0)
  496. doctor_id, _ := this.GetInt64("doctor_id", 0)
  497. record_time_str := this.GetString("record_time")
  498. if patientID <= 0 || id == 0 || len(record_time_str) == 0 {
  499. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  500. return
  501. }
  502. t := this.GetString("t")
  503. p := this.GetString("p")
  504. r := this.GetString("r")
  505. bp_left := this.GetString("bp_left")
  506. bp_right := this.GetString("bp_right")
  507. pinxuerongmao, _ := this.GetInt64("pinxuerongmao")
  508. tiwei, _ := this.GetInt64("tiwei")
  509. fuzhong, _ := this.GetInt64("fuzhong")
  510. chuxuedian, _ := this.GetInt64("chuxuedian")
  511. fayu, _ := this.GetInt64("fayu")
  512. yinyang, _ := this.GetInt64("yinyang")
  513. shenzhi, _ := this.GetInt64("shenzhi")
  514. pifunianmo, _ := this.GetInt64("pifunianmo")
  515. buwei := this.GetString("buwei")
  516. chengdu := this.GetString("chengdu")
  517. pixiachuxue, _ := this.GetInt64("pixiachuxue")
  518. zidian, _ := this.GetInt64("zidian")
  519. pifuwendu, _ := this.GetInt64("pifuwendu")
  520. qita := this.GetString("qita")
  521. linbazhongda, _ := this.GetInt64("linbazhongda")
  522. linbabuwei := this.GetString("linbabuwei")
  523. yanlian, _ := this.GetInt64("yanlian")
  524. tongkong, _ := this.GetInt64("tongkong")
  525. zuo := this.GetString("zuo")
  526. you := this.GetString("you")
  527. duiguangfanshe := this.GetString("duiguangfanshe")
  528. biantaoti := this.GetString("biantaoti")
  529. yanbu := this.GetString("yanbu")
  530. toubuqita := this.GetString("toubuqita")
  531. huxiyin := this.GetString("huxiyin")
  532. xiongmomocayin, _ := this.GetInt64("xiongmomocayin")
  533. feizhangbuwei, _ := this.GetInt64("feizhangbuwei")
  534. luoyin, _ := this.GetInt64("luoyin")
  535. desc := this.GetString("desc")
  536. xinzangdaxiao, _ := this.GetInt64("xinzangdaxiao")
  537. xinlv, _ := this.GetInt64("xinlv")
  538. xinbaomocasheng, _ := this.GetInt64("xinbaomocasheng")
  539. zayin, _ := this.GetInt64("zayin")
  540. fujiayin, _ := this.GetInt64("fujiayin")
  541. xinzangdesc := this.GetString("xinzangdesc")
  542. fushuizheng, _ := this.GetInt64("fushuizheng")
  543. ganjingjingmai := this.GetString("ganjingjingmai")
  544. gangzhang_yatong, _ := this.GetInt64("gangzhang_yatong")
  545. gangzhang_koutong, _ := this.GetInt64("gangzhang_koutong")
  546. pizhang_yatong, _ := this.GetInt64("pizhang_yatong")
  547. pizhang_koutong, _ := this.GetInt64("pizhang_koutong")
  548. shenzhang_yatong, _ := this.GetInt64("shenzhang_yatong")
  549. shenzhang_koutong, _ := this.GetInt64("shenzhang_koutong")
  550. fubu_desc := this.GetString("fubu_desc")
  551. oth_desc := this.GetString("oth_desc")
  552. checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
  553. adminUserInfo := this.GetAdminUserInfo()
  554. patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
  555. if getPatientErr != nil {
  556. this.ErrorLog("获取患者信息失败:%v", getPatientErr)
  557. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  558. return
  559. } else if patient == nil {
  560. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  561. return
  562. }
  563. now := time.Now().Unix()
  564. record := models.XtPatientPhysiqueCheck{
  565. ID: id,
  566. OrgId: adminUserInfo.CurrentOrgId,
  567. PatientId: patientID,
  568. Recorder: adminUserInfo.AdminUser.Id,
  569. RecordTime: checkDate.Unix(),
  570. DoctorId: doctor_id,
  571. Status: 1,
  572. Ctime: now,
  573. Mtime: now,
  574. T: t,
  575. P: p,
  576. R: r,
  577. BpRight: bp_right,
  578. BpLeft: bp_left,
  579. Pinxuerongmao: pinxuerongmao,
  580. Tiwei: tiwei,
  581. Fuzhong: fuzhong,
  582. Chuxuedian: chuxuedian,
  583. Fayu: fayu,
  584. Yinyang: yinyang,
  585. Shenzhi: shenzhi,
  586. Pifunianmo: pifunianmo,
  587. Buwei: buwei,
  588. Chengdu: chengdu,
  589. Pixiachuxue: pixiachuxue,
  590. Zidian: zidian,
  591. Pifuwendu: pifuwendu,
  592. Qita: qita,
  593. Linbazhongda: linbazhongda,
  594. Linbabuwei: linbabuwei,
  595. Yanlian: yanlian,
  596. Tongkong: tongkong,
  597. Zuo: zuo,
  598. You: you,
  599. Duiguangfanshe: duiguangfanshe,
  600. Biantaoti: biantaoti,
  601. Yanbu: yanbu,
  602. Toubuqita: toubuqita,
  603. Huxiyin: huxiyin,
  604. Xiongmomocayin: xiongmomocayin,
  605. Feizhangbuwei: feizhangbuwei,
  606. Luoyin: luoyin,
  607. Desc: desc,
  608. Xinzangdaxiao: xinzangdaxiao,
  609. Xinlv: xinlv,
  610. Xinbaomocasheng: xinbaomocasheng,
  611. Zayin: zayin,
  612. Fujiayin: fujiayin,
  613. Xinzangdesc: xinzangdesc,
  614. Fushuizheng: fushuizheng,
  615. Ganjingjingmai: ganjingjingmai,
  616. GangzhangYatong: gangzhang_yatong,
  617. GangzhangKoutong: gangzhang_koutong,
  618. PizhangKoutong: pizhang_koutong,
  619. PizhangYatong: pizhang_yatong,
  620. ShenzhangKoutong: shenzhang_koutong,
  621. ShenzhangYatong: shenzhang_yatong,
  622. FubuDesc: fubu_desc,
  623. OthDesc: oth_desc,
  624. }
  625. createErr := service.ModifyPatientPhysiqueCheck(&record)
  626. if createErr != nil {
  627. this.ErrorLog("修改患者体格检查失败:%v", createErr)
  628. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  629. return
  630. }
  631. this.ServeSuccessJSON(map[string]interface{}{
  632. "record": record,
  633. })
  634. }
  635. // /api/patient/courses [get]
  636. // @param patient_id:int
  637. // @param start_time:string (yyyy-MM-dd)
  638. // @param end_time:string (yyyy-MM-dd)
  639. func (this *PatientDataConfigAPIController) Courses() {
  640. patientID, _ := this.GetInt64("patient_id")
  641. startTimeYMDStr := this.GetString("start_time")
  642. endTimeYMDStr := this.GetString("end_time")
  643. if patientID <= 0 || len(startTimeYMDStr) == 0 || len(endTimeYMDStr) == 0 {
  644. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  645. return
  646. }
  647. endTimeYMDHmsStr := endTimeYMDStr + " 23:59:59"
  648. startTime, parseStartTimeErr := utils.ParseTimeStringToTime("2006-01-02", startTimeYMDStr)
  649. endTime, parseEndTimeErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
  650. if parseStartTimeErr != nil || parseEndTimeErr != nil {
  651. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamFormatWrong)
  652. return
  653. }
  654. adminUserInfo := this.GetAdminUserInfo()
  655. //patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
  656. //if getPatientErr != nil {
  657. // this.ErrorLog("获取患者信息失败:%v", getPatientErr)
  658. // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  659. // return
  660. //} else if patient == nil {
  661. // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  662. // return
  663. //}
  664. records, getRecordsErr := service.GetPatientCourseOfDisease(adminUserInfo.CurrentOrgId, patientID, startTime.Unix(), endTime.Unix())
  665. if getRecordsErr != nil {
  666. this.ErrorLog("获取患者病程记录失败:%v", getRecordsErr)
  667. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  668. return
  669. }
  670. admins, getAllAdminsErr := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
  671. if getAllAdminsErr != nil {
  672. this.ErrorLog("获取所有管理员失败:%v", getAllAdminsErr)
  673. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  674. return
  675. }
  676. this.ServeSuccessJSON(map[string]interface{}{
  677. "records": records,
  678. "doctors": admins,
  679. })
  680. }
  681. // /api/patient/course/create [post]
  682. // @param patient_id:int
  683. // @param content:string
  684. func (this *PatientDataConfigAPIController) CreateCourse() {
  685. patientID, _ := this.GetInt64("patient_id")
  686. fmt.Println(patientID)
  687. content := this.GetString("content")
  688. record_time_str := this.GetString("record_time")
  689. title := this.GetString("title")
  690. if patientID <= 0 || len(content) == 0 {
  691. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  692. return
  693. }
  694. if len(record_time_str) == 0 {
  695. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  696. return
  697. }
  698. checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
  699. adminUserInfo := this.GetAdminUserInfo()
  700. //patient, _ := service.GetPatientByIDOne(adminUserInfo.CurrentOrgId, patientID)
  701. //if getPatientErr != nil {
  702. // this.ErrorLog("获取患者信息失败:%v", getPatientErr)
  703. // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  704. // return
  705. //} else if patient == nil {
  706. // this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  707. // return
  708. //}
  709. now := time.Now().Unix()
  710. record := models.PatientDiseaseCourse{
  711. OrgID: adminUserInfo.CurrentOrgId,
  712. PatientID: patientID,
  713. Recorder: adminUserInfo.AdminUser.Id,
  714. RecordTime: checkDate.Unix(),
  715. Content: content,
  716. Status: 1,
  717. CreateTime: now,
  718. ModifyTime: now,
  719. Title: title,
  720. }
  721. createErr := service.CreatePatientCourseOfDisease(&record)
  722. if createErr != nil {
  723. this.ErrorLog("创建患者病程记录失败:%v", createErr)
  724. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  725. return
  726. }
  727. this.ServeSuccessJSON(map[string]interface{}{
  728. "record": record,
  729. })
  730. }
  731. // /api/patient/course/delete
  732. // @param patient_id:int
  733. // @param ids:string 一个或多个record_id以逗号相隔 ("1,3,7")
  734. func (this *PatientDataConfigAPIController) DeleteCourse() {
  735. patientID, _ := this.GetInt64("patient_id")
  736. idsStr := this.GetString("ids")
  737. if patientID <= 0 || len(idsStr) == 0 {
  738. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  739. return
  740. }
  741. adminUserInfo := this.GetAdminUserInfo()
  742. patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
  743. if getPatientErr != nil {
  744. this.ErrorLog("获取患者信息失败:%v", getPatientErr)
  745. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  746. return
  747. } else if patient == nil {
  748. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  749. return
  750. }
  751. recordIDStrs := strings.Split(idsStr, ",")
  752. recordIDs := make([]int64, 0, len(recordIDStrs))
  753. for _, idStr := range recordIDStrs {
  754. id, parseErr := strconv.Atoi(idStr)
  755. if parseErr != nil {
  756. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  757. return
  758. }
  759. recordIDs = append(recordIDs, int64(id))
  760. }
  761. deleteErr := service.DeletePatientCoursesInBatch(adminUserInfo.CurrentOrgId, patientID, recordIDs)
  762. if deleteErr != nil {
  763. this.ErrorLog("删除患者病程记录失败:%v", deleteErr)
  764. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  765. return
  766. }
  767. this.ServeSuccessJSON(nil)
  768. }
  769. // /api/patient/rescues [get]
  770. // @param patient_id:int
  771. // @param start_time:string (yyyy-MM-dd)
  772. // @param end_time:string (yyyy-MM-dd)
  773. func (this *PatientDataConfigAPIController) Rescues() {
  774. patientID, _ := this.GetInt64("patient_id")
  775. startTimeYMDStr := this.GetString("start_time")
  776. endTimeYMDStr := this.GetString("end_time")
  777. if patientID <= 0 || len(startTimeYMDStr) == 0 || len(endTimeYMDStr) == 0 {
  778. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  779. return
  780. }
  781. endTimeYMDHmsStr := endTimeYMDStr + " 23:59:59"
  782. startTime, parseStartTimeErr := utils.ParseTimeStringToTime("2006-01-02", startTimeYMDStr)
  783. endTime, parseEndTimeErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
  784. if parseStartTimeErr != nil || parseEndTimeErr != nil {
  785. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamFormatWrong)
  786. return
  787. }
  788. adminUserInfo := this.GetAdminUserInfo()
  789. patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
  790. if getPatientErr != nil {
  791. this.ErrorLog("获取患者信息失败:%v", getPatientErr)
  792. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  793. return
  794. } else if patient == nil {
  795. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  796. return
  797. }
  798. records, getRecordsErr := service.GetPatientRescueRecords(adminUserInfo.CurrentOrgId, patientID, startTime.Unix(), endTime.Unix())
  799. if getRecordsErr != nil {
  800. this.ErrorLog("获取患者抢救记录失败:%v", getRecordsErr)
  801. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  802. return
  803. }
  804. admins, getAllAdminsErr := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
  805. if getAllAdminsErr != nil {
  806. this.ErrorLog("获取所有管理员失败:%v", getAllAdminsErr)
  807. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  808. return
  809. }
  810. this.ServeSuccessJSON(map[string]interface{}{
  811. "records": records,
  812. "doctors": admins,
  813. })
  814. }
  815. // /api/patient/rescue/create [post]
  816. // @param patient_id:int
  817. // @param content:string
  818. func (this *PatientDataConfigAPIController) CreateRescue() {
  819. patientID, _ := this.GetInt64("patient_id")
  820. content := this.GetString("content")
  821. if patientID <= 0 || len(content) == 0 {
  822. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  823. return
  824. }
  825. adminUserInfo := this.GetAdminUserInfo()
  826. patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
  827. if getPatientErr != nil {
  828. this.ErrorLog("获取患者信息失败:%v", getPatientErr)
  829. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  830. return
  831. } else if patient == nil {
  832. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  833. return
  834. }
  835. now := time.Now().Unix()
  836. record := models.PatientRescueRecord{
  837. OrgID: adminUserInfo.CurrentOrgId,
  838. PatientID: patientID,
  839. Recorder: adminUserInfo.AdminUser.Id,
  840. RecordTime: now,
  841. Content: content,
  842. Status: 1,
  843. CreateTime: now,
  844. ModifyTime: now,
  845. }
  846. createErr := service.CreatePatientRescueRecord(&record)
  847. if createErr != nil {
  848. this.ErrorLog("创建患者抢救记录失败:%v", createErr)
  849. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  850. return
  851. }
  852. this.ServeSuccessJSON(map[string]interface{}{
  853. "record": record,
  854. })
  855. }
  856. // /api/patient/rescue/delete
  857. // @param patient_id:int
  858. // @param ids:string 一个或多个record_id以逗号相隔 ("1,3,7")
  859. func (this *PatientDataConfigAPIController) DeleteRescue() {
  860. patientID, _ := this.GetInt64("patient_id")
  861. idsStr := this.GetString("ids")
  862. if patientID <= 0 || len(idsStr) == 0 {
  863. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  864. return
  865. }
  866. adminUserInfo := this.GetAdminUserInfo()
  867. patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
  868. if getPatientErr != nil {
  869. this.ErrorLog("获取患者信息失败:%v", getPatientErr)
  870. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  871. return
  872. } else if patient == nil {
  873. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  874. return
  875. }
  876. recordIDStrs := strings.Split(idsStr, ",")
  877. recordIDs := make([]int64, 0, len(recordIDStrs))
  878. for _, idStr := range recordIDStrs {
  879. id, parseErr := strconv.Atoi(idStr)
  880. if parseErr != nil {
  881. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  882. return
  883. }
  884. recordIDs = append(recordIDs, int64(id))
  885. }
  886. deleteErr := service.DeletePatientResuceRecordsInBatch(adminUserInfo.CurrentOrgId, patientID, recordIDs)
  887. if deleteErr != nil {
  888. this.ErrorLog("删除患者抢救记录失败:%v", deleteErr)
  889. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  890. return
  891. }
  892. this.ServeSuccessJSON(nil)
  893. }
  894. func (this *PatientDataConfigAPIController) ModifyCourse() {
  895. patientID, _ := this.GetInt64("patient_id")
  896. content := this.GetString("content")
  897. id, _ := this.GetInt64("id", 0)
  898. record_time_str := this.GetString("record_time")
  899. title := this.GetString("title")
  900. if patientID <= 0 || len(content) == 0 || id == 0 || len(record_time_str) == 0 {
  901. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  902. return
  903. }
  904. //timeLayout := "2006-01-02"
  905. //loc, _ := time.LoadLocation("Local")
  906. checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
  907. adminUserInfo := this.GetAdminUserInfo()
  908. patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
  909. if getPatientErr != nil {
  910. this.ErrorLog("获取患者信息失败:%v", getPatientErr)
  911. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  912. return
  913. } else if patient == nil {
  914. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
  915. return
  916. }
  917. now := time.Now().Unix()
  918. record := models.PatientDiseaseCourse{
  919. ID: id,
  920. OrgID: adminUserInfo.CurrentOrgId,
  921. PatientID: patientID,
  922. Recorder: adminUserInfo.AdminUser.Id,
  923. Content: content,
  924. Status: 1,
  925. CreateTime: now,
  926. ModifyTime: now,
  927. Title: title,
  928. RecordTime: checkDate.Unix(),
  929. }
  930. createErr := service.ModifyPatientCourses(&record)
  931. if createErr != nil {
  932. this.ErrorLog("创建患者抢救记录失败:%v", createErr)
  933. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  934. return
  935. }
  936. this.ServeSuccessJSON(map[string]interface{}{
  937. "record": record,
  938. })
  939. }
  940. func (this *PatientDataConfigAPIController) GetPatientDialysisInforList() {
  941. patientID, _ := this.GetInt64("patient_id")
  942. record_date := this.GetString("record_date")
  943. timeLayout := "2006-01-02"
  944. loc, _ := time.LoadLocation("Local")
  945. var startTime int64
  946. if len(record_date) > 0 {
  947. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
  948. if err != nil {
  949. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  950. return
  951. }
  952. startTime = theTime.Unix()
  953. }
  954. //获取患者姓名
  955. patient, _ := service.GetPatientName(patientID)
  956. orgId := this.GetAdminUserInfo().CurrentOrgId
  957. //获取透析处方
  958. prescription, _ := service.GetDialysisPrescription(patientID, orgId, startTime)
  959. //获取透前评估
  960. assessmentBefor, _ := service.GetAssessmentBefor(orgId, patientID, startTime)
  961. //透析上机
  962. order, _ := service.GetDialysisOrder(orgId, patientID, startTime)
  963. //透析监测
  964. monitor, _ := service.GetFistMonitorSix(orgId, patientID, startTime)
  965. //透析医嘱
  966. advice, _ := service.GetBloodDoctorAdvice(startTime, orgId, patientID)
  967. //透后评估
  968. afterDislysis, _ := service.GetAssessmentAfterDissData(patientID, orgId, startTime)
  969. this.ServeSuccessJSON(map[string]interface{}{
  970. "patient": patient,
  971. "prescription": prescription,
  972. "assessmentBefor": assessmentBefor,
  973. "order": order,
  974. "monitor": monitor,
  975. "advice": advice,
  976. "afterDislysis": afterDislysis,
  977. })
  978. }
  979. func (this *PatientDataConfigAPIController) GetContextScheduleList() {
  980. limit, _ := this.GetInt64("limit")
  981. page, _ := this.GetInt64("page")
  982. start_time := this.GetString("start_time")
  983. end_time := this.GetString("end_time")
  984. timeLayout := "2006-01-02"
  985. loc, _ := time.LoadLocation("Local")
  986. var startTime int64
  987. if len(start_time) > 0 {
  988. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  989. if err != nil {
  990. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  991. return
  992. }
  993. startTime = theTime.Unix()
  994. }
  995. var endTime int64
  996. if len(end_time) > 0 {
  997. theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 00:00:00", loc)
  998. if err != nil {
  999. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  1000. return
  1001. }
  1002. startTime = theTime.Unix()
  1003. }
  1004. org_id := this.GetAdminUserInfo().CurrentOrgId
  1005. schedule, total, _ := service.GetContextScheduleListGroupPatientId(limit, page, startTime, endTime, org_id)
  1006. list, _, _ := service.GetContextScheduleListPatientId(startTime, endTime, org_id)
  1007. patients, _ := service.GetAllpatientThirty(org_id)
  1008. devicenumber, _ := service.GetAllBedNumber(org_id)
  1009. this.ServeSuccessJSON(map[string]interface{}{
  1010. "schedule": schedule,
  1011. "total": total,
  1012. "list": list,
  1013. "patients": patients,
  1014. "devicenumber": devicenumber,
  1015. })
  1016. }
  1017. func (this *PatientDataConfigAPIController) GetPatientAllagicList() {
  1018. id, _ := this.GetInt64("id")
  1019. orgId := this.GetAdminUserInfo().CurrentOrgId
  1020. list, _ := service.GetPatientAllagicList(id, orgId)
  1021. this.ServeSuccessJSON(map[string]interface{}{
  1022. "list": list,
  1023. })
  1024. }
  1025. func (this *PatientDataConfigAPIController) SaveSiteMap() {
  1026. dataBody := make(map[string]interface{}, 0)
  1027. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  1028. if err != nil {
  1029. utils.ErrorLog(err.Error())
  1030. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
  1031. return
  1032. }
  1033. patient_id := int64(dataBody["patient_id"].(float64))
  1034. user_org_id := this.GetAdminUserInfo().CurrentOrgId
  1035. id := int64(dataBody["id"].(float64))
  1036. if dataBody["a_left"] != nil && reflect.TypeOf(dataBody["a_left"]).String() == "[]interface {}" {
  1037. prescriptions, _ := dataBody["a_left"].([]interface{})
  1038. service.UpdateValsualAleft(patient_id, user_org_id)
  1039. for _, item := range prescriptions {
  1040. var a_num float64
  1041. var mark_num float64
  1042. if item.(map[string]interface{})["a_num"] != nil || reflect.TypeOf(item.(map[string]interface{})["a_num"]).String() == "float64" {
  1043. a_num = item.(map[string]interface{})["a_num"].(float64)
  1044. }
  1045. if item.(map[string]interface{})["markNum"] != nil || reflect.TypeOf(item.(map[string]interface{})["markNum"]).String() == "float64" {
  1046. mark_num = item.(map[string]interface{})["markNum"].(float64)
  1047. }
  1048. fmt.Println(a_num, mark_num)
  1049. valsualALeft := models.XtDeviceValsualALeft{
  1050. ANum: a_num,
  1051. MarkNum: mark_num,
  1052. UserOrgId: user_org_id,
  1053. PatientId: patient_id,
  1054. Ctime: time.Now().Unix(),
  1055. Mtime: time.Now().Unix(),
  1056. MapId: 0,
  1057. Status: 1,
  1058. }
  1059. service.CreateValsualAleft(valsualALeft)
  1060. }
  1061. }
  1062. is_append := int64(dataBody["is_append"].(float64))
  1063. is_img_v := int64(dataBody["is_img_v"].(float64))
  1064. is_img_a := int64(dataBody["is_img_a"].(float64))
  1065. a_top := dataBody["a_top"].(float64)
  1066. av_bkx := dataBody["av_bkx"].(float64)
  1067. av_bky := dataBody["av_bky"].(float64)
  1068. if dataBody["fangxiang_a"] != nil && reflect.TypeOf(dataBody["fangxiang_a"]).String() == "[]interface {}" {
  1069. prescriptions, _ := dataBody["fangxiang_a"].([]interface{})
  1070. service.ValsualMapFangxiangA(patient_id, user_org_id)
  1071. for _, item := range prescriptions {
  1072. var a_num float64
  1073. var mark_num float64
  1074. var mark_top float64
  1075. if item.(map[string]interface{})["left"] != nil || reflect.TypeOf(item.(map[string]interface{})["left"]).String() == "float64" {
  1076. a_num = item.(map[string]interface{})["left"].(float64)
  1077. }
  1078. if item.(map[string]interface{})["markNum"] != nil || reflect.TypeOf(item.(map[string]interface{})["markNum"]).String() == "float64" {
  1079. mark_num = item.(map[string]interface{})["markNum"].(float64)
  1080. }
  1081. if item.(map[string]interface{})["top"] != nil || reflect.TypeOf(item.(map[string]interface{})["top"]).String() == "float64" {
  1082. mark_top = item.(map[string]interface{})["top"].(float64)
  1083. }
  1084. ValsualMapFangxiangA := models.XtDeviceValsualMapFangxiangA{
  1085. PatientId: patient_id,
  1086. UserOrgId: user_org_id,
  1087. Status: 1,
  1088. Left: a_num,
  1089. MarkNum: mark_num,
  1090. Top: mark_top,
  1091. MapId: 0,
  1092. Ctime: time.Now().Unix(),
  1093. Mtime: time.Now().Unix(),
  1094. }
  1095. service.CreateValsualMapFangxiangA(ValsualMapFangxiangA)
  1096. }
  1097. }
  1098. fangxiang_a_num := dataBody["fangxiang_a_num"].(float64)
  1099. fangxiang_a_top := dataBody["fangxiang_a_top"].(float64)
  1100. fangxiang_v_left := dataBody["fangxiang_v_left"].(float64)
  1101. fangxiang_v_num := dataBody["fangxiang_v_num"].(float64)
  1102. fangxiang_v_top := dataBody["fangxiang_v_top"].(float64)
  1103. if dataBody["fangxiang_v"] != nil && reflect.TypeOf(dataBody["fangxiang_v"]).String() == "[]interface {}" {
  1104. prescriptions, _ := dataBody["fangxiang_v"].([]interface{})
  1105. service.UpdateValsualMapFangxiangV(patient_id, user_org_id)
  1106. for _, item := range prescriptions {
  1107. var a_num float64
  1108. var mark_num float64
  1109. var mark_top float64
  1110. if item.(map[string]interface{})["left"] != nil || reflect.TypeOf(item.(map[string]interface{})["left"]).String() == "float64" {
  1111. a_num = item.(map[string]interface{})["left"].(float64)
  1112. }
  1113. if item.(map[string]interface{})["markNum"] != nil || reflect.TypeOf(item.(map[string]interface{})["markNum"]).String() == "float64" {
  1114. mark_num = item.(map[string]interface{})["markNum"].(float64)
  1115. }
  1116. if item.(map[string]interface{})["top"] != nil || reflect.TypeOf(item.(map[string]interface{})["top"]).String() == "float64" {
  1117. mark_top = item.(map[string]interface{})["top"].(float64)
  1118. }
  1119. ValsualMapFangxiangV := models.XtDeviceValsualMapFangxiangV{
  1120. PatientId: patient_id,
  1121. UserOrgId: user_org_id,
  1122. Status: 1,
  1123. Left: a_num,
  1124. MarkNum: mark_num,
  1125. Top: mark_top,
  1126. MapId: 0,
  1127. Ctime: time.Now().Unix(),
  1128. Mtime: time.Now().Unix(),
  1129. }
  1130. service.CreateValsualMapFangxiangV(ValsualMapFangxiangV)
  1131. }
  1132. }
  1133. fangxiang_a_left := dataBody["fangxiang_a_left"].(float64)
  1134. if dataBody["fuzhu_a"] != nil && reflect.TypeOf(dataBody["fuzhu_a"]).String() == "[]interface {}" {
  1135. prescriptions, _ := dataBody["fuzhu_a"].([]interface{})
  1136. service.UpdateValSualFuzhA(patient_id, user_org_id)
  1137. for _, item := range prescriptions {
  1138. var a_left float64
  1139. var a_markNum float64
  1140. var a_top float64
  1141. if item.(map[string]interface{})["a_left"] != nil || reflect.TypeOf(item.(map[string]interface{})["a_left"]).String() == "float64" {
  1142. a_left = item.(map[string]interface{})["a_left"].(float64)
  1143. }
  1144. if item.(map[string]interface{})["a_markNum"] != nil || reflect.TypeOf(item.(map[string]interface{})["a_markNum"]).String() == "float64" {
  1145. a_markNum = item.(map[string]interface{})["a_markNum"].(float64)
  1146. }
  1147. if item.(map[string]interface{})["a_top"] != nil || reflect.TypeOf(item.(map[string]interface{})["a_top"]).String() == "float64" {
  1148. a_top = item.(map[string]interface{})["a_top"].(float64)
  1149. }
  1150. valsualFuzhuA := models.XtDeviceValsualFuzhuA{
  1151. PatientId: patient_id,
  1152. UserOrgId: user_org_id,
  1153. Status: 1,
  1154. Ctime: time.Now().Unix(),
  1155. Mtime: time.Now().Unix(),
  1156. ALeft: a_left,
  1157. AMarkNum: a_markNum,
  1158. ATop: a_top,
  1159. MapId: 0,
  1160. }
  1161. service.CreateValSualFuzhA(valsualFuzhuA)
  1162. }
  1163. }
  1164. fuzhu_a_left := dataBody["fuzhu_a_left"].(float64)
  1165. fuzhu_a_num := dataBody["fuzhu_a_num"].(float64)
  1166. fuzhu_a_top := dataBody["fuzhu_a_top"].(float64)
  1167. left_a := dataBody["left_a"].(float64)
  1168. left_v := dataBody["left_v"].(float64)
  1169. if dataBody["fuzhu_v"] != nil && reflect.TypeOf(dataBody["fuzhu_v"]).String() == "[]interface {}" {
  1170. prescriptions, _ := dataBody["fuzhu_v"].([]interface{})
  1171. service.UpdateVasuaLfuzhuV(patient_id, user_org_id)
  1172. for _, item := range prescriptions {
  1173. var v_left float64
  1174. var v_markNum float64
  1175. var v_top float64
  1176. if item.(map[string]interface{})["v_left"] != nil || reflect.TypeOf(item.(map[string]interface{})["v_left"]).String() == "float64" {
  1177. v_left = item.(map[string]interface{})["v_left"].(float64)
  1178. }
  1179. if item.(map[string]interface{})["v_markNum"] != nil || reflect.TypeOf(item.(map[string]interface{})["v_markNum"]).String() == "float64" {
  1180. v_markNum = item.(map[string]interface{})["v_markNum"].(float64)
  1181. }
  1182. if item.(map[string]interface{})["v_top"] != nil || reflect.TypeOf(item.(map[string]interface{})["v_top"]).String() == "float64" {
  1183. v_top = item.(map[string]interface{})["v_top"].(float64)
  1184. }
  1185. fuzhuV := models.XtDeviceValsualFuzhuV{
  1186. PatientId: patient_id,
  1187. UserOrgId: user_org_id,
  1188. Status: 1,
  1189. Ctime: time.Now().Unix(),
  1190. Mtime: 1,
  1191. VMarkNum: v_markNum,
  1192. VLeft: v_left,
  1193. VTop: v_top,
  1194. MapId: 0,
  1195. }
  1196. service.CreateVasuaLfuzhuV(fuzhuV)
  1197. }
  1198. }
  1199. fuzhu_v_left := dataBody["fuzhu_v_left"].(float64)
  1200. fuzhu_v_num := dataBody["fuzhu_v_num"].(float64)
  1201. fuzhu_v_top := dataBody["fuzhu_v_top"].(float64)
  1202. scalea_num := dataBody["scalea_num"].(float64)
  1203. scalev_num := dataBody["scalev_num"].(float64)
  1204. if dataBody["text_arr"] != nil && reflect.TypeOf(dataBody["text_arr"]).String() == "[]interface {}" {
  1205. prescriptions, _ := dataBody["text_arr"].([]interface{})
  1206. service.UpdateTextArr(patient_id, user_org_id)
  1207. for _, item := range prescriptions {
  1208. var left float64
  1209. var text_markNum string
  1210. var v_top float64
  1211. var width float64
  1212. if item.(map[string]interface{})["left"] != nil || reflect.TypeOf(item.(map[string]interface{})["left"]).String() == "float64" {
  1213. left = item.(map[string]interface{})["left"].(float64)
  1214. }
  1215. if item.(map[string]interface{})["text"] != nil || reflect.TypeOf(item.(map[string]interface{})["text"]).String() == "string" {
  1216. text_markNum = item.(map[string]interface{})["text"].(string)
  1217. }
  1218. if item.(map[string]interface{})["top"] != nil || reflect.TypeOf(item.(map[string]interface{})["top"]).String() == "float64" {
  1219. v_top = item.(map[string]interface{})["top"].(float64)
  1220. }
  1221. if item.(map[string]interface{})["width"] != nil || reflect.TypeOf(item.(map[string]interface{})["width"]).String() == "float64" {
  1222. width = item.(map[string]interface{})["width"].(float64)
  1223. }
  1224. textArr := models.XtDeviceValsualTextArr{
  1225. PatientId: patient_id,
  1226. UserOrgId: user_org_id,
  1227. Ctime: time.Now().Unix(),
  1228. Mtime: 0,
  1229. Status: 1,
  1230. Left: left,
  1231. Text: text_markNum,
  1232. Top: v_top,
  1233. Width: width,
  1234. MapId: 0,
  1235. }
  1236. service.CreateTextArr(textArr)
  1237. }
  1238. text_left := dataBody["text_left"].(float64)
  1239. text_num := dataBody["text_num"].(float64)
  1240. text_top := dataBody["text_top"].(float64)
  1241. if dataBody["v_left"] != nil && reflect.TypeOf(dataBody["v_left"]).String() == "[]interface {}" {
  1242. prescriptions, _ := dataBody["v_left"].([]interface{})
  1243. service.UpdateValsualVleft(patient_id, user_org_id)
  1244. for _, item := range prescriptions {
  1245. var v_num float64
  1246. var markNum float64
  1247. if item.(map[string]interface{})["v_num"] != nil || reflect.TypeOf(item.(map[string]interface{})["v_num"]).String() == "float64" {
  1248. v_num = item.(map[string]interface{})["v_num"].(float64)
  1249. }
  1250. if item.(map[string]interface{})["mark_num"] != nil || reflect.TypeOf(item.(map[string]interface{})["mark_num"]).String() == "float64" {
  1251. markNum = item.(map[string]interface{})["mark_num"].(float64)
  1252. }
  1253. valsualVLeft := models.XtDeviceValsualVLeft{
  1254. PatientId: patient_id,
  1255. UserOrgId: user_org_id,
  1256. Status: 1,
  1257. Ctime: time.Now().Unix(),
  1258. Mtime: time.Now().Unix(),
  1259. MarkNum: markNum,
  1260. VNum: v_num,
  1261. MapId: 0,
  1262. }
  1263. service.CreateValsualVleft(valsualVLeft)
  1264. }
  1265. }
  1266. if dataBody["aarr"] != nil && reflect.TypeOf(dataBody["aarr"]).String() == "[]interface {}" {
  1267. prescriptions, _ := dataBody["aarr"].([]interface{})
  1268. service.UpdateValusalMapArr(patient_id, user_org_id)
  1269. for _, item := range prescriptions {
  1270. var mark_num float64
  1271. var is_status float64
  1272. var left float64
  1273. var top float64
  1274. if item.(map[string]interface{})["mark_num"] != nil || reflect.TypeOf(item.(map[string]interface{})["mark_num"]).String() == "float64" {
  1275. mark_num = item.(map[string]interface{})["mark_num"].(float64)
  1276. }
  1277. if item.(map[string]interface{})["is_status"] != nil || reflect.TypeOf(item.(map[string]interface{})["is_status"]).String() == "float64" {
  1278. is_status = item.(map[string]interface{})["is_status"].(float64)
  1279. }
  1280. if item.(map[string]interface{})["left"] != nil || reflect.TypeOf(item.(map[string]interface{})["left"]).String() == "float64" {
  1281. left = item.(map[string]interface{})["left"].(float64)
  1282. }
  1283. if item.(map[string]interface{})["top"] != nil || reflect.TypeOf(item.(map[string]interface{})["top"]).String() == "float64" {
  1284. top = item.(map[string]interface{})["top"].(float64)
  1285. }
  1286. mapArr := models.XtDeviceValusalMapArr{
  1287. PatientId: patient_id,
  1288. UserOrgId: user_org_id,
  1289. Status: 1,
  1290. MarkNum: mark_num,
  1291. Left: left,
  1292. Top: top,
  1293. IsStatus: is_status,
  1294. Ctime: time.Now().Unix(),
  1295. Mtime: 0,
  1296. }
  1297. service.CreateDeviceValusalMapArr(mapArr)
  1298. }
  1299. }
  1300. if dataBody["varr"] != nil && reflect.TypeOf(dataBody["varr"]).String() == "[]interface {}" {
  1301. prescriptions, _ := dataBody["varr"].([]interface{})
  1302. service.UpdateDeviceValusalMapVrr(patient_id, user_org_id)
  1303. for _, item := range prescriptions {
  1304. var mark_num float64
  1305. var is_status float64
  1306. var left float64
  1307. var top float64
  1308. if item.(map[string]interface{})["mark_num"] != nil || reflect.TypeOf(item.(map[string]interface{})["mark_num"]).String() == "float64" {
  1309. mark_num = item.(map[string]interface{})["mark_num"].(float64)
  1310. }
  1311. if item.(map[string]interface{})["is_status"] != nil || reflect.TypeOf(item.(map[string]interface{})["is_status"]).String() == "float64" {
  1312. is_status = item.(map[string]interface{})["is_status"].(float64)
  1313. }
  1314. if item.(map[string]interface{})["left"] != nil || reflect.TypeOf(item.(map[string]interface{})["left"]).String() == "float64" {
  1315. left = item.(map[string]interface{})["left"].(float64)
  1316. }
  1317. if item.(map[string]interface{})["top"] != nil || reflect.TypeOf(item.(map[string]interface{})["top"]).String() == "float64" {
  1318. top = item.(map[string]interface{})["top"].(float64)
  1319. }
  1320. mapVrr := models.XtDeviceValusalMapVrr{
  1321. PatientId: patient_id,
  1322. UserOrgId: user_org_id,
  1323. Status: 1,
  1324. MarkNum: mark_num,
  1325. Left: left,
  1326. Top: top,
  1327. IsStatus: is_status,
  1328. Ctime: time.Now().Unix(),
  1329. Mtime: 0,
  1330. }
  1331. service.CreateDeviceValusalMapVrr(mapVrr)
  1332. }
  1333. }
  1334. v_num := dataBody["v_num"].(float64)
  1335. v_top := dataBody["v_top"].(float64)
  1336. xuanzhuan_a := dataBody["xuanzhuan_a"].(float64)
  1337. xuanzhuan_v := dataBody["xuanzhuan_v"].(float64)
  1338. img_url := dataBody["img_url"].(string)
  1339. deviceValsualMap := models.XtDeviceValsualMap{
  1340. ID: id,
  1341. PatientId: patient_id,
  1342. IsAppend: is_append,
  1343. IsImgV: is_img_v,
  1344. IsImgA: is_img_a,
  1345. VNum: v_num,
  1346. Status: 1,
  1347. UserOrgId: user_org_id,
  1348. ATop: a_top,
  1349. AvBkx: av_bkx,
  1350. AvBky: av_bky,
  1351. FangxiangALeft: fangxiang_a_left,
  1352. FangxiangANum: fangxiang_a_num,
  1353. FangxiangATop: fangxiang_a_top,
  1354. FangxiangVLeft: fangxiang_v_left,
  1355. FangxiangVNum: fangxiang_v_num,
  1356. FangxiangVTop: fangxiang_v_top,
  1357. FuzhuALeft: fuzhu_a_left,
  1358. FuzhuANum: fuzhu_a_num,
  1359. FuzhuATop: fuzhu_a_top,
  1360. FuzhuVLeft: fuzhu_v_left,
  1361. FuzhuVNum: fuzhu_v_num,
  1362. FuzhuVTop: fuzhu_v_top,
  1363. ScaleaNum: scalea_num,
  1364. ScalevNum: scalev_num,
  1365. TextLeft: text_left,
  1366. TextNum: text_num,
  1367. TextTop: text_top,
  1368. VTop: v_top,
  1369. XuanzhuanA: xuanzhuan_a,
  1370. XuanzhuanV: xuanzhuan_v,
  1371. ALeft: left_a,
  1372. VLeft: left_v,
  1373. ImgUrl: img_url,
  1374. }
  1375. err = service.CreateDeviceValsualMap(deviceValsualMap)
  1376. this.ServeSuccessJSON(map[string]interface{}{
  1377. "deviceValsualMap": deviceValsualMap,
  1378. })
  1379. }
  1380. }
  1381. func (this *PatientDataConfigAPIController) GetPatientSitemap() {
  1382. patient_id, _ := this.GetInt64("patient_id")
  1383. orgId := this.GetAdminUserInfo().CurrentOrgId
  1384. sitemap, _ := service.GetPatientSitemap(patient_id, orgId)
  1385. patients, _ := service.GetPatientByIDOne(orgId, patient_id)
  1386. this.ServeSuccessJSON(map[string]interface{}{
  1387. "sitemap": sitemap,
  1388. "patients": patients,
  1389. })
  1390. }