ah_dianzichufang.go 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751
  1. package service
  2. import (
  3. "bytes"
  4. "encoding/json"
  5. "fmt"
  6. "gdyb/models"
  7. "io/ioutil"
  8. "net/http"
  9. "strconv"
  10. "time"
  11. )
  12. func GetAHCFYLJG001(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG001 models.CFYLJG001, isu string) (string, string) {
  13. //生成签名
  14. nonce := GetRandomString(32)
  15. timestamp := time.Now().Unix()
  16. signature := setSignature(timestamp, nonce, secret_key)
  17. //生成输入报文
  18. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  19. //input := make(map[string]interface{})
  20. inputData := make(map[string]interface{}, 0)
  21. inputMessage["infno"] = "CFYLJG001"
  22. inputData["mdtrt_cert_type"] = cFYLJG001.MdtrtCertType
  23. inputData["mdtrt_cert_no"] = cFYLJG001.MdtrtCertNo
  24. inputData["card_sn"] = cFYLJG001.CardSn
  25. inputData["ec_token"] = cFYLJG001.EcToken
  26. inputData["auth_no"] = cFYLJG001.AuthNo
  27. inputData["biz_type_code"] = cFYLJG001.BizTypeCode
  28. inputData["insu_admdvs"] = cFYLJG001.InsuAdmdvs
  29. inputData["hosp_rxno"] = cFYLJG001.HospRxno
  30. inputData["init_rxno"] = cFYLJG001.InitRxno
  31. inputData["rx_type_code"] = cFYLJG001.RxTypeCode
  32. inputData["prsc_time"] = cFYLJG001.PrscTime
  33. inputData["rx_drug_cnt"] = cFYLJG001.RxDrugCnt
  34. inputData["rx_used_way_codg"] = cFYLJG001.RxUsedWayCodg
  35. inputData["rx_used_way_name"] = cFYLJG001.RxUsedWayName
  36. inputData["rx_frqu_codg"] = cFYLJG001.RxFrquCodg
  37. inputData["rx_frqu_name"] = cFYLJG001.RxFrquName
  38. inputData["rx_dosunt"] = cFYLJG001.RxDosunt
  39. inputData["rx_doscnt"] = cFYLJG001.RxDoscnt
  40. inputData["rx_drord_dscr"] = cFYLJG001.RxDrordDscr
  41. inputData["vali_days"] = cFYLJG001.ValiDays
  42. inputData["vali_end_time"] = cFYLJG001.ValiEndTime
  43. inputData["rept_flag"] = cFYLJG001.ReptFlag
  44. inputData["max_rept_cnt"] = cFYLJG001.MaxReptCnt
  45. inputData["reptd_cnt"] = cFYLJG001.ReptdCnt
  46. inputData["min_inrv_days"] = cFYLJG001.MinInrvDays
  47. inputData["rx_cotn_flag"] = cFYLJG001.RxCotnFlag
  48. inputData["long_rx_flag"] = cFYLJG001.LongRxFlag
  49. inputData["mdtrtareaNo"] = cFYLJG001.MdtrtareaNo
  50. rxdrugdetail := make([]map[string]interface{}, 0)
  51. rxdrug := make(map[string]interface{})
  52. for _, item := range cFYLJG001.List {
  53. rxdrug["med_list_codg"] = item.MedListCodg
  54. rxdrug["medins_list_codg"] = item.MedinsListCodg
  55. rxdrug["hosp_prep_flag"] = item.HospPrepFlag
  56. rxdrug["rx_item_type_code"] = item.RxItemTypeCode
  57. rxdrug["rx_item_type_name"] = item.RxItemTypeName
  58. rxdrug["tcmdrug_type_name"] = item.TcmdrugTypeName
  59. rxdrug["tcmdrug_type_code"] = item.TcmdrugTypeCode
  60. rxdrug["tcmherb_foote"] = item.TcmherbFoote
  61. rxdrug["medn_type_code"] = item.MednTypeCode
  62. rxdrug["medn_type_name"] = item.MednTypeName
  63. rxdrug["main_medc_flag"] = item.MainMedcFlag
  64. rxdrug["urgt_flag"] = item.UrgtFlag
  65. rxdrug["bas_medn_flag"] = item.BasMednFlag
  66. rxdrug["imp_drug_flag"] = item.ImpDrugFlag
  67. rxdrug["drug_prodname"] = item.DrugProdname
  68. rxdrug["genname_codg"] = item.GennameCodg
  69. rxdrug["drug_genname"] = item.DrugGenname
  70. rxdrug["drug_dosform"] = item.DrugDosform
  71. rxdrug["drug_spec"] = item.DrugSpec
  72. rxdrug["prdr_name"] = item.PrdrName
  73. rxdrug["medc_way_codg"] = item.MedcWayCodg
  74. rxdrug["medc_way_dscr"] = item.MedcWayDscr
  75. rxdrug["medc_begntime"] = item.MedcBegntime
  76. rxdrug["medc_endtime"] = item.MedcEndtime
  77. rxdrug["medc_days"] = item.MedcDays
  78. rxdrug["drug_pric"] = item.DrugPric
  79. rxdrug["drug_sumamt"] = item.DrugSumamt
  80. rxdrug["drug_cnt"] = item.DrugCnt
  81. rxdrug["drug_dosunt"] = item.DrugDosunt
  82. rxdrug["sin_doscnt"] = item.SinDoscnt
  83. rxdrug["sin_dosunt"] = item.SinDosunt
  84. rxdrug["used_frqu_codg"] = item.UsedFrquCodg
  85. rxdrug["used_frqu_name"] = item.UsedFrquName
  86. rxdrug["drug_totlcnt"] = item.DrugTotlcnt
  87. rxdrug["drug_totlcnt_emp"] = item.DrugTotlcntEmp
  88. rxdrug["hosp_appr_flag"] = item.HospApprFlag
  89. //rxdrug["extras"] = ""
  90. rxdrugdetail = append(rxdrugdetail, rxdrug)
  91. }
  92. inputData["rxdrugdetail"] = rxdrugdetail
  93. mdtrtinfo := make(map[string]interface{})
  94. mdtrtinfo["fixmedins_code"] = cFYLJG001.Mdtrtinfo.FixmedinsCode
  95. mdtrtinfo["fixmedins_name"] = cFYLJG001.Mdtrtinfo.FixmedinsName
  96. mdtrtinfo["mdtrt_id"] = cFYLJG001.Mdtrtinfo.MdtrtID
  97. mdtrtinfo["med_type"] = cFYLJG001.Mdtrtinfo.MedType
  98. mdtrtinfo["ipt_otp_no"] = cFYLJG001.Mdtrtinfo.IptOtpNo
  99. mdtrtinfo["otp_ipt_flag"] = cFYLJG001.Mdtrtinfo.OtpIptFlag
  100. mdtrtinfo["psn_no"] = cFYLJG001.Mdtrtinfo.PsnNo
  101. mdtrtinfo["patn_name"] = cFYLJG001.Mdtrtinfo.PatnName
  102. mdtrtinfo["psn_cert_type"] = cFYLJG001.Mdtrtinfo.PsnCertType
  103. mdtrtinfo["certno"] = cFYLJG001.Mdtrtinfo.Certno
  104. mdtrtinfo["patn_age"] = cFYLJG001.Mdtrtinfo.PatnAge
  105. mdtrtinfo["patn_hgt"] = cFYLJG001.Mdtrtinfo.PatnHgt
  106. mdtrtinfo["patn_wt"] = cFYLJG001.Mdtrtinfo.PatnWt
  107. mdtrtinfo["gend"] = cFYLJG001.Mdtrtinfo.Gend
  108. mdtrtinfo["birctrlType"] = cFYLJG001.Mdtrtinfo.BirctrlType
  109. mdtrtinfo["birctrlMatnDate"] = cFYLJG001.Mdtrtinfo.BirctrlMatnDate
  110. mdtrtinfo["matnType"] = cFYLJG001.Mdtrtinfo.MatnType
  111. mdtrtinfo["geso_val"] = cFYLJG001.Mdtrtinfo.GesoVal
  112. mdtrtinfo["nwb_flag"] = cFYLJG001.Mdtrtinfo.NwbFlag
  113. mdtrtinfo["nwb_age"] = cFYLJG001.Mdtrtinfo.NwbAge
  114. mdtrtinfo["suck_prd_flag"] = cFYLJG001.Mdtrtinfo.SuckPrdFlag
  115. mdtrtinfo["algs_his"] = cFYLJG001.Mdtrtinfo.AlgsHis
  116. mdtrtinfo["prsc_dept_name"] = cFYLJG001.Mdtrtinfo.PrscDeptName
  117. mdtrtinfo["prsc_dept_code"] = cFYLJG001.Mdtrtinfo.PrscDeptCode
  118. mdtrtinfo["dr_code"] = cFYLJG001.Mdtrtinfo.DrCode
  119. mdtrtinfo["prsc_dr_name"] = cFYLJG001.Mdtrtinfo.PrscDrName
  120. mdtrtinfo["prsc_dr_cert_type"] = cFYLJG001.Mdtrtinfo.PrscDrCertType
  121. mdtrtinfo["prsc_dr_certno"] = cFYLJG001.Mdtrtinfo.PrscDrCertno
  122. mdtrtinfo["dr_profttl_codg"] = cFYLJG001.Mdtrtinfo.DrProfttlCodg
  123. mdtrtinfo["dr_profttl_name"] = cFYLJG001.Mdtrtinfo.DrProfttlName
  124. mdtrtinfo["dr_dept_code"] = cFYLJG001.Mdtrtinfo.DrDeptCode
  125. mdtrtinfo["dr_dept_name"] = cFYLJG001.Mdtrtinfo.DrDeptName
  126. mdtrtinfo["caty"] = cFYLJG001.Mdtrtinfo.Caty
  127. mdtrtinfo["mdtrt_time"] = cFYLJG001.Mdtrtinfo.MdtrtTime
  128. mdtrtinfo["dise_codg"] = cFYLJG001.Mdtrtinfo.DiseCodg
  129. mdtrtinfo["dise_name"] = cFYLJG001.Mdtrtinfo.DiseName
  130. mdtrtinfo["sp_dise_flag"] = cFYLJG001.Mdtrtinfo.SpDiseFlag
  131. mdtrtinfo["maindiag_code"] = cFYLJG001.Mdtrtinfo.MaindiagCode
  132. mdtrtinfo["maindiag_name"] = cFYLJG001.Mdtrtinfo.MaindiagName
  133. mdtrtinfo["dise_cond_dscr"] = cFYLJG001.Mdtrtinfo.DiseCondDscr
  134. mdtrtinfo["hi_feesetl_flag"] = cFYLJG001.Mdtrtinfo.HiFeesetlFlag
  135. mdtrtinfo["hi_feesetl_name"] = cFYLJG001.Mdtrtinfo.HiFeesetlName
  136. mdtrtinfo["rgst_fee"] = cFYLJG001.Mdtrtinfo.RgstFee
  137. mdtrtinfo["medfee_sumamt"] = cFYLJG001.Mdtrtinfo.MedfeeSumamt
  138. mdtrtinfo["fstdiag_flag"] = cFYLJG001.Mdtrtinfo.FstdiagFlag
  139. type MyData struct {
  140. Insutype string `json:"insutype"`
  141. }
  142. data := MyData{
  143. Insutype: isu,
  144. }
  145. mdtrtinfo["extras"] = data
  146. inputData["mdtrtinfo"] = mdtrtinfo
  147. diseinfos := make([]map[string]interface{}, 0)
  148. for _, item := range cFYLJG001.Diseinfo {
  149. diseinfo := make(map[string]interface{})
  150. diseinfo["diag_type"] = item.DiagType
  151. diseinfo["maindiag_flag"] = item.MaindiagFlag
  152. diseinfo["diag_srt_no"] = item.DiagSrtNo
  153. diseinfo["diag_code"] = item.DiagCode
  154. diseinfo["diag_name"] = item.DiagName
  155. diseinfo["diag_dept"] = item.DiagDept
  156. diseinfo["diag_dr_no"] = item.DiagDrNo
  157. diseinfo["diag_dr_name"] = item.DiagDrName
  158. diseinfo["diag_time"] = item.DiagTime
  159. diseinfo["tcm_dise_code"] = item.TcmDiseCode
  160. diseinfo["tcm_dise_name"] = item.TcmDiseName
  161. diseinfo["tcmsymp_code"] = item.TcmsympCode
  162. diseinfo["tcmsymp"] = item.Tcmsymp
  163. diseinfos = append(diseinfos, diseinfo)
  164. }
  165. inputData["diseinfo"] = diseinfos
  166. inputMessage["input"] = inputData
  167. var inputLog string
  168. bytesData, err := json.Marshal(inputMessage)
  169. inputLog = string(bytesData)
  170. fmt.Println(string(bytesData))
  171. if err != nil {
  172. fmt.Println(err.Error())
  173. return err.Error(), ""
  174. }
  175. reader := bytes.NewReader(bytesData)
  176. gdyb_url := beego.AppConfig.String("gdyb_url")
  177. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  178. var url string
  179. if fixmedins_code == "H15049901371" {
  180. url = gdyb_url
  181. } else {
  182. url = gdyb_url + "CFYLJG001"
  183. }
  184. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  185. request, err := http.NewRequest("POST", url, reader)
  186. if err != nil {
  187. fmt.Println(err.Error())
  188. return err.Error(), ""
  189. }
  190. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  191. request.Header.Set("x-tif-paasid", gdyb_paasid)
  192. request.Header.Set("x-tif-signature", signature)
  193. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  194. request.Header.Set("x-tif-nonce", nonce)
  195. client := http.Client{}
  196. resp, err := client.Do(request)
  197. if err != nil {
  198. fmt.Println(err.Error())
  199. return err.Error(), ""
  200. }
  201. respBytes, err := ioutil.ReadAll(resp.Body)
  202. if err != nil {
  203. fmt.Println(err.Error())
  204. return err.Error(), ""
  205. }
  206. fmt.Println(string(respBytes))
  207. str := string(respBytes)
  208. return str, inputLog
  209. }
  210. func GetAHCFYLJG002(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, original_value string, original_rx_file string, extras string) (string, string) {
  211. //生成签名
  212. nonce := GetRandomString(32)
  213. timestamp := time.Now().Unix()
  214. signature := setSignature(timestamp, nonce, secret_key)
  215. //生成输入报文
  216. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  217. inputData := make(map[string]interface{})
  218. inputDatas := make(map[string]interface{})
  219. inputMessage["infno"] = "CFYLJG002"
  220. inputData["fixmedins_code"] = fixmedins_code
  221. inputData["original_value"] = original_value
  222. inputData["original_rx_file"] = original_rx_file
  223. inputData["extras"] = extras
  224. inputDatas["rx_sign_info"] = inputData
  225. inputMessage["input"] = inputDatas
  226. var inputLog string
  227. bytesData, err := json.Marshal(inputMessage)
  228. inputLog = string(bytesData)
  229. fmt.Println(string(bytesData))
  230. if err != nil {
  231. fmt.Println(err.Error())
  232. return err.Error(), ""
  233. }
  234. reader := bytes.NewReader(bytesData)
  235. gdyb_url := beego.AppConfig.String("gdyb_url")
  236. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  237. var url string
  238. if fixmedins_code == "H15049901371" {
  239. url = gdyb_url
  240. } else {
  241. url = gdyb_url + "CFYLJG002"
  242. }
  243. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  244. request, err := http.NewRequest("POST", url, reader)
  245. if err != nil {
  246. fmt.Println(err.Error())
  247. return err.Error(), ""
  248. }
  249. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  250. request.Header.Set("x-tif-paasid", gdyb_paasid)
  251. request.Header.Set("x-tif-signature", signature)
  252. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  253. request.Header.Set("x-tif-nonce", nonce)
  254. client := http.Client{}
  255. resp, err := client.Do(request)
  256. if err != nil {
  257. fmt.Println(err.Error())
  258. return err.Error(), ""
  259. }
  260. respBytes, err := ioutil.ReadAll(resp.Body)
  261. if err != nil {
  262. fmt.Println(err.Error())
  263. return err.Error(), ""
  264. }
  265. fmt.Println(string(respBytes))
  266. str := string(respBytes)
  267. return str, inputLog
  268. }
  269. func GetAHCFYLJG003(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG003 models.CFYLJG003) (string, string) {
  270. //生成签名
  271. nonce := GetRandomString(32)
  272. timestamp := time.Now().Unix()
  273. signature := setSignature(timestamp, nonce, secret_key)
  274. //生成输入报文
  275. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  276. //input := make(map[string]interface{})
  277. inputData := make(map[string]interface{})
  278. inputData2 := make(map[string]interface{})
  279. inputMessage["infno"] = "CFYLJG003"
  280. inputData["rx_trace_code"] = cFYLJG003.RxTraceCode
  281. inputData["hi_rxno"] = cFYLJG003.HiRxno
  282. inputData["mdtrt_id"] = cFYLJG003.MdtrtID
  283. inputData["patn_name"] = cFYLJG003.PatnName
  284. inputData["psn_cert_type"] = cFYLJG003.PsnCertType
  285. inputData["certno"] = cFYLJG003.Certno
  286. inputData["fixmedins_name"] = cFYLJG003.FixmedinsName
  287. inputData["fixmedins_code"] = cFYLJG003.FixmedinsCode
  288. inputData["dr_code"] = cFYLJG003.DrCode
  289. inputData["prsc_dr_name"] = cFYLJG003.PrscDrName
  290. inputData["phar_dept_name"] = cFYLJG003.PharDeptName
  291. inputData["phar_dept_code"] = cFYLJG003.PharDeptCode
  292. inputData["phar_profttl_codg"] = cFYLJG003.PharProfttlCodg
  293. inputData["phar_profttl_name"] = cFYLJG003.PharProfttlName
  294. inputData["phar_code"] = cFYLJG003.PharCode
  295. inputData["rx_frqu_name"] = cFYLJG003.RxFrquName
  296. inputData["phar_cert_type"] = cFYLJG003.PsnCertType
  297. inputData["phar_certno"] = cFYLJG003.PharCertno
  298. inputData["phar_name"] = cFYLJG003.PharName
  299. inputData["phar_prac_cert_no"] = cFYLJG003.PharPracCertNo
  300. inputData["phar_chk_time"] = cFYLJG003.PharChkTime
  301. inputData["rx_file"] = cFYLJG003.RxFile
  302. inputData["sign_digest"] = cFYLJG003.SignDigest
  303. inputData2["rx_upload_info"] = inputData
  304. inputMessage["input"] = inputData2
  305. var inputLog string
  306. bytesData, err := json.Marshal(inputMessage)
  307. inputLog = string(bytesData)
  308. fmt.Println(string(bytesData))
  309. if err != nil {
  310. fmt.Println(err.Error())
  311. return err.Error(), ""
  312. }
  313. reader := bytes.NewReader(bytesData)
  314. gdyb_url := beego.AppConfig.String("gdyb_url")
  315. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  316. var url string
  317. if fixmedins_code == "H15049901371" {
  318. url = gdyb_url
  319. } else {
  320. url = gdyb_url + "CFYLJG003"
  321. }
  322. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  323. request, err := http.NewRequest("POST", url, reader)
  324. if err != nil {
  325. fmt.Println(err.Error())
  326. return err.Error(), ""
  327. }
  328. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  329. request.Header.Set("x-tif-paasid", gdyb_paasid)
  330. request.Header.Set("x-tif-signature", signature)
  331. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  332. request.Header.Set("x-tif-nonce", nonce)
  333. client := http.Client{}
  334. resp, err := client.Do(request)
  335. if err != nil {
  336. fmt.Println(err.Error())
  337. return err.Error(), ""
  338. }
  339. respBytes, err := ioutil.ReadAll(resp.Body)
  340. if err != nil {
  341. fmt.Println(err.Error())
  342. return err.Error(), ""
  343. }
  344. fmt.Println(string(respBytes))
  345. str := string(respBytes)
  346. return str, inputLog
  347. }
  348. func GetAHCFYLJG004(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG004 models.CFYLJG004) (string, string) {
  349. //生成签名
  350. nonce := GetRandomString(32)
  351. timestamp := time.Now().Unix()
  352. signature := setSignature(timestamp, nonce, secret_key)
  353. //生成输入报文
  354. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  355. inputData := make(map[string]interface{})
  356. inputData1 := make(map[string]interface{})
  357. //inputDatas := make([]map[string]interface{}, 0)
  358. inputMessage["infno"] = "CFYLJG004"
  359. inputData["hi_rxno"] = cFYLJG004.HiRxno
  360. inputData["undo_dr_code"] = cFYLJG004.UndoDrCode
  361. inputData["undo_dr_name"] = cFYLJG004.UndoDrName
  362. inputData["undo_dr_cert_type"] = cFYLJG004.UndoDrCertType
  363. inputData["undo_dr_certno"] = cFYLJG004.UndoDrCertno
  364. inputData["undo_rea"] = cFYLJG004.UndoRea
  365. inputData["undo_time"] = cFYLJG004.UndoTime
  366. inputData["fixmedins_code"] = cFYLJG004.FixmedinsCode
  367. inputData1["rx_cancel_info"] = inputData
  368. inputMessage["input"] = inputData1
  369. var inputLog string
  370. bytesData, err := json.Marshal(inputMessage)
  371. inputLog = string(bytesData)
  372. fmt.Println(string(bytesData))
  373. if err != nil {
  374. fmt.Println(err.Error())
  375. return err.Error(), ""
  376. }
  377. reader := bytes.NewReader(bytesData)
  378. gdyb_url := beego.AppConfig.String("gdyb_url")
  379. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  380. var url string
  381. if fixmedins_code == "H15049901371" {
  382. url = gdyb_url
  383. } else {
  384. url = gdyb_url + "CFYLJG004"
  385. }
  386. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  387. request, err := http.NewRequest("POST", url, reader)
  388. if err != nil {
  389. fmt.Println(err.Error())
  390. return err.Error(), ""
  391. }
  392. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  393. request.Header.Set("x-tif-paasid", gdyb_paasid)
  394. request.Header.Set("x-tif-signature", signature)
  395. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  396. request.Header.Set("x-tif-nonce", nonce)
  397. client := http.Client{}
  398. resp, err := client.Do(request)
  399. if err != nil {
  400. fmt.Println(err.Error())
  401. return err.Error(), ""
  402. }
  403. respBytes, err := ioutil.ReadAll(resp.Body)
  404. if err != nil {
  405. fmt.Println(err.Error())
  406. return err.Error(), ""
  407. }
  408. fmt.Println(string(respBytes))
  409. str := string(respBytes)
  410. return str, inputLog
  411. }
  412. func GetAHCFYLJG005(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG005 models.CFYLJG005) (string, string) {
  413. //生成签名
  414. nonce := GetRandomString(32)
  415. timestamp := time.Now().Unix()
  416. signature := setSignature(timestamp, nonce, secret_key)
  417. //生成输入报文
  418. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  419. inputData := make(map[string]interface{})
  420. inputData2 := make(map[string]interface{})
  421. //inputDatas := make([]map[string]interface{}, 0)
  422. inputMessage["infno"] = "CFYLJG005"
  423. inputData["fixmedins_code"] = fixmedins_code
  424. inputData["hi_rxno"] = cFYLJG005.HiRxno
  425. inputData["mdtrt_id"] = cFYLJG005.MdtrtID
  426. inputData["ec_token"] = cFYLJG005.EcToken
  427. inputData["psn_name"] = cFYLJG005.PsnName
  428. inputData["psn_cert_type"] = cFYLJG005.PsnCertType
  429. inputData["certno"] = cFYLJG005.Certno
  430. inputData2["rx_detl_query"] = inputData
  431. inputMessage["input"] = inputData2
  432. var inputLog string
  433. bytesData, err := json.Marshal(inputMessage)
  434. inputLog = string(bytesData)
  435. fmt.Println(string(bytesData))
  436. if err != nil {
  437. fmt.Println(err.Error())
  438. return err.Error(), ""
  439. }
  440. reader := bytes.NewReader(bytesData)
  441. gdyb_url := beego.AppConfig.String("gdyb_url")
  442. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  443. var url string
  444. if fixmedins_code == "H15049901371" {
  445. url = gdyb_url
  446. } else {
  447. url = gdyb_url + "CFYLJG005"
  448. }
  449. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  450. request, err := http.NewRequest("POST", url, reader)
  451. if err != nil {
  452. fmt.Println(err.Error())
  453. return err.Error(), ""
  454. }
  455. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  456. request.Header.Set("x-tif-paasid", gdyb_paasid)
  457. request.Header.Set("x-tif-signature", signature)
  458. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  459. request.Header.Set("x-tif-nonce", nonce)
  460. client := http.Client{}
  461. resp, err := client.Do(request)
  462. if err != nil {
  463. fmt.Println(err.Error())
  464. return err.Error(), ""
  465. }
  466. respBytes, err := ioutil.ReadAll(resp.Body)
  467. if err != nil {
  468. fmt.Println(err.Error())
  469. return err.Error(), ""
  470. }
  471. fmt.Println(string(respBytes))
  472. str := string(respBytes)
  473. return str, inputLog
  474. }
  475. func GetAHCFYLJG006(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG006 models.CFYLJG006) (string, string) {
  476. //生成签名
  477. nonce := GetRandomString(32)
  478. timestamp := time.Now().Unix()
  479. signature := setSignature(timestamp, nonce, secret_key)
  480. //生成输入报文
  481. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  482. inputData := make(map[string]interface{})
  483. //inputDatas := make([]map[string]interface{}, 0)
  484. inputData2 := make(map[string]interface{})
  485. inputMessage["infno"] = "CFYLJG006"
  486. inputData["fixmedins_code"] = fixmedins_code
  487. inputData["hi_rxno"] = cFYLJG006.HiRxno
  488. inputData["mdtrt_id"] = cFYLJG006.MdtrtID
  489. inputData["psn_cert_type"] = cFYLJG006.PsnCertType
  490. inputData["certno"] = cFYLJG006.Certno
  491. inputData["psn_name"] = cFYLJG006.PsnName
  492. inputData2["rx_chk_info"] = inputData
  493. inputMessage["input"] = inputData2
  494. var inputLog string
  495. bytesData, err := json.Marshal(inputMessage)
  496. inputLog = string(bytesData)
  497. fmt.Println(string(bytesData))
  498. if err != nil {
  499. fmt.Println(err.Error())
  500. return err.Error(), ""
  501. }
  502. reader := bytes.NewReader(bytesData)
  503. gdyb_url := beego.AppConfig.String("gdyb_url")
  504. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  505. var url string
  506. if fixmedins_code == "H15049901371" {
  507. url = gdyb_url
  508. } else {
  509. url = gdyb_url + "CFYLJG006"
  510. }
  511. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  512. request, err := http.NewRequest("POST", url, reader)
  513. if err != nil {
  514. fmt.Println(err.Error())
  515. return err.Error(), ""
  516. }
  517. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  518. request.Header.Set("x-tif-paasid", gdyb_paasid)
  519. request.Header.Set("x-tif-signature", signature)
  520. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  521. request.Header.Set("x-tif-nonce", nonce)
  522. client := http.Client{}
  523. resp, err := client.Do(request)
  524. if err != nil {
  525. fmt.Println(err.Error())
  526. return err.Error(), ""
  527. }
  528. respBytes, err := ioutil.ReadAll(resp.Body)
  529. if err != nil {
  530. fmt.Println(err.Error())
  531. return err.Error(), ""
  532. }
  533. fmt.Println(string(respBytes))
  534. str := string(respBytes)
  535. return str, inputLog
  536. }
  537. func GetAHCFYLJG007(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG007 models.CFYLJG007) (string, string) {
  538. //生成签名
  539. nonce := GetRandomString(32)
  540. timestamp := time.Now().Unix()
  541. signature := setSignature(timestamp, nonce, secret_key)
  542. //生成输入报文
  543. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  544. inputData := make(map[string]interface{})
  545. inputData2 := make(map[string]interface{})
  546. //inputDatas := make([]map[string]interface{}, 0)
  547. inputMessage["infno"] = "CFYLJG007"
  548. inputData["fixmedins_code"] = fixmedins_code
  549. inputData["hi_rxno"] = cFYLJG007.HiRxno
  550. inputData["mdtrt_id"] = cFYLJG007.MdtrtID
  551. inputData["psn_no"] = cFYLJG007.PsnNo
  552. inputData["psn_cert_type"] = cFYLJG007.PsnCertType
  553. inputData["certno"] = cFYLJG007.Certno
  554. inputData["psn_name"] = cFYLJG007.PsnName
  555. inputData2["rx_setl_query"] = inputData
  556. inputMessage["input"] = inputData2
  557. var inputLog string
  558. bytesData, err := json.Marshal(inputMessage)
  559. inputLog = string(bytesData)
  560. fmt.Println(string(bytesData))
  561. if err != nil {
  562. fmt.Println(err.Error())
  563. return err.Error(), ""
  564. }
  565. reader := bytes.NewReader(bytesData)
  566. gdyb_url := beego.AppConfig.String("gdyb_url")
  567. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  568. var url string
  569. if fixmedins_code == "H15049901371" {
  570. url = gdyb_url
  571. } else {
  572. url = gdyb_url + "CFYLJG007"
  573. }
  574. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  575. request, err := http.NewRequest("POST", url, reader)
  576. if err != nil {
  577. fmt.Println(err.Error())
  578. return err.Error(), ""
  579. }
  580. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  581. request.Header.Set("x-tif-paasid", gdyb_paasid)
  582. request.Header.Set("x-tif-signature", signature)
  583. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  584. request.Header.Set("x-tif-nonce", nonce)
  585. client := http.Client{}
  586. resp, err := client.Do(request)
  587. if err != nil {
  588. fmt.Println(err.Error())
  589. return err.Error(), ""
  590. }
  591. respBytes, err := ioutil.ReadAll(resp.Body)
  592. if err != nil {
  593. fmt.Println(err.Error())
  594. return err.Error(), ""
  595. }
  596. fmt.Println(string(respBytes))
  597. str := string(respBytes)
  598. return str, inputLog
  599. }
  600. func GetAHCFYLJG008(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, cFYLJG008 models.CFYLJG008) (string, string) {
  601. //生成签名
  602. nonce := GetRandomString(32)
  603. timestamp := time.Now().Unix()
  604. signature := setSignature(timestamp, nonce, secret_key)
  605. //生成输入报文
  606. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  607. inputData := make(map[string]interface{})
  608. //inputData2 := make(map[string]interface{})
  609. //inputDatas := make([]map[string]interface{}, 0)
  610. inputMessage["infno"] = "CFYLJG008"
  611. inputData["pageNum"] = cFYLJG008.PageNum
  612. inputData["pageSize"] = cFYLJG008.PageSize
  613. inputData["orderType"] = cFYLJG008.OrderType
  614. inputData["poolareaNo"] = cFYLJG008.PoolareaNo
  615. inputData["fixmedinsName"] = cFYLJG008.FixmedinsName
  616. inputData["lng"] = cFYLJG008.Lng
  617. inputData["lat"] = cFYLJG008.Lat
  618. inputData["medinsProdInvChgDDTOList"] = cFYLJG008.MedList
  619. inputMessage["input"] = inputData
  620. var inputLog string
  621. bytesData, err := json.Marshal(inputMessage)
  622. inputLog = string(bytesData)
  623. fmt.Println(string(bytesData))
  624. if err != nil {
  625. fmt.Println(err.Error())
  626. return err.Error(), ""
  627. }
  628. reader := bytes.NewReader(bytesData)
  629. gdyb_url := beego.AppConfig.String("gdyb_url")
  630. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  631. var url string
  632. if fixmedins_code == "H15049901371" {
  633. url = gdyb_url
  634. } else {
  635. url = gdyb_url + "CFYLJG007"
  636. }
  637. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  638. request, err := http.NewRequest("POST", url, reader)
  639. if err != nil {
  640. fmt.Println(err.Error())
  641. return err.Error(), ""
  642. }
  643. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  644. request.Header.Set("x-tif-paasid", gdyb_paasid)
  645. request.Header.Set("x-tif-signature", signature)
  646. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  647. request.Header.Set("x-tif-nonce", nonce)
  648. client := http.Client{}
  649. resp, err := client.Do(request)
  650. if err != nil {
  651. fmt.Println(err.Error())
  652. return err.Error(), ""
  653. }
  654. respBytes, err := ioutil.ReadAll(resp.Body)
  655. if err != nil {
  656. fmt.Println(err.Error())
  657. return err.Error(), ""
  658. }
  659. fmt.Println(string(respBytes))
  660. str := string(respBytes)
  661. return str, inputLog
  662. }
  663. func Getflow(id int64) (flow models.HisPrescriptionFlow, err error) {
  664. err = readDb.Model(&models.HisPrescriptionFlow{}).Where("id = ?", id).First(&flow).Error
  665. return
  666. }
  667. func Getflowtwo(m_id string) (flow models.HisPrescriptionFlow, err error) {
  668. err = readDb.Model(&models.HisPrescriptionFlow{}).Where("m_id = ?", m_id).First(&flow).Error
  669. return
  670. }