hbyb_controller.go 36KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059
  1. package hb
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "time"
  6. "os"
  7. "gdyb/controllers"
  8. "gdyb/models"
  9. "gdyb/service"
  10. "gdyb/utils"
  11. "github.com/astaxie/beego"
  12. "io/ioutil"
  13. )
  14. type HBybController struct {
  15. controllers.BaseAuthAPIController
  16. }
  17. func HbybRegistRouters() {
  18. beego.Router("/hbyb/1101", &HBybController{}, "get:PostOne")
  19. beego.Router("/hbyb/2201", &HBybController{}, "get:PostTwo")
  20. beego.Router("/hbyb/2202", &HBybController{}, "get:PostThree")
  21. beego.Router("/hbyb/2203", &HBybController{}, "post:PostFour")
  22. beego.Router("/hbyb/2204", &HBybController{}, "post:PostFive")
  23. beego.Router("/hbyb/2205", &HBybController{}, "get:PostSix")
  24. beego.Router("/hbyb/2206", &HBybController{}, "get:PostSeven")
  25. beego.Router("/hbyb/2207", &HBybController{}, "get:PostEight")
  26. beego.Router("/hbyb/2208", &HBybController{}, "get:PostNine")
  27. beego.Router("/hbyb/5203", &HBybController{}, "get:PostTen")
  28. beego.Router("/hbyb/2001", &HBybController{}, "get:Post2001")
  29. beego.Router("/hbyb/3202", &HBybController{}, "post:Post3202a")
  30. beego.Router("/hbyb/1608", &HBybController{}, "post:Post1608")
  31. beego.Router("/hbyb/3202b", &HBybController{}, "post:Post3202b")
  32. //beego.Router("/hbyb/3202c", &HBybController{}, "post:Post3202")
  33. beego.Router("/hbyb/4101", &HBybController{}, "post:Post4101")
  34. beego.Router("/hbyb/5262", &HBybController{}, "post:Post5262")
  35. beego.Router("/hbyb/5267", &HBybController{}, "post:Post5267")
  36. beego.Router("/hbyb/5301", &HBybController{}, "get:Post5301")
  37. beego.Router("/hbyb/2401", &HBybController{}, "post:Post2401")
  38. beego.Router("/hbyb/2402", &HBybController{}, "post:Post2402")
  39. beego.Router("/hbyb/2404", &HBybController{}, "get:Post2404")
  40. beego.Router("/hbyb/2405", &HBybController{}, "get:Post2405")
  41. beego.Router("/hbyb/2301", &HBybController{}, "post:Post2301")
  42. beego.Router("/hbyb/2302", &HBybController{}, "get:Post2302")
  43. beego.Router("/hbyb/2303", &HBybController{}, "get:Post2303")
  44. beego.Router("/hbyb/2304", &HBybController{}, "get:Post2304")
  45. beego.Router("/hbyb/2305", &HBybController{}, "get:Post2305")
  46. }
  47. func (c *HBybController) Post2401() {
  48. body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
  49. var respJSON map[string]interface{}
  50. if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  51. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  52. return
  53. }
  54. userJSONBytes, _ := json.Marshal(respJSON["struct_2401"])
  55. var struct2401 service.Struct2401
  56. if err := json.Unmarshal(userJSONBytes, &struct2401); err != nil {
  57. utils.ErrorLog("解析失败:%v", err)
  58. return
  59. }
  60. org_name := respJSON["org_name"].(string)
  61. fixmedins_code := respJSON["fixmedins_code"].(string)
  62. doctor := respJSON["doctor"].(string)
  63. insuplc_admdvs := respJSON["insuplc_admdvs"].(string)
  64. mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
  65. secret_key := respJSON["secret_key"].(string)
  66. result, request_log := service.Hbyb2401(struct2401, secret_key, org_name, fixmedins_code, doctor, insuplc_admdvs, mdtrtarea_admvs)
  67. saveJsLog(result, request_log, "2401", "入院登记", org_name)
  68. var dat2 map[string]interface{}
  69. if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
  70. } else {
  71. }
  72. var dat map[string]interface{}
  73. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  74. } else {
  75. }
  76. c.ServeSuccessJSON(map[string]interface{}{
  77. "pre": dat,
  78. "request_log": dat2,
  79. })
  80. }
  81. func (c *HBybController) Post2404() {
  82. mdtrt_id := c.GetString("mdtrt_id")
  83. psn_no := c.GetString("psn_no")
  84. doctor := c.GetString("doctor")
  85. fixmedins_code := c.GetString("fixmedins_code")
  86. insuplc_admdvs := c.GetString("insuplc_admdvs")
  87. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  88. secret_key := c.GetString("secret_key")
  89. org_name := c.GetString("org_name")
  90. result, requestLog := service.Hbyb2404(mdtrt_id, psn_no, secret_key, org_name, fixmedins_code, doctor, insuplc_admdvs, mdtrtarea_admvs)
  91. saveJsLog(result, requestLog, "2404", "入院登记撤销", org_name)
  92. var dat map[string]interface{}
  93. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  94. } else {
  95. }
  96. var dat2 map[string]interface{}
  97. if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil {
  98. } else {
  99. }
  100. c.ServeSuccessJSON(map[string]interface{}{
  101. "pre": dat,
  102. "log": dat2,
  103. })
  104. }
  105. func (c *HBybController) Post2405() {
  106. mdtrt_id := c.GetString("mdtrt_id")
  107. psn_no := c.GetString("psn_no")
  108. doctor := c.GetString("doctor")
  109. fixmedins_code := c.GetString("fixmedins_code")
  110. insuplc_admdvs := c.GetString("insuplc_admdvs")
  111. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  112. secret_key := c.GetString("secret_key")
  113. org_name := c.GetString("org_name")
  114. result, requestLog := service.Hb2405(mdtrt_id, psn_no, secret_key, org_name, fixmedins_code, doctor, insuplc_admdvs, mdtrtarea_admvs)
  115. saveJsLog(result, requestLog, "2405", "出院登记撤销", org_name)
  116. var dat map[string]interface{}
  117. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  118. } else {
  119. }
  120. var dat2 map[string]interface{}
  121. if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil {
  122. } else {
  123. }
  124. c.ServeSuccessJSON(map[string]interface{}{
  125. "pre": dat,
  126. "log": dat2,
  127. })
  128. }
  129. func (c *HBybController) Post2402() {
  130. body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
  131. var respJSON map[string]interface{}
  132. if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  133. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  134. return
  135. }
  136. userJSONBytes, _ := json.Marshal(respJSON["struct_2402"])
  137. var struct2402 service.Struct2402
  138. if err := json.Unmarshal(userJSONBytes, &struct2402); err != nil {
  139. utils.ErrorLog("解析失败:%v", err)
  140. return
  141. }
  142. org_name := respJSON["org_name"].(string)
  143. fixmedins_code := respJSON["fixmedins_code"].(string)
  144. doctor := respJSON["doctor"].(string)
  145. insuplc_admdvs := respJSON["insuplc_admdvs"].(string)
  146. mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
  147. secret_key := respJSON["secret_key"].(string)
  148. result, request_log := service.Hb2402(struct2402, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code)
  149. saveJsLog(result, request_log, "2402", "出院", org_name)
  150. var dat2 map[string]interface{}
  151. if err := json.Unmarshal([]byte(request_log), &dat2); err == nil {
  152. } else {
  153. }
  154. var dat map[string]interface{}
  155. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  156. } else {
  157. }
  158. c.ServeSuccessJSON(map[string]interface{}{
  159. "pre": dat,
  160. "request_log": dat2,
  161. })
  162. }
  163. func (c *HBybController) Post2301() {
  164. body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
  165. var respJSON map[string]interface{}
  166. if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  167. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  168. return
  169. }
  170. userJSONBytes, _ := json.Marshal(respJSON["customs"])
  171. var customs []*models.NewCustom
  172. if err := json.Unmarshal(userJSONBytes, &customs); err != nil {
  173. utils.ErrorLog("解析失败:%v", err)
  174. return
  175. }
  176. number := respJSON["number"].(string)
  177. chrg_bchno := respJSON["chrg_bchno"].(string)
  178. dept := respJSON["dept"].(string)
  179. dept_code := respJSON["dept_code"].(string)
  180. doctor_code := respJSON["doctor_code"].(string)
  181. doctor_name := respJSON["doctor_name"].(string)
  182. opertor := respJSON["opertor"].(string)
  183. org_name := respJSON["org_name"].(string)
  184. fixmedins_code := respJSON["fixmedins_code"].(string)
  185. insuplc_admdvs := respJSON["insuplc_admdvs"].(string)
  186. mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
  187. secret_key := respJSON["secret_key"].(string)
  188. med_type := respJSON["med_type"].(string)
  189. //med_type := strconv.FormatInt(int64(respJSON["med_type"].(float64)), 10)
  190. psn_no := respJSON["psn_no"].(string)
  191. result, requestLog := service.Hb2301A(psn_no, number, customs, chrg_bchno, org_name, doctor_name, dept, fixmedins_code, dept_code, doctor_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, opertor)
  192. saveJsLog(result, requestLog, "2301", "上传明细", org_name)
  193. var dat2 map[string]interface{}
  194. if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil {
  195. } else {
  196. }
  197. var dat map[string]interface{}
  198. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  199. } else {
  200. }
  201. c.ServeSuccessJSON(map[string]interface{}{
  202. "pre": dat,
  203. "request_log": dat2,
  204. })
  205. }
  206. func (c *HBybController) Post2302() {
  207. mdtrt_id := c.GetString("mdtrtId")
  208. psn_no := c.GetString("psn_no")
  209. number := c.GetString("feedetl_sn")
  210. doctor := c.GetString("doctor")
  211. fixmedins_code := c.GetString("fixmedins_code")
  212. insuplc_admdvs := c.GetString("insuplc_admdvs")
  213. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  214. secret_key := c.GetString("secret_key")
  215. org_name := c.GetString("org_name")
  216. refund_type, _ := c.GetInt64("refund_type")
  217. result, requestLog := service.Hb2302(psn_no, mdtrt_id, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code, number, refund_type)
  218. saveJsLog(result, requestLog, "2302", "退明细", org_name)
  219. var dat2 map[string]interface{}
  220. if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil {
  221. } else {
  222. }
  223. var dat map[string]interface{}
  224. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  225. } else {
  226. }
  227. c.ServeSuccessJSON(map[string]interface{}{
  228. "pre": dat,
  229. "request_log": dat2,
  230. })
  231. }
  232. func (c *HBybController) Post2303() {
  233. mdtrt_id := c.GetString("mdtrt_id")
  234. psn_no := c.GetString("psn_no")
  235. chrg_bchno := c.GetString("chrg_bchno")
  236. cert_no := c.GetString("cert_no")
  237. insutype_type := c.GetString("insutype_type")
  238. allTotal := c.GetString("total")
  239. id_card_type, _ := c.GetInt64("id_card_type")
  240. doctor := c.GetString("doctor")
  241. certificates, _ := c.GetInt64("certificates")
  242. fixmedins_code := c.GetString("fixmedins_code")
  243. insuplc_admdvs := c.GetString("insuplc_admdvs")
  244. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  245. secret_key := c.GetString("secret_key")
  246. org_name := c.GetString("org_name")
  247. result, src_resquest := service.Hb2303(psn_no, mdtrt_id, chrg_bchno, cert_no, insutype_type, allTotal, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, "0", id_card_type, 0, 0, 0, 0, certificates)
  248. saveJsLog(result, src_resquest, "2303", "预结算", org_name)
  249. var dat2 map[string]interface{}
  250. if err := json.Unmarshal([]byte(src_resquest), &dat2); err == nil {
  251. } else {
  252. }
  253. var dat map[string]interface{}
  254. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  255. } else {
  256. }
  257. c.ServeSuccessJSON(map[string]interface{}{
  258. "pre": dat,
  259. "request_log": dat2,
  260. })
  261. }
  262. func (c *HBybController) Post2304() {
  263. mdtrt_id := c.GetString("mdtrt_id")
  264. psn_no := c.GetString("psn_no")
  265. chrg_bchno := c.GetString("chrg_bchno")
  266. cert_no := c.GetString("cert_no")
  267. insutype_type := c.GetString("insutype_type")
  268. allTotal := c.GetString("total")
  269. id_card_type, _ := c.GetInt64("id_card_type")
  270. doctor := c.GetString("doctor")
  271. certificates, _ := c.GetInt64("certificates")
  272. fixmedins_code := c.GetString("fixmedins_code")
  273. insuplc_admdvs := c.GetString("insuplc_admdvs")
  274. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  275. secret_key := c.GetString("secret_key")
  276. org_name := c.GetString("org_name")
  277. fapiao_number := c.GetString("fapiao_number")
  278. acct_used_flag := c.GetString("acct_used_flag")
  279. result, src_resquest := service.Hb2304(psn_no, mdtrt_id, chrg_bchno, cert_no, insutype_type, allTotal, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, "0", id_card_type, 0, 0, 0, 0, certificates, fapiao_number, acct_used_flag)
  280. saveJsLog(result, src_resquest, "2304", "住院结算", org_name)
  281. var dat2 map[string]interface{}
  282. if err := json.Unmarshal([]byte(src_resquest), &dat2); err == nil {
  283. } else {
  284. }
  285. var dat map[string]interface{}
  286. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  287. } else {
  288. }
  289. c.ServeSuccessJSON(map[string]interface{}{
  290. "pre": dat,
  291. "request_log": dat2,
  292. })
  293. }
  294. func (c *HBybController) Post2305() {
  295. mdtrt_id := c.GetString("mdtrt_id")
  296. psn_no := c.GetString("psn_no")
  297. doctor := c.GetString("doctor")
  298. setl_id := c.GetString("setl_id")
  299. fixmedins_code := c.GetString("fixmedins_code")
  300. insuplc_admdvs := c.GetString("insuplc_admdvs")
  301. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  302. secret_key := c.GetString("secret_key")
  303. org_name := c.GetString("org_name")
  304. result, requestLog := service.Hb2305(psn_no, mdtrt_id, setl_id, org_name, doctor, secret_key, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  305. saveJsLog(result, requestLog, "2305", "退费", org_name)
  306. var dat2 map[string]interface{}
  307. if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil {
  308. } else {
  309. }
  310. var dat map[string]interface{}
  311. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  312. } else {
  313. }
  314. c.ServeSuccessJSON(map[string]interface{}{
  315. "pre": dat,
  316. "request_log": dat2,
  317. })
  318. }
  319. func (c *HBybController)Post5301(){
  320. org_name := c.GetString("org_name")
  321. doctor := c.GetString("doctor")
  322. fixmedins_code := c.GetString("fixmedins_code")
  323. insuplc_admdvs := c.GetString("insuplc_admdvs")
  324. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  325. secret_key := c.GetString("secret_key")
  326. psn_no := c.GetString("psn_no")
  327. result := service.Hbyb5301(psn_no,"",org_name, doctor,fixmedins_code,"",insuplc_admdvs,mdtrtarea_admvs,secret_key,"","")
  328. var dat map[string]interface{}
  329. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  330. fmt.Println(dat)
  331. } else {
  332. fmt.Println(err)
  333. }
  334. c.ServeSuccessJSON(map[string]interface{}{
  335. "pre": dat,
  336. })
  337. }
  338. func (c *HBybController)Post5262(){
  339. body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
  340. var respJSON map[string]interface{}
  341. if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  342. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  343. return
  344. }
  345. userJSONBytes, _ := json.Marshal(respJSON["bps"])
  346. var bps models.BusinessParams5262
  347. if err := json.Unmarshal(userJSONBytes, &bps); err != nil {
  348. utils.ErrorLog("解析失败:%v", err)
  349. return
  350. }
  351. var baseParams models.BaseParams
  352. baseParams.InsuplcAdmdvs = respJSON["insuplc_admdvs"].(string)
  353. baseParams.MdtrtareaAdmvs = respJSON["mdtrtarea_admvs"].(string)
  354. baseParams.OrgName = respJSON["org_name"].(string)
  355. baseParams.Doctor = respJSON["doctor"].(string)
  356. baseParams.FixmedinsCode = respJSON["fixmedins_code"].(string)
  357. page := respJSON["page"].(string)
  358. limit := respJSON["limit"].(string)
  359. result := service.Hbyb5262(baseParams, bps,page,limit)
  360. var dat map[string]interface{}
  361. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  362. fmt.Println(dat)
  363. } else {
  364. fmt.Println(err)
  365. }
  366. c.ServeSuccessJSON(map[string]interface{}{
  367. "pre": dat,
  368. })
  369. }
  370. func (c *HBybController)Post5267(){
  371. body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
  372. var respJSON map[string]interface{}
  373. if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  374. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  375. return
  376. }
  377. userJSONBytes, _ := json.Marshal(respJSON["bps"])
  378. var bps models.BusinessParams5262
  379. if err := json.Unmarshal(userJSONBytes, &bps); err != nil {
  380. utils.ErrorLog("解析失败:%v", err)
  381. return
  382. }
  383. var baseParams models.BaseParams
  384. baseParams.InsuplcAdmdvs = respJSON["insuplc_admdvs"].(string)
  385. baseParams.MdtrtareaAdmvs = respJSON["mdtrtarea_admvs"].(string)
  386. baseParams.OrgName = respJSON["org_name"].(string)
  387. baseParams.Doctor = respJSON["doctor"].(string)
  388. baseParams.FixmedinsCode = respJSON["fixmedins_code"].(string)
  389. page := respJSON["page"].(string)
  390. limit := respJSON["limit"].(string)
  391. result := service.Hbyb5267(baseParams, bps,page,limit)
  392. var dat map[string]interface{}
  393. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  394. fmt.Println(dat)
  395. } else {
  396. fmt.Println(err)
  397. }
  398. c.ServeSuccessJSON(map[string]interface{}{
  399. "pre": dat,
  400. })
  401. }
  402. func (c *HBybController) Post3202a() {
  403. body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
  404. var respJSON map[string]interface{}
  405. if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  406. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  407. return
  408. }
  409. userJSONBytes, _ := json.Marshal(respJSON["bps"])
  410. var bps []*models.BusinessParamsTwo
  411. if err := json.Unmarshal(userJSONBytes, &bps); err != nil {
  412. utils.ErrorLog("解析失败:%v", err)
  413. return
  414. }
  415. var baseParams models.BaseParams
  416. baseParams.InsuplcAdmdvs = respJSON["insuplc_admdvs"].(string)
  417. baseParams.MdtrtareaAdmvs = respJSON["mdtrtarea_admvs"].(string)
  418. baseParams.OrgName = respJSON["org_name"].(string)
  419. baseParams.Doctor = respJSON["doctor"].(string)
  420. baseParams.FixmedinsCode = respJSON["fixmedins_code"].(string)
  421. result := service.Hbyb3202a(baseParams, bps)
  422. var dat map[string]interface{}
  423. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  424. fmt.Println(dat)
  425. } else {
  426. fmt.Println(err)
  427. }
  428. c.ServeSuccessJSON(map[string]interface{}{
  429. "pre": dat,
  430. })
  431. }
  432. func (c *HBybController) Post1608() {
  433. body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
  434. var respJSON map[string]interface{}
  435. if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  436. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  437. return
  438. }
  439. var baseParams models.BaseParams
  440. baseParams.InsuplcAdmdvs = respJSON["insuplc_admdvs"].(string)
  441. baseParams.MdtrtareaAdmvs = respJSON["mdtrtarea_admvs"].(string)
  442. baseParams.OrgName = respJSON["org_name"].(string)
  443. baseParams.Doctor = respJSON["doctor"].(string)
  444. baseParams.FixmedinsCode = respJSON["fixmedins_code"].(string)
  445. cnt := respJSON["cnt"].(string)
  446. medfee_sumamt := respJSON["medfee_sumamt"].(string)
  447. func_smamt := respJSON["func_smamt"].(string)
  448. start_time := respJSON["start_time"].(string)
  449. end_time := respJSON["end_time"].(string)
  450. result := service.Hbyb1608(baseParams,cnt,medfee_sumamt,start_time,end_time,func_smamt)
  451. var dat map[string]interface{}
  452. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  453. fmt.Println(dat)
  454. } else {
  455. fmt.Println(err)
  456. }
  457. c.ServeSuccessJSON(map[string]interface{}{
  458. "pre": dat,
  459. })
  460. }
  461. func (c *HBybController) Post3202b() {
  462. body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
  463. var respJSON map[string]interface{}
  464. if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  465. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  466. return
  467. }
  468. userJSONBytes, _ := json.Marshal(respJSON["bps"])
  469. var bps []*models.BusinessParamsTwo
  470. if err := json.Unmarshal(userJSONBytes, &bps); err != nil {
  471. utils.ErrorLog("解析失败:%v", err)
  472. return
  473. }
  474. var baseParams models.BaseParams
  475. baseParams.InsuplcAdmdvs = respJSON["insuplc_admdvs"].(string)
  476. baseParams.MdtrtareaAdmvs = respJSON["mdtrtarea_admvs"].(string)
  477. baseParams.OrgName = respJSON["org_name"].(string)
  478. baseParams.Doctor = respJSON["doctor"].(string)
  479. baseParams.FixmedinsCode = respJSON["fixmedins_code"].(string)
  480. result := service.Hbyb3202b(baseParams, bps)
  481. var dat map[string]interface{}
  482. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  483. fmt.Println(dat)
  484. } else {
  485. fmt.Println(err)
  486. }
  487. c.ServeSuccessJSON(map[string]interface{}{
  488. "pre": dat,
  489. })
  490. }
  491. func (c *HBybController) Post4101() {
  492. body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
  493. var respJSON map[string]interface{}
  494. if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  495. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  496. return
  497. }
  498. userJSONBytes, _ := json.Marshal(respJSON["struct4101"])
  499. var struct4101 service.Struct4101
  500. if err := json.Unmarshal(userJSONBytes, &struct4101); err != nil {
  501. utils.ErrorLog("解析失败:%v", err)
  502. return
  503. }
  504. result, inputLog := service.Hbyb4101(struct4101, respJSON["secret_key"].(string), respJSON["org_name"].(string), respJSON["opera"].(string), respJSON["code"].(string), respJSON["insuplc_admdvs"].(string), respJSON["mdtrtarea_admvs"].(string))
  505. var dat map[string]interface{}
  506. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  507. } else {
  508. }
  509. var dat2 map[string]interface{}
  510. if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
  511. } else {
  512. }
  513. c.ServeSuccessJSON(map[string]interface{}{
  514. "pre": dat,
  515. "log": dat2,
  516. })
  517. }
  518. func (c *HBybController) Post2001() {
  519. org_name := c.GetString("org_name")
  520. doctor := c.GetString("doctor")
  521. fixmedins_code := c.GetString("fixmedins_code")
  522. insuplc_admdvs := c.GetString("insuplc_admdvs")
  523. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  524. secret_key := c.GetString("secret_key")
  525. psn_no := c.GetString("psn_no")
  526. insutype := c.GetString("insutype")
  527. med_type := c.GetString("med_type")
  528. result, inputLog := service.Hbyb2001(secret_key, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, psn_no, insutype, med_type)
  529. fmt.Println(result)
  530. fmt.Println(inputLog)
  531. var dat map[string]interface{}
  532. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  533. } else {
  534. }
  535. var dat2 map[string]interface{}
  536. if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
  537. } else {
  538. }
  539. c.ServeSuccessJSON(map[string]interface{}{
  540. "pre": dat,
  541. "log": dat2,
  542. })
  543. }
  544. func (c *HBybController) PostOne() {
  545. certNo := c.GetString("cert_no")
  546. org_name := c.GetString("org_name")
  547. doctor := c.GetString("doctor")
  548. fixmedins_code := c.GetString("fixmedins_code")
  549. insuplc_admdvs := c.GetString("insuplc_admdvs")
  550. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  551. secret_key := c.GetString("secret_key")
  552. id_card_type, _ := c.GetInt64("id_card_type")
  553. card_sn := c.GetString("card_sn")
  554. certificates := c.GetString("certificates")
  555. fmt.Println(certNo)
  556. fmt.Println(org_name)
  557. fmt.Println(doctor)
  558. fmt.Println(fixmedins_code)
  559. fmt.Println(insuplc_admdvs)
  560. fmt.Println(mdtrtarea_admvs)
  561. fmt.Println(secret_key)
  562. fmt.Println(id_card_type)
  563. fmt.Println(card_sn)
  564. fmt.Println(certificates)
  565. result, inputLog := service.Hbyb1101(certNo, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type, card_sn, certificates)
  566. fmt.Println(result)
  567. fmt.Println(inputLog)
  568. var dat map[string]interface{}
  569. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  570. } else {
  571. }
  572. var dat2 map[string]interface{}
  573. if err := json.Unmarshal([]byte(inputLog), &dat2); err == nil {
  574. } else {
  575. }
  576. c.ServeSuccessJSON(map[string]interface{}{
  577. "pre": dat,
  578. "log": dat2,
  579. })
  580. }
  581. func (c *HBybController) PostTwo() {
  582. psnNo := c.GetString("psn_no")
  583. insutype := c.GetString("insutype")
  584. certNo := c.GetString("cert_no")
  585. org_name := c.GetString("org_name")
  586. doctor := c.GetString("doctor")
  587. ipt_otp_no := c.GetString("ipt_otp_no")
  588. dept := c.GetString("dept")
  589. fixmedins_code := c.GetString("fixmedins_code")
  590. opter := c.GetString("opter")
  591. dept_code := c.GetString("dept_code")
  592. doctor_id := c.GetString("doctor_id")
  593. doctor_name := c.GetString("doctor_name")
  594. insuplc_admdvs := c.GetString("insuplc_admdvs")
  595. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  596. secret_key := c.GetString("secret_key")
  597. id_card_type, _ := c.GetInt64("id_card_type")
  598. result, _ := service.Hbyb2201(psnNo, insutype, certNo, org_name, doctor, ipt_otp_no, dept, fixmedins_code, dept_code, doctor_id, insuplc_admdvs, mdtrtarea_admvs, secret_key, id_card_type, opter, doctor_name)
  599. var dat map[string]interface{}
  600. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  601. //fmt.Println(dat["status"])
  602. } else {
  603. }
  604. c.ServeSuccessJSON(map[string]interface{}{
  605. "pre": dat,
  606. })
  607. }
  608. func (c *HBybController) PostThree() {
  609. psnNo := c.GetString("psn_no")
  610. mdtrtId := c.GetString("mdtrt_id")
  611. iptOtpNo := c.GetString("ipt_otp_no")
  612. org_name := c.GetString("org_name")
  613. doctor := c.GetString("doctor")
  614. insuplc_admdvs := c.GetString("insuplc_admdvs")
  615. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  616. secret_key := c.GetString("secret_key")
  617. fixmedins_code := c.GetString("fixmedins_code")
  618. result, requestLog := service.Hbyb2202(psnNo, mdtrtId, iptOtpNo, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code)
  619. var dat map[string]interface{}
  620. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  621. } else {
  622. }
  623. c.ServeSuccessJSON(map[string]interface{}{
  624. "pre": dat,
  625. "request_log": requestLog,
  626. })
  627. }
  628. func (c *HBybController) PostFour() {
  629. body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
  630. var respJSON map[string]interface{}
  631. if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  632. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  633. return
  634. }
  635. userJSONBytes, _ := json.Marshal(respJSON["config"])
  636. var config []*models.HisXtDiagnoseConfig
  637. if err := json.Unmarshal(userJSONBytes, &config); err != nil {
  638. utils.ErrorLog("解析失败:%v", err)
  639. return
  640. }
  641. psnNo := respJSON["psn_no"].(string)
  642. mdtrtId := respJSON["mdtrt_id"].(string)
  643. opter := respJSON["opter"].(string)
  644. org_name := respJSON["org_name"].(string)
  645. med_type := respJSON["med_type"].(string)
  646. doctor_id := respJSON["doctor_id"].(string)
  647. doctor_name := respJSON["doctor_name"].(string)
  648. department := respJSON["department"].(string)
  649. fixmedins_code := respJSON["fixmedins_code"].(string)
  650. insuplc_admdvs := respJSON["insuplc_admdvs"].(string)
  651. mdtrtarea_admvs := respJSON["mdtrtarea_admvs"].(string)
  652. secret_key := respJSON["secret_key"].(string)
  653. sick_code := respJSON["sick_code"].(string)
  654. sick_name := respJSON["sick_name"].(string)
  655. dept := respJSON["dept"].(string)
  656. begin_time := respJSON["begin_time"].(string)
  657. result, request_log := service.Hbyb2203(psnNo, mdtrtId, dept, department, org_name, med_type, doctor_id, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, sick_code, sick_name, dept, config, begin_time, doctor_name, opter)
  658. fmt.Println(request_log)
  659. var dat map[string]interface{}
  660. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  661. } else {
  662. }
  663. c.ServeSuccessJSON(map[string]interface{}{
  664. "pre": dat,
  665. })
  666. }
  667. type All struct {
  668. HisPrescription HisPrescription
  669. mdtrt_id string
  670. psn_no string
  671. }
  672. type HisPrescription struct {
  673. ID int64 `gorm:"column:id" json:"id" form:"id"`
  674. UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
  675. RecordDate int64 `gorm:"column:record_date" json:"record_date" form:"record_date"`
  676. PatientId int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
  677. HisPatientId int64 `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
  678. Status int64 `gorm:"column:status" json:"status" form:"status"`
  679. Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
  680. Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
  681. Number string `gorm:"column:number" json:"number" form:"number"`
  682. Type int64 `gorm:"column:type" json:"type" form:"type"`
  683. Doctor int64 `gorm:"column:doctor" json:"doctor" form:"doctor"`
  684. Creator int64 `gorm:"column:creator" json:"creator" form:"creator"`
  685. Modifier int64 `gorm:"column:modifier" json:"modifier" form:"modifier"`
  686. HisDoctorAdviceInfo []*models.HisDoctorAdviceInfo `gorm:"ForeignKey:PatientId,RecordDate,PrescriptionId;AssociationForeignKey:PatientId,RecordDate,ID" json:"advices"`
  687. HisPrescriptionProject []*models.HisPrescriptionProject `gorm:"ForeignKey:PatientId,RecordDate,PrescriptionId;AssociationForeignKey:PatientId,RecordDate,ID" json:"project"`
  688. }
  689. func (c *HBybController) PostFive() {
  690. body, _ := ioutil.ReadAll(c.Ctx.Request.Body)
  691. var respJSON map[string]interface{}
  692. if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  693. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  694. return
  695. }
  696. userJSONBytes, _ := json.Marshal(respJSON["pre"])
  697. var hp []*models.HisPrescription
  698. if err := json.Unmarshal(userJSONBytes, &hp); err != nil {
  699. utils.ErrorLog("解析失败:%v", err)
  700. return
  701. }
  702. fmt.Println(respJSON["psn_no"].(string))
  703. fmt.Println(respJSON["mdtrt_id"].(string))
  704. fmt.Println(respJSON["chrg_bchno"].(string))
  705. fmt.Println(respJSON["org_name"].(string))
  706. fmt.Println(respJSON["doctor"].(string))
  707. fmt.Println(respJSON["doctor_id"].(string))
  708. fmt.Println(respJSON["dept"].(string))
  709. fmt.Println(respJSON["fixmedins_code"].(string))
  710. fmt.Println(respJSON["dept_code"].(string))
  711. fmt.Println(respJSON["balance_accounts_type"].(string))
  712. fmt.Println("1111111")
  713. fmt.Println(respJSON["opter"].(string))
  714. fmt.Println(respJSON["insuplc_admdvs"].(string))
  715. fmt.Println(respJSON["mdtrtarea_admvs"].(string))
  716. fmt.Println(respJSON["secret_key"].(string))
  717. result, requestLog := service.Hbyb2204(respJSON["psn_no"].(string), respJSON["mdtrt_id"].(string), hp, respJSON["chrg_bchno"].(string), respJSON["org_name"].(string),
  718. respJSON["doctor"].(string), respJSON["dept"].(string), respJSON["fixmedins_code"].(string), respJSON["dept_code"].(string), respJSON["doctor_id"].(string), respJSON["insuplc_admdvs"].(string), respJSON["mdtrtarea_admvs"].(string), respJSON["secret_key"].(string), respJSON["balance_accounts_type"].(string), respJSON["opter"].(string))
  719. var dat map[string]interface{}
  720. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  721. fmt.Println(dat)
  722. } else {
  723. fmt.Println(err)
  724. }
  725. var dat2 map[string]interface{}
  726. if err := json.Unmarshal([]byte(requestLog), &dat2); err == nil {
  727. fmt.Println(dat2)
  728. } else {
  729. fmt.Println(err)
  730. }
  731. c.ServeSuccessJSON(map[string]interface{}{
  732. "pre": dat,
  733. "request_log": requestLog,
  734. })
  735. }
  736. func (c *HBybController) PostSix() {
  737. psnNo := c.GetString("psn_no")
  738. mdtrtId := c.GetString("mdtrt_id")
  739. chrgBchno := c.GetString("chrg_bchno")
  740. org_name := c.GetString("org_name")
  741. doctor := c.GetString("doctor")
  742. insuplc_admdvs := c.GetString("insuplc_admdvs")
  743. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  744. secret_key := c.GetString("secret_key")
  745. fixmedins_code := c.GetString("fixmedins_code")
  746. result, requestlog := service.Hbyb2205(psnNo, mdtrtId, chrgBchno, org_name, doctor, insuplc_admdvs, mdtrtarea_admvs, secret_key, fixmedins_code)
  747. fmt.Println(requestlog)
  748. var dat map[string]interface{}
  749. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  750. fmt.Println(dat)
  751. } else {
  752. fmt.Println(err)
  753. }
  754. c.ServeSuccessJSON(map[string]interface{}{
  755. "pre": dat,
  756. })
  757. }
  758. func (c *HBybController) PostSeven() {
  759. psnNo := c.GetString("psn_no")
  760. mdtrtId := c.GetString("mdtrt_id")
  761. chrgBchno := c.GetString("chrg_bchno")
  762. certNo := c.GetString("cert_no")
  763. insutype := c.GetString("insutype")
  764. total := c.GetString("total")
  765. org_name := c.GetString("org_name")
  766. doctor := c.GetString("doctor")
  767. fixmedins_code := c.GetString("fixmedins_code")
  768. insuplc_admdvs := c.GetString("insuplc_admdvs")
  769. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  770. secret_key := c.GetString("secret_key")
  771. med_type := c.GetString("med_type")
  772. id_card_type, _ := c.GetInt64("id_card_type")
  773. certificates, _ := c.GetInt64("certificates")
  774. result, requestlog := service.Hbyb2206(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type, 0, 0, 0, 0, certificates)
  775. fmt.Println(requestlog)
  776. var dat map[string]interface{}
  777. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  778. fmt.Println(dat)
  779. } else {
  780. fmt.Println(err)
  781. }
  782. c.ServeSuccessJSON(map[string]interface{}{
  783. "pre": dat,
  784. })
  785. }
  786. func (c *HBybController) PostEight() {
  787. psnNo := c.GetString("psn_no")
  788. mdtrtId := c.GetString("mdtrt_id")
  789. chrgBchno := c.GetString("chrg_bchno")
  790. certNo := c.GetString("cert_no")
  791. insutype := c.GetString("insutype")
  792. total := c.GetString("total")
  793. org_name := c.GetString("org_name")
  794. doctor := c.GetString("doctor")
  795. fixmedins_code := c.GetString("fixmedins_code")
  796. insuplc_admdvs := c.GetString("insuplc_admdvs")
  797. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  798. secret_key := c.GetString("secret_key")
  799. med_type := c.GetString("med_type")
  800. id_card_type, _ := c.GetInt64("id_card_type")
  801. certificates, _ := c.GetInt64("certificates")
  802. fulamt_ownpay_amt, _ := c.GetFloat("fulamt_ownpay_amt")
  803. overlmt_selfpay, _ := c.GetFloat("overlmt_selfpay")
  804. preselfpay_amt, _ := c.GetFloat("preselfpay_amt")
  805. inscp_scp_amt, _ := c.GetFloat("inscp_scp_amt")
  806. acct_used_flag, _ := c.GetInt64("acct_used_flag")
  807. result, srcRequest := service.Hbyb2207(psnNo, mdtrtId, chrgBchno, certNo, insutype, total, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, med_type, id_card_type, fulamt_ownpay_amt, overlmt_selfpay, preselfpay_amt, inscp_scp_amt, certificates, acct_used_flag)
  808. var dat map[string]interface{}
  809. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  810. fmt.Println(dat)
  811. } else {
  812. fmt.Println(err)
  813. }
  814. var dat2 map[string]interface{}
  815. if err := json.Unmarshal([]byte(srcRequest), &dat2); err == nil {
  816. fmt.Println(dat2)
  817. } else {
  818. fmt.Println(err)
  819. }
  820. c.ServeSuccessJSON(map[string]interface{}{
  821. "pre": dat,
  822. "pre2": dat2,
  823. })
  824. }
  825. func (c *HBybController) PostNine() {
  826. psnNo := c.GetString("psn_no")
  827. mdtrtId := c.GetString("mdtrt_id")
  828. setlId := c.GetString("setl_id")
  829. org_name := c.GetString("org_name")
  830. doctor := c.GetString("doctor")
  831. secret_key := c.GetString("secret_key")
  832. fixmedins_code := c.GetString("fixmedins_code")
  833. insuplc_admdvs := c.GetString("insuplc_admdvs")
  834. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  835. result, src_request := service.Hbyb2208(psnNo, mdtrtId, setlId, org_name, doctor, secret_key, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  836. fmt.Println(src_request)
  837. var dat map[string]interface{}
  838. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  839. fmt.Println(dat)
  840. } else {
  841. fmt.Println(err)
  842. }
  843. c.ServeSuccessJSON(map[string]interface{}{
  844. "pre": dat,
  845. })
  846. }
  847. func (c *HBybController) PostTen() {
  848. psnNo := c.GetString("psn_no")
  849. mdtrtId := c.GetString("mdtrt_id")
  850. setlId := c.GetString("setl_id")
  851. org_name := c.GetString("org_name")
  852. doctor := c.GetString("doctor")
  853. med_type := c.GetString("med_type")
  854. secret_key := c.GetString("secret_key")
  855. fixmedins_code := c.GetString("fixmedins_code")
  856. insuplc_admdvs := c.GetString("insuplc_admdvs")
  857. mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
  858. baseParams := models.BaseParams{
  859. SecretKey: secret_key,
  860. FixmedinsCode: fixmedins_code,
  861. InsuplcAdmdvs: insuplc_admdvs,
  862. MdtrtareaAdmvs: mdtrtarea_admvs,
  863. OrgName: org_name,
  864. Doctor: doctor,
  865. }
  866. businessParams := models.BusinessParams{
  867. PsnNo: psnNo,
  868. MdtrtId: mdtrtId,
  869. SetlId: setlId,
  870. }
  871. var result string
  872. if mdtrtarea_admvs == "421182"{
  873. result = service.Hbyb5203(baseParams, businessParams,med_type)
  874. }else{
  875. result = service.Hbyb5203aa(baseParams, businessParams)
  876. }
  877. var dat map[string]interface{}
  878. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  879. fmt.Println(dat)
  880. } else {
  881. fmt.Println(err)
  882. }
  883. c.ServeSuccessJSON(map[string]interface{}{
  884. "pre": dat,
  885. })
  886. }
  887. func saveJsLog(result string, request string, infno string, desc string, org_name string) {
  888. //org_id, _ := beego.AppConfig.Int64("org_id")
  889. //miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
  890. dir := org_name + "日志"
  891. utils.Mkdir(dir)
  892. month := time.Unix(1557042972, 0).Format("1")
  893. year := time.Now().Format("2006")
  894. month = time.Now().Format("01")
  895. day := time.Now().Format("02")
  896. hour := time.Now().Format("15")
  897. min := time.Now().Format("04")
  898. sec := time.Now().Format("05")
  899. result_time := year + "-" + month + "-" + day + " " + hour + ":" + min + ":" + sec
  900. file := org_name + "_" + year + month + day + "_log"
  901. file_name := file + ".txt"
  902. file_path := org_name + "日志" + "/" + file_name
  903. exist, _ := utils.PathExists(file_path)
  904. if exist { //存在
  905. fmt.Println("存在")
  906. f, err := os.OpenFile(file_path, os.O_WRONLY, 0644)
  907. if err != nil {
  908. fmt.Println("read fail")
  909. }
  910. content := "\r\n" + "\r\n" + "\r\n" + result_time + " " + "【 " + desc + infno + "入参" + " 】:" + "\r\n" + request + "\r\n" + result_time + " " + "【 " + desc + infno + "出参" + " 】:" + "\r\n" + result
  911. n, _ := f.Seek(0, 2)
  912. _, err = f.WriteAt([]byte(content), n)
  913. } else { //不存在
  914. fmt.Println("文件不存在,创建文件")
  915. f, err := os.Create(org_name + "日志" + "/" + file_name)
  916. defer f.Close()
  917. if err != nil {
  918. } else {
  919. _, err = f.Write([]byte("记录日志"))
  920. }
  921. }
  922. }