123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512 |
- package service
-
- import (
- "bytes"
- "encoding/json"
- "fmt"
- "gdyb/models"
- "github.com/astaxie/beego"
- "io/ioutil"
- "math/rand"
- "net/http"
- "strconv"
- "time"
- _ "unsafe"
- )
-
- func SzybXX001(doctor string, doctor_code string, fixmedins_code string, account string, verify_code string, serial_number string, version_code string) string {
- // 生成输入报文
- inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, serial_number)
- inputData := make(map[string]interface{})
- inputMessage["transType"] = "XX001" // 交易编码
- inputMessage["transVersion"] = version_code // 交易编码
-
- inputData["aaz500"] = account
- inputData["bzz269"] = "000000"
- inputData["bke384"] = inputMessage["serialNumber"]
- inputMessage["transBody"] = inputData
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://192.168.1.228:17001/szsi-portal/transData"
- url := "http://192.168.1.88:6666/szsi-portal/transData"
-
- 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")
- 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
-
- }
-
- func SzybMZ002(doctor string, doctor_code string, fixmedins_code string, dept_code string, account string, verify_code string, serial_number string, mz_number string, version_code string, custom_code string, project_name string, price float64, medical_care int64) string {
- // 生成输入报文
- inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, serial_number)
- inputData := make(map[string]interface{})
- inputMessage["transType"] = "MZ002" // 交易编码
- inputMessage["transVersion"] = version_code // 交易编码
-
- if medical_care == 11 || medical_care == 1111 || medical_care == 1112 {
- inputData["aka130"] = "11"
- } else if medical_care == 13 {
- inputData["aka130"] = "13"
- } else {
- inputData["aka130"] = fmt.Sprintf("%d", medical_care)
- }
- //inputData["aka130"] = "13"
- inputData["akc190"] = mz_number
- inputData["aaz500"] = account
- inputData["bzz269"] = "000000"
- inputData["akf001"] = dept_code
- inputData["akc264"] = price
- inputData["bke384"] = inputMessage["serialNumber"]
-
- switch custom_code {
- case "110100002":
- inputData["bkc368"] = "1"
- break
- case "110200002-2":
- inputData["bkc368"] = "3"
- break
- case "110200002-3":
- inputData["bkc368"] = "2"
- break
- case "110200003":
- break
- case "110200002-1":
- inputData["bkc368"] = "5"
- break
- }
-
- if custom_code == "0" {
- inputData["bkc368"] = "4"
- inputData["listsize"] = 0
- inputMessage["transBody"] = inputData
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://192.168.1.228:17001/szsi-portal/transData"
- url := "http://192.168.1.88:6666/szsi-portal/transData"
-
- 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")
- 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
- } else {
- inputData["listsize"] = 1
- timestamp := time.Now().Unix()
- tempTime := time.Unix(timestamp, 0)
- timeFormat := tempTime.Format("20060102150405")
- feedetail := make([]map[string]interface{}, 0)
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["aae072"] = timeFormat
- feedetailInfo["bkf500"] = timeFormat
- feedetailInfo["ake001"] = custom_code
- feedetailInfo["ake005"] = custom_code
- feedetailInfo["ake006"] = project_name
- feedetailInfo["aae019"] = price
- feedetail = append(feedetail, feedetailInfo)
- inputData["inputlist"] = feedetail
- inputMessage["transBody"] = inputData
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://192.168.1.228:17001/szsi-portal/transData"
- url := "http://192.168.1.88:6666/szsi-portal/transData"
-
- 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")
-
- 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
- }
- }
- func SzybFY001(doctor string, doctor_code string, fixmedins_code string, datas []*models.CustomDetail, verify_code string, serial_number string, mz_number string, version_code string, drug_doctor_code string) string {
- // 生成输入报文
- inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, serial_number)
- inputData := make(map[string]interface{})
- inputMessage["transType"] = "FY001" // 交易编码
- inputMessage["transChannel"] = "10" // 交易编码
- inputMessage["transVersion"] = version_code // 交易编码
-
- inputData["akc190"] = mz_number
- inputData["bke384"] = serial_number
- inputData["listsize"] = len(datas)
-
- feedetail := make([]map[string]interface{}, 0)
-
- for _, item := range datas {
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["aae072"] = item.PrescriptionNumber
- feedetailInfo["bkc369"] = item.OrderType
- feedetailInfo["bkf500"] = item.ChargeSerialNumber
- feedetailInfo["ake001"] = item.Code
- feedetailInfo["ake002"] = item.CodeName
- feedetailInfo["bkm017"] = item.BwCode
- feedetailInfo["aka070"] = item.DoseCode
- feedetailInfo["aka074"] = item.Spec
- feedetailInfo["aka064"] = 1
- feedetailInfo["ake005"] = item.Code
- feedetailInfo["ake006"] = item.CodeName
- feedetailInfo["akc225"] = item.Price
- feedetailInfo["akc226"] = item.Count
- feedetailInfo["akc264"] = item.Total
- feedetailInfo["aka067"] = item.Unit
- feedetailInfo["akc271"] = item.ChargeOrderDate
- feedetailInfo["bkc320"] = drug_doctor_code
-
- feedetail = append(feedetail, feedetailInfo)
- }
- inputData["inputlist"] = feedetail
- inputMessage["transBody"] = inputData
-
- fmt.Println(inputMessage)
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- url := "http://192.168.1.88:6666/szsi-portal/transData"
- 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")
-
- 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
- }
- func SzybFY002(doctor string, doctor_code string, fixmedins_code string, datas []*models.CustomDetail, verify_code string, serial_number string, mz_number string, version_code string) string {
- // 生成输入报文
- inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, serial_number)
- inputData := make(map[string]interface{})
- inputMessage["transType"] = "FY002" // 交易编码
- inputMessage["transVersion"] = version_code // 交易编码
-
- inputData["akc190"] = mz_number
- inputData["bke384"] = serial_number
- inputData["listsize"] = len(datas)
-
- feedetail := make([]map[string]interface{}, 0)
-
- for _, item := range datas {
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["aae072"] = item.PrescriptionNumber
- feedetailInfo["bkf500"] = item.ChargeSerialNumber
- feedetail = append(feedetail, feedetailInfo)
- }
- inputData["inputlist"] = feedetail
- inputMessage["transBody"] = inputData
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://192.168.1.99:10000"
- //url := "http://192.168.1.228:17001/szsi-portal/transData"
- url := "http://192.168.1.88:6666/szsi-portal/transData"
-
- 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")
-
- 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
- }
- func SzybFY004(doctor string, doctor_code string, fixmedins_code string, total float64, account string, verify_code string, serial_number string, mz_number string, version_code string, drug_doctor string, drug_doctor_name string, medical_care int64, code string, new_number string) string {
- inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, new_number)
- inputData := make(map[string]interface{})
- inputMessage["transType"] = "FY004" // 交易编码
-
- inputMessage["transVersion"] = version_code // 交易编码
- inputData["akc190"] = mz_number
-
- if medical_care == 11 || medical_care == 1111 || medical_care == 1112 {
- inputData["aka130"] = "11"
- } else if medical_care == 13 {
- inputData["aka130"] = "13"
- inputData["cka303"] = code
- } else {
- inputData["aka130"] = fmt.Sprintf("%d", medical_care)
- }
- inputData["bkc320"] = drug_doctor
- inputData["ckc350"] = drug_doctor_name
-
- inputData["bzz269"] = "000000"
- inputData["aka030"] = "12"
- inputData["akc264"] = total
- inputData["ckc601"] = "0"
- inputData["bke384"] = serial_number
-
- inputMessage["transBody"] = inputData
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://192.168.1.99:10000"
- //url := "http://192.168.1.228:17001/szsi-portal/transData"
- url := "http://192.168.1.88:6666/szsi-portal/transData"
-
- 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")
-
- 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
- }
- func SzybFY005(doctor string, doctor_code string, fixmedins_code string, total float64, account string, verify_code string, serial_number string, mz_number string, version_code string, drug_doctor string, drug_doctor_name string, medical_care int64, code string, new_number string) string {
- // 生成输入报文
- inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, new_number)
- inputData := make(map[string]interface{})
- inputMessage["transType"] = "FY005" // 交易编码
-
- inputMessage["transVersion"] = version_code // 交易编码
-
- if medical_care == 11 || medical_care == 1111 || medical_care == 1112 {
- inputData["aka130"] = "11"
- } else if medical_care == 13 {
- inputData["aka130"] = "13"
- inputData["cka303"] = code
- } else {
- inputData["aka130"] = fmt.Sprintf("%d", medical_care)
- }
- inputData["aaz500"] = account
- inputData["bzz269"] = "000000"
- inputData["akc190"] = mz_number
- inputData["bkc320"] = drug_doctor
- inputData["ckc350"] = drug_doctor_name
- inputData["aka030"] = "12"
- inputData["akc264"] = total
- inputData["ckc601"] = "0"
- inputData["bke384"] = serial_number
-
- inputMessage["transBody"] = inputData
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://192.168.1.99:10000"
- //url := "http://192.168.1.228:17001/szsi-portal/transData"
- url := "http://192.168.1.88:6666/szsi-portal/transData"
-
- 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")
-
- 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
- }
- func SzybJY001(doctor string, doctor_code string, fixmedins_code string, setl_number string, mz_number string, verify_code string, version_code string) string {
- // 生成输入报文
- inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, setl_number)
- inputData := make(map[string]interface{})
- inputMessage["transType"] = "JY001" // 交易编码
- inputMessage["transVersion"] = version_code // 交易编码
-
- inputData["akc190"] = mz_number
- inputData["bke384"] = setl_number
-
- inputMessage["transBody"] = inputData
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://192.168.1.99:10000"
- //url := "http://192.168.1.228:17001/szsi-portal/transData"
- url := "http://192.168.1.88:6666/szsi-portal/transData"
-
- 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")
-
- 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
- }
- func SzybJY002(doctor string, doctor_code string, fixmedins_code string, setl_number string, mz_number string, verify_code string, new_setl_number string, version_code string) string {
- // 生成输入报文
- inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, new_setl_number)
- inputData := make(map[string]interface{})
- inputMessage["transType"] = "JY002" // 交易编码
- inputMessage["transVersion"] = version_code // 交易编码
-
- inputData["akc190"] = mz_number
- inputData["bke384"] = setl_number
-
- inputMessage["transBody"] = inputData
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://192.168.1.99:10000"
- //url := "http://192.168.1.228:17001/szsi-portal/transData"
- url := "http://192.168.1.88:6666/szsi-portal/transData"
-
- 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")
-
- 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
- }
- func SzybJY003(doctor string, doctor_code string, fixmedins_code string, setl_number string, mz_number string, verify_code string, version_code string) string {
-
- // 生成输入报文
- inputMessage := SetSZInputMessage(doctor, doctor_code, fixmedins_code, verify_code, setl_number)
-
- inputData := make(map[string]interface{})
- inputMessage["transType"] = "JY003" // 交易编码
- inputMessage["transVersion"] = version_code // 交易编码
-
- inputData["akc190"] = mz_number
- inputData["bke384"] = setl_number
-
- inputMessage["transBody"] = inputData
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://192.168.1.99:10000"
- //url := "http://192.168.1.228:17001/szsi-portal/transData"
- url := "http://192.168.1.88:6666/szsi-portal/transData"
-
- 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")
-
- 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
- }
-
- // 生成基础报文
- func SetSZInputMessage(doctor string, doctor_code string, fixmedins_code string, verify_code string, number string) map[string]interface{} {
- month := time.Unix(1557042972, 0).Format("1")
- year := time.Now().Format("2006")
- month = time.Now().Format("01")
- day := time.Now().Format("02")
-
- hour := time.Now().Format("15")
- min := time.Now().Format("04")
- sec := time.Now().Format("05")
-
- msec := time.Now().Format("000")
-
- // 生成输入报文
- inputMessage := make(map[string]interface{})
- //
-
- inputMessage["cardArea"] = "440300" // 发卡地行政区划代码
- inputMessage["extendDeviceId"] = ""
- inputMessage["extendSerialNumber"] = ""
- inputMessage["extendUserId"] = ""
- inputMessage["hospitalCode"] = fixmedins_code // 协议机构编码
- inputMessage["operatorCode"] = doctor_code // 操作员编码
- inputMessage["operatorName"] = doctor // 操作员名字
- inputMessage["operatorPass"] = "" // 定点协议机构操作人员编码
- inputMessage["serialNumber"] = number
- inputMessage["transReturnCode"] = "" //
- inputMessage["transReturnMessage"] = "" //
- inputMessage["transTime"] = year + month + day + hour + min + sec + ":" + msec //
- inputMessage["verifyCode"] = verify_code //
- inputMessage["transChannel"] = "10" //
-
- return inputMessage
- }
- func msToTime(ms int64) string {
- tm := time.Unix(0, ms*int64(time.Millisecond))
- return tm.Format("2006-02-01 15:04:05.000")
- }
-
- //
- //func SzybML008(doctor string, doctor_code string, fixmedins_code string, datas []*models.DrugDetail) string {
- // //生成输入报文
- // inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code)
- //
- // inputData := make(map[string]interface{})
- // inputMessage["transType"] = "JY003" // 交易编码
- //
- // inputData["listsize"] = len(datas)
- // inputMessage["transType"] = "ML008" // 交易编码S
- // feedetail := make([]map[string]interface{}, 0)
- // //inputData["akc190"] = mz_number
- // //inputData["bke384"] = setl_number
- //
- // for _, item := range datas {
- //
- // feedetailInfo := make(map[string]interface{})
- // feedetailInfo["ake001"] = item.MedicalInsuranceNumber
- // feedetailInfo["bkm017"] = item.Code
- // feedetailInfo["ake005"] = item.Code
- // feedetailInfo["ake006"] = item.DrugName
- // feedetailInfo["aka074"] = item.DrugSpec
- // feedetailInfo["aka070"] = item.DrugDosageName
- // //feedetailInfo["aka070"] = "片"
- // feedetailInfo["aka067"] = item.MinUnit
- // feedetailInfo["bka053"] = item.ManufacturerName
- // feedetailInfo["aka064"] = "1"
- // feedetailInfo["bka505"] = item.LastPrice
- // feedetailInfo["bka506"] = item.RetailPrice
- // feedetailInfo["aae030"] = 20210406
- // feedetailInfo["aae013"] = item.LimitRemark
- // feedetail = append(feedetail, feedetailInfo)
- // }
- //
- // inputData["inputlist"] = feedetail
- // inputMessage["transBody"] = inputData
- //
- // bytesData, err := json.Marshal(inputMessage)
- // fmt.Println(string(bytesData))
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // reader := bytes.NewReader(bytesData)
- // //url := "http://192.168.1.99:10000"
- // url := "http://192.168.1.228:17001/szsi-portal/transData"
- //
- // 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")
- //
- // 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
- //}
-
- func SzybML008(doctor string, doctor_code string, fixmedins_code string, basedrug *models.DrugDetail) string {
- //生成输入报文
- inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code)
- inputData := make(map[string]interface{})
- inputData["listsize"] = 1
- inputMessage["transType"] = "ML008" // 交易编码S
- feedetail := make([]map[string]interface{}, 0)
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["ake001"] = basedrug.MedicalInsuranceNumber
- feedetailInfo["bkm017"] = basedrug.Code
- feedetailInfo["ake005"] = basedrug.Code
- feedetailInfo["ake006"] = basedrug.DrugName
- feedetailInfo["aka074"] = basedrug.DrugSpec
- feedetailInfo["aka070"] = basedrug.DrugDosageName
- feedetailInfo["aka067"] = basedrug.MinUnit
- feedetailInfo["bka053"] = basedrug.ManufacturerName
- feedetailInfo["aka064"] = "1"
- feedetailInfo["bka505"] = basedrug.LastPrice
- feedetailInfo["bka506"] = basedrug.RetailPrice
- feedetailInfo["aae030"], _ = strconv.ParseInt(basedrug.RecordDate, 10, 64)
- feedetailInfo["aae013"] = basedrug.LimitRemark
- feedetail = append(feedetail, feedetailInfo)
-
- inputData["inputlist"] = feedetail
- inputMessage["transBody"] = inputData
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
-
- url := beego.AppConfig.String("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")
-
- 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
- }
-
- // 生成基础报文
- func SetSZDrugMessage(doctor string, doctor_code string, fixmedins_code string) map[string]interface{} {
- month := time.Unix(1557042972, 0).Format("1")
- year := time.Now().Format("2006")
- month = time.Now().Format("01")
- day := time.Now().Format("02")
-
- hour := time.Now().Format("15")
- min := time.Now().Format("04")
- sec := time.Now().Format("05")
-
- msec := time.Now().Format("000")
-
- //生成输入报文
- inputMessage := make(map[string]interface{})
- //
-
- inputMessage["cardArea"] = "440300" // 发卡地行政区划代码
- inputMessage["extendDeviceId"] = ""
- inputMessage["extendSerialNumber"] = ""
- inputMessage["extendUserId"] = ""
- inputMessage["hospitalCode"] = fixmedins_code // 协议机构编码
- inputMessage["operatorCode"] = doctor_code // 操作员编码
- inputMessage["operatorName"] = doctor // 操作员名字
- inputMessage["operatorPass"] = "" // 定点协议机构操作人员编码
- inputMessage["serialNumber"] = fixmedins_code + year + month + day +
- fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
- //inputMessage["serialNumber"] = "G554020210406" + fmt.Sprintf("%07v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000000)) // 定点协议机构编码(5位)+日期(8位)+流水号(7位)
- inputMessage["verifyCode"] = "000000|8ec5b7745a5cc45b631f23b4bf1e417e"
-
- inputMessage["transReturnCode"] = "" //
- inputMessage["transReturnMessage"] = "" //
- inputMessage["transTime"] = year + month + day + hour + min + sec + ":" + msec //
- inputMessage["transVersion"] = "V0.2" // //
- inputMessage["transChannel"] = "10" //
-
- return inputMessage
- }
-
- func SzybML009(doctor string, doctor_code string, fixmedins_code string, pro *models.MyHisProject) string {
- //timeLayout := "20060102"
- //record_date := time.Unix(pro.RecordDate, 0).Format(timeLayout)
- //recordDate, _ := strconv.ParseInt(record_date, 10, 64)
- //生成输入报文
- inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code)
-
- month := time.Unix(1557042972, 0).Format("1")
- year := time.Now().Format("2006")
- month = time.Now().Format("01")
- day := time.Now().Format("02")
-
- inputData := make(map[string]interface{})
- inputData["listsize"] = 1
- inputMessage["transType"] = "ML009" // 交易编码
- feedetail := make([]map[string]interface{}, 0)
-
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["ake001"] = pro.MedicalCode //社保目录编码
- feedetailInfo["ake005"] = pro.MedicalCode //协议机构内部目录编码
- feedetailInfo["ake006"] = pro.ProjectName // 协议机构内部目录名称
- feedetailInfo["bkf131"] = pro.Category //协议机构项目类别
- feedetailInfo["bkm062"] = strconv.FormatInt(pro.SpecailProject, 10) // 门诊特检项目标识
- feedetailInfo["bka506"] = pro.Price // 协议机构内部项目收费价格
- feedetailInfo["aae030"] = year + month + day // 备案日期
- feedetailInfo["aae013"] = pro.Remark // 备注
- feedetail = append(feedetail, feedetailInfo)
-
- inputData["inputlist"] = feedetail
- inputMessage["transBody"] = inputData
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- url := beego.AppConfig.String("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")
-
- 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
-
- }
-
- //func SzybML009(doctor string, doctor_code string, fixmedins_code string, datas []*models.ProjectDetail) string {
- // //生成输入报文
- // inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code)
- //
- // inputData := make(map[string]interface{})
- //
- // inputData["listsize"] = len(datas)
- // inputMessage["transType"] = "ML009" // 交易编码
- // feedetail := make([]map[string]interface{}, 0)
- //
- // for _, item := range datas {
- // feedetailInfo := make(map[string]interface{})
- // feedetailInfo["ake001"] = item.SocialSecurityDirectoryCode //社保目录编码
- // feedetailInfo["ake005"] = item.SocialSecurityDirectoryCode //协议机构内部目录编码
- // feedetailInfo["ake006"] = item.ProjectName // 协议机构内部目录名称
- // feedetailInfo["bkf131"] = item.Category //协议机构项目类别
- // feedetailInfo["bkm062"] = "0" // 门诊特检项目标识
- // feedetailInfo["bka506"] = item.Price // 协议机构内部项目收费价格
- // feedetailInfo["aae030"] = 20210407 // 备案日期
- // feedetailInfo["aae013"] = item.Remark // 备注
- // feedetail = append(feedetail, feedetailInfo)
- // }
- // fmt.Println("feeedDetal2333333333", feedetail)
- // inputData["inputlist"] = feedetail
- // inputMessage["transBody"] = inputData
- //
- // bytesData, err := json.Marshal(inputMessage)
- // fmt.Println(string(bytesData))
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // reader := bytes.NewReader(bytesData)
- // //url := "http://192.168.1.99:10000"
- // url := "http://192.168.1.228:17001/szsi-portal/transData"
- //
- // 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")
- //
- // 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
- //
- //}
-
- func SzybML010(doctor string, doctor_code string, fixmedins_code string, datas []*models.DrugDetail, typeId int64) string {
- //生成输入报文
- inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code)
-
- inputData := make(map[string]interface{})
-
- inputData["listsize"] = len(datas)
- inputMessage["transType"] = "ML010" // 交易编码
- feedetail := make([]map[string]interface{}, 0)
-
- for _, item := range datas {
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["ake003"] = strconv.FormatInt(typeId, 10)
- feedetailInfo["ake001"] = item.SocialSecurityDirectoryCode //社保目录编码
- feedetailInfo["ake005"] = item.SocialSecurityDirectoryCode //协议机构内部目录编码
- feedetail = append(feedetail, feedetailInfo)
- }
-
- inputData["inputlist"] = feedetail
- inputMessage["transBody"] = inputData
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- url := beego.AppConfig.String("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")
-
- 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
-
- }
-
- func SzybYS001(doctor string, doctor_code string, fixmedins_code string, doc *models.DocDetail) string {
- //生成输入报文
- inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code)
-
- inputData := make(map[string]interface{})
-
- inputData["listsize"] = 1
- inputMessage["transType"] = "YS001" // 交易编码
- feedetail := make([]map[string]interface{}, 0)
-
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["aac003"] = doc.UserName //医护人员姓名
- feedetailInfo["bka633"] = "1" //医护人员类别
- feedetailInfo["aac004"] = doc.Sex //性别
-
- switch doc.CardType {
-
- }
-
- if doc.CardType == "1" {
- feedetailInfo["aac058"] = "01"
- } else if doc.CardType == "2" {
- feedetailInfo["aac058"] = "02"
- } else if doc.CardType == "4" {
- feedetailInfo["aac058"] = "04"
- } else if doc.CardType == "6" {
- feedetailInfo["aac058"] = "06"
- } else if doc.CardType == "8" {
- feedetailInfo["aac058"] = "08"
- } else if doc.CardType == "90" {
- feedetailInfo["aac058"] = "90"
- }
-
- feedetailInfo["aac147"] = doc.IdCard //证件号码
- feedetailInfo["aae005"] = doc.Phone //联系电话
- feedetailInfo["bkc322"] = doc.WorkMajorName //现从事专业名称
- feedetailInfo["aac005"] = doc.Nation //民族
- feedetailInfo["aac006"] = doc.BirthDay //出生日期
- feedetailInfo["aac007"] = doc.WorkTime //参加工作日期
- feedetailInfo["aac011"] = doc.Education //学历
- feedetailInfo["aac183"] = doc.StudyMajorName //所学的专业名称
- feedetailInfo["bkc323"] = doc.CertificateCode //医(药)师执业证书编码
- feedetailInfo["bke955"] = doc.MedicalCode //医(药)师资格证编码
- feedetailInfo["akc055"] = doc.MedicalRangeCode // 医师执业范围代码
- feedetailInfo["bcc950"] = doc.MedicalLevel //医生执业资格证中的医师级别
- feedetailInfo["bcc955"] = doc.TypeJob //医生执业资格证中的执业类别
- feedetailInfo["bka503"] = doc.DoctorNumber //医保医师编号
- feedetailInfo["bkc324"] = doc.Licensing //多点执业标志
- feedetailInfo["bkc326"] = doc.DoctorServiceStatus //医师医保服务资格状态
- feedetailInfo["bkc328"] = doc.MonitoringLevel //监控等级
- feedetailInfo["bkc329"] = doc.DrugPsychotropicSubstances //毒麻精神药品资格
- feedetailInfo["bke801"] = doc.HealthCareCode //母婴保健技术考核合格证书编号
- feedetailInfo["bkc330"] = doc.PlanningTechnicalServiceCode //bkc330 计划生育技术服务人员合格证编号
- feedetailInfo["bkc332"] = doc.PharmacistType //药师类别
- feedetailInfo["bkc333"] = doc.PharmacistPracticeCategory //药师执业类别
- feedetailInfo["bkc334"] = doc.PharmacistsLicensing //药师执业范围
- feedetailInfo["bkc335"] = doc.PharmacistRegistrationNumber //执业药师注册证编号
- feedetailInfo["akf001"] = doc.OfficeCode //所属科室编码
- feedetailInfo["acc501"] = doc.JobNumber //工号
- feedetailInfo["ahc451"] = doc.PostName //职务名称
- feedetailInfo["aaf009"] = doc.TechnicalJobLevelCode //专业技术职务级别编码
- feedetailInfo["bkc321"] = doc.IsActive //在职与否
- feedetailInfo["ckc302"] = doc.PrescriptionQualificationIdentification //处方资格标识
- feedetailInfo["bkc325"] = doc.IdentificationOutpatients //门诊大病医师 标识
- feedetailInfo["ckc304"] = doc.OutpatientIllnessCategory //门诊大病类别
- feedetailInfo["aae030"] = doc.StartTime //开始日期
- feedetail = append(feedetail, feedetailInfo)
-
- inputData["inputlist"] = feedetail
- inputMessage["transBody"] = inputData
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- url := beego.AppConfig.String("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")
-
- 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
-
- }
-
- //func SzybYS001(doctor string, doctor_code string, fixmedins_code string, datas []*models.DocDetail) string {
- // //生成输入报文
- // inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code)
- //
- // inputData := make(map[string]interface{})
- //
- // inputData["listsize"] = len(datas)
- // inputMessage["transType"] = "YS001" // 交易编码
- // feedetail := make([]map[string]interface{}, 0)
- //
- // for _, item := range datas {
- // fmt.Println("item222222", item.RoleId)
- // feedetailInfo := make(map[string]interface{})
- // feedetailInfo["aac003"] = item.UserName
- // feedetailInfo["bka633"] = "1"
- // feedetailInfo["aac004"] = item.Sex
- // feedetailInfo["aac058"] = item.CardType
- // feedetailInfo["aac147"] = item.IdCard
- // feedetailInfo["aae005"] = item.Phone
- // feedetailInfo["bkc322"] = item.WorkMajorName
- // feedetailInfo["aac005"] = item.Nation
- // feedetailInfo["aac006"] = item.BirthDay
- // feedetailInfo["aac007"] = item.WorkTime
- // feedetailInfo["aac011"] = item.Education
- // feedetailInfo["aac183"] = item.StudyMajorName
- // feedetailInfo["bkc323"] = item.CertificateCode
- // feedetailInfo["bke955"] = item.MedicalCode
- // feedetailInfo["akc055"] = item.MedicalRangeCode
- // feedetailInfo["bcc950"] = item.MedicalLevel
- // feedetailInfo["bcc955"] = item.TypeJob
- // feedetailInfo["bka503"] = item.DoctorNumber
- // feedetailInfo["bkc324"] = item.Licensing
- // feedetailInfo["bkc326"] = item.DoctorServiceStatus
- // feedetailInfo["bkc328"] = item.MonitoringLevel
- // feedetailInfo["bkc329"] = item.DrugPsychotropicSubstances
- // feedetailInfo["bke801"] = item.HealthCareCode
- // feedetailInfo["bkc330"] = item.PlanningTechnicalServiceCode
- // feedetailInfo["bkc332"] = item.PharmacistType
- // feedetailInfo["bkc333"] = item.PharmacistPracticeCategory
- // feedetailInfo["bkc334"] = item.PharmacistsLicensing
- // feedetailInfo["bkc335"] = item.PharmacistRegistrationNumber
- // feedetailInfo["akf001"] = item.OfficeCode
- // feedetailInfo["acc501"] = item.JobNumber
- // feedetailInfo["ahc451"] = item.PostName
- // feedetailInfo["aaf009"] = item.TechnicalJobLevelCode
- // feedetailInfo["bkc321"] = item.IsActive
- // feedetailInfo["ckc302"] = item.PrescriptionQualificationIdentification
- // feedetailInfo["bkc325"] = item.IdentificationOutpatients
- // feedetailInfo["ckc304"] = item.OutpatientIllnessCategory
- // feedetailInfo["aae030"] = item.StartTime
- // feedetail = append(feedetail, feedetailInfo)
- // }
- //
- // inputData["inputlist"] = feedetail
- // inputMessage["transBody"] = inputData
- //
- // bytesData, err := json.Marshal(inputMessage)
- // fmt.Println(string(bytesData))
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // reader := bytes.NewReader(bytesData)
- // //url := "http://192.168.1.99:10000"
- // url := "http://192.168.1.228:17001/szsi-portal/transData"
- //
- // 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")
- //
- // 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
- //
- //}
-
- func SzybYS002(doctor string, doctor_code string, fixmedins_code string, datas *models.DocDetail) string {
-
- //生成输入报文
- inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code)
-
- inputData := make(map[string]interface{})
-
- inputData["listsize"] = 1
- inputMessage["transType"] = "YS002" // 交易编码
- feedetail := make([]map[string]interface{}, 0)
-
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["bkc320"] = datas.DoctorNumber
- feedetailInfo["bke155"] = "4"
- feedetail = append(feedetail, feedetailInfo)
-
- inputData["inputlist"] = feedetail
- inputMessage["transBody"] = inputData
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- url := beego.AppConfig.String("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")
-
- 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
- }
-
- func SzybYS003(doctor string, doctor_code string, fixmedins_code string, datas []*models.DocDetail) string {
-
- //生成输入报文
- inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code)
-
- inputData := make(map[string]interface{})
-
- inputData["listsize"] = len(datas)
- inputMessage["transType"] = "YS003" // 交易编码
- feedetail := make([]map[string]interface{}, 0)
-
- for _, item := range datas {
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["bkc320"] = item.StaffCode
- feedetailInfo["aac003"] = item.UserName
- feedetailInfo["bka633"] = item.RoleId
- feedetailInfo["aac004"] = item.Sex
- feedetailInfo["aac058"] = item.CardType
- feedetailInfo["aac147"] = item.IdCard
- feedetailInfo["aae005"] = item.Phone
- feedetailInfo["bkc322"] = item.WorkMajorName
- feedetailInfo["aac005"] = item.Nation
- feedetailInfo["aac006"] = item.BirthDay
- feedetailInfo["aac007"] = item.WorkTime
- feedetailInfo["aac011"] = item.Education
- feedetailInfo["aac183"] = item.StudyMajorName
- feedetailInfo["bkc323"] = item.CertificateCode
- feedetailInfo["bke955"] = item.MedicalCode
- feedetailInfo["akc055"] = item.MedicalRangeCode
- feedetailInfo["bcc950"] = item.MedicalLevel
- feedetailInfo["bcc955"] = item.TypeJob
- feedetailInfo["bka503"] = item.DoctorNumber
- feedetailInfo["bkc324"] = item.Licensing
- feedetailInfo["bkc326"] = item.DoctorServiceStatus
- feedetailInfo["bkc328"] = item.MonitoringLevel
- feedetailInfo["bkc329"] = item.DrugPsychotropicSubstances
- feedetailInfo["bke801"] = item.HealthCareCode
- feedetailInfo["bkc330"] = item.PlanningTechnicalServiceCode
- feedetailInfo["bkc332"] = item.PharmacistType
- feedetailInfo["bkc333"] = item.PharmacistPracticeCategory
- feedetailInfo["bkc334"] = item.PharmacistsLicensing
- feedetailInfo["bkc335"] = item.PharmacistRegistrationNumber
- feedetailInfo["akf001"] = item.OfficeCode
- feedetailInfo["acc501"] = item.JobNumber
- feedetailInfo["ahc451"] = item.PostName
- feedetailInfo["aaf009"] = item.TechnicalJobLevelCode
- feedetailInfo["bkc321"] = item.IsActive
- feedetailInfo["ckc302"] = item.PrescriptionQualificationIdentification
- feedetailInfo["bkc325"] = item.IdentificationOutpatients
- feedetailInfo["ckc304"] = item.OutpatientIllnessCategory
- feedetailInfo["aae030"] = item.StartTime
- feedetailInfo["aae031"] = item.EndTime
- feedetail = append(feedetail, feedetailInfo)
- }
-
- inputData["inputlist"] = feedetail
- inputMessage["transBody"] = inputData
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- url := beego.AppConfig.String("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")
-
- 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
- }
-
- func SzybYML007(doctor string, doctor_code string, fixmedins_code string, infor *models.XtGoodInformation) string {
-
- //生成输入报文
- inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code)
-
- inputData := make(map[string]interface{})
- inputData["listsize"] = 1
- inputMessage["transType"] = "ML007" // 交易编码
- feedetail := make([]map[string]interface{}, 0)
-
- feedetailInfo := make(map[string]interface{})
- feedetailInfo["ake001"] = infor.SocialSecurityDirectoryCode // 社保目录编码
-
- feedetailInfo["ake005"] = infor.SocialSecurityDirectoryCode //协议机构内部目录编码
- feedetailInfo["ake006"] = infor.GoodName //医药机构内部目录名称
- feedetailInfo["bka053"] = infor.ManufacturerName //生产厂家
- feedetailInfo["ake004"] = infor.ProductionType //生产地类别
- feedetailInfo["ckf261"] = infor.SpecialMedical //特殊医用材料标识
- feedetailInfo["aka067"] = "支" //计价单位
- feedetailInfo["aka074"] = infor.SpecificationName //规格
- feedetailInfo["bka505"] = infor.BuyPrice //进货价
- feedetailInfo["bka506"] = infor.SellPrice // 收获价
- feedetailInfo["aae013"] = infor.Remark //备注
- feedetail = append(feedetail, feedetailInfo)
-
- inputData["inputlist"] = feedetail
- inputMessage["transBody"] = inputData
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- url := beego.AppConfig.String("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")
-
- 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
- }
-
- //func SzybYML007(doctor string, doctor_code string, fixmedins_code string, datas []*models.GoodDetail) string {
- //
- // //生成输入报文
- // inputMessage := SetSZDrugMessage(doctor, doctor_code, fixmedins_code)
- //
- // inputData := make(map[string]interface{})
- //
- // inputData["listsize"] = len(datas)
- // inputMessage["transType"] = "ML007" // 交易编码
- // feedetail := make([]map[string]interface{}, 0)
- //
- // for _, item := range datas {
- // fmt.Println("item222222222", item.BuyPrice)
- // feedetailInfo := make(map[string]interface{})
- // feedetailInfo["ake001"] = item.SocialSecurityDirectoryCode // 社保目录编码
- // //feedetailInfo["ake001"] = "3333333333" // 社保目录编码
- // feedetailInfo["ake005"] = item.SocialSecurityDirectoryCode //协议机构内部目录编码
- // //feedetailInfo["ake006"] = item.GoodName //医药机构内部目录名称
- // feedetailInfo["ake006"] = "222222" //医药机构内部目录名称
- // feedetailInfo["bka053"] = item.ManufacturerName //生产厂家
- // feedetailInfo["ake004"] = "1" //生产地类别
- // feedetailInfo["ckf261"] = "1" //特殊医用材料标识
- // feedetailInfo["aka067"] = "支" //计价单位
- // feedetailInfo["aka074"] = "ftp" //规格
- // feedetailInfo["bka505"] = item.BuyPrice //进货价
- // feedetailInfo["bka506"] = item.SellPrice // 收获价
- // feedetailInfo["aae013"] = item.Remark //备注
- // feedetail = append(feedetail, feedetailInfo)
- // }
- //
- // inputData["inputlist"] = feedetail
- // inputMessage["transBody"] = inputData
- //
- // bytesData, err := json.Marshal(inputMessage)
- // fmt.Println(string(bytesData))
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // reader := bytes.NewReader(bytesData)
- // //url := "http://192.168.1.99:10000"
- // url := "http://192.168.1.228:17001/szsi-portal/transData"
- //
- // 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")
- //
- // 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
- //}
-
- func GetDoseCode(dose_id int64, user_org_id int64) (error, string) {
- var data models.DictDataconfig
- err := readDb.Model(&models.DictDataconfig{}).Where(" (org_id = ? Or org_id = 0) AND parent_id = 4 AND module = 'system' AND status = 1 AND value = ?", user_org_id, dose_id).First(&data).Error
- return err, data.Code
- }
-
- func UpdataOrderStatusSZ(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 UpdataHisStatusSZ(user_org_id int64, his_mz_number string, his_number string, result string, his_patient_id int64) (err error) {
- err = writeDb.Model(&models.HisPatient{}).Where("status = 1 AND user_org_id = ? AND mz_number = ? AND number = ?", user_org_id, his_mz_number, his_number).Updates(map[string]interface{}{"status": 0, "mtime": time.Now().Unix(), "refund_detail": result}).Error
- writeDb.Model(&models.HisPrescription{}).Where("status = 1 AND user_org_id = ? AND his_patient_id = ?", user_org_id, his_patient_id).Updates(map[string]interface{}{"his_patient_id": 0, "mtime": time.Now().Unix()})
- writeDb.Model(&models.HisPrescriptionInfo{}).Where("status = 1 AND user_org_id = ? AND his_patient_id = ?", user_org_id, his_patient_id).Updates(map[string]interface{}{"his_patient_id": 0, "mtime": time.Now().Unix()})
- return
- }
-
- func UpdataOrderlog(id int64, user_org_id int64, refund_log string) (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, "refund_log": refund_log}).Error
-
- return
-
- }
-
- func UpdateBaseDrugById(id int64) (models.XtBaseDrug, error) {
-
- drug := models.XtBaseDrug{}
-
- err := XTWriteDB().Model(&drug).Where("id = ?", id).Updates(map[string]interface{}{"is_mark": 1}).Error
- return drug, err
- }
-
- func UpdateDrugByIdDetail(id int64) (models.XtBaseDrug, error) {
- drug := models.XtBaseDrug{}
-
- err := XTWriteDB().Model(&drug).Where("id = ?", id).Updates(map[string]interface{}{"is_mark": 0}).Error
- return drug, err
- }
-
- func UpdateGoodInformaitonByDetail(id int64) (models.MyGoodInformation, error) {
- information := models.MyGoodInformation{}
- err := XTWriteDB().Model(&information).Where("id=?", id).Updates(map[string]interface{}{"is_mark": 1}).Error
- return information, err
- }
-
- func UpdateGoodInfoById(id int64) (models.MyGoodInformation, error) {
- information := models.MyGoodInformation{}
- err := XTWriteDB().Model(&information).Where("id=?", id).Updates(map[string]interface{}{"is_mark": 0}).Error
- return information, err
- }
-
- func UpdateProjectById(id int64) (models.MyHisProject, error) {
- project := models.MyHisProject{}
- err := XTWriteDB().Model(&project).Where("id = ?", id).Updates(map[string]interface{}{"is_mark": 1}).Error
- return project, err
- }
-
- func UpdateMyProjectById(id int64) (models.MyHisProject, error) {
- project := models.MyHisProject{}
- err := XTWriteDB().Model(&project).Where("id = ?", id).Updates(map[string]interface{}{"is_mark": 0}).Error
- return project, err
- }
-
- func UpdateAdminUserRoleById(id int64, orgid int64) (models.MySgjUserAdminRole, error) {
-
- role := models.MySgjUserAdminRole{}
- err = UserWriteDB().Model(&role).Where("admin_user_id = ? and org_id = ?", id, orgid).Updates(map[string]interface{}{"is_mark = ?": 1}).Error
- return role, err
- }
-
- func UpdataOrderInfoStatus(id int64, number string, user_org_id int64) {
- err = writeDb.Model(&models.HisOrder{}).Where("status = 1 AND id = ? AND user_org_id = ?", id, user_org_id).Updates(map[string]interface{}{"mtime": time.Now().Unix(), "status": 0}).Error
- err = writeDb.Model(&models.HisOrderInfo{}).Where("status = 1 AND user_org_id = ? AND order_number = ?", user_org_id, number).Updates(map[string]interface{}{"mtime": time.Now().Unix(), "status": 0}).Error
-
- return
-
- }
|