his_summary_controller.go 27KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718
  1. package controllers
  2. import (
  3. "XT_New/enums"
  4. "XT_New/service"
  5. "fmt"
  6. "github.com/astaxie/beego"
  7. "time"
  8. )
  9. type HisSummaryApiController struct {
  10. BaseAuthAPIController
  11. }
  12. func HisSummaryApiRegistRouters() {
  13. beego.Router("/api/gethissummarydetaillist", &HisSummaryApiController{}, "Get:GetHisSummaryDetailList")
  14. beego.Router("/api/his/getgatherdetailist", &HisSummaryApiController{}, "Get:GetGatherDetaiList")
  15. beego.Router("/api/his/getdetailpatients", &HisSummaryApiController{}, "Get:GetDetailPatients")
  16. beego.Router("/api/his/gethisorderlist", &HisSummaryApiController{}, "Get:GetHisOrderList")
  17. beego.Router("/api/his/gethisadviceorderlist", &HisSummaryApiController{}, "Get:GetHisAdviceOrderList")
  18. }
  19. func (this *HisSummaryApiController) GetHisSummaryDetailList() {
  20. start_time := this.GetString("start_time")
  21. end_time := this.GetString("end_time")
  22. keyword := this.GetString("keyword")
  23. item_type, _ := this.GetInt64("type")
  24. patient_id, _ := this.GetInt64("patient_id")
  25. adminUser := this.GetAdminUserInfo()
  26. timeLayout := "2006-01-02"
  27. loc, _ := time.LoadLocation("Local")
  28. startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  29. if err != nil {
  30. }
  31. startRecordDateTime := startTime.Unix()
  32. endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  33. if err != nil {
  34. }
  35. endRecordDateTime := endTime.Unix()
  36. list, err := service.GetHisSummaryDetailList(keyword, item_type, patient_id, adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime)
  37. patient, _ := service.GetFaPiaoPatientByID(adminUser.CurrentOrgId, patient_id)
  38. his_patient, _ := service.GetHisSummaryPatientInfo(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
  39. order, _ := service.GetHisLastOrder(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
  40. his_record_patient, _ := service.GetHisSummaryPatientInfoSix(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
  41. //获取所有的科室
  42. hisDepatment, _ := service.GetHisDepatment(adminUser.CurrentOrgId)
  43. //获取个人支付总额
  44. orderList, _ := service.GetAllHisOrderList(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
  45. if err == nil {
  46. this.ServeSuccessJSON(map[string]interface{}{
  47. "list": list,
  48. "patient": patient,
  49. "his_patient": his_patient,
  50. "hisDepatment": hisDepatment,
  51. "order": order,
  52. "his_record_patient": his_record_patient,
  53. "orderList": orderList,
  54. })
  55. return
  56. } else {
  57. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  58. return
  59. }
  60. }
  61. func (this *HisSummaryApiController) GetGatherDetaiList() {
  62. start_time := this.GetString("start_time")
  63. end_time := this.GetString("end_time")
  64. keyword := this.GetString("keyword")
  65. item_type, _ := this.GetInt64("type")
  66. patient_id, _ := this.GetInt64("patient_id")
  67. adminUser := this.GetAdminUserInfo()
  68. timeLayout := "2006-01-02"
  69. loc, _ := time.LoadLocation("Local")
  70. startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  71. if err != nil {
  72. }
  73. startRecordDateTime := startTime.Unix()
  74. endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  75. if err != nil {
  76. }
  77. endRecordDateTime := endTime.Unix()
  78. list, err := service.GetHisSummaryDetailList(keyword, item_type, patient_id, adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime)
  79. patient, _ := service.GetFaPiaoPatientByID(adminUser.CurrentOrgId, patient_id)
  80. his_patient, _ := service.GetHisSummaryPatientInfo(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
  81. order, _ := service.GetHisLastOrder(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
  82. his_record_patient, _ := service.GetHisSummaryPatientInfoSix(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
  83. //获取所有的科室
  84. hisDepatment, _ := service.GetHisDepatment(adminUser.CurrentOrgId)
  85. var medicalInsuranceLevel = "医保等级"
  86. medicalInsuranceLevelParent, _ := service.GetDrugDataConfig(0, medicalInsuranceLevel)
  87. medicalInsuranceLevelList, _ := service.GetParentDataConfig(medicalInsuranceLevelParent.ID, adminUser.CurrentOrgId)
  88. var drugType = "药品类型"
  89. drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
  90. drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, adminUser.CurrentOrgId)
  91. var costClassify = "费用类别"
  92. costClassifyParent, _ := service.GetDrugDataConfig(0, costClassify)
  93. costClassifyList, _ := service.GetParentDataConfig(costClassifyParent.ID, adminUser.CurrentOrgId)
  94. doctorlist, _ := service.GetAllDoctorSix(adminUser.CurrentOrgId, adminUser.CurrentAppId)
  95. //获取最后一次排班
  96. schedule, _ := service.GetHisSchedule(patient_id, adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime)
  97. bedNumber, _ := service.GetAllBedNumberSix(adminUser.CurrentOrgId)
  98. orderInfo, _ := service.GetHisLastOrder(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
  99. //获取个人支付总额
  100. orderList, _ := service.GetAllHisOrderList(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
  101. if err == nil {
  102. this.ServeSuccessJSON(map[string]interface{}{
  103. "list": list,
  104. "patient": patient,
  105. "his_patient": his_patient,
  106. "hisDepatment": hisDepatment,
  107. "order": order,
  108. "his_record_patient": his_record_patient,
  109. "medicalInsuranceLevelList": medicalInsuranceLevelList,
  110. "drugTypeList": drugTypeList,
  111. "costClassifyList": costClassifyList,
  112. "doctorlist": doctorlist,
  113. "schedule": schedule,
  114. "bedNumber": bedNumber,
  115. "orderInfo": orderInfo,
  116. "orderList": orderList,
  117. })
  118. return
  119. } else {
  120. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  121. return
  122. }
  123. }
  124. //func (this *HisSummaryApiController) GetGatherDetaiList() {
  125. //
  126. // start_time := this.GetString("start_time")
  127. // end_time := this.GetString("end_time")
  128. // keyword := this.GetString("keyword")
  129. // item_type, _ := this.GetInt64("type")
  130. // patient_id, _ := this.GetInt64("patient_id")
  131. // adminUser := this.GetAdminUserInfo()
  132. //
  133. // timeLayout := "2006-01-02"
  134. // loc, _ := time.LoadLocation("Local")
  135. // startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  136. // if err != nil {
  137. //
  138. // }
  139. // startRecordDateTime := startTime.Unix()
  140. //
  141. // endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  142. // if err != nil {
  143. //
  144. // }
  145. // endRecordDateTime := endTime.Unix()
  146. //
  147. // //查询该病人这段时间的记录单号
  148. // orderInfo, _ := service.GetGatherHisOrder(keyword, item_type, patient_id, adminUser.CurrentOrgId, startRecordDateTime, endRecordDateTime)
  149. //
  150. // org_id := this.GetAdminUserInfo().CurrentOrgId
  151. // appid := this.GetAdminUserInfo().CurrentAppId
  152. // var order_info []*service.HisOrderInfo
  153. //
  154. // var MdtrtId string
  155. //
  156. // patient, _ := service.GetPatientByID(org_id, patient_id)
  157. // for _, item := range orderInfo {
  158. // orderinfo, _ := service.GetHisOrderDetailByNumber(item.Number, org_id)
  159. // MdtrtId = item.MdtrtId
  160. // for _, it := range orderinfo {
  161. //
  162. // order_info = append(order_info, it)
  163. // }
  164. // }
  165. // his, _ := service.GetHisPatientInfoFive(org_id, patient_id, startRecordDateTime, endRecordDateTime)
  166. //
  167. // record, _ := service.GetInHospitalRecordByNumber(MdtrtId)
  168. //
  169. // //获取所有客户
  170. // adminInfo, _ := service.GetAllDoctorSix(org_id, appid)
  171. //
  172. // //获取最后一次排班
  173. // schedule, _ := service.GetHisSchedule(patient_id, org_id, startRecordDateTime, endRecordDateTime)
  174. //
  175. // bedNumber, _ := service.GetAllBedNumberSix(org_id)
  176. // var bedCostTotal float64 = 0 //床位总费
  177. //
  178. // var operationCostTotal float64 = 0 //手术费
  179. //
  180. // var otherCostTotal float64 = 0 //其他费用
  181. //
  182. // var materialCostTotal float64 = 0 //材料费
  183. //
  184. // var westernMedicineCostTotal float64 = 0 //西药费
  185. //
  186. // var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  187. //
  188. // var checkCostTotal float64 = 0 //检查费
  189. //
  190. // var laboratoryCostTotal float64 = 0 //化验费
  191. //
  192. // var treatCostTotal float64 = 0 //治疗费用
  193. //
  194. // var zhenChaCostTotal float64 = 0 //其他费用
  195. //
  196. // decimal.DivisionPrecision = 2
  197. // var BalanceAccountsType int64
  198. // if his.ID > 0 {
  199. // BalanceAccountsType = his.BalanceAccountsType
  200. // } else {
  201. // BalanceAccountsType = record.BalanceAccountsType
  202. // }
  203. //
  204. // his_patient, _ := service.GetHisSummaryPatientInfo(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime)
  205. //
  206. // //获取所有的科室
  207. // hisDepatment, _ := service.GetHisDepatment(adminUser.CurrentOrgId)
  208. //
  209. // //统计
  210. // prescription, _ := service.GetHisPrescriptionTenty(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, keyword, item_type)
  211. //
  212. // //orderlist, _ := service.GetHisChargeOrder(adminUser.CurrentOrgId, patient_id, startRecordDateTime, endRecordDateTime, keyword, item_type)
  213. //
  214. // var medicalInsuranceLevel = "医保等级"
  215. // medicalInsuranceLevelParent, _ := service.GetDrugDataConfig(0, medicalInsuranceLevel)
  216. // medicalInsuranceLevelList, _ := service.GetParentDataConfig(medicalInsuranceLevelParent.ID, adminUser.CurrentOrgId)
  217. // if BalanceAccountsType != 2 && BalanceAccountsType > 0 {
  218. // for _, item := range order_info {
  219. // if org_id == 10215 {
  220. // if item.MedChrgitmType == "01" { //床位费
  221. // bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  222. // }
  223. // if item.MedChrgitmType == "02" { //诊察费
  224. // zhenChaCostTotal, _ = decimal.NewFromFloat(zhenChaCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  225. //
  226. // }
  227. // if item.MedChrgitmType == "03" { //检查费
  228. // checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  229. //
  230. // }
  231. //
  232. // if item.MedChrgitmType == "04" { //化验费
  233. // laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  234. // }
  235. //
  236. // if item.MedChrgitmType == "05" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" { //治疗费
  237. // treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  238. //
  239. // }
  240. //
  241. // if item.MedChrgitmType == "06" { //手术费
  242. // operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  243. // }
  244. //
  245. // if item.MedChrgitmType == "08" { //材料费
  246. // materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  247. // }
  248. //
  249. // if item.MedChrgitmType == "09" { //西药费
  250. // westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  251. // }
  252. //
  253. // if item.MedChrgitmType == "11" { //中成费
  254. // chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  255. // }
  256. //
  257. // if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" { //其他费
  258. // otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  259. // }
  260. //
  261. // } else if org_id == 10188 || org_id == 10217 {
  262. // if item.MedChrgitmType == "01" { //床位费
  263. // bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  264. //
  265. // }
  266. // if item.MedChrgitmType == "02" { //诊察费
  267. // zhenChaCostTotal, _ = decimal.NewFromFloat(zhenChaCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  268. // }
  269. // if item.MedChrgitmType == "03" { //检查费
  270. // laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  271. // }
  272. //
  273. // if item.MedChrgitmType == "04" { //化验费
  274. // laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  275. // }
  276. //
  277. // if item.MedChrgitmType == "05" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" { //治疗费
  278. // treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  279. // }
  280. //
  281. // if item.MedChrgitmType == "06" { //手术费
  282. // operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  283. // }
  284. //
  285. // if item.MedChrgitmType == "08" { //材料费
  286. // materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  287. // }
  288. //
  289. // if item.MedChrgitmType == "09" { //西药费
  290. // westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  291. // }
  292. //
  293. // if item.MedChrgitmType == "11" { //中成费
  294. // chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  295. // }
  296. //
  297. // if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" { //其他费
  298. // otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  299. // }
  300. //
  301. // } else {
  302. //
  303. // if item.MedChrgitmType == "01" { //床位费
  304. // bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  305. //
  306. // }
  307. //
  308. // if item.MedChrgitmType == "03" { //检查费
  309. // checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  310. // }
  311. //
  312. // if item.MedChrgitmType == "04" { //化验费
  313. // laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  314. //
  315. // }
  316. //
  317. // if item.MedChrgitmType == "05" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" { //治疗费
  318. // treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  319. // }
  320. //
  321. // if item.MedChrgitmType == "06" { //手术费
  322. // operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  323. // }
  324. //
  325. // if item.MedChrgitmType == "08" { //材料费
  326. // materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  327. // }
  328. //
  329. // if item.MedChrgitmType == "09" { //西药费
  330. // westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  331. // }
  332. //
  333. // if item.MedChrgitmType == "11" { //中成费
  334. // chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  335. // }
  336. //
  337. // if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" || item.MedChrgitmType == "02" { //其他费
  338. // otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  339. //
  340. // }
  341. //
  342. // }
  343. // }
  344. // this.ServeSuccessJSON(map[string]interface{}{
  345. // "order": orderInfo,
  346. // "order_info": order_info,
  347. // "patient": patient,
  348. // "admin_info": adminInfo,
  349. // "his_hospital": record,
  350. // "bedCostTotal": bedCostTotal,
  351. // "operationCostTotal": operationCostTotal,
  352. // "otherCostTotal": otherCostTotal,
  353. // "materialCostTotal": materialCostTotal,
  354. // "westernMedicineCostTotal": westernMedicineCostTotal,
  355. // "chineseTraditionalMedicineCostTotal": chineseTraditionalMedicineCostTotal,
  356. // "checkCostTotal": checkCostTotal,
  357. // "zhenChaCostTotal": zhenChaCostTotal,
  358. // "laboratoryCostTotal": laboratoryCostTotal,
  359. // "treatCostTotal": treatCostTotal,
  360. // "his_patient": his_patient,
  361. // "hisDepatment": hisDepatment,
  362. // "prescription": prescription,
  363. // "schedule": schedule,
  364. // "bedNumber": bedNumber,
  365. // })
  366. // } else {
  367. // for _, item := range order_info {
  368. //
  369. // item.FulamtOwnpayAmt = item.DetItemFeeSumamt
  370. // if item.HisDoctorAdviceInfo.ID > 0 && item.HisPrescriptionProject.ID == 0 { //药品
  371. // item.MedChrgitmType = "09"
  372. // }
  373. // if item.HisPrescriptionProject.ID > 0 && item.HisDoctorAdviceInfo.ID == 0 {
  374. // if item.HisPrescriptionProject.Type == 2 {
  375. // if this.GetAdminUserInfo().CurrentOrgId == 10215 {
  376. // switch item.HisPrescriptionProject.VMHisProject.CostClassify {
  377. // case 0:
  378. // item.MedChrgitmType = "0"
  379. // break
  380. // case 1:
  381. // item.MedChrgitmType = "14"
  382. // break
  383. // case 2:
  384. // item.MedChrgitmType = "05"
  385. //
  386. // break
  387. // case 3:
  388. // item.MedChrgitmType = "03"
  389. //
  390. // break
  391. // case 4:
  392. // item.MedChrgitmType = "03"
  393. //
  394. // break
  395. // case 5:
  396. // item.MedChrgitmType = "08"
  397. //
  398. // break
  399. // case 6:
  400. // item.MedChrgitmType = "14"
  401. //
  402. // break
  403. // case 7:
  404. // item.MedChrgitmType = "14"
  405. //
  406. // break
  407. // case 8:
  408. // item.MedChrgitmType = "03"
  409. // break
  410. // case 9:
  411. // item.MedChrgitmType = "14"
  412. // break
  413. // case 10:
  414. // item.MedChrgitmType = "14"
  415. // break
  416. // case 11:
  417. // item.MedChrgitmType = "06"
  418. // break
  419. // case 12:
  420. // item.MedChrgitmType = "12"
  421. // break
  422. // case 13:
  423. // item.MedChrgitmType = "01"
  424. // break
  425. // case 14:
  426. // item.MedChrgitmType = "04"
  427. // break
  428. // case 15:
  429. // item.MedChrgitmType = "14"
  430. // break
  431. //
  432. // }
  433. //
  434. // } else {
  435. // switch item.HisPrescriptionProject.VMHisProject.CostClassify {
  436. //
  437. // case 1:
  438. // item.MedChrgitmType = "14"
  439. // break
  440. // case 2:
  441. // item.MedChrgitmType = "05"
  442. //
  443. // break
  444. // case 3:
  445. // item.MedChrgitmType = "04"
  446. //
  447. // break
  448. // case 4:
  449. // item.MedChrgitmType = "14"
  450. //
  451. // break
  452. // case 5:
  453. // item.MedChrgitmType = "08"
  454. //
  455. // break
  456. // case 6:
  457. // item.MedChrgitmType = "14"
  458. //
  459. // break
  460. // case 7:
  461. // item.MedChrgitmType = "14"
  462. //
  463. // break
  464. // case 8:
  465. // item.MedChrgitmType = "03"
  466. // break
  467. // case 9:
  468. // item.MedChrgitmType = "14"
  469. // break
  470. // }
  471. // }
  472. // } else if item.HisPrescriptionProject.Type == 3 {
  473. // item.MedChrgitmType = "08"
  474. // }
  475. // }
  476. // }
  477. //
  478. // for _, item := range order_info {
  479. // if org_id == 10215 {
  480. // if item.MedChrgitmType == "01" { //床位费
  481. // bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  482. // }
  483. // if item.MedChrgitmType == "02" { //诊察费
  484. // zhenChaCostTotal, _ = decimal.NewFromFloat(zhenChaCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  485. // }
  486. //
  487. // if item.MedChrgitmType == "03" { //检查费
  488. // checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  489. // }
  490. //
  491. // if item.MedChrgitmType == "04" { //化验费
  492. // laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  493. // }
  494. //
  495. // if item.MedChrgitmType == "05" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" { //治疗费
  496. // treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  497. // }
  498. //
  499. // if item.MedChrgitmType == "06" { //手术费
  500. // operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  501. // }
  502. //
  503. // if item.MedChrgitmType == "08" { //材料费
  504. // materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  505. // }
  506. //
  507. // if item.MedChrgitmType == "09" { //西药费
  508. // westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  509. // }
  510. //
  511. // if item.MedChrgitmType == "11" { //中成费
  512. // chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  513. // }
  514. //
  515. // if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" { //其他费
  516. // otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  517. // }
  518. //
  519. // } else {
  520. //
  521. // if item.MedChrgitmType == "01" { //床位费
  522. // bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  523. // }
  524. //
  525. // if item.MedChrgitmType == "03" { //检查费
  526. // checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  527. // }
  528. //
  529. // if item.MedChrgitmType == "04" { //化验费
  530. // laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  531. // }
  532. //
  533. // if item.MedChrgitmType == "05" || item.MedChrgitmType == "1402" || item.MedChrgitmType == "1403" { //治疗费
  534. // treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  535. // }
  536. //
  537. // if item.MedChrgitmType == "06" { //手术费
  538. // operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  539. // }
  540. //
  541. // if item.MedChrgitmType == "08" { //材料费
  542. // materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  543. // }
  544. //
  545. // if item.MedChrgitmType == "09" { //西药费
  546. // westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  547. // }
  548. //
  549. // if item.MedChrgitmType == "11" { //中成费
  550. // chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  551. // }
  552. //
  553. // if item.MedChrgitmType == "14" || item.MedChrgitmType == "0" || item.MedChrgitmType == "12" || item.MedChrgitmType == "02" { //其他费
  554. // otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  555. // }
  556. //
  557. // }
  558. //
  559. // }
  560. //
  561. // this.ServeSuccessJSON(map[string]interface{}{
  562. // "order": orderInfo,
  563. // "order_info": order_info,
  564. // "patient": patient,
  565. // "admin_info": adminInfo,
  566. // "his_hospital": record,
  567. // "bedCostTotal": bedCostTotal,
  568. // "operationCostTotal": operationCostTotal,
  569. // "otherCostTotal": otherCostTotal,
  570. // "materialCostTotal": materialCostTotal,
  571. // "westernMedicineCostTotal": westernMedicineCostTotal,
  572. // "chineseTraditionalMedicineCostTotal": chineseTraditionalMedicineCostTotal,
  573. // "checkCostTotal": checkCostTotal,
  574. // "zhenChaCostTotal": zhenChaCostTotal,
  575. // "laboratoryCostTotal": laboratoryCostTotal,
  576. // "treatCostTotal": treatCostTotal,
  577. // "his_patient": his_patient,
  578. // "hisDepatment": hisDepatment,
  579. // "prescription": prescription,
  580. // "balanceAccountsType": BalanceAccountsType,
  581. // "medicalInsuranceLevelList": medicalInsuranceLevelList,
  582. // "schedule": schedule,
  583. // "bedNumber": bedNumber,
  584. // })
  585. //
  586. // }
  587. //}
  588. func (this *HisSummaryApiController) GetDetailPatients() {
  589. keyword := this.GetString("keyword")
  590. orgId := this.GetAdminUserInfo().CurrentOrgId
  591. patients, err := service.GetDetailPatients(keyword, orgId)
  592. if err == nil {
  593. this.ServeSuccessJSON(map[string]interface{}{
  594. "patient": patients,
  595. })
  596. return
  597. } else {
  598. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  599. return
  600. }
  601. }
  602. func (this *HisSummaryApiController) GetHisOrderList() {
  603. patient_id, _ := this.GetInt64("patient_id")
  604. start_time := this.GetString("start_time")
  605. end_time := this.GetString("end_time")
  606. //med_type := this.GetString("med_type")
  607. timeLayout := "2006-01-02"
  608. loc, _ := time.LoadLocation("Local")
  609. startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  610. if err != nil {
  611. }
  612. startRecordDateTime := startTime.Unix()
  613. endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  614. if err != nil {
  615. }
  616. endRecordDateTime := endTime.Unix()
  617. orgId := this.GetAdminUserInfo().CurrentOrgId
  618. groupList, _ := service.GetOrderInfoList(patient_id, startRecordDateTime, endRecordDateTime, orgId)
  619. fmt.Println("groupList32332323232232332322323", groupList)
  620. //list, err := service.GetHisOrderListTwenty(patient_id, startRecordDateTime, endRecordDateTime, orgId)
  621. if err == nil {
  622. this.ServeSuccessJSON(map[string]interface{}{
  623. "groupList": groupList,
  624. // "list": list,
  625. })
  626. return
  627. } else {
  628. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  629. return
  630. }
  631. }
  632. func (this *HisSummaryApiController) GetHisAdviceOrderList() {
  633. patient_id, _ := this.GetInt64("patient_id")
  634. start_time := this.GetString("start_time")
  635. end_time := this.GetString("end_time")
  636. timeLayout := "2006-01-02"
  637. loc, _ := time.LoadLocation("Local")
  638. startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
  639. if err != nil {
  640. }
  641. startRecordDateTime := startTime.Unix()
  642. endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
  643. if err != nil {
  644. }
  645. endRecordDateTime := endTime.Unix()
  646. orgId := this.GetAdminUserInfo().CurrentOrgId
  647. list, err := service.GetOrderInfoList(patient_id, startRecordDateTime, endRecordDateTime, orgId)
  648. //drugList, err := service.GetAllDrugLibList(orgId)
  649. //
  650. //goodList, err := service.GetAllGoodList(orgId)
  651. if err == nil {
  652. this.ServeSuccessJSON(map[string]interface{}{
  653. "list": list,
  654. //"drugList":drugList,
  655. //"goodList":goodList,
  656. })
  657. return
  658. } else {
  659. this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
  660. return
  661. }
  662. }