coordinate_service.go 50KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546
  1. package service
  2. import (
  3. "bytes"
  4. "encoding/json"
  5. "fmt"
  6. "gdyb/models"
  7. "github.com/jinzhu/gorm"
  8. "io/ioutil"
  9. "net/http"
  10. "net/url"
  11. "strings"
  12. "time"
  13. )
  14. func SavePatientMessageInfo() (string, string) {
  15. //input := make(map[string]interface{})
  16. inputData := make(map[string]interface{})
  17. inputData["patType"] = "1" // 就诊凭证编号
  18. inputData["patIdNo"] = "440510199211080038" // 开始时间
  19. inputData["patName"] = "测试患者4 " // 人员姓名
  20. inputData["patMobile"] = "13535547902" // 人员姓名
  21. inputData["patSex"] = "M" // 人员姓名
  22. inputData["patMarriage"] = "1" // 人员姓名
  23. inputData["birthday"] = "1992-10-23" // 人员姓名
  24. inputData["patAddress"] = "11111" // 人员姓名
  25. inputData["thirdPartyID"] = "6936" // 人员姓名
  26. inputData["patAge"] = "30" // 人员姓名
  27. //input["req"] = inputData
  28. var inputLog string
  29. bytesData, err := json.Marshal(inputData)
  30. inputLog = string(bytesData)
  31. fmt.Println(string(bytesData))
  32. if err != nil {
  33. fmt.Println(err.Error())
  34. return err.Error(), ""
  35. }
  36. reader := bytes.NewReader(bytesData)
  37. var url string
  38. gdyb_url := "http://218.104.146.179:9091/esb/listener/savePatientMessageInfo"
  39. url = gdyb_url
  40. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  41. request, err := http.NewRequest("GET", url, reader)
  42. if err != nil {
  43. fmt.Println(err.Error())
  44. return err.Error(), ""
  45. }
  46. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  47. request.Header.Set("code", "Xmrjyy")
  48. client := http.Client{}
  49. resp, err := client.Do(request)
  50. if err != nil {
  51. fmt.Println(err.Error())
  52. return err.Error(), ""
  53. }
  54. respBytes, err := ioutil.ReadAll(resp.Body)
  55. if err != nil {
  56. fmt.Println(err.Error())
  57. return err.Error(), ""
  58. }
  59. fmt.Println(string(respBytes))
  60. str := string(respBytes)
  61. return str, inputLog
  62. }
  63. func SaveReg(reg models.Reg) (string, string) {
  64. //input := make(map[string]interface{})
  65. inputData := make(map[string]interface{})
  66. inputData["deptId"] = reg.DeptId
  67. inputData["clinicUnitId"] = ""
  68. inputData["healthCardNo"] = ""
  69. fmt.Println(reg.PatientId)
  70. inputData["patientId"] = reg.PatientId
  71. inputData["patientName"] = reg.PatientName
  72. inputData["idCardNo"] = reg.IdCardNo
  73. inputData["phone"] = ""
  74. inputData["doctorId"] = ""
  75. inputData["doctorLevelCode"] = ""
  76. inputData["regDate"] = reg.RegDate
  77. inputData["shiftCode"] = ""
  78. inputData["startTime"] = ""
  79. inputData["endTime"] = ""
  80. inputData["scheduleId"] = ""
  81. inputData["periodId"] = ""
  82. inputData["svObjectId"] = ""
  83. inputData["diseaseId"] = ""
  84. inputData["regFee"] = reg.RegFee
  85. inputData["treatFee"] = reg.TreatFee
  86. inputData["operatorId"] = reg.OperatorId
  87. inputData["remark"] = "血透"
  88. inputData["orderType"] = "0"
  89. inputData["clinicCode"] = ""
  90. inputData["infoSeq"] = ""
  91. //input["Request"] = inputData
  92. var inputLog string
  93. bytesData, err := json.Marshal(inputData)
  94. inputLog = string(bytesData)
  95. fmt.Println(string(bytesData))
  96. if err != nil {
  97. fmt.Println(err.Error())
  98. return err.Error(), ""
  99. }
  100. reader := bytes.NewReader(bytesData)
  101. var url string
  102. gdyb_url := "http://218.104.146.179:9091/esb/listener/saveReg"
  103. url = gdyb_url
  104. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  105. request, err := http.NewRequest("POST", url, reader)
  106. if err != nil {
  107. fmt.Println(err.Error())
  108. return err.Error(), ""
  109. }
  110. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  111. request.Header.Set("code", "Xmrjyy")
  112. client := http.Client{}
  113. resp, err := client.Do(request)
  114. if err != nil {
  115. fmt.Println(err.Error())
  116. return err.Error(), ""
  117. }
  118. respBytes, err := ioutil.ReadAll(resp.Body)
  119. if err != nil {
  120. fmt.Println(err.Error())
  121. return err.Error(), ""
  122. }
  123. fmt.Println(string(respBytes))
  124. str := string(respBytes)
  125. return str, inputLog
  126. }
  127. func GetWaitPayDetail() (string, string) {
  128. //input := make(map[string]interface{})
  129. inputData := make(map[string]interface{})
  130. inputData["clinicSeq"] = "30445" // 就诊凭证编号
  131. inputData["prescriptionId"] = "" // 开始时间
  132. inputData["patientId"] = "701822660170096645" // 人员姓名
  133. var inputLog string
  134. bytesData, err := json.Marshal(inputData)
  135. inputLog = string(bytesData)
  136. fmt.Println(string(bytesData))
  137. if err != nil {
  138. fmt.Println(err.Error())
  139. return err.Error(), ""
  140. }
  141. reader := bytes.NewReader(bytesData)
  142. var url string
  143. gdyb_url := "http://218.104.146.179:9091/esb/listener/getWaitPayDetail"
  144. url = gdyb_url
  145. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  146. request, err := http.NewRequest("POST", url, reader)
  147. if err != nil {
  148. fmt.Println(err.Error())
  149. return err.Error(), ""
  150. }
  151. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  152. request.Header.Set("code", "Xmrjyy")
  153. client := http.Client{}
  154. resp, err := client.Do(request)
  155. if err != nil {
  156. fmt.Println(err.Error())
  157. return err.Error(), ""
  158. }
  159. respBytes, err := ioutil.ReadAll(resp.Body)
  160. if err != nil {
  161. fmt.Println(err.Error())
  162. return err.Error(), ""
  163. }
  164. fmt.Println(string(respBytes))
  165. str := string(respBytes)
  166. return str, inputLog
  167. }
  168. func OpKeepAccounts(number string, cus []*models.NewCustomTwo) (string, string) {
  169. inputData := make(map[string]interface{})
  170. feedetail := make([]map[string]interface{}, 0)
  171. for _, item := range cus {
  172. feedetailInfo := make(map[string]interface{})
  173. feedetailInfo["itemCode"] = item.MedListCodg
  174. feedetailInfo["num"] = item.Cut
  175. feedetail = append(feedetail, feedetailInfo)
  176. }
  177. inputData["item"] = feedetail
  178. inputData["clinicSeq"] = number // 就诊凭证编号
  179. var inputLog string
  180. bytesData, err := json.Marshal(inputData)
  181. inputLog = string(bytesData)
  182. fmt.Println(string(bytesData))
  183. if err != nil {
  184. fmt.Println(err.Error())
  185. return err.Error(), ""
  186. }
  187. reader := bytes.NewReader(bytesData)
  188. var url string
  189. gdyb_url := "http://218.104.146.179:9091/esb/listener/opKeepAccounts"
  190. url = gdyb_url
  191. request, err := http.NewRequest("POST", url, reader)
  192. if err != nil {
  193. fmt.Println(err.Error())
  194. return err.Error(), ""
  195. }
  196. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  197. request.Header.Set("code", "Xmrjyy")
  198. client := http.Client{}
  199. resp, err := client.Do(request)
  200. if err != nil {
  201. fmt.Println(err.Error())
  202. return err.Error(), ""
  203. }
  204. respBytes, err := ioutil.ReadAll(resp.Body)
  205. if err != nil {
  206. fmt.Println(err.Error())
  207. return err.Error(), ""
  208. }
  209. fmt.Println(string(respBytes))
  210. str := string(respBytes)
  211. return str, inputLog
  212. }
  213. func OpCancelKeepAccounts(setl_id string, op_name string, op_code string) (string, string) {
  214. inputData := make(map[string]interface{})
  215. inputData["docId"] = setl_id
  216. inputData["operCode"] = "111"
  217. inputData["operName"] = "2222"
  218. var inputLog string
  219. bytesData, err := json.Marshal(inputData)
  220. inputLog = string(bytesData)
  221. fmt.Println(string(bytesData))
  222. if err != nil {
  223. fmt.Println(err.Error())
  224. return err.Error(), ""
  225. }
  226. reader := bytes.NewReader(bytesData)
  227. var url string
  228. gdyb_url := "http://218.104.146.179:9091/esb/listener/opCancelKeepAccounts"
  229. url = gdyb_url
  230. request, err := http.NewRequest("POST", url, reader)
  231. if err != nil {
  232. fmt.Println(err.Error())
  233. return err.Error(), ""
  234. }
  235. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  236. request.Header.Set("code", "Xmrjyy")
  237. client := http.Client{}
  238. resp, err := client.Do(request)
  239. if err != nil {
  240. fmt.Println(err.Error())
  241. return err.Error(), ""
  242. }
  243. respBytes, err := ioutil.ReadAll(resp.Body)
  244. if err != nil {
  245. fmt.Println(err.Error())
  246. return err.Error(), ""
  247. }
  248. fmt.Println(string(respBytes))
  249. str := string(respBytes)
  250. return str, inputLog
  251. }
  252. func UpdateHisPatientStatusten(his *models.VMHisPatient) {
  253. writeDb.Save(&his)
  254. }
  255. func GetUnSettleHisPrescriptionFive(org_id int64, patient_id int64, record_date int64, p_type int64) (prescription []*models.HisPrescription, err error) {
  256. err = readDb.Model(&models.HisPrescription{}).
  257. Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
  258. return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("BaseDrugLib", "status=1")
  259. }).
  260. Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
  261. return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject").Preload("GoodInfo", "status=1")
  262. }).
  263. Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND order_status <> 2 AND order_status <> 3 and order_status <> 5 AND p_type = ?", org_id, record_date, patient_id, p_type).
  264. Find(&prescription).Error
  265. return
  266. }
  267. func GetUnSettleMonthHisPrescription(org_id int64, patient_id int64, start_date int64, end_date int64) (prescription []*models.HisPrescription, err error) {
  268. err = readDb.Model(&models.HisPrescription{}).
  269. Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
  270. return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("XtHisAddtionConfig", "status=1")
  271. }).
  272. Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
  273. return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("Drug", "status=1")
  274. }).
  275. Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
  276. return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject").Preload("GoodInfo", "status=1").Preload("XtHisProjectTeam", "status = 1")
  277. }).
  278. Where("user_org_id = ? AND status = 1 AND record_date >= ? AND record_date <= ? AND patient_id = ? AND order_status <> 2 AND order_status <> 5 AND p_type <> 1", org_id, start_date, end_date, patient_id).
  279. Find(&prescription).Error
  280. return
  281. }
  282. func GetHisOrderFour(patient_id string, infoSeq string, docId string) (order models.HisOrder, err error) {
  283. if len(docId) > 0 {
  284. err = readDb.Model(&models.HisOrder{}).Where("mdtrt_id = ? AND psn_no = ? AND setl_id = ? AND status = 1", infoSeq, patient_id, docId).First(&order).Error
  285. } else {
  286. err = readDb.Model(&models.HisOrder{}).Where("mdtrt_id = ? AND psn_no = ? AND status = 1 ", infoSeq, patient_id).First(&order).Error
  287. }
  288. return
  289. }
  290. func GetHisPatientForCoordinate(id_card_no string) (string, string) {
  291. //input := make(map[string]interface{})
  292. inputData := make(map[string]interface{})
  293. inputData["idcard"] = id_card_no // 就诊凭证编号
  294. var inputLog string
  295. bytesData, err := json.Marshal(inputData)
  296. inputLog = string(bytesData)
  297. fmt.Println(string(bytesData))
  298. if err != nil {
  299. fmt.Println(err.Error())
  300. return err.Error(), ""
  301. }
  302. reader := bytes.NewReader(bytesData)
  303. var url string
  304. gdyb_url := "http://218.104.146.179:9091/esb/listener/getPatientType"
  305. url = gdyb_url
  306. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  307. request, err := http.NewRequest("GET", url, reader)
  308. if err != nil {
  309. fmt.Println(err.Error())
  310. return err.Error(), ""
  311. }
  312. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  313. request.Header.Set("code", "Xmrjyy")
  314. client := http.Client{}
  315. resp, err := client.Do(request)
  316. if err != nil {
  317. fmt.Println(err.Error())
  318. return err.Error(), ""
  319. }
  320. respBytes, err := ioutil.ReadAll(resp.Body)
  321. if err != nil {
  322. fmt.Println(err.Error())
  323. return err.Error(), ""
  324. }
  325. fmt.Println(string(respBytes))
  326. str := string(respBytes)
  327. return str, inputLog
  328. }
  329. //查询患者列表
  330. func GetNMGHisPatientForCoordinate(VAA01 int64,VAA07 int64,ACF01 int64,keyword string) (string, string) {
  331. //input := make(map[string]interface{})
  332. inputData := make(map[string]interface{})
  333. inputData["vaa01"] = VAA01 // 就诊凭证编号
  334. inputData["vaa07"] = VAA07 // 就诊凭证编号
  335. inputData["acf01"] = ACF01// 就诊凭证编号
  336. inputData["keyword"] = keyword // 就诊凭证编号
  337. var inputLog string
  338. bytesData, err := json.Marshal(inputData)
  339. inputLog = string(bytesData)
  340. fmt.Println(string(bytesData))
  341. if err != nil {
  342. fmt.Println(err.Error())
  343. return err.Error(), ""
  344. }
  345. reader := bytes.NewBuffer(bytesData)
  346. var url string
  347. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/QueryPat"
  348. url = gdyb_url
  349. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  350. request, err := http.NewRequest("POST", url, reader)
  351. if err != nil {
  352. fmt.Println(err.Error())
  353. return err.Error(), ""
  354. }
  355. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  356. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  357. request.Header.Set("Accept", "*/*")
  358. fmt.Println(request)
  359. fmt.Println(request.Header)
  360. client := http.Client{}
  361. resp, err := client.Do(request)
  362. if err != nil {
  363. fmt.Println(err.Error())
  364. return err.Error(), ""
  365. }
  366. defer resp.Body.Close()
  367. fmt.Println(resp)
  368. fmt.Println("resp.Status")
  369. fmt.Println(resp.Status)
  370. fmt.Println("resp.Body")
  371. fmt.Println(resp.Body)
  372. respBytes, err := ioutil.ReadAll(resp.Body)
  373. if err != nil {
  374. fmt.Println(err.Error())
  375. return err.Error(), ""
  376. }
  377. fmt.Println(string(respBytes))
  378. str := string(respBytes)
  379. return str, inputLog
  380. }
  381. func GetDeptEmp() (string, string) {
  382. //input := make(map[string]interface{})
  383. inputData := make(map[string]interface{})
  384. var inputLog string
  385. bytesData, err := json.Marshal(inputData)
  386. inputLog = string(bytesData)
  387. fmt.Println(string(bytesData))
  388. if err != nil {
  389. fmt.Println(err.Error())
  390. return err.Error(), ""
  391. }
  392. reader := bytes.NewBuffer(bytesData)
  393. var url string
  394. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/GetDeptEmp"
  395. url = gdyb_url
  396. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  397. request, err := http.NewRequest("POST", url, reader)
  398. if err != nil {
  399. fmt.Println(err.Error())
  400. return err.Error(), ""
  401. }
  402. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  403. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  404. request.Header.Set("Accept", "*/*")
  405. fmt.Println(request)
  406. fmt.Println(request.Header)
  407. client := http.Client{}
  408. resp, err := client.Do(request)
  409. if err != nil {
  410. fmt.Println(err.Error())
  411. return err.Error(), ""
  412. }
  413. defer resp.Body.Close()
  414. fmt.Println(resp)
  415. fmt.Println("resp.Status")
  416. fmt.Println(resp.Status)
  417. fmt.Println("resp.Body")
  418. fmt.Println(resp.Body)
  419. respBytes, err := ioutil.ReadAll(resp.Body)
  420. if err != nil {
  421. fmt.Println(err.Error())
  422. return err.Error(), ""
  423. }
  424. fmt.Println(string(respBytes))
  425. str := string(respBytes)
  426. return str, inputLog
  427. }
  428. func GetDrugInterval() (string, string) {
  429. //input := make(map[string]interface{})
  430. inputData := make(map[string]interface{})
  431. //inputData["BCE41"] = ”“ // 就诊凭证编号
  432. var inputLog string
  433. bytesData, err := json.Marshal(inputData)
  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.NewBuffer(bytesData)
  441. var url string
  442. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/GetDrugInterval"
  443. url = gdyb_url
  444. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  445. request, err := http.NewRequest("POST", url, reader)
  446. if err != nil {
  447. fmt.Println(err.Error())
  448. return err.Error(), ""
  449. }
  450. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  451. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  452. request.Header.Set("Accept", "*/*")
  453. fmt.Println(request)
  454. fmt.Println(request.Header)
  455. client := http.Client{}
  456. resp, err := client.Do(request)
  457. if err != nil {
  458. fmt.Println(err.Error())
  459. return err.Error(), ""
  460. }
  461. defer resp.Body.Close()
  462. fmt.Println(resp)
  463. fmt.Println("resp.Status")
  464. fmt.Println(resp.Status)
  465. fmt.Println("resp.Body")
  466. fmt.Println(resp.Body)
  467. respBytes, err := ioutil.ReadAll(resp.Body)
  468. if err != nil {
  469. fmt.Println(err.Error())
  470. return err.Error(), ""
  471. }
  472. fmt.Println(string(respBytes))
  473. str := string(respBytes)
  474. return str, inputLog
  475. }
  476. func GetUsage() (string, string) {
  477. //input := make(map[string]interface{})
  478. inputData := make(map[string]interface{})
  479. var inputLog string
  480. bytesData, err := json.Marshal(inputData)
  481. inputLog = string(bytesData)
  482. fmt.Println(string(bytesData))
  483. if err != nil {
  484. fmt.Println(err.Error())
  485. return err.Error(), ""
  486. }
  487. reader := bytes.NewBuffer(bytesData)
  488. var url string
  489. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/GetUsage"
  490. url = gdyb_url
  491. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  492. request, err := http.NewRequest("POST", url, reader)
  493. if err != nil {
  494. fmt.Println(err.Error())
  495. return err.Error(), ""
  496. }
  497. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  498. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  499. request.Header.Set("Accept", "*/*")
  500. fmt.Println(request)
  501. fmt.Println(request.Header)
  502. client := http.Client{}
  503. resp, err := client.Do(request)
  504. if err != nil {
  505. fmt.Println(err.Error())
  506. return err.Error(), ""
  507. }
  508. defer resp.Body.Close()
  509. fmt.Println(resp)
  510. fmt.Println("resp.Status")
  511. fmt.Println(resp.Status)
  512. fmt.Println("resp.Body")
  513. fmt.Println(resp.Body)
  514. respBytes, err := ioutil.ReadAll(resp.Body)
  515. if err != nil {
  516. fmt.Println(err.Error())
  517. return err.Error(), ""
  518. }
  519. fmt.Println(string(respBytes))
  520. str := string(respBytes)
  521. return str, inputLog
  522. }
  523. func GetDrugs() (string, string) {
  524. //input := make(map[string]interface{})
  525. inputData := make(map[string]interface{})
  526. var inputLog string
  527. bytesData, err := json.Marshal(inputData)
  528. inputLog = string(bytesData)
  529. fmt.Println(string(bytesData))
  530. if err != nil {
  531. fmt.Println(err.Error())
  532. return err.Error(), ""
  533. }
  534. reader := bytes.NewBuffer(bytesData)
  535. var url string
  536. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/GetDrugs"
  537. url = gdyb_url
  538. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  539. request, err := http.NewRequest("POST", url, reader)
  540. if err != nil {
  541. fmt.Println(err.Error())
  542. return err.Error(), ""
  543. }
  544. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  545. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  546. request.Header.Set("Accept", "*/*")
  547. fmt.Println(request)
  548. fmt.Println(request.Header)
  549. client := http.Client{}
  550. resp, err := client.Do(request)
  551. if err != nil {
  552. fmt.Println(err.Error())
  553. return err.Error(), ""
  554. }
  555. defer resp.Body.Close()
  556. fmt.Println(resp)
  557. fmt.Println("resp.Status")
  558. fmt.Println(resp.Status)
  559. fmt.Println("resp.Body")
  560. fmt.Println(resp.Body)
  561. respBytes, err := ioutil.ReadAll(resp.Body)
  562. if err != nil {
  563. fmt.Println(err.Error())
  564. return err.Error(), ""
  565. }
  566. fmt.Println(string(respBytes))
  567. str := string(respBytes)
  568. return str, inputLog
  569. }
  570. func GetProject() (string, string) {
  571. //input := make(map[string]interface{})
  572. inputData := make(map[string]interface{})
  573. var inputLog string
  574. bytesData, err := json.Marshal(inputData)
  575. inputLog = string(bytesData)
  576. fmt.Println(string(bytesData))
  577. if err != nil {
  578. fmt.Println(err.Error())
  579. return err.Error(), ""
  580. }
  581. reader := bytes.NewBuffer(bytesData)
  582. var url string
  583. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/GetProject"
  584. url = gdyb_url
  585. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  586. request, err := http.NewRequest("POST", url, reader)
  587. if err != nil {
  588. fmt.Println(err.Error())
  589. return err.Error(), ""
  590. }
  591. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  592. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  593. request.Header.Set("Accept", "*/*")
  594. fmt.Println(request)
  595. fmt.Println(request.Header)
  596. client := http.Client{}
  597. resp, err := client.Do(request)
  598. if err != nil {
  599. fmt.Println(err.Error())
  600. return err.Error(), ""
  601. }
  602. defer resp.Body.Close()
  603. fmt.Println(resp)
  604. fmt.Println("resp.Status")
  605. fmt.Println(resp.Status)
  606. fmt.Println("resp.Body")
  607. fmt.Println(resp.Body)
  608. respBytes, err := ioutil.ReadAll(resp.Body)
  609. if err != nil {
  610. fmt.Println(err.Error())
  611. return err.Error(), ""
  612. }
  613. fmt.Println(string(respBytes))
  614. str := string(respBytes)
  615. return str, inputLog
  616. }
  617. //开医嘱版本1
  618. func UploadNMGPrescriptionForCoordinate(info models.UploadInfo) (string, string) {
  619. inputData := make(map[string]interface{})
  620. presInfos := make([]map[string]interface{}, 0)
  621. for _, item := range info.ChargeList {
  622. inputDataPresInfo := make(map[string]interface{})
  623. inputDataPresInfo["bbx01"] = item.Bbx01
  624. inputDataPresInfo["vaf21"] = item.Vaf21
  625. inputDataPresInfo["vaf22"] = item.Vaf22
  626. inputDataPresInfo["vaf42"] = item.Vaf42
  627. presInfos = append(presInfos, inputDataPresInfo)
  628. }
  629. inputData["vaa01"] = info.Vaa01 // 就诊凭证编号
  630. inputData["vaa07"] = info.Vaa07 // 就诊凭证编号
  631. inputData["acf01"] = info.Acf01 // 就诊凭证编号
  632. inputData["vaa05"] = info.Vaa05 // 就诊凭证编号
  633. inputData["bck01"] = info.Bck01 // 就诊凭证编号
  634. inputData["bce01a"] = info.Bce01a // 就诊凭证编号
  635. inputData["bck01a"] = info.Bck01a // 就诊凭证编号
  636. inputData["vafReqList"] = presInfos // 就诊凭证编号
  637. var inputLog string
  638. bytesData, err := json.Marshal(inputData)
  639. inputLog = string(bytesData)
  640. fmt.Println(string(bytesData))
  641. if err != nil {
  642. fmt.Println(err.Error())
  643. return err.Error(), ""
  644. }
  645. reader := bytes.NewReader(bytesData)
  646. var url string
  647. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAF_New"
  648. //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  649. url = gdyb_url
  650. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  651. request, err := http.NewRequest("POST", url, reader)
  652. if err != nil {
  653. fmt.Println(err.Error())
  654. return err.Error(), ""
  655. }
  656. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  657. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  658. request.Header.Set("Accept", "*/*")
  659. client := http.Client{}
  660. resp, err := client.Do(request)
  661. if err != nil {
  662. fmt.Println(err.Error())
  663. return err.Error(), ""
  664. }
  665. respBytes, err := ioutil.ReadAll(resp.Body)
  666. if err != nil {
  667. fmt.Println(err.Error())
  668. return err.Error(), ""
  669. }
  670. fmt.Println(string(respBytes))
  671. str := string(respBytes)
  672. return str, inputLog
  673. }
  674. //开医嘱版本2
  675. func UploadNMGPrescriptionForCoordinatetwo(cmdid string, xml_date string) (string, string) {
  676. //inputData := make(map[string]interface{})
  677. //requestBody := fmt.Sprintf(`{"cmdid": "%s", "data": "%s"}`, cmdid, xml_date)
  678. //requestBody = url.QueryEscape(requestBody)
  679. //reader := bytes.NewReader(bytesData)
  680. var urls string
  681. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/HODoctorAdvice"
  682. //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  683. urls = gdyb_url
  684. values := url.Values{}
  685. values.Set("cmdid", cmdid)
  686. values.Set("data", xml_date)
  687. dataStr := values.Encode()
  688. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  689. request, err := http.NewRequest("POST", urls, strings.NewReader(dataStr))
  690. if err != nil {
  691. fmt.Println(err.Error())
  692. return err.Error(), ""
  693. }
  694. request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
  695. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  696. request.Header.Set("Accept", "*/*")
  697. client := http.Client{}
  698. resp, err := client.Do(request)
  699. if err != nil {
  700. fmt.Println(err.Error())
  701. return err.Error(), ""
  702. }
  703. respBytes, err := ioutil.ReadAll(resp.Body)
  704. if err != nil {
  705. fmt.Println(err.Error())
  706. return err.Error(), ""
  707. }
  708. fmt.Println(string(respBytes))
  709. str := string(respBytes)
  710. return str, dataStr
  711. }
  712. //查询医嘱
  713. func QueryNMGPrescriptionForCoordinate(ACF01 int64, vaf01List []string, cbm01 string) (string, string) {
  714. inputData := make(map[string]interface{})
  715. inputData["ACF01"] = ACF01 // 就诊凭证编号
  716. inputData["vaf01List"] = vaf01List // 就诊凭证编号
  717. inputData["cbm01"] = cbm01 // 就诊凭证编号
  718. var inputLog string
  719. bytesData, err := json.Marshal(inputData)
  720. inputLog = string(bytesData)
  721. fmt.Println(string(bytesData))
  722. if err != nil {
  723. fmt.Println(err.Error())
  724. return err.Error(), ""
  725. }
  726. reader := bytes.NewReader(bytesData)
  727. var url string
  728. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAF_Query"
  729. //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  730. url = gdyb_url
  731. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  732. request, err := http.NewRequest("POST", url, reader)
  733. if err != nil {
  734. fmt.Println(err.Error())
  735. return err.Error(), ""
  736. }
  737. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  738. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  739. request.Header.Set("Accept", "*/*")
  740. client := http.Client{}
  741. resp, err := client.Do(request)
  742. if err != nil {
  743. fmt.Println(err.Error())
  744. return err.Error(), ""
  745. }
  746. respBytes, err := ioutil.ReadAll(resp.Body)
  747. if err != nil {
  748. fmt.Println(err.Error())
  749. return err.Error(), ""
  750. }
  751. fmt.Println(string(respBytes))
  752. str := string(respBytes)
  753. return str, inputLog
  754. }
  755. //删除医嘱
  756. func CancleNMGPrescriptionForCoordinate(ACF01 int64, cbm01 string,vaf01List []string) (string, string) {
  757. inputData := make(map[string]interface{})
  758. //
  759. //if len(vaf01List) == 0{
  760. inputData["ACF01"] = ACF01 // 就诊凭证编号
  761. inputData["vaf01List"] = "" // 就诊凭证编号
  762. inputData["cbm01"] = cbm01 // 就诊凭证编号
  763. //}else{
  764. // inputData["ACF01"] = ACF01 // 就诊凭证编号
  765. // inputData["vaf01List"] = vaf01List // 就诊凭证编号
  766. // inputData["cbm01"] = cbm01 // 就诊凭证编号
  767. //}
  768. var inputLog string
  769. bytesData, err := json.Marshal(inputData)
  770. inputLog = string(bytesData)
  771. fmt.Println(string(bytesData))
  772. if err != nil {
  773. fmt.Println(err.Error())
  774. return err.Error(), ""
  775. }
  776. reader := bytes.NewReader(bytesData)
  777. var url string
  778. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAF_Del"
  779. //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  780. url = gdyb_url
  781. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  782. request, err := http.NewRequest("POST", url, reader)
  783. if err != nil {
  784. fmt.Println(err.Error())
  785. return err.Error(), ""
  786. }
  787. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  788. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  789. request.Header.Set("Accept", "*/*")
  790. client := http.Client{}
  791. resp, err := client.Do(request)
  792. if err != nil {
  793. fmt.Println(err.Error())
  794. return err.Error(), ""
  795. }
  796. respBytes, err := ioutil.ReadAll(resp.Body)
  797. if err != nil {
  798. fmt.Println(err.Error())
  799. return err.Error(), ""
  800. }
  801. fmt.Println(string(respBytes))
  802. str := string(respBytes)
  803. return str, inputLog
  804. }
  805. //删除医嘱版本2
  806. //func CancleNMGPrescriptionForCoordinatetwo(ACF01 int, cbm01 string,vaf01List []string) (string, string) {
  807. //
  808. // inputData := make(map[string]interface{})
  809. // //
  810. // //if len(vaf01List) == 0{
  811. // inputData["ACF01"] = ACF01 // 就诊凭证编号
  812. // inputData["vaf01List"] = "" // 就诊凭证编号
  813. // inputData["cbm01"] = cbm01 // 就诊凭证编号
  814. //
  815. // //}else{
  816. // // inputData["ACF01"] = ACF01 // 就诊凭证编号
  817. // // inputData["vaf01List"] = vaf01List // 就诊凭证编号
  818. // // inputData["cbm01"] = cbm01 // 就诊凭证编号
  819. // //}
  820. //
  821. // var inputLog string
  822. // bytesData, err := json.Marshal(inputData)
  823. // inputLog = string(bytesData)
  824. // fmt.Println(string(bytesData))
  825. // if err != nil {
  826. // fmt.Println(err.Error())
  827. // return err.Error(), ""
  828. // }
  829. // reader := bytes.NewReader(bytesData)
  830. // var url string
  831. // gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAF_Del"
  832. //
  833. // //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  834. // url = gdyb_url
  835. //
  836. // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  837. // request, err := http.NewRequest("POST", url, reader)
  838. // if err != nil {
  839. // fmt.Println(err.Error())
  840. // return err.Error(), ""
  841. // }
  842. //
  843. // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  844. // request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  845. // request.Header.Set("Accept", "*/*")
  846. // client := http.Client{}
  847. // resp, err := client.Do(request)
  848. // if err != nil {
  849. // fmt.Println(err.Error())
  850. // return err.Error(), ""
  851. // }
  852. // respBytes, err := ioutil.ReadAll(resp.Body)
  853. // if err != nil {
  854. // fmt.Println(err.Error())
  855. // return err.Error(), ""
  856. // }
  857. // fmt.Println(string(respBytes))
  858. // str := string(respBytes)
  859. // return str, inputLog
  860. //
  861. //}
  862. func CancleNMGPrescriptionForCoordinatetwo(cmdid string, xml_date string) (string, string) {
  863. //inputData := make(map[string]interface{})
  864. //requestBody := fmt.Sprintf(`{"cmdid": "%s", "data": "%s"}`, cmdid, xml_date)
  865. //requestBody = url.QueryEscape(requestBody)
  866. //reader := bytes.NewReader(bytesData)
  867. var urls string
  868. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/HODoctorAdvice"
  869. //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  870. urls = gdyb_url
  871. values := url.Values{}
  872. values.Set("cmdid", cmdid)
  873. values.Set("data", xml_date)
  874. dataStr := values.Encode()
  875. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  876. request, err := http.NewRequest("POST", urls, strings.NewReader(dataStr))
  877. if err != nil {
  878. fmt.Println(err.Error())
  879. return err.Error(), ""
  880. }
  881. request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
  882. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  883. request.Header.Set("Accept", "*/*")
  884. client := http.Client{}
  885. resp, err := client.Do(request)
  886. if err != nil {
  887. fmt.Println(err.Error())
  888. return err.Error(), ""
  889. }
  890. respBytes, err := ioutil.ReadAll(resp.Body)
  891. if err != nil {
  892. fmt.Println(err.Error())
  893. return err.Error(), ""
  894. }
  895. fmt.Println(string(respBytes))
  896. str := string(respBytes)
  897. return str, dataStr
  898. }
  899. func Createzuobiao(zuobiao *models.HisZuobiaoAdvice){
  900. writeDb.Save(&zuobiao)
  901. }
  902. func Getzuobiao(user_org_id int64,patient_id int64,record_date int64)(zuobiao models.HisZuobiaoAdvice,err error){
  903. err = readDb.Model(&models.HisZuobiaoAdvice{}).Where("user_org_id = ? and patient_id = ? and record_date = ?",user_org_id,patient_id,record_date).First(&zuobiao).Error
  904. return
  905. }
  906. //查询诊断
  907. func QueryNMGDiagnoseForCoordinate(ACF01 int64, vaa01 string, vaa07 string) (string, string) {
  908. inputData := make(map[string]interface{})
  909. inputData["ACF01"] = ACF01 // 就诊凭证编号
  910. inputData["vaa01"] = vaa01 // 就诊凭证编号
  911. inputData["vaa07"] = vaa07 // 就诊凭证编号
  912. var inputLog string
  913. bytesData, err := json.Marshal(inputData)
  914. inputLog = string(bytesData)
  915. fmt.Println(string(bytesData))
  916. if err != nil {
  917. fmt.Println(err.Error())
  918. return err.Error(), ""
  919. }
  920. reader := bytes.NewReader(bytesData)
  921. var url string
  922. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAO_Query"
  923. //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  924. url = gdyb_url
  925. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  926. request, err := http.NewRequest("POST", url, reader)
  927. if err != nil {
  928. fmt.Println(err.Error())
  929. return err.Error(), ""
  930. }
  931. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  932. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  933. request.Header.Set("Accept", "*/*")
  934. client := http.Client{}
  935. resp, err := client.Do(request)
  936. if err != nil {
  937. fmt.Println(err.Error())
  938. return err.Error(), ""
  939. }
  940. respBytes, err := ioutil.ReadAll(resp.Body)
  941. if err != nil {
  942. fmt.Println(err.Error())
  943. return err.Error(), ""
  944. }
  945. fmt.Println(string(respBytes))
  946. str := string(respBytes)
  947. return str, inputLog
  948. }
  949. //查询检验
  950. func QueryNMGChenckForCoordinate(ACF01 int64, vaa01 string, vaa07 string,bfc03s string) (string, string) {
  951. inputData := make(map[string]interface{})
  952. inputData["ACF01"] = ACF01 // 就诊凭证编号
  953. inputData["vaa01"] = vaa01 // 就诊凭证编号
  954. inputData["vaa07"] = vaa07 // 就诊凭证编号
  955. inputData["bfc03s"] = bfc03s // 就诊凭证编号
  956. var inputLog string
  957. bytesData, err := json.Marshal(inputData)
  958. inputLog = string(bytesData)
  959. fmt.Println(string(bytesData))
  960. if err != nil {
  961. fmt.Println(err.Error())
  962. return err.Error(), ""
  963. }
  964. reader := bytes.NewReader(bytesData)
  965. var url string
  966. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/LAC_Query"
  967. //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  968. url = gdyb_url
  969. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  970. request, err := http.NewRequest("POST", url, reader)
  971. if err != nil {
  972. fmt.Println(err.Error())
  973. return err.Error(), ""
  974. }
  975. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  976. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  977. request.Header.Set("Accept", "*/*")
  978. client := http.Client{}
  979. resp, err := client.Do(request)
  980. if err != nil {
  981. fmt.Println(err.Error())
  982. return err.Error(), ""
  983. }
  984. respBytes, err := ioutil.ReadAll(resp.Body)
  985. if err != nil {
  986. fmt.Println(err.Error())
  987. return err.Error(), ""
  988. }
  989. fmt.Println(string(respBytes))
  990. str := string(respBytes)
  991. return str, inputLog
  992. }
  993. //血库记账接口
  994. func NMGSettleForCoordinate(info models.UploadInfo) (string, string) {
  995. inputData := make(map[string]interface{})
  996. inputData["acf01"] = info.Acf01 // 就诊凭证编号
  997. inputData["bce01"] = info.Bce01 // 就诊凭证编号
  998. inputData["bck01"] = info.Bck01 // 就诊凭证编号
  999. inputData["vaa07"] = info.Vaa07 // 就诊凭证编号
  1000. inputData["chargeList"] = info.ChargeListtwo // 就诊凭证编号
  1001. var inputLog string
  1002. bytesData, err := json.Marshal(inputData)
  1003. inputLog = string(bytesData)
  1004. fmt.Println(string(bytesData))
  1005. if err != nil {
  1006. fmt.Println(err.Error())
  1007. return err.Error(), ""
  1008. }
  1009. reader := bytes.NewReader(bytesData)
  1010. var url string
  1011. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAI_New"
  1012. //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  1013. url = gdyb_url
  1014. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  1015. request, err := http.NewRequest("POST", url, reader)
  1016. if err != nil {
  1017. fmt.Println(err.Error())
  1018. return err.Error(), ""
  1019. }
  1020. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1021. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  1022. request.Header.Set("Accept", "*/*")
  1023. client := http.Client{}
  1024. resp, err := client.Do(request)
  1025. if err != nil {
  1026. fmt.Println(err.Error())
  1027. return err.Error(), ""
  1028. }
  1029. respBytes, err := ioutil.ReadAll(resp.Body)
  1030. if err != nil {
  1031. fmt.Println(err.Error())
  1032. return err.Error(), ""
  1033. }
  1034. fmt.Println(string(respBytes))
  1035. str := string(respBytes)
  1036. return str, inputLog
  1037. }
  1038. //销账
  1039. func NMGCancleSettleForCoordinate(ACF01 int64,VAI01 string ) (string, string) {
  1040. inputData := make(map[string]interface{})
  1041. inputData["ACF01"] = ACF01 // 就诊凭证编号
  1042. inputData["VAI01"] = VAI01 // 就诊凭证编号
  1043. var inputLog string
  1044. bytesData, err := json.Marshal(inputData)
  1045. inputLog = string(bytesData)
  1046. fmt.Println(string(bytesData))
  1047. if err != nil {
  1048. fmt.Println(err.Error())
  1049. return err.Error(), ""
  1050. }
  1051. reader := bytes.NewReader(bytesData)
  1052. var url string
  1053. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAI_Del"
  1054. //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  1055. url = gdyb_url
  1056. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  1057. request, err := http.NewRequest("POST", url, reader)
  1058. if err != nil {
  1059. fmt.Println(err.Error())
  1060. return err.Error(), ""
  1061. }
  1062. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1063. //request.Header.Set("code", "Xmrjyy")
  1064. request.Header.Set("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  1065. request.Header.Set("Accept", "*/*")
  1066. client := http.Client{}
  1067. resp, err := client.Do(request)
  1068. if err != nil {
  1069. fmt.Println(err.Error())
  1070. return err.Error(), ""
  1071. }
  1072. respBytes, err := ioutil.ReadAll(resp.Body)
  1073. if err != nil {
  1074. fmt.Println(err.Error())
  1075. return err.Error(), ""
  1076. }
  1077. fmt.Println(string(respBytes))
  1078. str := string(respBytes)
  1079. return str, inputLog
  1080. }
  1081. func UploadPrescriptionForCoordinate(info models.UploadInfo) (string, string) {
  1082. //input := make(map[string]interface{})
  1083. inputData := make(map[string]interface{})
  1084. diags := make([]map[string]interface{}, 0)
  1085. //diags := make([]map[string]interface{}, 0)
  1086. presInfos := make([]map[string]interface{}, 0)
  1087. for _, item := range info.Diag {
  1088. inputDataDiag := make(map[string]interface{})
  1089. inputDataDiag["vao06"] = item.Vao06
  1090. inputDataDiag["bak02"] = item.Bak02
  1091. diags = append(diags, inputDataDiag)
  1092. }
  1093. for _, item := range info.PresInfo {
  1094. inputDataPresInfo := make(map[string]interface{})
  1095. inputDataPresInfo["cbm06"] = item.Cbm06
  1096. inputDataPresInfo["cbm07"] = item.Cbm06
  1097. inputDataPresInfo["cbmid"] = item.Cbmid
  1098. presDetails := make([]map[string]interface{}, 0)
  1099. for _, subItem := range item.PresDetail {
  1100. inputDataPresDetail := make(map[string]interface{})
  1101. inputDataPresDetail["vaf59"] = subItem.Vaf59
  1102. Items := make([]map[string]interface{}, 0)
  1103. for _, subSubItem := range subItem.Item {
  1104. inputDataItem := make(map[string]interface{})
  1105. inputDataItem["bbx01"] = subSubItem.Bbx01
  1106. inputDataItem["bda01"] = subSubItem.Bda01
  1107. inputDataItem["bby01"] = subSubItem.Bby01
  1108. inputDataItem["bck01b"] = subSubItem.Bck01b
  1109. inputDataItem["bck01d"] = subSubItem.Bck01d
  1110. inputDataItem["bdi01"] = subSubItem.Bdi01
  1111. inputDataItem["rownr"] = subSubItem.Rownr
  1112. inputDataItem["vaf11"] = subSubItem.Vaf11
  1113. inputDataItem["vaf14"] = subSubItem.Vaf14
  1114. inputDataItem["vaf15"] = subSubItem.Vaf15
  1115. inputDataItem["vaf17"] = subSubItem.Vaf17
  1116. inputDataItem["vaf18"] = subSubItem.Vaf18
  1117. inputDataItem["vaf19"] = subSubItem.Vaf19
  1118. inputDataItem["vaf20"] = subSubItem.Vaf20
  1119. inputDataItem["vaf21"] = subSubItem.Vaf21
  1120. inputDataItem["vaf22"] = subSubItem.Vaf22
  1121. inputDataItem["vaf32"] = subSubItem.Vaf32
  1122. inputDataItem["vaf35"] = subSubItem.Vaf35
  1123. inputDataItem["vaf36"] = subSubItem.Vaf36
  1124. inputDataItem["vaf58"] = subSubItem.Vaf58
  1125. inputDataItem["vaf61"] = subSubItem.Vaf61
  1126. Items = append(Items, inputDataItem)
  1127. }
  1128. inputDataPresDetail["item"] = Items
  1129. presDetails = append(presDetails, inputDataPresDetail)
  1130. }
  1131. inputDataPresInfo["presDetail"] = presDetails
  1132. presInfos = append(presInfos, inputDataPresInfo)
  1133. }
  1134. inputData["vaa01"] = info.Vaa01 // 就诊凭证编号
  1135. inputData["Fasong"] = info.Fasong // 就诊凭证编号
  1136. inputData["vaa07"] = info.Vaa07 // 就诊凭证编号
  1137. inputData["bck01c"] = info.Bck01c // 就诊凭证编号
  1138. inputData["bce02a"] = "1001" // 就诊凭证编号
  1139. inputData["diag"] = diags // 就诊凭证编号
  1140. inputData["presInfo"] = presInfos // 就诊凭证编号
  1141. var inputLog string
  1142. bytesData, err := json.Marshal(inputData)
  1143. inputLog = string(bytesData)
  1144. fmt.Println(string(bytesData))
  1145. if err != nil {
  1146. fmt.Println(err.Error())
  1147. return err.Error(), ""
  1148. }
  1149. reader := bytes.NewReader(bytesData)
  1150. var url string
  1151. gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  1152. url = gdyb_url
  1153. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  1154. request, err := http.NewRequest("POST", url, reader)
  1155. if err != nil {
  1156. fmt.Println(err.Error())
  1157. return err.Error(), ""
  1158. }
  1159. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1160. request.Header.Set("code", "Xmrjyy")
  1161. client := http.Client{}
  1162. resp, err := client.Do(request)
  1163. if err != nil {
  1164. fmt.Println(err.Error())
  1165. return err.Error(), ""
  1166. }
  1167. respBytes, err := ioutil.ReadAll(resp.Body)
  1168. if err != nil {
  1169. fmt.Println(err.Error())
  1170. return err.Error(), ""
  1171. }
  1172. fmt.Println(string(respBytes))
  1173. str := string(respBytes)
  1174. return str, inputLog
  1175. }
  1176. func UploadPrescriptionForCoordinateHospital(info models.UploadInfo) (string, string) {
  1177. //input := make(map[string]interface{})
  1178. inputData := make(map[string]interface{})
  1179. diags := make([]map[string]interface{}, 0)
  1180. //diags := make([]map[string]interface{}, 0)
  1181. presInfos := make([]map[string]interface{}, 0)
  1182. for _, item := range info.Diag {
  1183. inputDataDiag := make(map[string]interface{})
  1184. inputDataDiag["vao06"] = item.Vao06
  1185. inputDataDiag["bak02"] = item.Bak02
  1186. diags = append(diags, inputDataDiag)
  1187. }
  1188. for _, item := range info.PresInfo {
  1189. inputDataPresInfo := make(map[string]interface{})
  1190. inputDataPresInfo["cbm06"] = item.Cbm06
  1191. inputDataPresInfo["cbm07"] = item.Cbm06
  1192. inputDataPresInfo["cbmid"] = item.Cbmid
  1193. presDetails := make([]map[string]interface{}, 0)
  1194. for _, subItem := range item.PresDetail {
  1195. inputDataPresDetail := make(map[string]interface{})
  1196. inputDataPresDetail["vaf59"] = subItem.Vaf59
  1197. Items := make([]map[string]interface{}, 0)
  1198. for _, subSubItem := range subItem.Item {
  1199. inputDataItem := make(map[string]interface{})
  1200. inputDataItem["bbx01"] = subSubItem.Bbx01
  1201. inputDataItem["bda01"] = subSubItem.Bda01
  1202. inputDataItem["bby01"] = subSubItem.Bby01
  1203. inputDataItem["bck01b"] = subSubItem.Bck01b
  1204. inputDataItem["bck01d"] = subSubItem.Bck01d
  1205. inputDataItem["bdi01"] = subSubItem.Bdi01
  1206. inputDataItem["rownr"] = subSubItem.Rownr
  1207. inputDataItem["vaf11"] = subSubItem.Vaf11
  1208. inputDataItem["vaf14"] = subSubItem.Vaf14
  1209. inputDataItem["vaf15"] = subSubItem.Vaf15
  1210. inputDataItem["vaf17"] = subSubItem.Vaf17
  1211. inputDataItem["vaf18"] = subSubItem.Vaf18
  1212. inputDataItem["vaf19"] = subSubItem.Vaf19
  1213. inputDataItem["vaf20"] = subSubItem.Vaf20
  1214. inputDataItem["vaf21"] = subSubItem.Vaf21
  1215. inputDataItem["vaf22"] = subSubItem.Vaf22
  1216. inputDataItem["vaf32"] = subSubItem.Vaf32
  1217. inputDataItem["vaf35"] = subSubItem.Vaf35
  1218. inputDataItem["vaf36"] = subSubItem.Vaf36
  1219. inputDataItem["vaf58"] = subSubItem.Vaf58
  1220. inputDataItem["vaf61"] = subSubItem.Vaf61
  1221. Items = append(Items, inputDataItem)
  1222. }
  1223. inputDataPresDetail["item"] = Items
  1224. presDetails = append(presDetails, inputDataPresDetail)
  1225. }
  1226. inputDataPresInfo["presDetail"] = presDetails
  1227. presInfos = append(presInfos, inputDataPresInfo)
  1228. }
  1229. inputData["vaa01"] = info.Vaa01 // 就诊凭证编号
  1230. inputData["Fasong"] = info.Fasong // 就诊凭证编号
  1231. inputData["vaa07"] = info.Vaa07 // 就诊凭证编号
  1232. inputData["bck01c"] = info.Bck01c // 就诊凭证编号
  1233. inputData["bce02a"] = "1001" // 就诊凭证编号
  1234. inputData["diag"] = diags // 就诊凭证编号
  1235. inputData["presInfo"] = presInfos // 就诊凭证编号
  1236. var inputLog string
  1237. bytesData, err := json.Marshal(inputData)
  1238. inputLog = string(bytesData)
  1239. fmt.Println(string(bytesData))
  1240. if err != nil {
  1241. fmt.Println(err.Error())
  1242. return err.Error(), ""
  1243. }
  1244. reader := bytes.NewReader(bytesData)
  1245. var url string
  1246. gdyb_url := "http://218.104.146.179:9091/esb/listener/saveOrdInfoIp"
  1247. url = gdyb_url
  1248. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  1249. request, err := http.NewRequest("POST", url, reader)
  1250. if err != nil {
  1251. fmt.Println(err.Error())
  1252. return err.Error(), ""
  1253. }
  1254. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1255. request.Header.Set("code", "Xmrjyy")
  1256. client := http.Client{}
  1257. resp, err := client.Do(request)
  1258. if err != nil {
  1259. fmt.Println(err.Error())
  1260. return err.Error(), ""
  1261. }
  1262. respBytes, err := ioutil.ReadAll(resp.Body)
  1263. if err != nil {
  1264. fmt.Println(err.Error())
  1265. return err.Error(), ""
  1266. }
  1267. fmt.Println(string(respBytes))
  1268. str := string(respBytes)
  1269. return str, inputLog
  1270. }
  1271. func UpDatePrescriptionNumberForCoordinate(user_org_id int64, ids []int64, number string) (err error) {
  1272. err = writeDb.Model(&models.HisPrescription{}).Where("user_org_id = ? AND status = 1 AND id in (?)", user_org_id, ids).Updates(map[string]interface{}{"batch_number": number, "mtime": time.Now().Unix(), "order_status": 6}).Error
  1273. return
  1274. }
  1275. func FindPatientPrescriptionInfoTwo(org_id int64, patient_id int64, record_date int64, p_type int64) (info models.HisPrescriptionInfo, err error) {
  1276. err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ? AND p_type = ? ", org_id, record_date, patient_id, p_type).First(&info).Error
  1277. return
  1278. }
  1279. func GetExecutionFrequencyByName(name string, org_id int64) (ef models.ExecutionFrequencyDic, err error) {
  1280. err = readDb.Model(&models.ExecutionFrequencyDic{}).Where("org_id = ? AND name = ?", org_id, name).First(&ef).Error
  1281. return
  1282. }
  1283. func UpdataHisPateintTwo(his *models.VMHisPatient) {
  1284. writeDb.Save(&his)
  1285. }
  1286. func UpdataHisPateintThree(his *models.HisPatient) {
  1287. writeDb.Save(&his)
  1288. }
  1289. func UpDateHisPrescriptionInfoNumbertwo(user_org_id int64, id int64, number string, record_time int64, his_patient_id int64) (err error) {
  1290. err = writeDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND his_patient_id = ? AND record_date = ?", user_org_id, his_patient_id, record_time).Updates(map[string]interface{}{"batch_number": number, "prescription_status": 3, "mtime": time.Now().Unix()}).Error
  1291. return
  1292. }
  1293. func UpdataOrderStatusThreef(number string, user_org_id int64) (err error) {
  1294. err = writeDb.Model(&models.HisPrescription{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"order_status": 5, "mtime": time.Now().Unix()}).Error
  1295. err = writeDb.Model(&models.HisPrescriptionInfo{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"prescription_status": 5, "mtime": time.Now().Unix()}).Error
  1296. return
  1297. }
  1298. func UpdataOrderStatustwo(id int64, number string, user_org_id int64) (err error) {
  1299. err = writeDb.Model(&models.HisOrder{}).Where("status = 1 AND id = ? AND user_org_id = ?", id, user_org_id).Updates(map[string]interface{}{"order_status": 3, "mtime": time.Now().Unix(), "status": 0}).Error
  1300. err = writeDb.Model(&models.HisPrescription{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"order_status": 1, "mtime": time.Now().Unix()}).Error
  1301. err = writeDb.Model(&models.HisPrescriptionInfo{}).Where("status = 1 AND batch_number = ? AND user_org_id = ?", number, user_org_id).Updates(map[string]interface{}{"prescription_status": 1, "mtime": time.Now().Unix()}).Error
  1302. return
  1303. }
  1304. func GetHisPatientByIdThree(id int64) (models.HisPatient, error) {
  1305. patient := models.HisPatient{}
  1306. err := XTReadDB().Model(&patient).Where("id = ? and status = 1", id).First(&patient).Error
  1307. return patient, err
  1308. }
  1309. func GetDrugwayDicByName(name string, org_id int64) (ef models.DrugwayDic, err error) {
  1310. err = readDb.Model(&models.DrugwayDic{}).Where("org_id = ? AND name = ?", org_id, name).First(&ef).Error
  1311. return
  1312. }