1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546 |
- package service
-
- import (
- "bytes"
- "encoding/json"
- "fmt"
- "gdyb/models"
- "github.com/jinzhu/gorm"
- "io/ioutil"
- "net/http"
- "net/url"
- "strings"
- "time"
- )
-
- func SavePatientMessageInfo() (string, string) {
-
- //input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputData["patType"] = "1" // 就诊凭证编号
- inputData["patIdNo"] = "440510199211080038" // 开始时间
- inputData["patName"] = "测试患者4 " // 人员姓名
-
- inputData["patMobile"] = "13535547902" // 人员姓名
- inputData["patSex"] = "M" // 人员姓名
- inputData["patMarriage"] = "1" // 人员姓名
- inputData["birthday"] = "1992-10-23" // 人员姓名
- inputData["patAddress"] = "11111" // 人员姓名
- inputData["thirdPartyID"] = "6936" // 人员姓名
- inputData["patAge"] = "30" // 人员姓名
- //input["req"] = inputData
-
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- var url string
- gdyb_url := "http://218.104.146.179:9091/esb/listener/savePatientMessageInfo"
- url = gdyb_url
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("GET", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("code", "Xmrjyy")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
-
- func SaveReg(reg models.Reg) (string, string) {
-
- //input := make(map[string]interface{})
- inputData := make(map[string]interface{})
-
- inputData["deptId"] = reg.DeptId
- inputData["clinicUnitId"] = ""
- inputData["healthCardNo"] = ""
- fmt.Println(reg.PatientId)
- inputData["patientId"] = reg.PatientId
- inputData["patientName"] = reg.PatientName
- inputData["idCardNo"] = reg.IdCardNo
- inputData["phone"] = ""
- inputData["doctorId"] = ""
- inputData["doctorLevelCode"] = ""
- inputData["regDate"] = reg.RegDate
-
- inputData["shiftCode"] = ""
- inputData["startTime"] = ""
- inputData["endTime"] = ""
-
- inputData["scheduleId"] = ""
- inputData["periodId"] = ""
-
- inputData["svObjectId"] = ""
- inputData["diseaseId"] = ""
- inputData["regFee"] = reg.RegFee
-
- inputData["treatFee"] = reg.TreatFee
- inputData["operatorId"] = reg.OperatorId
- inputData["remark"] = "血透"
-
- inputData["orderType"] = "0"
- inputData["clinicCode"] = ""
- inputData["infoSeq"] = ""
-
- //input["Request"] = inputData
-
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- var url string
- gdyb_url := "http://218.104.146.179:9091/esb/listener/saveReg"
- url = gdyb_url
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("code", "Xmrjyy")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
- func GetWaitPayDetail() (string, string) {
-
- //input := make(map[string]interface{})
- inputData := make(map[string]interface{})
-
- inputData["clinicSeq"] = "30445" // 就诊凭证编号
- inputData["prescriptionId"] = "" // 开始时间
- inputData["patientId"] = "701822660170096645" // 人员姓名
-
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- var url string
- gdyb_url := "http://218.104.146.179:9091/esb/listener/getWaitPayDetail"
- url = gdyb_url
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("code", "Xmrjyy")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
- func OpKeepAccounts(number string, cus []*models.NewCustomTwo) (string, string) {
-
- inputData := make(map[string]interface{})
- feedetail := make([]map[string]interface{}, 0)
- for _, item := range cus {
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["itemCode"] = item.MedListCodg
- feedetailInfo["num"] = item.Cut
- feedetail = append(feedetail, feedetailInfo)
- }
- inputData["item"] = feedetail
- inputData["clinicSeq"] = number // 就诊凭证编号
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- var url string
- gdyb_url := "http://218.104.146.179:9091/esb/listener/opKeepAccounts"
- url = gdyb_url
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("code", "Xmrjyy")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
- func OpCancelKeepAccounts(setl_id string, op_name string, op_code string) (string, string) {
- inputData := make(map[string]interface{})
- inputData["docId"] = setl_id
- inputData["operCode"] = "111"
- inputData["operName"] = "2222"
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- var url string
- gdyb_url := "http://218.104.146.179:9091/esb/listener/opCancelKeepAccounts"
- url = gdyb_url
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("code", "Xmrjyy")
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
-
- func UpdateHisPatientStatusten(his *models.VMHisPatient) {
- writeDb.Save(&his)
- }
-
- func GetUnSettleHisPrescriptionFive(org_id int64, patient_id int64, record_date int64, p_type int64) (prescription []*models.HisPrescription, err error) {
- err = readDb.Model(&models.HisPrescription{}).
- Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("BaseDrugLib", "status=1")
- }).
- Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject").Preload("GoodInfo", "status=1")
- }).
- 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).
- Find(&prescription).Error
- return
- }
-
- func GetUnSettleMonthHisPrescription(org_id int64, patient_id int64, start_date int64, end_date int64) (prescription []*models.HisPrescription, err error) {
- err = readDb.Model(&models.HisPrescription{}).
- Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("XtHisAddtionConfig", "status=1")
- }).
- Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("Drug", "status=1")
- }).
- Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
- return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisProject").Preload("GoodInfo", "status=1").Preload("XtHisProjectTeam", "status = 1")
- }).
- 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).
- Find(&prescription).Error
- return
- }
-
- func GetHisOrderFour(patient_id string, infoSeq string, docId string) (order models.HisOrder, err error) {
- if len(docId) > 0 {
- err = readDb.Model(&models.HisOrder{}).Where("mdtrt_id = ? AND psn_no = ? AND setl_id = ? AND status = 1", infoSeq, patient_id, docId).First(&order).Error
- } else {
- err = readDb.Model(&models.HisOrder{}).Where("mdtrt_id = ? AND psn_no = ? AND status = 1 ", infoSeq, patient_id).First(&order).Error
- }
- return
- }
-
- func GetHisPatientForCoordinate(id_card_no string) (string, string) {
-
- //input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputData["idcard"] = id_card_no // 就诊凭证编号
-
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- var url string
- gdyb_url := "http://218.104.146.179:9091/esb/listener/getPatientType"
- url = gdyb_url
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("GET", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("code", "Xmrjyy")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
-
-
- //查询患者列表
- func GetNMGHisPatientForCoordinate(VAA01 int64,VAA07 int64,ACF01 int64,keyword string) (string, string) {
-
- //input := make(map[string]interface{})
- inputData := make(map[string]interface{})
-
- inputData["vaa01"] = VAA01 // 就诊凭证编号
- inputData["vaa07"] = VAA07 // 就诊凭证编号
- inputData["acf01"] = ACF01// 就诊凭证编号
- inputData["keyword"] = keyword // 就诊凭证编号
-
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewBuffer(bytesData)
- var url string
- gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/QueryPat"
- url = gdyb_url
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
- request.Header.Set("Accept", "*/*")
-
- fmt.Println(request)
- fmt.Println(request.Header)
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- defer resp.Body.Close()
- fmt.Println(resp)
- fmt.Println("resp.Status")
- fmt.Println(resp.Status)
- fmt.Println("resp.Body")
-
- fmt.Println(resp.Body)
-
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
-
-
-
- func GetDeptEmp() (string, string) {
-
- //input := make(map[string]interface{})
- inputData := make(map[string]interface{})
-
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewBuffer(bytesData)
- var url string
- gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/GetDeptEmp"
- url = gdyb_url
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
- request.Header.Set("Accept", "*/*")
-
- fmt.Println(request)
- fmt.Println(request.Header)
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- defer resp.Body.Close()
- fmt.Println(resp)
- fmt.Println("resp.Status")
- fmt.Println(resp.Status)
- fmt.Println("resp.Body")
-
- fmt.Println(resp.Body)
-
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
- func GetDrugInterval() (string, string) {
-
- //input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- //inputData["BCE41"] = ”“ // 就诊凭证编号
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewBuffer(bytesData)
- var url string
- gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/GetDrugInterval"
- url = gdyb_url
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
- request.Header.Set("Accept", "*/*")
-
- fmt.Println(request)
- fmt.Println(request.Header)
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- defer resp.Body.Close()
- fmt.Println(resp)
- fmt.Println("resp.Status")
- fmt.Println(resp.Status)
- fmt.Println("resp.Body")
-
- fmt.Println(resp.Body)
-
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
- func GetUsage() (string, string) {
-
- //input := make(map[string]interface{})
- inputData := make(map[string]interface{})
-
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewBuffer(bytesData)
- var url string
- gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/GetUsage"
- url = gdyb_url
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
- request.Header.Set("Accept", "*/*")
-
- fmt.Println(request)
- fmt.Println(request.Header)
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- defer resp.Body.Close()
- fmt.Println(resp)
- fmt.Println("resp.Status")
- fmt.Println(resp.Status)
- fmt.Println("resp.Body")
-
- fmt.Println(resp.Body)
-
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
- func GetDrugs() (string, string) {
-
- //input := make(map[string]interface{})
- inputData := make(map[string]interface{})
-
-
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewBuffer(bytesData)
- var url string
- gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/GetDrugs"
- url = gdyb_url
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
- request.Header.Set("Accept", "*/*")
-
- fmt.Println(request)
- fmt.Println(request.Header)
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- defer resp.Body.Close()
- fmt.Println(resp)
- fmt.Println("resp.Status")
- fmt.Println(resp.Status)
- fmt.Println("resp.Body")
-
- fmt.Println(resp.Body)
-
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
- func GetProject() (string, string) {
-
- //input := make(map[string]interface{})
- inputData := make(map[string]interface{})
-
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewBuffer(bytesData)
- var url string
- gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/GetProject"
- url = gdyb_url
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
- request.Header.Set("Accept", "*/*")
-
- fmt.Println(request)
- fmt.Println(request.Header)
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- defer resp.Body.Close()
- fmt.Println(resp)
- fmt.Println("resp.Status")
- fmt.Println(resp.Status)
- fmt.Println("resp.Body")
-
- fmt.Println(resp.Body)
-
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
-
-
-
-
-
-
- //开医嘱版本1
- func UploadNMGPrescriptionForCoordinate(info models.UploadInfo) (string, string) {
-
-
- inputData := make(map[string]interface{})
-
-
- presInfos := make([]map[string]interface{}, 0)
-
-
- for _, item := range info.ChargeList {
- inputDataPresInfo := make(map[string]interface{})
- inputDataPresInfo["bbx01"] = item.Bbx01
- inputDataPresInfo["vaf21"] = item.Vaf21
- inputDataPresInfo["vaf22"] = item.Vaf22
- inputDataPresInfo["vaf42"] = item.Vaf42
- presInfos = append(presInfos, inputDataPresInfo)
- }
- inputData["vaa01"] = info.Vaa01 // 就诊凭证编号
- inputData["vaa07"] = info.Vaa07 // 就诊凭证编号
- inputData["acf01"] = info.Acf01 // 就诊凭证编号
- inputData["vaa05"] = info.Vaa05 // 就诊凭证编号
- inputData["bck01"] = info.Bck01 // 就诊凭证编号
- inputData["bce01a"] = info.Bce01a // 就诊凭证编号
- inputData["bck01a"] = info.Bck01a // 就诊凭证编号
- inputData["vafReqList"] = presInfos // 就诊凭证编号
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- var url string
- gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAF_New"
-
- //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
- url = gdyb_url
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
- request.Header.Set("Accept", "*/*")
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
-
- //开医嘱版本2
- func UploadNMGPrescriptionForCoordinatetwo(cmdid string, xml_date string) (string, string) {
-
-
- //inputData := make(map[string]interface{})
-
- //requestBody := fmt.Sprintf(`{"cmdid": "%s", "data": "%s"}`, cmdid, xml_date)
- //requestBody = url.QueryEscape(requestBody)
- //reader := bytes.NewReader(bytesData)
- var urls string
- gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/HODoctorAdvice"
-
- //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
- urls = gdyb_url
-
- values := url.Values{}
- values.Set("cmdid", cmdid)
- values.Set("data", xml_date)
- dataStr := values.Encode()
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", urls, strings.NewReader(dataStr))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
- request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
- request.Header.Set("Accept", "*/*")
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, dataStr
-
- }
-
- //查询医嘱
- func QueryNMGPrescriptionForCoordinate(ACF01 int64, vaf01List []string, cbm01 string) (string, string) {
-
- inputData := make(map[string]interface{})
-
-
- inputData["ACF01"] = ACF01 // 就诊凭证编号
- inputData["vaf01List"] = vaf01List // 就诊凭证编号
- inputData["cbm01"] = cbm01 // 就诊凭证编号
-
-
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- var url string
- gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAF_Query"
-
- //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
- url = gdyb_url
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
- request.Header.Set("Accept", "*/*")
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
-
- //删除医嘱
- func CancleNMGPrescriptionForCoordinate(ACF01 int64, cbm01 string,vaf01List []string) (string, string) {
-
- inputData := make(map[string]interface{})
- //
- //if len(vaf01List) == 0{
- inputData["ACF01"] = ACF01 // 就诊凭证编号
- inputData["vaf01List"] = "" // 就诊凭证编号
- inputData["cbm01"] = cbm01 // 就诊凭证编号
-
- //}else{
- // inputData["ACF01"] = ACF01 // 就诊凭证编号
- // inputData["vaf01List"] = vaf01List // 就诊凭证编号
- // inputData["cbm01"] = cbm01 // 就诊凭证编号
- //}
-
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- var url string
- gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAF_Del"
-
- //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
- url = gdyb_url
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
- request.Header.Set("Accept", "*/*")
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
-
-
- //删除医嘱版本2
- //func CancleNMGPrescriptionForCoordinatetwo(ACF01 int, cbm01 string,vaf01List []string) (string, string) {
- //
- // inputData := make(map[string]interface{})
- // //
- // //if len(vaf01List) == 0{
- // inputData["ACF01"] = ACF01 // 就诊凭证编号
- // inputData["vaf01List"] = "" // 就诊凭证编号
- // inputData["cbm01"] = cbm01 // 就诊凭证编号
- //
- // //}else{
- // // inputData["ACF01"] = ACF01 // 就诊凭证编号
- // // inputData["vaf01List"] = vaf01List // 就诊凭证编号
- // // inputData["cbm01"] = cbm01 // 就诊凭证编号
- // //}
- //
- // var inputLog string
- // bytesData, err := json.Marshal(inputData)
- // inputLog = string(bytesData)
- // fmt.Println(string(bytesData))
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error(), ""
- // }
- // reader := bytes.NewReader(bytesData)
- // var url string
- // gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAF_Del"
- //
- // //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
- // url = gdyb_url
- //
- // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- // request, err := http.NewRequest("POST", url, reader)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error(), ""
- // }
- //
- // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- // request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
- // request.Header.Set("Accept", "*/*")
- // client := http.Client{}
- // resp, err := client.Do(request)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error(), ""
- // }
- // respBytes, err := ioutil.ReadAll(resp.Body)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error(), ""
- // }
- // fmt.Println(string(respBytes))
- // str := string(respBytes)
- // return str, inputLog
- //
- //}
-
-
- func CancleNMGPrescriptionForCoordinatetwo(cmdid string, xml_date string) (string, string) {
-
-
- //inputData := make(map[string]interface{})
-
- //requestBody := fmt.Sprintf(`{"cmdid": "%s", "data": "%s"}`, cmdid, xml_date)
- //requestBody = url.QueryEscape(requestBody)
- //reader := bytes.NewReader(bytesData)
- var urls string
- gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/HODoctorAdvice"
-
- //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
- urls = gdyb_url
-
- values := url.Values{}
- values.Set("cmdid", cmdid)
- values.Set("data", xml_date)
- dataStr := values.Encode()
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", urls, strings.NewReader(dataStr))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
- request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
- request.Header.Set("Accept", "*/*")
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, dataStr
-
- }
-
-
- func Createzuobiao(zuobiao *models.HisZuobiaoAdvice){
- writeDb.Save(&zuobiao)
-
- }
-
- func Getzuobiao(user_org_id int64,patient_id int64,record_date int64)(zuobiao models.HisZuobiaoAdvice,err error){
- err = readDb.Model(&models.HisZuobiaoAdvice{}).Where("user_org_id = ? and patient_id = ? and record_date = ?",user_org_id,patient_id,record_date).First(&zuobiao).Error
- return
- }
-
-
- //查询诊断
- func QueryNMGDiagnoseForCoordinate(ACF01 int64, vaa01 string, vaa07 string) (string, string) {
-
- inputData := make(map[string]interface{})
- inputData["ACF01"] = ACF01 // 就诊凭证编号
- inputData["vaa01"] = vaa01 // 就诊凭证编号
- inputData["vaa07"] = vaa07 // 就诊凭证编号
-
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- var url string
- gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAO_Query"
-
- //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
- url = gdyb_url
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
- request.Header.Set("Accept", "*/*")
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
-
- //查询检验
- func QueryNMGChenckForCoordinate(ACF01 int64, vaa01 string, vaa07 string,bfc03s string) (string, string) {
-
- inputData := make(map[string]interface{})
- inputData["ACF01"] = ACF01 // 就诊凭证编号
- inputData["vaa01"] = vaa01 // 就诊凭证编号
- inputData["vaa07"] = vaa07 // 就诊凭证编号
- inputData["bfc03s"] = bfc03s // 就诊凭证编号
-
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- var url string
- gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/LAC_Query"
-
- //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
- url = gdyb_url
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
- request.Header.Set("Accept", "*/*")
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
-
- //血库记账接口
- func NMGSettleForCoordinate(info models.UploadInfo) (string, string) {
-
- inputData := make(map[string]interface{})
- inputData["acf01"] = info.Acf01 // 就诊凭证编号
- inputData["bce01"] = info.Bce01 // 就诊凭证编号
- inputData["bck01"] = info.Bck01 // 就诊凭证编号
- inputData["vaa07"] = info.Vaa07 // 就诊凭证编号
- inputData["chargeList"] = info.ChargeListtwo // 就诊凭证编号
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- var url string
- gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAI_New"
-
- //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
- url = gdyb_url
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Authorization", "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
- request.Header.Set("Accept", "*/*")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
-
- //销账
- func NMGCancleSettleForCoordinate(ACF01 int64,VAI01 string ) (string, string) {
-
- inputData := make(map[string]interface{})
- inputData["ACF01"] = ACF01 // 就诊凭证编号
- inputData["VAI01"] = VAI01 // 就诊凭证编号
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- var url string
- gdyb_url := "http://192.168.100.199:8080/HO/HOClinical/v1/VAI_Del"
-
- //gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
- url = gdyb_url
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- //request.Header.Set("code", "Xmrjyy")
- request.Header.Set("Authorization", "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJIT0RTV1NlcnZlciIsImV4cCI6NzczNjI2NzE1ODUsIm5iZiI6MTY3NjI3MTI4NSwiaWF0IjoxNjc2MjcxNTg1LCJ1c2VyY29kZSI6IjEwMDAwMSIsInJvbGVzIjoicm9sZTEiLCJjdXN0b20xIjoidmFsdWUxIiwidXNlcm5hbWUiOiLlnZDmoIdIT-ezu-e7nyIsImx2dyI6IjMwMjQwMDAwIn0.s9upThmOj_t2ZqC5_s7UIXbIdphQ6b4XE-nqQaUs5RTTA8jr2UtMlYZkV4B1b0J1maReMnENaJ3hud5Tfw7eug")
- request.Header.Set("Accept", "*/*")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
-
-
-
- func UploadPrescriptionForCoordinate(info models.UploadInfo) (string, string) {
-
- //input := make(map[string]interface{})
- inputData := make(map[string]interface{})
-
- diags := make([]map[string]interface{}, 0)
- //diags := make([]map[string]interface{}, 0)
-
- presInfos := make([]map[string]interface{}, 0)
-
- for _, item := range info.Diag {
- inputDataDiag := make(map[string]interface{})
- inputDataDiag["vao06"] = item.Vao06
- inputDataDiag["bak02"] = item.Bak02
- diags = append(diags, inputDataDiag)
- }
-
- for _, item := range info.PresInfo {
- inputDataPresInfo := make(map[string]interface{})
- inputDataPresInfo["cbm06"] = item.Cbm06
- inputDataPresInfo["cbm07"] = item.Cbm06
- inputDataPresInfo["cbmid"] = item.Cbmid
- presDetails := make([]map[string]interface{}, 0)
-
- for _, subItem := range item.PresDetail {
- inputDataPresDetail := make(map[string]interface{})
- inputDataPresDetail["vaf59"] = subItem.Vaf59
- Items := make([]map[string]interface{}, 0)
- for _, subSubItem := range subItem.Item {
- inputDataItem := make(map[string]interface{})
- inputDataItem["bbx01"] = subSubItem.Bbx01
- inputDataItem["bda01"] = subSubItem.Bda01
- inputDataItem["bby01"] = subSubItem.Bby01
- inputDataItem["bck01b"] = subSubItem.Bck01b
- inputDataItem["bck01d"] = subSubItem.Bck01d
- inputDataItem["bdi01"] = subSubItem.Bdi01
- inputDataItem["rownr"] = subSubItem.Rownr
- inputDataItem["vaf11"] = subSubItem.Vaf11
- inputDataItem["vaf14"] = subSubItem.Vaf14
- inputDataItem["vaf15"] = subSubItem.Vaf15
- inputDataItem["vaf17"] = subSubItem.Vaf17
- inputDataItem["vaf18"] = subSubItem.Vaf18
- inputDataItem["vaf19"] = subSubItem.Vaf19
- inputDataItem["vaf20"] = subSubItem.Vaf20
- inputDataItem["vaf21"] = subSubItem.Vaf21
- inputDataItem["vaf22"] = subSubItem.Vaf22
- inputDataItem["vaf32"] = subSubItem.Vaf32
- inputDataItem["vaf35"] = subSubItem.Vaf35
- inputDataItem["vaf36"] = subSubItem.Vaf36
- inputDataItem["vaf58"] = subSubItem.Vaf58
- inputDataItem["vaf61"] = subSubItem.Vaf61
- Items = append(Items, inputDataItem)
-
- }
- inputDataPresDetail["item"] = Items
- presDetails = append(presDetails, inputDataPresDetail)
- }
- inputDataPresInfo["presDetail"] = presDetails
- presInfos = append(presInfos, inputDataPresInfo)
- }
-
- inputData["vaa01"] = info.Vaa01 // 就诊凭证编号
- inputData["Fasong"] = info.Fasong // 就诊凭证编号
- inputData["vaa07"] = info.Vaa07 // 就诊凭证编号
- inputData["bck01c"] = info.Bck01c // 就诊凭证编号
- inputData["bce02a"] = "1001" // 就诊凭证编号
-
- inputData["diag"] = diags // 就诊凭证编号
- inputData["presInfo"] = presInfos // 就诊凭证编号
-
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- var url string
- gdyb_url := "http://218.104.146.179:9091/esb/listener/sendPretreat"
- url = gdyb_url
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("code", "Xmrjyy")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
-
- func UploadPrescriptionForCoordinateHospital(info models.UploadInfo) (string, string) {
-
- //input := make(map[string]interface{})
- inputData := make(map[string]interface{})
-
- diags := make([]map[string]interface{}, 0)
- //diags := make([]map[string]interface{}, 0)
-
- presInfos := make([]map[string]interface{}, 0)
-
- for _, item := range info.Diag {
- inputDataDiag := make(map[string]interface{})
- inputDataDiag["vao06"] = item.Vao06
- inputDataDiag["bak02"] = item.Bak02
- diags = append(diags, inputDataDiag)
- }
-
- for _, item := range info.PresInfo {
- inputDataPresInfo := make(map[string]interface{})
- inputDataPresInfo["cbm06"] = item.Cbm06
- inputDataPresInfo["cbm07"] = item.Cbm06
- inputDataPresInfo["cbmid"] = item.Cbmid
- presDetails := make([]map[string]interface{}, 0)
-
- for _, subItem := range item.PresDetail {
- inputDataPresDetail := make(map[string]interface{})
- inputDataPresDetail["vaf59"] = subItem.Vaf59
- Items := make([]map[string]interface{}, 0)
- for _, subSubItem := range subItem.Item {
- inputDataItem := make(map[string]interface{})
- inputDataItem["bbx01"] = subSubItem.Bbx01
- inputDataItem["bda01"] = subSubItem.Bda01
- inputDataItem["bby01"] = subSubItem.Bby01
- inputDataItem["bck01b"] = subSubItem.Bck01b
- inputDataItem["bck01d"] = subSubItem.Bck01d
- inputDataItem["bdi01"] = subSubItem.Bdi01
- inputDataItem["rownr"] = subSubItem.Rownr
- inputDataItem["vaf11"] = subSubItem.Vaf11
- inputDataItem["vaf14"] = subSubItem.Vaf14
- inputDataItem["vaf15"] = subSubItem.Vaf15
- inputDataItem["vaf17"] = subSubItem.Vaf17
- inputDataItem["vaf18"] = subSubItem.Vaf18
- inputDataItem["vaf19"] = subSubItem.Vaf19
- inputDataItem["vaf20"] = subSubItem.Vaf20
- inputDataItem["vaf21"] = subSubItem.Vaf21
- inputDataItem["vaf22"] = subSubItem.Vaf22
- inputDataItem["vaf32"] = subSubItem.Vaf32
- inputDataItem["vaf35"] = subSubItem.Vaf35
- inputDataItem["vaf36"] = subSubItem.Vaf36
- inputDataItem["vaf58"] = subSubItem.Vaf58
- inputDataItem["vaf61"] = subSubItem.Vaf61
- Items = append(Items, inputDataItem)
-
- }
- inputDataPresDetail["item"] = Items
- presDetails = append(presDetails, inputDataPresDetail)
- }
- inputDataPresInfo["presDetail"] = presDetails
- presInfos = append(presInfos, inputDataPresInfo)
- }
-
- inputData["vaa01"] = info.Vaa01 // 就诊凭证编号
- inputData["Fasong"] = info.Fasong // 就诊凭证编号
- inputData["vaa07"] = info.Vaa07 // 就诊凭证编号
- inputData["bck01c"] = info.Bck01c // 就诊凭证编号
- inputData["bce02a"] = "1001" // 就诊凭证编号
-
- inputData["diag"] = diags // 就诊凭证编号
- inputData["presInfo"] = presInfos // 就诊凭证编号
-
- var inputLog string
- bytesData, err := json.Marshal(inputData)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- reader := bytes.NewReader(bytesData)
- var url string
- gdyb_url := "http://218.104.146.179:9091/esb/listener/saveOrdInfoIp"
- url = gdyb_url
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("code", "Xmrjyy")
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str, inputLog
-
- }
-
- func UpDatePrescriptionNumberForCoordinate(user_org_id int64, ids []int64, number string) (err error) {
- 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
- return
- }
-
- func FindPatientPrescriptionInfoTwo(org_id int64, patient_id int64, record_date int64, p_type int64) (info models.HisPrescriptionInfo, err error) {
- 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
- return
-
- }
-
- func GetExecutionFrequencyByName(name string, org_id int64) (ef models.ExecutionFrequencyDic, err error) {
- err = readDb.Model(&models.ExecutionFrequencyDic{}).Where("org_id = ? AND name = ?", org_id, name).First(&ef).Error
- return
- }
- func UpdataHisPateintTwo(his *models.VMHisPatient) {
- writeDb.Save(&his)
- }
-
- func UpdataHisPateintThree(his *models.HisPatient) {
- writeDb.Save(&his)
- }
-
- func UpDateHisPrescriptionInfoNumbertwo(user_org_id int64, id int64, number string, record_time int64, his_patient_id int64) (err error) {
- 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
-
- return
- }
-
- func UpdataOrderStatusThreef(number string, user_org_id int64) (err error) {
- 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
- 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
- return
- }
-
- func UpdataOrderStatustwo(id int64, number string, user_org_id int64) (err error) {
- 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
- 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
- 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
- return
- }
-
- func GetHisPatientByIdThree(id int64) (models.HisPatient, error) {
- patient := models.HisPatient{}
- err := XTReadDB().Model(&patient).Where("id = ? and status = 1", id).First(&patient).Error
- return patient, err
- }
-
-
- func GetDrugwayDicByName(name string, org_id int64) (ef models.DrugwayDic, err error) {
- err = readDb.Model(&models.DrugwayDic{}).Where("org_id = ? AND name = ?", org_id, name).First(&ef).Error
- return
- }
|