coordinate_service.go 51KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563
  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 GetExecutionFrequencyByName(name string, org_id int64) (ef models.ExecutionFrequencyDic, err error) {
  1296. err = readDb.Model(&models.ExecutionFrequencyDic{}).Where("org_id = ? AND name = ?", org_id, name).First(&ef).Error
  1297. return
  1298. }
  1299. func UpdataHisPateintTwo(his *models.VMHisPatient) {
  1300. writeDb.Save(&his)
  1301. }
  1302. func UpdataHisPateintThree(his *models.HisPatient) {
  1303. writeDb.Save(&his)
  1304. }
  1305. func UpDateHisPrescriptionInfoNumbertwo(user_org_id int64, id int64, number string, record_time int64, his_patient_id int64) (err error) {
  1306. 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
  1307. return
  1308. }
  1309. func UpdataOrderStatusThreef(number string, user_org_id int64) (err error) {
  1310. 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
  1311. 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
  1312. return
  1313. }
  1314. func UpdataOrderStatustwo(id int64, number string, user_org_id int64) (err error) {
  1315. 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
  1316. //err = writeDb.Model(&models.HisPatient{}).Where("status = 1 AND number = ?", number).Updates(map[string]interface{}{"mtime": time.Now().Unix(), "status": 0}).Error
  1317. 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
  1318. 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
  1319. return
  1320. }
  1321. func GetHisPatientByIdThree(id int64) (models.HisPatient, error) {
  1322. patient := models.HisPatient{}
  1323. err := XTReadDB().Model(&patient).Where("id = ? and status = 1", id).First(&patient).Error
  1324. return patient, err
  1325. }
  1326. func GetDrugwayDicByName(name string, org_id int64) (ef models.DrugwayDic, err error) {
  1327. err = readDb.Model(&models.DrugwayDic{}).Where("org_id = ? AND name = ?", org_id, name).First(&ef).Error
  1328. return
  1329. }
  1330. func GetResultRecord(date string) (record []models.CmResult, err error) {
  1331. err = nmDataBase.Model(&models.CmResult{}).Where("inspect_date >= ?",date).Find(&record).Error
  1332. return
  1333. }