coordinate_service.go 52KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570
  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("VMHisPrescriptionInfo","status = 1").
  258. Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
  259. return db.Where("status = 1 AND user_org_id = ? and is_self_drug <> 1", org_id).Preload("BaseDrugLib", "status=1")
  260. }).
  261. Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
  262. return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject").Preload("GoodInfo", "status=1")
  263. }).
  264. 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).
  265. Find(&prescription).Error
  266. return
  267. }
  268. func GetUnSettleHisPrescriptionFiveone(id int64) (prescription []models.HisPrescription, err error) {
  269. err = readDb.Model(&models.HisPrescription{}).
  270. Preload("VMHisPrescriptionInfo","status = 1").
  271. Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
  272. return db.Where("status = 1 and is_self_drug <> 1").Preload("BaseDrugLib", "status=1")
  273. }).
  274. Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
  275. return db.Where("status = 1").Preload("HisProject").Preload("GoodInfo", "status=1")
  276. }).
  277. Where("id = ?", id).
  278. Find(&prescription).Error
  279. return
  280. }
  281. func GetUnSettleMonthHisPrescription(org_id int64, patient_id int64, start_date int64, end_date int64) (prescription []models.HisPrescription, err error) {
  282. err = readDb.Model(&models.HisPrescription{}).
  283. Preload("VMHisPrescriptionInfo","status = 1").
  284. Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
  285. return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("XtHisAddtionConfig", "status=1")
  286. }).
  287. Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
  288. return db.Where("status = 1 AND user_org_id = ? and is_self_drug <> 1 ", org_id).Preload("BaseDrugLib", "status=1")
  289. }).
  290. Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
  291. return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject").Preload("GoodInfo", "status=1").Preload("XtHisProjectTeam", "status = 1")
  292. }).
  293. 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).
  294. Find(&prescription).Error
  295. return
  296. }
  297. func GetHisOrderFour(patient_id string, infoSeq string, docId string) (order models.HisOrder, err error) {
  298. if len(docId) > 0 {
  299. err = readDb.Model(&models.HisOrder{}).Where("mdtrt_id = ? AND psn_no = ? AND setl_id = ? AND status = 1", infoSeq, patient_id, docId).First(&order).Error
  300. } else {
  301. err = readDb.Model(&models.HisOrder{}).Where("mdtrt_id = ? AND psn_no = ? AND status = 1 ", infoSeq, patient_id).First(&order).Error
  302. }
  303. return
  304. }
  305. func GetHisPatientForCoordinate(id_card_no string) (string, string) {
  306. //input := make(map[string]interface{})
  307. inputData := make(map[string]interface{})
  308. inputData["idcard"] = id_card_no // 就诊凭证编号
  309. var inputLog string
  310. bytesData, err := json.Marshal(inputData)
  311. inputLog = string(bytesData)
  312. fmt.Println(string(bytesData))
  313. if err != nil {
  314. fmt.Println(err.Error())
  315. return err.Error(), ""
  316. }
  317. reader := bytes.NewReader(bytesData)
  318. var url string
  319. gdyb_url := "http://218.104.146.179:9091/esb/listener/getPatientType"
  320. url = gdyb_url
  321. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  322. request, err := http.NewRequest("GET", url, reader)
  323. if err != nil {
  324. fmt.Println(err.Error())
  325. return err.Error(), ""
  326. }
  327. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  328. request.Header.Set("code", "Xmrjyy")
  329. client := http.Client{}
  330. resp, err := client.Do(request)
  331. if err != nil {
  332. fmt.Println(err.Error())
  333. return err.Error(), ""
  334. }
  335. respBytes, err := ioutil.ReadAll(resp.Body)
  336. if err != nil {
  337. fmt.Println(err.Error())
  338. return err.Error(), ""
  339. }
  340. fmt.Println(string(respBytes))
  341. str := string(respBytes)
  342. return str, inputLog
  343. }
  344. //查询患者列表
  345. func GetNMGHisPatientForCoordinate(VAA01 int64,VAA07 int64,ACF01 int64,keyword string) (string, string) {
  346. //input := make(map[string]interface{})
  347. inputData := make(map[string]interface{})
  348. inputData["vaa01"] = VAA01 // 就诊凭证编号
  349. inputData["vaa07"] = VAA07 // 就诊凭证编号
  350. inputData["acf01"] = ACF01// 就诊凭证编号
  351. inputData["keyword"] = keyword // 就诊凭证编号
  352. var inputLog string
  353. bytesData, err := json.Marshal(inputData)
  354. inputLog = string(bytesData)
  355. fmt.Println(string(bytesData))
  356. if err != nil {
  357. fmt.Println(err.Error())
  358. return err.Error(), ""
  359. }
  360. reader := bytes.NewBuffer(bytesData)
  361. var url string
  362. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/QueryPat"
  363. url = gdyb_url
  364. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  365. request, err := http.NewRequest("POST", url, reader)
  366. if err != nil {
  367. fmt.Println(err.Error())
  368. return err.Error(), ""
  369. }
  370. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  371. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  372. request.Header.Set("Accept", "*/*")
  373. fmt.Println(request)
  374. fmt.Println(request.Header)
  375. client := http.Client{}
  376. resp, err := client.Do(request)
  377. if err != nil {
  378. fmt.Println(err.Error())
  379. return err.Error(), ""
  380. }
  381. defer resp.Body.Close()
  382. fmt.Println(resp)
  383. fmt.Println("resp.Status")
  384. fmt.Println(resp.Status)
  385. fmt.Println("resp.Body")
  386. fmt.Println(resp.Body)
  387. respBytes, err := ioutil.ReadAll(resp.Body)
  388. if err != nil {
  389. fmt.Println(err.Error())
  390. return err.Error(), ""
  391. }
  392. fmt.Println(string(respBytes))
  393. str := string(respBytes)
  394. return str, inputLog
  395. }
  396. func GetDeptEmp() (string, string) {
  397. //input := make(map[string]interface{})
  398. inputData := make(map[string]interface{})
  399. var inputLog string
  400. bytesData, err := json.Marshal(inputData)
  401. inputLog = string(bytesData)
  402. fmt.Println(string(bytesData))
  403. if err != nil {
  404. fmt.Println(err.Error())
  405. return err.Error(), ""
  406. }
  407. reader := bytes.NewBuffer(bytesData)
  408. var url string
  409. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/GetDeptEmp"
  410. url = gdyb_url
  411. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  412. request, err := http.NewRequest("POST", url, reader)
  413. if err != nil {
  414. fmt.Println(err.Error())
  415. return err.Error(), ""
  416. }
  417. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  418. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  419. request.Header.Set("Accept", "*/*")
  420. fmt.Println(request)
  421. fmt.Println(request.Header)
  422. client := http.Client{}
  423. resp, err := client.Do(request)
  424. if err != nil {
  425. fmt.Println(err.Error())
  426. return err.Error(), ""
  427. }
  428. defer resp.Body.Close()
  429. fmt.Println(resp)
  430. fmt.Println("resp.Status")
  431. fmt.Println(resp.Status)
  432. fmt.Println("resp.Body")
  433. fmt.Println(resp.Body)
  434. respBytes, err := ioutil.ReadAll(resp.Body)
  435. if err != nil {
  436. fmt.Println(err.Error())
  437. return err.Error(), ""
  438. }
  439. fmt.Println(string(respBytes))
  440. str := string(respBytes)
  441. return str, inputLog
  442. }
  443. func GetDrugInterval() (string, string) {
  444. //input := make(map[string]interface{})
  445. inputData := make(map[string]interface{})
  446. //inputData["BCE41"] = ”“ // 就诊凭证编号
  447. var inputLog string
  448. bytesData, err := json.Marshal(inputData)
  449. inputLog = string(bytesData)
  450. fmt.Println(string(bytesData))
  451. if err != nil {
  452. fmt.Println(err.Error())
  453. return err.Error(), ""
  454. }
  455. reader := bytes.NewBuffer(bytesData)
  456. var url string
  457. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/GetDrugInterval"
  458. url = gdyb_url
  459. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  460. request, err := http.NewRequest("POST", url, reader)
  461. if err != nil {
  462. fmt.Println(err.Error())
  463. return err.Error(), ""
  464. }
  465. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  466. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  467. request.Header.Set("Accept", "*/*")
  468. fmt.Println(request)
  469. fmt.Println(request.Header)
  470. client := http.Client{}
  471. resp, err := client.Do(request)
  472. if err != nil {
  473. fmt.Println(err.Error())
  474. return err.Error(), ""
  475. }
  476. defer resp.Body.Close()
  477. fmt.Println(resp)
  478. fmt.Println("resp.Status")
  479. fmt.Println(resp.Status)
  480. fmt.Println("resp.Body")
  481. fmt.Println(resp.Body)
  482. respBytes, err := ioutil.ReadAll(resp.Body)
  483. if err != nil {
  484. fmt.Println(err.Error())
  485. return err.Error(), ""
  486. }
  487. fmt.Println(string(respBytes))
  488. str := string(respBytes)
  489. return str, inputLog
  490. }
  491. func GetUsage() (string, string) {
  492. //input := make(map[string]interface{})
  493. inputData := make(map[string]interface{})
  494. var inputLog string
  495. bytesData, err := json.Marshal(inputData)
  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.NewBuffer(bytesData)
  503. var url string
  504. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/GetUsage"
  505. url = gdyb_url
  506. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  507. request, err := http.NewRequest("POST", url, reader)
  508. if err != nil {
  509. fmt.Println(err.Error())
  510. return err.Error(), ""
  511. }
  512. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  513. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  514. request.Header.Set("Accept", "*/*")
  515. fmt.Println(request)
  516. fmt.Println(request.Header)
  517. client := http.Client{}
  518. resp, err := client.Do(request)
  519. if err != nil {
  520. fmt.Println(err.Error())
  521. return err.Error(), ""
  522. }
  523. defer resp.Body.Close()
  524. fmt.Println(resp)
  525. fmt.Println("resp.Status")
  526. fmt.Println(resp.Status)
  527. fmt.Println("resp.Body")
  528. fmt.Println(resp.Body)
  529. respBytes, err := ioutil.ReadAll(resp.Body)
  530. if err != nil {
  531. fmt.Println(err.Error())
  532. return err.Error(), ""
  533. }
  534. fmt.Println(string(respBytes))
  535. str := string(respBytes)
  536. return str, inputLog
  537. }
  538. func GetDrugs() (string, string) {
  539. //input := make(map[string]interface{})
  540. inputData := make(map[string]interface{})
  541. var inputLog string
  542. bytesData, err := json.Marshal(inputData)
  543. inputLog = string(bytesData)
  544. fmt.Println(string(bytesData))
  545. if err != nil {
  546. fmt.Println(err.Error())
  547. return err.Error(), ""
  548. }
  549. reader := bytes.NewBuffer(bytesData)
  550. var url string
  551. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/GetDrugs"
  552. url = gdyb_url
  553. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  554. request, err := http.NewRequest("POST", url, reader)
  555. if err != nil {
  556. fmt.Println(err.Error())
  557. return err.Error(), ""
  558. }
  559. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  560. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  561. request.Header.Set("Accept", "*/*")
  562. //fmt.Println(request)
  563. //fmt.Println(request.Header)
  564. client := http.Client{}
  565. resp, err := client.Do(request)
  566. if err != nil {
  567. fmt.Println(err.Error())
  568. return err.Error(), ""
  569. }
  570. defer resp.Body.Close()
  571. respBytes, err := ioutil.ReadAll(resp.Body)
  572. if err != nil {
  573. fmt.Println(err.Error())
  574. return err.Error(), ""
  575. }
  576. str := string(respBytes)
  577. return str, inputLog
  578. }
  579. func GetProject() (string, string) {
  580. //input := make(map[string]interface{})
  581. inputData := make(map[string]interface{})
  582. var inputLog string
  583. bytesData, err := json.Marshal(inputData)
  584. //inputLog = string(bytesData)
  585. if err != nil {
  586. fmt.Println(err.Error())
  587. return err.Error(), ""
  588. }
  589. reader := bytes.NewBuffer(bytesData)
  590. var url string
  591. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/GetProject"
  592. url = gdyb_url
  593. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  594. request, err := http.NewRequest("POST", url, reader)
  595. if err != nil {
  596. fmt.Println(err.Error())
  597. return err.Error(), ""
  598. }
  599. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  600. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  601. request.Header.Set("Accept", "*/*")
  602. client := http.Client{}
  603. resp, err := client.Do(request)
  604. if err != nil {
  605. fmt.Println(err.Error())
  606. return err.Error(), ""
  607. }
  608. defer resp.Body.Close()
  609. respBytes, err := ioutil.ReadAll(resp.Body)
  610. if err != nil {
  611. fmt.Println(err.Error())
  612. return err.Error(), ""
  613. }
  614. str := string(respBytes)
  615. return str, inputLog
  616. }
  617. //开医嘱版本1
  618. //func UploadNMGPrescriptionForCoordinate(info models.UploadInfo) (string, string) {
  619. //
  620. //
  621. // inputData := make(map[string]interface{})
  622. //
  623. //
  624. // presInfos := make([]map[string]interface{}, 0)
  625. //
  626. //
  627. // for _, item := range info.ChargeList {
  628. // inputDataPresInfo := make(map[string]interface{})
  629. // inputDataPresInfo["bbx01"] = item.Bbx01
  630. // inputDataPresInfo["vaf21"] = item.Vaf21
  631. // inputDataPresInfo["vaf22"] = item.Vaf22
  632. // inputDataPresInfo["vaf42"] = item.Vaf42
  633. // presInfos = append(presInfos, inputDataPresInfo)
  634. // }
  635. // inputData["vaa01"] = info.Vaa01 // 就诊凭证编号
  636. // inputData["vaa07"] = info.Vaa07 // 就诊凭证编号
  637. // inputData["acf01"] = info.Acf01 // 就诊凭证编号
  638. // inputData["vaa05"] = info.Vaa05 // 就诊凭证编号
  639. // inputData["bck01"] = info.Bck01 // 就诊凭证编号
  640. // inputData["bce01a"] = info.Bce01a // 就诊凭证编号
  641. // inputData["bck01a"] = info.Bck01a // 就诊凭证编号
  642. // inputData["vafReqList"] = presInfos // 就诊凭证编号
  643. // var inputLog string
  644. // bytesData, err := json.Marshal(inputData)
  645. // inputLog = string(bytesData)
  646. // fmt.Println(string(bytesData))
  647. // if err != nil {
  648. // fmt.Println(err.Error())
  649. // return err.Error(), ""
  650. // }
  651. // reader := bytes.NewReader(bytesData)
  652. // var url string
  653. // gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAF_New"
  654. //
  655. // //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  656. // url = gdyb_url
  657. //
  658. // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  659. // request, err := http.NewRequest("POST", url, reader)
  660. // if err != nil {
  661. // fmt.Println(err.Error())
  662. // return err.Error(), ""
  663. // }
  664. //
  665. // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  666. // request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  667. // request.Header.Set("Accept", "*/*")
  668. // client := http.Client{}
  669. // resp, err := client.Do(request)
  670. // if err != nil {
  671. // fmt.Println(err.Error())
  672. // return err.Error(), ""
  673. // }
  674. // respBytes, err := ioutil.ReadAll(resp.Body)
  675. // if err != nil {
  676. // fmt.Println(err.Error())
  677. // return err.Error(), ""
  678. // }
  679. // fmt.Println(string(respBytes))
  680. // str := string(respBytes)
  681. // return str, inputLog
  682. //
  683. //}
  684. //开医嘱版本2
  685. func UploadNMGPrescriptionForCoordinatetwo(cmdid string, xml_date string) (string, string) {
  686. //inputData := make(map[string]interface{})
  687. //requestBody := fmt.Sprintf(`{"cmdid": "%s", "data": "%s"}`, cmdid, xml_date)
  688. //requestBody = url.QueryEscape(requestBody)
  689. //reader := bytes.NewReader(bytesData)
  690. var urls string
  691. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/HODoctorAdvice"
  692. //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  693. urls = gdyb_url
  694. values := url.Values{}
  695. values.Set("cmdid", cmdid)
  696. values.Set("data", xml_date)
  697. dataStr := values.Encode()
  698. fmt.Println(xml_date)
  699. fmt.Println(dataStr)
  700. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  701. request, err := http.NewRequest("POST", urls, bytes.NewBufferString(string(dataStr)))
  702. if err != nil {
  703. fmt.Println(err.Error())
  704. return err.Error(), ""
  705. }
  706. request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
  707. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  708. request.Header.Set("Accept", "*/*")
  709. client := http.Client{}
  710. resp, err := client.Do(request)
  711. if err != nil {
  712. fmt.Println(err.Error())
  713. return err.Error(), ""
  714. }
  715. respBytes, err := ioutil.ReadAll(resp.Body)
  716. if err != nil {
  717. fmt.Println(err.Error())
  718. return err.Error(), ""
  719. }
  720. fmt.Println(string(respBytes))
  721. str := string(respBytes)
  722. return str, dataStr
  723. }
  724. //查询医嘱
  725. func QueryNMGPrescriptionForCoordinate(ACF01 int64, vaf01List []string, cbm01 string) (string, string) {
  726. inputData := make(map[string]interface{})
  727. inputData["ACF01"] = ACF01 // 就诊凭证编号
  728. inputData["vaf01List"] = vaf01List // 就诊凭证编号
  729. inputData["cbm01"] = cbm01 // 就诊凭证编号
  730. var inputLog string
  731. bytesData, err := json.Marshal(inputData)
  732. inputLog = string(bytesData)
  733. fmt.Println(string(bytesData))
  734. if err != nil {
  735. fmt.Println(err.Error())
  736. return err.Error(), ""
  737. }
  738. reader := bytes.NewReader(bytesData)
  739. var url string
  740. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAF_Query"
  741. //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  742. url = gdyb_url
  743. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  744. request, err := http.NewRequest("POST", url, reader)
  745. if err != nil {
  746. fmt.Println(err.Error())
  747. return err.Error(), ""
  748. }
  749. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  750. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  751. request.Header.Set("Accept", "*/*")
  752. client := http.Client{}
  753. resp, err := client.Do(request)
  754. if err != nil {
  755. fmt.Println(err.Error())
  756. return err.Error(), ""
  757. }
  758. respBytes, err := ioutil.ReadAll(resp.Body)
  759. if err != nil {
  760. fmt.Println(err.Error())
  761. return err.Error(), ""
  762. }
  763. fmt.Println(string(respBytes))
  764. str := string(respBytes)
  765. return str, inputLog
  766. }
  767. //删除医嘱
  768. func CancleNMGPrescriptionForCoordinate(ACF01 int64, cbm01 string) (string, string) {
  769. inputData := make(map[string]interface{})
  770. //
  771. //if len(vaf01List) == 0{
  772. inputData["ACF01"] = ACF01 // 就诊凭证编号
  773. inputData["vaf01List"] = "" // 就诊凭证编号
  774. inputData["cbm01"] = cbm01 // 就诊凭证编号
  775. //}else{
  776. // inputData["ACF01"] = ACF01 // 就诊凭证编号
  777. // inputData["vaf01List"] = vaf01List // 就诊凭证编号
  778. // inputData["cbm01"] = cbm01 // 就诊凭证编号
  779. //}
  780. var inputLog string
  781. bytesData, err := json.Marshal(inputData)
  782. inputLog = string(bytesData)
  783. fmt.Println(string(bytesData))
  784. if err != nil {
  785. fmt.Println(err.Error())
  786. return err.Error(), ""
  787. }
  788. reader := bytes.NewReader(bytesData)
  789. var url string
  790. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAF_Del"
  791. //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  792. url = gdyb_url
  793. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  794. request, err := http.NewRequest("POST", url, reader)
  795. if err != nil {
  796. fmt.Println(err.Error())
  797. return err.Error(), ""
  798. }
  799. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  800. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  801. request.Header.Set("Accept", "*/*")
  802. client := http.Client{}
  803. resp, err := client.Do(request)
  804. if err != nil {
  805. fmt.Println(err.Error())
  806. return err.Error(), ""
  807. }
  808. respBytes, err := ioutil.ReadAll(resp.Body)
  809. if err != nil {
  810. fmt.Println(err.Error())
  811. return err.Error(), ""
  812. }
  813. fmt.Println(string(respBytes))
  814. str := string(respBytes)
  815. return str, inputLog
  816. }
  817. //删除医嘱版本2
  818. //func CancleNMGPrescriptionForCoordinatetwo(ACF01 int, cbm01 string,vaf01List []string) (string, string) {
  819. //
  820. // inputData := make(map[string]interface{})
  821. // //
  822. // //if len(vaf01List) == 0{
  823. // inputData["ACF01"] = ACF01 // 就诊凭证编号
  824. // inputData["vaf01List"] = "" // 就诊凭证编号
  825. // inputData["cbm01"] = cbm01 // 就诊凭证编号
  826. //
  827. // //}else{
  828. // // inputData["ACF01"] = ACF01 // 就诊凭证编号
  829. // // inputData["vaf01List"] = vaf01List // 就诊凭证编号
  830. // // inputData["cbm01"] = cbm01 // 就诊凭证编号
  831. // //}
  832. //
  833. // var inputLog string
  834. // bytesData, err := json.Marshal(inputData)
  835. // inputLog = string(bytesData)
  836. // fmt.Println(string(bytesData))
  837. // if err != nil {
  838. // fmt.Println(err.Error())
  839. // return err.Error(), ""
  840. // }
  841. // reader := bytes.NewReader(bytesData)
  842. // var url string
  843. // gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAF_Del"
  844. //
  845. // //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  846. // url = gdyb_url
  847. //
  848. // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  849. // request, err := http.NewRequest("POST", url, reader)
  850. // if err != nil {
  851. // fmt.Println(err.Error())
  852. // return err.Error(), ""
  853. // }
  854. //
  855. // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  856. // request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  857. // request.Header.Set("Accept", "*/*")
  858. // client := http.Client{}
  859. // resp, err := client.Do(request)
  860. // if err != nil {
  861. // fmt.Println(err.Error())
  862. // return err.Error(), ""
  863. // }
  864. // respBytes, err := ioutil.ReadAll(resp.Body)
  865. // if err != nil {
  866. // fmt.Println(err.Error())
  867. // return err.Error(), ""
  868. // }
  869. // fmt.Println(string(respBytes))
  870. // str := string(respBytes)
  871. // return str, inputLog
  872. //
  873. //}
  874. func CancleNMGPrescriptionForCoordinatetwo(cmdid string, xml_date string) (string, string) {
  875. //inputData := make(map[string]interface{})
  876. //requestBody := fmt.Sprintf(`{"cmdid": "%s", "data": "%s"}`, cmdid, xml_date)
  877. //requestBody = url.QueryEscape(requestBody)
  878. //reader := bytes.NewReader(bytesData)
  879. var urls string
  880. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/HODoctorAdvice"
  881. //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  882. urls = gdyb_url
  883. values := url.Values{}
  884. values.Set("cmdid", cmdid)
  885. values.Set("data", xml_date)
  886. dataStr := values.Encode()
  887. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  888. request, err := http.NewRequest("POST", urls, strings.NewReader(dataStr))
  889. if err != nil {
  890. fmt.Println(err.Error())
  891. return err.Error(), ""
  892. }
  893. request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
  894. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  895. request.Header.Set("Accept", "*/*")
  896. client := http.Client{}
  897. resp, err := client.Do(request)
  898. if err != nil {
  899. fmt.Println(err.Error())
  900. return err.Error(), ""
  901. }
  902. respBytes, err := ioutil.ReadAll(resp.Body)
  903. if err != nil {
  904. fmt.Println(err.Error())
  905. return err.Error(), ""
  906. }
  907. fmt.Println(string(respBytes))
  908. str := string(respBytes)
  909. return str, dataStr
  910. }
  911. func Createzuobiao(zuobiao *models.HisZuobiaoAdvice){
  912. writeDb.Save(&zuobiao)
  913. }
  914. func Getzuobiao(user_org_id int64,patient_id int64,start_time int64,end_time int64, ids string,vaa01 string, vaa07 string)(zuobiao models.HisZuobiaoAdvice,err error){
  915. err = readDb.Model(&models.HisZuobiaoAdvice{}).Where("user_org_id = ? and patient_id = ? and start_time = ? and end_time = ? and status = 1 and cbm01 = ? and vaa01 = ? and vaa07 = ?",user_org_id,patient_id,start_time,end_time,ids,vaa01,vaa07).Last(&zuobiao).Error
  916. return
  917. }
  918. func Getzuobiaobyid(id int64)(zuobiao models.HisZuobiaoAdvice,err error){
  919. err = readDb.Model(&models.HisZuobiaoAdvice{}).Where("id = ?",id).Last(&zuobiao).Error
  920. return
  921. }
  922. //查询诊断
  923. func QueryNMGDiagnoseForCoordinate(ACF01 int64, vaa01 string, vaa07 string) (string, string) {
  924. inputData := make(map[string]interface{})
  925. inputData["ACF01"] = ACF01 // 就诊凭证编号
  926. inputData["vaa01"] = vaa01 // 就诊凭证编号
  927. inputData["vaa07"] = vaa07 // 就诊凭证编号
  928. var inputLog string
  929. bytesData, err := json.Marshal(inputData)
  930. inputLog = string(bytesData)
  931. fmt.Println(string(bytesData))
  932. if err != nil {
  933. fmt.Println(err.Error())
  934. return err.Error(), ""
  935. }
  936. reader := bytes.NewReader(bytesData)
  937. var url string
  938. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAO_Query"
  939. //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  940. url = gdyb_url
  941. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  942. request, err := http.NewRequest("POST", url, reader)
  943. if err != nil {
  944. fmt.Println(err.Error())
  945. return err.Error(), ""
  946. }
  947. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  948. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  949. request.Header.Set("Accept", "*/*")
  950. client := http.Client{}
  951. resp, err := client.Do(request)
  952. if err != nil {
  953. fmt.Println(err.Error())
  954. return err.Error(), ""
  955. }
  956. respBytes, err := ioutil.ReadAll(resp.Body)
  957. if err != nil {
  958. fmt.Println(err.Error())
  959. return err.Error(), ""
  960. }
  961. fmt.Println(string(respBytes))
  962. str := string(respBytes)
  963. return str, inputLog
  964. }
  965. //查询检验
  966. func QueryNMGChenckForCoordinate(ACF01 int64, vaa01 string, vaa07 string,bfc03s string) (string, string) {
  967. inputData := make(map[string]interface{})
  968. inputData["ACF01"] = ACF01 // 就诊凭证编号
  969. inputData["vaa01"] = vaa01 // 就诊凭证编号
  970. inputData["vaa07"] = vaa07 // 就诊凭证编号
  971. inputData["bfc03s"] = bfc03s // 就诊凭证编号
  972. var inputLog string
  973. bytesData, err := json.Marshal(inputData)
  974. inputLog = string(bytesData)
  975. fmt.Println(string(bytesData))
  976. if err != nil {
  977. fmt.Println(err.Error())
  978. return err.Error(), ""
  979. }
  980. reader := bytes.NewReader(bytesData)
  981. var url string
  982. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/LAC_Query"
  983. //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  984. url = gdyb_url
  985. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  986. request, err := http.NewRequest("POST", url, reader)
  987. if err != nil {
  988. fmt.Println(err.Error())
  989. return err.Error(), ""
  990. }
  991. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  992. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  993. request.Header.Set("Accept", "*/*")
  994. client := http.Client{}
  995. resp, err := client.Do(request)
  996. if err != nil {
  997. fmt.Println(err.Error())
  998. return err.Error(), ""
  999. }
  1000. respBytes, err := ioutil.ReadAll(resp.Body)
  1001. if err != nil {
  1002. fmt.Println(err.Error())
  1003. return err.Error(), ""
  1004. }
  1005. fmt.Println(string(respBytes))
  1006. str := string(respBytes)
  1007. return str, inputLog
  1008. }
  1009. //血库记账接口
  1010. func NMGSettleForCoordinate(info models.UploadInfo) (string, string) {
  1011. fmt.Println(info)
  1012. inputData := make(map[string]interface{})
  1013. inputData["acf01"] = info.Acf01 // 就诊凭证编号
  1014. inputData["bce01"] = info.Bce01 // 就诊凭证编号
  1015. inputData["bck01"] = info.Bck01 // 就诊凭证编号
  1016. inputData["vaa07"] = info.Vaa07 // 就诊凭证编号
  1017. inputData["chargeList"] = info.ChargeListtwo // 就诊凭证编号
  1018. var inputLog string
  1019. bytesData, err := json.Marshal(inputData)
  1020. inputLog = string(bytesData)
  1021. if err != nil {
  1022. fmt.Println(err.Error())
  1023. return err.Error(), ""
  1024. }
  1025. reader := bytes.NewReader(bytesData)
  1026. var url string
  1027. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAI_New"
  1028. //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  1029. url = gdyb_url
  1030. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  1031. request, err := http.NewRequest("POST", url, reader)
  1032. if err != nil {
  1033. fmt.Println(err.Error())
  1034. return err.Error(), ""
  1035. }
  1036. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1037. request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  1038. request.Header.Set("Accept", "*/*")
  1039. client := http.Client{}
  1040. resp, err := client.Do(request)
  1041. if err != nil {
  1042. fmt.Println(err.Error())
  1043. return err.Error(), ""
  1044. }
  1045. respBytes, err := ioutil.ReadAll(resp.Body)
  1046. if err != nil {
  1047. fmt.Println(err.Error())
  1048. return err.Error(), ""
  1049. }
  1050. fmt.Println(string(respBytes))
  1051. str := string(respBytes)
  1052. return str, inputLog
  1053. }
  1054. //销账
  1055. func NMGCancleSettleForCoordinate(ACF01 int64,VAI01 string ) (string, string) {
  1056. inputData := make(map[string]interface{})
  1057. inputData["ACF01"] = ACF01 // 就诊凭证编号
  1058. inputData["VAI01"] = VAI01 // 就诊凭证编号
  1059. var inputLog string
  1060. bytesData, err := json.Marshal(inputData)
  1061. inputLog = string(bytesData)
  1062. fmt.Println(string(bytesData))
  1063. if err != nil {
  1064. fmt.Println(err.Error())
  1065. return err.Error(), ""
  1066. }
  1067. reader := bytes.NewReader(bytesData)
  1068. var url string
  1069. gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAI_Del"
  1070. //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  1071. url = gdyb_url
  1072. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  1073. request, err := http.NewRequest("POST", url, reader)
  1074. if err != nil {
  1075. fmt.Println(err.Error())
  1076. return err.Error(), ""
  1077. }
  1078. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1079. //request.Header.Set("code", "Xmrjyy")
  1080. request.Header.Set("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
  1081. request.Header.Set("Accept", "*/*")
  1082. client := http.Client{}
  1083. resp, err := client.Do(request)
  1084. if err != nil {
  1085. fmt.Println(err.Error())
  1086. return err.Error(), ""
  1087. }
  1088. respBytes, err := ioutil.ReadAll(resp.Body)
  1089. if err != nil {
  1090. fmt.Println(err.Error())
  1091. return err.Error(), ""
  1092. }
  1093. fmt.Println(string(respBytes))
  1094. str := string(respBytes)
  1095. return str, inputLog
  1096. }
  1097. func UploadPrescriptionForCoordinate(info models.UploadInfo) (string, string) {
  1098. //input := make(map[string]interface{})
  1099. inputData := make(map[string]interface{})
  1100. diags := make([]map[string]interface{}, 0)
  1101. //diags := make([]map[string]interface{}, 0)
  1102. presInfos := make([]map[string]interface{}, 0)
  1103. for _, item := range info.Diag {
  1104. inputDataDiag := make(map[string]interface{})
  1105. inputDataDiag["vao06"] = item.Vao06
  1106. inputDataDiag["bak02"] = item.Bak02
  1107. diags = append(diags, inputDataDiag)
  1108. }
  1109. for _, item := range info.PresInfo {
  1110. inputDataPresInfo := make(map[string]interface{})
  1111. inputDataPresInfo["cbm06"] = item.Cbm06
  1112. inputDataPresInfo["cbm07"] = item.Cbm06
  1113. inputDataPresInfo["cbmid"] = item.Cbmid
  1114. presDetails := make([]map[string]interface{}, 0)
  1115. for _, subItem := range item.PresDetail {
  1116. inputDataPresDetail := make(map[string]interface{})
  1117. inputDataPresDetail["vaf59"] = subItem.Vaf59
  1118. Items := make([]map[string]interface{}, 0)
  1119. for _, subSubItem := range subItem.Item {
  1120. inputDataItem := make(map[string]interface{})
  1121. inputDataItem["bbx01"] = subSubItem.Bbx01
  1122. inputDataItem["bda01"] = subSubItem.Bda01
  1123. inputDataItem["bby01"] = subSubItem.Bby01
  1124. inputDataItem["bck01b"] = subSubItem.Bck01b
  1125. inputDataItem["bck01d"] = subSubItem.Bck01d
  1126. inputDataItem["bdi01"] = subSubItem.Bdi01
  1127. inputDataItem["rownr"] = subSubItem.Rownr
  1128. inputDataItem["vaf11"] = subSubItem.Vaf11
  1129. inputDataItem["vaf14"] = subSubItem.Vaf14
  1130. inputDataItem["vaf15"] = subSubItem.Vaf15
  1131. inputDataItem["vaf17"] = subSubItem.Vaf17
  1132. inputDataItem["vaf18"] = subSubItem.Vaf18
  1133. inputDataItem["vaf19"] = subSubItem.Vaf19
  1134. inputDataItem["vaf20"] = subSubItem.Vaf20
  1135. inputDataItem["vaf21"] = subSubItem.Vaf21
  1136. inputDataItem["vaf22"] = subSubItem.Vaf22
  1137. inputDataItem["vaf32"] = subSubItem.Vaf32
  1138. inputDataItem["vaf35"] = subSubItem.Vaf35
  1139. inputDataItem["vaf36"] = subSubItem.Vaf36
  1140. inputDataItem["vaf58"] = subSubItem.Vaf58
  1141. inputDataItem["vaf61"] = subSubItem.Vaf61
  1142. Items = append(Items, inputDataItem)
  1143. }
  1144. inputDataPresDetail["item"] = Items
  1145. presDetails = append(presDetails, inputDataPresDetail)
  1146. }
  1147. inputDataPresInfo["presDetail"] = presDetails
  1148. presInfos = append(presInfos, inputDataPresInfo)
  1149. }
  1150. inputData["vaa01"] = info.Vaa01 // 就诊凭证编号
  1151. inputData["Fasong"] = info.Fasong // 就诊凭证编号
  1152. inputData["vaa07"] = info.Vaa07 // 就诊凭证编号
  1153. inputData["bck01c"] = info.Bck01c // 就诊凭证编号
  1154. inputData["bce02a"] = "1001" // 就诊凭证编号
  1155. inputData["diag"] = diags // 就诊凭证编号
  1156. inputData["presInfo"] = presInfos // 就诊凭证编号
  1157. var inputLog string
  1158. bytesData, err := json.Marshal(inputData)
  1159. inputLog = string(bytesData)
  1160. fmt.Println(string(bytesData))
  1161. if err != nil {
  1162. fmt.Println(err.Error())
  1163. return err.Error(), ""
  1164. }
  1165. reader := bytes.NewReader(bytesData)
  1166. var url string
  1167. gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
  1168. url = gdyb_url
  1169. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  1170. request, err := http.NewRequest("POST", url, reader)
  1171. if err != nil {
  1172. fmt.Println(err.Error())
  1173. return err.Error(), ""
  1174. }
  1175. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1176. request.Header.Set("code", "Xmrjyy")
  1177. client := http.Client{}
  1178. resp, err := client.Do(request)
  1179. if err != nil {
  1180. fmt.Println(err.Error())
  1181. return err.Error(), ""
  1182. }
  1183. respBytes, err := ioutil.ReadAll(resp.Body)
  1184. if err != nil {
  1185. fmt.Println(err.Error())
  1186. return err.Error(), ""
  1187. }
  1188. fmt.Println(string(respBytes))
  1189. str := string(respBytes)
  1190. return str, inputLog
  1191. }
  1192. func UploadPrescriptionForCoordinateHospital(info models.UploadInfo) (string, string) {
  1193. //input := make(map[string]interface{})
  1194. inputData := make(map[string]interface{})
  1195. diags := make([]map[string]interface{}, 0)
  1196. //diags := make([]map[string]interface{}, 0)
  1197. presInfos := make([]map[string]interface{}, 0)
  1198. for _, item := range info.Diag {
  1199. inputDataDiag := make(map[string]interface{})
  1200. inputDataDiag["vao06"] = item.Vao06
  1201. inputDataDiag["bak02"] = item.Bak02
  1202. diags = append(diags, inputDataDiag)
  1203. }
  1204. for _, item := range info.PresInfo {
  1205. inputDataPresInfo := make(map[string]interface{})
  1206. inputDataPresInfo["cbm06"] = item.Cbm06
  1207. inputDataPresInfo["cbm07"] = item.Cbm06
  1208. inputDataPresInfo["cbmid"] = item.Cbmid
  1209. presDetails := make([]map[string]interface{}, 0)
  1210. for _, subItem := range item.PresDetail {
  1211. inputDataPresDetail := make(map[string]interface{})
  1212. inputDataPresDetail["vaf59"] = subItem.Vaf59
  1213. Items := make([]map[string]interface{}, 0)
  1214. for _, subSubItem := range subItem.Item {
  1215. inputDataItem := make(map[string]interface{})
  1216. inputDataItem["bbx01"] = subSubItem.Bbx01
  1217. inputDataItem["bda01"] = subSubItem.Bda01
  1218. inputDataItem["bby01"] = subSubItem.Bby01
  1219. inputDataItem["bck01b"] = subSubItem.Bck01b
  1220. inputDataItem["bck01d"] = subSubItem.Bck01d
  1221. inputDataItem["bdi01"] = subSubItem.Bdi01
  1222. inputDataItem["rownr"] = subSubItem.Rownr
  1223. inputDataItem["vaf11"] = subSubItem.Vaf11
  1224. inputDataItem["vaf14"] = subSubItem.Vaf14
  1225. inputDataItem["vaf15"] = subSubItem.Vaf15
  1226. inputDataItem["vaf17"] = subSubItem.Vaf17
  1227. inputDataItem["vaf18"] = subSubItem.Vaf18
  1228. inputDataItem["vaf19"] = subSubItem.Vaf19
  1229. inputDataItem["vaf20"] = subSubItem.Vaf20
  1230. inputDataItem["vaf21"] = subSubItem.Vaf21
  1231. inputDataItem["vaf22"] = subSubItem.Vaf22
  1232. inputDataItem["vaf32"] = subSubItem.Vaf32
  1233. inputDataItem["vaf35"] = subSubItem.Vaf35
  1234. inputDataItem["vaf36"] = subSubItem.Vaf36
  1235. inputDataItem["vaf58"] = subSubItem.Vaf58
  1236. inputDataItem["vaf61"] = subSubItem.Vaf61
  1237. Items = append(Items, inputDataItem)
  1238. }
  1239. inputDataPresDetail["item"] = Items
  1240. presDetails = append(presDetails, inputDataPresDetail)
  1241. }
  1242. inputDataPresInfo["presDetail"] = presDetails
  1243. presInfos = append(presInfos, inputDataPresInfo)
  1244. }
  1245. inputData["vaa01"] = info.Vaa01 // 就诊凭证编号
  1246. inputData["Fasong"] = info.Fasong // 就诊凭证编号
  1247. inputData["vaa07"] = info.Vaa07 // 就诊凭证编号
  1248. inputData["bck01c"] = info.Bck01c // 就诊凭证编号
  1249. inputData["bce02a"] = "1001" // 就诊凭证编号
  1250. inputData["diag"] = diags // 就诊凭证编号
  1251. inputData["presInfo"] = presInfos // 就诊凭证编号
  1252. var inputLog string
  1253. bytesData, err := json.Marshal(inputData)
  1254. inputLog = string(bytesData)
  1255. fmt.Println(string(bytesData))
  1256. if err != nil {
  1257. fmt.Println(err.Error())
  1258. return err.Error(), ""
  1259. }
  1260. reader := bytes.NewReader(bytesData)
  1261. var url string
  1262. gdyb_url := "http://218.104.146.179:9091/esb/listener/saveOrdInfoIp"
  1263. url = gdyb_url
  1264. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  1265. request, err := http.NewRequest("POST", url, reader)
  1266. if err != nil {
  1267. fmt.Println(err.Error())
  1268. return err.Error(), ""
  1269. }
  1270. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1271. request.Header.Set("code", "Xmrjyy")
  1272. client := http.Client{}
  1273. resp, err := client.Do(request)
  1274. if err != nil {
  1275. fmt.Println(err.Error())
  1276. return err.Error(), ""
  1277. }
  1278. respBytes, err := ioutil.ReadAll(resp.Body)
  1279. if err != nil {
  1280. fmt.Println(err.Error())
  1281. return err.Error(), ""
  1282. }
  1283. fmt.Println(string(respBytes))
  1284. str := string(respBytes)
  1285. return str, inputLog
  1286. }
  1287. func UpDatePrescriptionNumberForCoordinate(user_org_id int64, ids []int64, number string) (err error) {
  1288. 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
  1289. return
  1290. }
  1291. func FindPatientPrescriptionInfoTwo(org_id int64, patient_id int64, record_date int64, p_type int64) (info models.HisPrescriptionInfo, err error) {
  1292. 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
  1293. return
  1294. }
  1295. func FindPatientPrescriptionInfoThree(org_id int64, patient_id int64, st_time int64,end_timne int64, p_type int64) (info []models.HisPrescriptionInfo, err error) {
  1296. err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND record_date >= ? and record_date <= ? AND patient_id = ? AND p_type = ? ", org_id, st_time,end_timne, patient_id, p_type).Find(&info).Error
  1297. return
  1298. }
  1299. func GetExecutionFrequencyByName(name string, org_id int64) (ef models.ExecutionFrequencyDic, err error) {
  1300. err = readDb.Model(&models.ExecutionFrequencyDic{}).Where("org_id = ? AND name = ?", org_id, name).First(&ef).Error
  1301. return
  1302. }
  1303. func UpdataHisPateintTwo(his *models.VMHisPatient) {
  1304. writeDb.Save(&his)
  1305. }
  1306. func UpdataHisPateintThree(his *models.HisPatient) {
  1307. writeDb.Save(&his)
  1308. }
  1309. func UpDateHisPrescriptionInfoNumbertwo(user_org_id int64, id int64, number string, record_time int64, his_patient_id int64) (err error) {
  1310. 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
  1311. return
  1312. }
  1313. func UpdataOrderStatusThreef(number string, user_org_id int64) (err error) {
  1314. 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
  1315. 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
  1316. return
  1317. }
  1318. func UpdataOrderStatustwo(id int64, number string, user_org_id int64) (err error) {
  1319. 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
  1320. //err = writeDb.Model(&models.HisPatient{}).Where("status = 1 AND number = ?", number).Updates(map[string]interface{}{"mtime": time.Now().Unix(), "status": 0}).Error
  1321. 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
  1322. 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
  1323. return
  1324. }
  1325. func GetHisPatientByIdThree(id int64) (models.HisPatient, error) {
  1326. patient := models.HisPatient{}
  1327. err := XTReadDB().Model(&patient).Where("id = ? and status = 1", id).First(&patient).Error
  1328. return patient, err
  1329. }
  1330. func GetDrugwayDicByName(name string, org_id int64) (ef models.DrugwayDic, err error) {
  1331. err = readDb.Model(&models.DrugwayDic{}).Where("org_id = ? AND name = ?", org_id, name).First(&ef).Error
  1332. return
  1333. }
  1334. func GetResultRecord(date string) (record []models.CmResult, err error) {
  1335. err = nmDataBase.Model(&models.CmResult{}).Where("inspect_date >= ?",date).Find(&record).Error
  1336. return
  1337. }