manage_controller.go 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. package manage
  2. import (
  3. "Kya_New/controllers"
  4. "Kya_New/enums"
  5. "Kya_New/models"
  6. "Kya_New/service/login_service"
  7. "Kya_New/service/manage_service"
  8. "Kya_New/service/patient_service"
  9. "Kya_New/utils"
  10. "encoding/json"
  11. "fmt"
  12. "github.com/astaxie/beego"
  13. "github.com/jinzhu/gorm"
  14. "strconv"
  15. "strings"
  16. "time"
  17. )
  18. func ManageRouter() {
  19. beego.Router("/api/patient/getcoursemanagement", &Manage{}, "Post:GetCourseManagement")
  20. beego.Router("/api/patient/savepatient", &Manage{}, "Post:SavePatient")
  21. beego.Router("/api/patient/todeletecousemanage", &Manage{}, "Get:DeleteCouseManage")
  22. beego.Router("/api/patient/getmissioninformation", &Manage{}, "Get:GetMissionInformation")
  23. beego.Router("/api/patient/getrecordsave", &Manage{}, "Get:GetRecordSave")
  24. beego.Router("/api/patient/getcheckpatientdata", &Manage{}, "Get:GetCheckPatientData")
  25. beego.Router("/api/patient/getlongdialysis", &Manage{}, "Get:GetLongDialysis")
  26. beego.Router("/api/patient/getdialysrecord", &Manage{}, "Get:GetDialysRecord")
  27. beego.Router("/api/site/toseacherCourseManagement", &Manage{}, "Get:ToSeacherCourseManagement")
  28. beego.Router("/api/site/todeletesaverecord", &Manage{}, "Get:ToDeleteSaveRecord")
  29. beego.Router("/api/site/toSeacherRecord", &Manage{}, "Get:ToSeacherRecord")
  30. beego.Router("/api/site/deletemissioninformation", &Manage{}, "Get:DeleteMissionInformation")
  31. beego.Router("/api/patient/toseachermissioninformation", &Manage{}, "Get:ToSeacherMissionInformation")
  32. beego.Router("/api/patient/getpatientschedules", &Manage{}, "Get:GetPatientSchedules")
  33. beego.Router("/api/patient/deletescheduleinformation", &Manage{}, "Get:DeleteScheduleinformation")
  34. beego.Router("/api/patient/toseacherscheduleinformation", &Manage{}, "Get:ToSeacherScheduleInformation")
  35. beego.Router("/api/patient/getpatienttype", &Manage{}, "Get:GetPatientType")
  36. beego.Router("/api/patient/checkall", &Manage{}, "Get:GetCheckall")
  37. }
  38. type Manage struct {
  39. controllers.BaseAPIController
  40. }
  41. func (this *Manage) ServeFailJsonSend(code int, msg string) {
  42. fmt.Println("code", code)
  43. this.Data["json"] = enums.MakeFailResponseJSON(msg, code)
  44. this.ServeJSON()
  45. }
  46. func (this *Manage) ServeSuccessJSON(data map[string]interface{}) {
  47. this.Data["json"] = enums.MakeSuccessResponseJSON(data)
  48. this.ServeJSON()
  49. }
  50. func (this *Manage) GetCourseManagement() {
  51. patienid, _ := this.GetInt64("patientid")
  52. fmt.Println("patientid", patienid)
  53. orgid, _ := this.GetInt64("orgid")
  54. fmt.Println("orgid", orgid)
  55. startime := this.GetString("startime")
  56. fmt.Println("startime", startime)
  57. endtime := this.GetString("endtime")
  58. endTimeYMDHmsStr := endtime + " 23:59:59"
  59. endTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
  60. fmt.Println("endtime", endtime)
  61. timeLayout := "2006-01-02 15:04:05"
  62. theTime, _ := utils.ParseTimeStringToTime(timeLayout, startime+" 00:00:00")
  63. star := theTime.Unix()
  64. patients, _ := login_service.GetPatintsInfo(patienid, orgid)
  65. patientCourse, err := patient_service.GetCourseManagementData(patienid, orgid, star, endTime.Unix())
  66. fmt.Print("报错----------------------", err)
  67. infectious, err := patient_service.GetPatientInfectious(patienid)
  68. fmt.Println("错误是设么", err)
  69. fmt.Println("patietnCourse", patientCourse)
  70. if err != nil {
  71. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
  72. return
  73. }
  74. this.ServeSuccessJSON(map[string]interface{}{
  75. "patientCourse": patientCourse,
  76. "patients": patients,
  77. "infectious": infectious,
  78. })
  79. }
  80. func (this *Manage) SavePatient() {
  81. dataBody := make(map[string]interface{}, 0)
  82. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  83. if err != nil {
  84. utils.ErrorLog(err.Error())
  85. this.ServeFailJsonSend(enums.ErrorCodeParamWrong, "参数错误")
  86. return
  87. }
  88. mobile := this.GetString("telephone")
  89. fmt.Println("phone", mobile)
  90. admin, _ := patient_service.GetCreatorId(mobile)
  91. org, _ := patient_service.GetOrgId(admin.ID)
  92. var orgID = org.ID
  93. fmt.Println("orgID是什么", orgID)
  94. //基本信息
  95. name := dataBody["name"].(string)
  96. fmt.Println("病人姓名", name)
  97. sex := int64(dataBody["sex"].(float64))
  98. fmt.Println("性别", sex)
  99. idcard := dataBody["idCard"].(string)
  100. fmt.Println("idcard", idcard)
  101. //manage_service.GetIdCardInfo(idcard)
  102. birthday := dataBody["birthday"].(string)
  103. births := strings.Split(birthday, "-")
  104. birYear, _ := strconv.Atoi(births[0])
  105. age := time.Now().Year() - birYear
  106. ages := int64(age)
  107. fmt.Println("age是多少", ages)
  108. fmt.Println("birthday", birthday)
  109. timeLayout := "2006-01-02 15:04:05"
  110. theTime, err := utils.ParseTimeStringToTime(timeLayout, birthday+" 00:00:00")
  111. birth := theTime.Unix()
  112. fmt.Println("出生日期", birth)
  113. phone := dataBody["phone"].(string)
  114. fmt.Println("手机号", phone)
  115. patientType := dataBody["patient_type"].([]interface{})
  116. fmt.Println("病人类型", patientType)
  117. //血透信息
  118. dialysis := dataBody["dialysis"].(string)
  119. fmt.Println("透析号", dialysis)
  120. admissionNumber := dataBody["admissionNumber"].(string)
  121. fmt.Println("住院门诊号", admissionNumber)
  122. patientsoure := int64(dataBody["patientsoure"].(float64))
  123. fmt.Println("患者来源", patientsoure)
  124. lapseto := int64(dataBody["lapseto"].(float64))
  125. fmt.Println("留置状态", lapseto)
  126. contagions := dataBody["contagions"].([]interface{})
  127. ids := make([]int64, 0)
  128. for _, contagion := range contagions {
  129. id := int64(contagion.(float64))
  130. ids = append(ids, id)
  131. }
  132. fmt.Println("传染病", contagions)
  133. fistdata := dataBody["fistDate"].(string)
  134. fmt.Println("首次透析日期", fistdata)
  135. times, err := utils.ParseTimeStringToTime(timeLayout, fistdata+"00:00:00")
  136. fisttime := times.Unix()
  137. fmt.Println("第一透析日期", fisttime)
  138. diagnose := dataBody["diagnose"].(string)
  139. fmt.Println("诊断", diagnose)
  140. patientHead := dataBody["patientHead"].(string)
  141. fmt.Println("患者头像", patientHead)
  142. //慢病信息
  143. requipmentid := dataBody["requipmentId"].(string)
  144. fmt.Println("设备id", requipmentid)
  145. slowcontagions := dataBody["slowcontagions"].([]interface{})
  146. fmt.Println("传染病", slowcontagions)
  147. slowPatients := dataBody["slowPatients"].([]interface{})
  148. fmt.Println("slowPatients", slowPatients)
  149. //会员信息
  150. memberIllnessTime := dataBody["memberIllnessTime"].(string)
  151. fmt.Println("会员患病时间", memberIllnessTime)
  152. memberTime, err := utils.ParseTimeStringToTime(timeLayout, memberIllnessTime+" 00:00:00")
  153. memberdata := memberTime.Unix()
  154. fmt.Println("会员患病时间", memberdata)
  155. memberlapseto := int64(dataBody["memberlapseto"].(float64))
  156. fmt.Println("留治转台", memberlapseto)
  157. treatementmethod := int64(dataBody["TreatmentMethod"].(float64))
  158. fmt.Println("治疗方式", treatementmethod)
  159. patients, errcode := manage_service.GetPatientInfoByIdCard(idcard, orgID)
  160. fmt.Println("errcode", errcode)
  161. fmt.Println("patients", patients)
  162. if errcode == gorm.ErrRecordNotFound {
  163. byPhone, err := manage_service.GetPatientInfoByPhone(phone, orgID)
  164. fmt.Println("byphone", byPhone)
  165. if err == gorm.ErrRecordNotFound {
  166. bloodPatients := models.Patients{
  167. Name: name,
  168. Gender: sex,
  169. IdCardNo: idcard,
  170. Birthday: birth,
  171. Phone: phone,
  172. DialysisNo: dialysis,
  173. Source: patientsoure,
  174. PatientType: 1,
  175. Lapseto: lapseto,
  176. FirstDialysisDate: fisttime,
  177. Diagnose: diagnose,
  178. Avatar: patientHead,
  179. Status: 1,
  180. CreatedTime: time.Now().Unix(),
  181. UserOrgId: orgID,
  182. Age: ages,
  183. }
  184. idtrs := make([]int64, 0)
  185. for _, patienttype := range patientType {
  186. id := int64(patienttype.(float64))
  187. idtrs = append(idtrs, id)
  188. }
  189. err := manage_service.AddPatients(&bloodPatients)
  190. patientss, _ := manage_service.GetLastData(orgID)
  191. err = manage_service.AddPatientType(orgID, patientss.ID, idtrs)
  192. fmt.Println("添加患者类型")
  193. fmt.Println("错误是什么", err)
  194. patients, err := manage_service.GetPatientLastData(orgID)
  195. fmt.Println("错误", err)
  196. fmt.Println("获取新增病人信息", patients)
  197. err = manage_service.AddContagions(patients.ID, patients.CreatedTime, patients.UpdatedTime, ids)
  198. fmt.Println("添加传染病失败", err)
  199. this.ServeSuccessJSON(map[string]interface{}{
  200. "bloodPatients": bloodPatients,
  201. "patientss": patientss,
  202. })
  203. fmt.Println("bloodPatients", bloodPatients)
  204. fmt.Println("数据为空")
  205. } else if errcode == nil {
  206. this.ServeSuccessJSON(map[string]interface{}{
  207. "msg": "ok",
  208. })
  209. return
  210. }
  211. } else if errcode == nil {
  212. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
  213. return
  214. }
  215. }
  216. func (this *Manage) DeleteCouseManage() {
  217. id, _ := this.GetInt64("id")
  218. fmt.Println("id", id)
  219. orgid, _ := this.GetInt64("orgid")
  220. fmt.Println("orgid", orgid)
  221. err := manage_service.DeleteCouseManage(id, orgid)
  222. fmt.Println("错误是什么", err)
  223. returnData := make(map[string]interface{}, 0)
  224. returnData["msg"] = "ok"
  225. this.ServeSuccessJSON(returnData)
  226. return
  227. }
  228. func (this *Manage) GetMissionInformation() {
  229. patientid, _ := this.GetInt64("patientid")
  230. fmt.Println("patientid", patientid)
  231. orgid, _ := this.GetInt64("orgid")
  232. fmt.Println("orgid是什么", orgid)
  233. startime := this.GetString("startime")
  234. fmt.Println("startime", startime)
  235. endtime := this.GetString("endtime")
  236. fmt.Println("endtime", endtime)
  237. timeLayout := "2006-01-02 15:04:05"
  238. theTime, _ := utils.ParseTimeStringToTime(timeLayout, startime+" 00:00:00")
  239. star := theTime.Unix()
  240. fmt.Println("star", star)
  241. toTime, _ := utils.ParseTimeStringToTime(timeLayout, endtime+" 00:00:00")
  242. end := toTime.Unix()
  243. fmt.Println("end", end)
  244. treatment, err := manage_service.GetMissionInforMation(patientid, orgid, star, end)
  245. patients, _ := login_service.GetPatintsInfo(patientid, orgid)
  246. fmt.Println("patients", patients)
  247. infectious, err := patient_service.GetPatientInfectious(patientid)
  248. if err != nil {
  249. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
  250. return
  251. }
  252. this.ServeSuccessJSON(map[string]interface{}{
  253. "treatment": treatment,
  254. "patients": patients,
  255. "infectious": infectious,
  256. })
  257. }
  258. func (this *Manage) GetRecordSave() {
  259. patientid, _ := this.GetInt64("patientid")
  260. fmt.Println("patientid", patientid)
  261. orgid, _ := this.GetInt64("orgid")
  262. fmt.Println("orgid", orgid)
  263. startime := this.GetString("startime")
  264. fmt.Println("startime", startime)
  265. timeLayout := "2006-01-02 15:04:05"
  266. theTime, _ := utils.ParseTimeStringToTime(timeLayout, startime+" 00:00:00")
  267. startimes := theTime.Unix()
  268. fmt.Println("startimes", startimes)
  269. endtime := this.GetString("endtime")
  270. endTimeYMDHmsStr := endtime + " 23:59:59"
  271. endTime, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endTimeYMDHmsStr)
  272. patients, _ := login_service.GetPatintsInfo(patientid, orgid)
  273. fmt.Println("paptients", patients)
  274. infectious, err := patient_service.GetPatientInfectious(patientid)
  275. record, err := manage_service.GetRecordServe(patientid, orgid, startimes, endTime.Unix())
  276. if err != nil {
  277. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
  278. return
  279. }
  280. this.ServeSuccessJSON(map[string]interface{}{
  281. "record": record,
  282. "patients": patients,
  283. "infectious": infectious,
  284. })
  285. }
  286. func (this *Manage) GetCheckPatientData() {
  287. patientid, _ := this.GetInt64("patientid")
  288. fmt.Println("patientid", patientid)
  289. orgid, _ := this.GetInt64("orgid")
  290. fmt.Println("orgid", orgid)
  291. startime := this.GetString("startime")
  292. fmt.Println("startime", startime)
  293. timeLayout := "2006-01-02 15:04:05"
  294. theTime, _ := utils.ParseTimeStringToTime(timeLayout, startime+" 00:00:00")
  295. startimes := theTime.Unix()
  296. fmt.Println("startimes", startimes)
  297. endtime := this.GetString("endtime")
  298. fmt.Println("endtime是什么", endtime)
  299. theTimes, _ := utils.ParseTimeStringToTime(timeLayout, endtime+" 00:00:00")
  300. endtimes := theTimes.Unix()
  301. fmt.Println("endtime", endtimes)
  302. checkpatientdata, err := patient_service.GetCheckPatientData(patientid, orgid, startimes, endtimes)
  303. //for _, check := range checkpatientdata {
  304. // Checkdata, _ := patient_service.GetCheckData(check.InspectDate, patientid, orgid)
  305. // this.ServeSuccessJSON(map[string]interface{}{
  306. // "checkdata":Checkdata,
  307. // })
  308. //}
  309. if err != nil {
  310. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
  311. return
  312. }
  313. this.ServeSuccessJSON(map[string]interface{}{
  314. "checkpatientdata": checkpatientdata,
  315. })
  316. }
  317. func (this *Manage) GetLongDialysis() {
  318. patientid, _ := this.GetInt64("patientid")
  319. fmt.Println("patientid", patientid)
  320. orgid, _ := this.GetInt64("orgid")
  321. fmt.Println("orgid", orgid)
  322. startime := this.GetString("startime")
  323. fmt.Println("startime", startime)
  324. timeLayout := "2006-01-02 15:04:05"
  325. theTime, _ := utils.ParseTimeStringToTime(timeLayout, startime+" 00:00:00")
  326. startimes := theTime.Unix()
  327. fmt.Println("startimes", startimes)
  328. endtime := this.GetString("endtime")
  329. fmt.Println("endtime是什么", endtime)
  330. theTimes, _ := utils.ParseTimeStringToTime(timeLayout, endtime+" 00:00:00")
  331. endtimes := theTimes.Unix()
  332. fmt.Println("endtime", endtimes)
  333. patients, err := login_service.GetPatintsInfo(patientid, orgid)
  334. dialysis, err := manage_service.GetLongDialysisData(patientid, orgid, startimes, endtimes)
  335. if err != nil {
  336. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
  337. return
  338. }
  339. this.ServeSuccessJSON(map[string]interface{}{
  340. "patients": patients,
  341. "dialysis": dialysis,
  342. })
  343. }
  344. func (this *Manage) GetDialysRecord() {
  345. patientid, _ := this.GetInt64("patientid")
  346. fmt.Println("patientid", patientid)
  347. orgid, _ := this.GetInt64("orgid")
  348. fmt.Println("orgid", orgid)
  349. startime := this.GetString("startime")
  350. fmt.Println("startime", startime)
  351. timeLayout := "2006-01-02 15:04:05"
  352. theTime, _ := utils.ParseTimeStringToTime(timeLayout, startime+" 00:00:00")
  353. startimes := theTime.Unix()
  354. fmt.Println("startimes", startimes)
  355. endtime := this.GetString("endtime")
  356. fmt.Println("endtime是什么", endtime)
  357. theTimes, _ := utils.ParseTimeStringToTime(timeLayout, endtime+" 00:00:00")
  358. endtimes := theTimes.Unix()
  359. fmt.Println("endtime", endtimes)
  360. patients, err := login_service.GetPatintsInfo(patientid, orgid)
  361. dialysisOrder, err := manage_service.GetDialysReCord(patientid, orgid, startimes, endtimes)
  362. if err != nil {
  363. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
  364. return
  365. }
  366. this.ServeSuccessJSON(map[string]interface{}{
  367. "dialysisOrder": dialysisOrder,
  368. "patients": patients,
  369. })
  370. }
  371. func (this *Manage) ToSeacherCourseManagement() {
  372. patientid, _ := this.GetInt64("patientid")
  373. fmt.Println("patientid", patientid)
  374. orgid, _ := this.GetInt64("orgid")
  375. fmt.Println("orgid是什么", orgid)
  376. seacherval := this.GetString("seacherVal")
  377. fmt.Println("seacherval", seacherval)
  378. patientCourse, err := manage_service.ToSeacherCourseManagement(patientid, orgid, seacherval)
  379. fmt.Println("patientCousrse是什么", patientCourse)
  380. if err != nil {
  381. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
  382. return
  383. }
  384. this.ServeSuccessJSON(map[string]interface{}{
  385. "patientCourse": patientCourse,
  386. })
  387. }
  388. func (this *Manage) ToDeleteSaveRecord() {
  389. id, _ := this.GetInt64("id")
  390. fmt.Println("id", id)
  391. err := manage_service.ToDeleteSaveRecord(id)
  392. fmt.Println("错误", err)
  393. returnData := make(map[string]interface{}, 0)
  394. returnData["msg"] = "ok"
  395. this.ServeSuccessJSON(returnData)
  396. return
  397. }
  398. func (this *Manage) ToSeacherRecord() {
  399. patientid, _ := this.GetInt64("patientid")
  400. orgid, _ := this.GetInt64("orgid")
  401. seacherVal := this.GetString("seacherVal")
  402. record, err := manage_service.ToSeacherRecord(patientid, orgid, seacherVal)
  403. if err != nil {
  404. this.ServeFailJsonSend(enums.ErrorCodeDataException, "查询失败")
  405. return
  406. }
  407. this.ServeSuccessJSON(map[string]interface{}{
  408. "record": record,
  409. })
  410. }
  411. func (this *Manage) DeleteMissionInformation() {
  412. id, _ := this.GetInt64("id")
  413. fmt.Println("id", id)
  414. orgid, _ := this.GetInt64("orgid")
  415. fmt.Println("orgid", orgid)
  416. err := manage_service.DeletMissionInformation(id)
  417. fmt.Println("err", err)
  418. returnData := make(map[string]interface{}, 0)
  419. returnData["msg"] = "ok"
  420. this.ServeSuccessJSON(returnData)
  421. return
  422. }
  423. func (this *Manage) ToSeacherMissionInformation() {
  424. patientid, _ := this.GetInt64("patientid")
  425. fmt.Println("patientid", patientid)
  426. orgid, _ := this.GetInt64("orgid")
  427. fmt.Println("orgid", orgid)
  428. seacherval := this.GetString("seacherVal")
  429. fmt.Println("seacherval", seacherval)
  430. treat, err := manage_service.ToSeacherMissionInformation(patientid, orgid, seacherval)
  431. if err != nil {
  432. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
  433. return
  434. }
  435. this.ServeSuccessJSON(map[string]interface{}{
  436. "treat": treat,
  437. })
  438. }
  439. func (this *Manage) GetPatientSchedules() {
  440. patientid, _ := this.GetInt64("patientid")
  441. fmt.Println("patientid", patientid)
  442. orgid, _ := this.GetInt64("orgid")
  443. fmt.Println("orgid", orgid)
  444. startime := this.GetString("startime")
  445. fmt.Println("startime", startime)
  446. timeLayout := "2006-01-02 15:04:05"
  447. theTime, _ := utils.ParseTimeStringToTime(timeLayout, startime+" 00:00:00")
  448. startimes := theTime.Unix()
  449. fmt.Println("startimes", startimes)
  450. endtime := this.GetString("endtime")
  451. toTime, _ := utils.ParseTimeStringToTime(timeLayout, endtime+" 00:00:00")
  452. endtimes := toTime.Unix()
  453. fmt.Println("endtimes", endtimes)
  454. schedules, err := manage_service.GetPatientSchedules(patientid, orgid, startimes, endtimes)
  455. patients, _ := login_service.GetPatintsInfo(patientid, orgid)
  456. infectious, err := patient_service.GetPatientInfectious(patientid)
  457. fmt.Println("err", err)
  458. fmt.Println("schedules", schedules)
  459. if err != nil {
  460. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
  461. return
  462. }
  463. this.ServeSuccessJSON(map[string]interface{}{
  464. "schedules": schedules,
  465. "patients": patients,
  466. "infectious": infectious,
  467. })
  468. }
  469. func (this *Manage) DeleteScheduleinformation() {
  470. id, _ := this.GetInt64("id")
  471. err := manage_service.DeleteScheduleinformationById(id)
  472. fmt.Println("错误是什么", err)
  473. if err != nil {
  474. this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除排班失败")
  475. return
  476. }
  477. returnData := make(map[string]interface{}, 0)
  478. returnData["msg"] = "ok"
  479. this.ServeSuccessJSON(returnData)
  480. return
  481. }
  482. func (this *Manage) ToSeacherScheduleInformation() {
  483. patientid, _ := this.GetInt64("patientid")
  484. fmt.Println("patientid", patientid)
  485. orgid, _ := this.GetInt64("orgid")
  486. fmt.Println("orgid", orgid)
  487. seacherval := this.GetString("seacherVal")
  488. fmt.Println("seacherval", seacherval)
  489. schedules, err := manage_service.ToSeacherSheduleinformation(patientid, orgid, seacherval)
  490. if err != nil {
  491. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
  492. return
  493. }
  494. this.ServeSuccessJSON(map[string]interface{}{
  495. "schedules": schedules,
  496. })
  497. }
  498. func (this *Manage) GetPatientType() {
  499. patientid, _ := this.GetInt64("patientid")
  500. fmt.Println("paitentid", patientid)
  501. orgid, _ := this.GetInt64("orgid")
  502. fmt.Println("orgid", orgid)
  503. patientType, err := manage_service.GetPaitentType(patientid, orgid)
  504. if err != nil {
  505. this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加医院失败")
  506. return
  507. }
  508. this.ServeSuccessJSON(map[string]interface{}{
  509. "patientType": patientType,
  510. })
  511. }
  512. func (this *Manage) GetCheckall() {
  513. checkdate, _ := this.GetInt64("checkdate")
  514. fmt.Print("checkdate", checkdate)
  515. patientid, _ := this.GetInt64("patientid")
  516. fmt.Print("patientid", patientid)
  517. orgid, _ := this.GetInt64("orgid")
  518. fmt.Print("org", orgid)
  519. checkdata, err := patient_service.GetCheckData(checkdate, patientid, orgid)
  520. if err != nil {
  521. this.ServeFailJsonSend(enums.ErrorCodeDataException, "查询失败")
  522. return
  523. }
  524. this.ServeSuccessJSON(map[string]interface{}{
  525. "checkdata": checkdata,
  526. })
  527. }