123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388 |
- package service
-
- import (
- "bytes"
- "crypto/hmac"
- "crypto/sha1"
- "encoding/base64"
- "encoding/json"
- "fmt"
-
- "XT_New/models"
- "XT_New/utils"
- "github.com/astaxie/beego"
- //"github.com/jung-kurt/gofpdf"
- "io/ioutil"
- "net/http"
- )
-
- func GetSignNameByPhone(phoneOne string) string {
-
- var url string
- url = "http://demo-open.itruscloud.com/apigate/smsService/sendingSms"
- var phone string
-
- phone = "13318464642"
-
- var content string
-
- content = "123456"
-
- var autograph string
- autograph = "【天威诚信】"
-
- maprequest := make(map[string]interface{})
-
- maprequest["phone"] = phone
- maprequest["content"] = content
- maprequest["autograph"] = autograph
-
- byterequest, _ := json.Marshal(maprequest)
-
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
-
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- fmt.Println(signatureStr)
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- }
- fmt.Println("请求参数", request)
- fmt.Println("Content-Signature", signatureStr)
- fmt.Println("appID", appId)
- fmt.Println("serviceCode", serviceCode)
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
-
- func generateHMACSHA1SignatureOne(data interface{}, key, serviceCode string) (string, error) {
- // 将数据转换为 JSON 格式的字节数组
- jsonData, err := json.Marshal(data)
- if err != nil {
- return "", err
- }
-
- // 将密钥和 serviceCode 进行拼接
- signingKey := key + serviceCode
-
- // 将签名密钥转换为字节数组
- keyBytes := []byte(signingKey)
-
- // 创建一个新的 HMAC-SHA1 实例
- h := hmac.New(sha1.New, keyBytes)
-
- // 将 JSON 数据添加到 HMAC 实例中
- h.Write(jsonData)
-
- signature := base64.StdEncoding.EncodeToString(h.Sum(nil))
-
- // 返回带有前缀的签名字符串
- return "HMAC-SHA1 " + signature, nil
- }
-
- func GenerateHMACSHA1SignatureTwo(data interface{}, key string) (string, error) {
- // 将数据转换为 JSON 格式的字节数组
- jsonData, err := json.Marshal(data)
- if err != nil {
- return "", err
- }
-
- // 将密钥和 serviceCode 进行拼接
- signingKey := key
-
- // 将签名密钥转换为字节数组
- keyBytes := []byte(signingKey)
-
- // 创建一个新的 HMAC-SHA1 实例
- h := hmac.New(sha1.New, keyBytes)
-
- // 将 JSON 数据添加到 HMAC 实例中
- h.Write(jsonData)
-
- signature := base64.StdEncoding.EncodeToString(h.Sum(nil))
-
- // 返回带有前缀的签名字符串
- return "HMAC-SHA1 " + signature, nil
- }
-
- func CreateUserName(phone string, disPlayName string) (string, string) {
-
- var url string
-
- url = "http://demo.itruscloud.com/apigate/contractpaasapi/user/createUserRealName"
- var phoneOne string
-
- phoneOne = "13318464642"
-
- var disPlayNameOne string
-
- disPlayNameOne = "马云的朋友"
-
- var authentication string
- //测试环境用true
- authentication = "true"
-
- maprequest := make(map[string]interface{})
-
- twAuthReq := make(map[string]interface{})
-
- apiAuthReq := make(map[string]interface{})
-
- customerReq := make(map[string]interface{})
-
- customerReq["idCardType"] = "0"
- customerReq["idCardNum"] = "430526199408156511"
-
- apiAuthReq["realNameType"] = 3
- apiAuthReq["idCardType"] = "0"
- apiAuthReq["idCardNum"] = "430526199408156511"
- apiAuthReq["bankCard"] = "6225551675364804"
- //验证码流水号
- apiAuthReq["codeNumber"] = "msg202307071510269187701"
- //验证码
- apiAuthReq["verifyCode"] = "123456"
-
- twAuthReq["oneLineAuth"] = "false"
-
- twAuthReq["apiAuthReq"] = apiAuthReq
-
- maprequest["phone"] = phoneOne
- maprequest["displayName"] = disPlayNameOne
- maprequest["authentication"] = authentication
-
- maprequest["twAuthReq"] = twAuthReq
- maprequest["customerAuthReq"] = customerReq
-
- byterequest, _ := json.Marshal(maprequest)
-
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
-
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- fmt.Println(signatureStr)
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- }
- fmt.Println("请求参数", request)
- fmt.Println("Content-Signature", signatureStr)
- fmt.Println("appID", appId)
- fmt.Println("serviceCode", serviceCode)
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
-
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(respBytes)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- }
- var UserId string
- UserId = respJSON["data"].(map[string]interface{})["userId"].(string)
- fmt.Println("str", UserId)
- return str, UserId
-
- }
-
- func CreatePersionSeal(user_id string, person_seal_type int64, person_seal_name string, person_seal_base string, color int64, alpha int64, width int64, height int64, border int64, font_type int64) (string, string) {
-
- maprequest := make(map[string]interface{})
-
- maprequest["userId"] = "PBRLMBFVIRR3BV8JGGOX9C7N"
-
- maprequest["personSealType"] = 1
-
- maprequest["personSealName"] = "小朋友的印章"
-
- var url string
-
- url = "http://demo.itruscloud.com/apigate/contractpaasapi/user/createPersonSeal"
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
- byterequest, _ := json.Marshal(maprequest)
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- fmt.Println(signatureStr)
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- }
-
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
-
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(respBytes)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- }
- var personSealId string
- personSealId = respJSON["data"].(map[string]interface{})["personSealId"].(string)
- fmt.Println("str", personSealId)
- return str, personSealId
- }
-
- func CreateUploadPact(contractcode string, contractname string, signcount int64, docname string, contractbase string, creator string, enterpriseid string, signvalidays int64, sysncurl string, asyncurl string) string {
-
- var url string
-
- url = "http://demo.itruscloud.com/apigate/contractpaasapi/contract/createByFile"
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
-
- maprequest := make(map[string]interface{})
-
- maprequest["contractName"] = "电脑购买交易合同"
-
- maprequest["signCount"] = 10
-
- maprequest["docName"] = "日本员工保密协议"
-
- file := "C:/Users/28169/Desktop/2.pdf"
-
- fileBytes, err := ioutil.ReadFile(file) // 读取file
-
- contractBase64 := base64.StdEncoding.EncodeToString(fileBytes) // 加密成base64字符串
-
- maprequest["contractBase64"] = contractBase64
-
- //添加企业成员 里面的USERID
- maprequest["creator"] = "PBRLMBFVIRR3BV8JGGOX9C7N"
-
- maprequest["enterpriseId"] = "BRWAABXW3RUD4PGCYEQWRRK8"
-
- maprequest["signValidDays"] = 90
-
- maprequest["sysnUrl"] = "https://kuyi.shengws.com/chenxuemin1.png"
-
- maprequest["asyncUrl"] = "https://kuyi.shengws.com/chenxuemin1.png"
-
- byterequest, _ := json.Marshal(maprequest)
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- }
-
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
-
- return str
- }
-
- func CreateEnterPriseRealName(enterprisename string) string {
-
- var url string
-
- url = "http://demo.itruscloud.com/apigate/contractpaasapi/enterprise/createEnterpriseRealName"
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
-
- maprequest := make(map[string]interface{})
-
- customerReq := make(map[string]interface{})
- customerReq["idCardType"] = "N"
- customerReq["idCardNum"] = "430526199408156511"
-
- maprequest["enterpriseName"] = "深圳德马西科技有限公司"
- maprequest["authentication"] = true
- maprequest["customerAuthReq"] = customerReq
-
- fmt.Println("maprequest", maprequest)
- byterequest, _ := json.Marshal(maprequest)
-
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- }
-
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
-
- return str
- }
-
- func CreateUserId(userId string, displayName string) string {
-
- var url string
-
- url = "http://demo.itruscloud.com/apigate/contractpaasapi/user/joinEnterprise"
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
-
- maprequest := make(map[string]interface{})
-
- maprequest["enterpriseId"] = "BRWAABXW3RUD4PGCYEQWRRK8"
- maprequest["userId"] = "PBRLMBFVIRR3BV8JGGOX9C7N"
-
- byterequest, _ := json.Marshal(maprequest)
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- }
-
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
-
- return str
- }
-
- //type ResultTwo struct {
- // ErrMsg string `json:"err_msg"`
- // InfRefmsgid string `json:"inf_refmsgid"`
- // Infcode int64 `json:"infcode"`
- // Output struct {
- // Baseinfo struct {
- // Age float64 `json:"age"`
- // Brdy string `json:"brdy"`
- // Certno string `json:"certno"`
- // Gend string `json:"gend"`
- // Naty string `json:"naty"`
- // PsnCertType string `json:"psn_cert_type"`
- // PsnName string `json:"psn_name"`
- // PsnNo string `json:"psn_no"`
- // } `json:"baseinfo"`
- // Idetinfo []interface{} `json:"idetinfo"`
- // Iinfo []struct {
- // Balc float64 `json:"balc"`
- // CvlservFlag string `json:"cvlserv_flag"`
- // EmpName string `json:"emp_name"`
- // InsuplcAdmdvs string `json:"insuplc_admdvs"`
- // Insutype string `json:"insutype"`
- // PausInsuDansuplcAdmdvs string `json:"paus_insu_dansuplc_admdvs"`
- // PausInsuDate string `json:"paus_insu_date"`
- // PsnInsuDate string `json:"psn_insu_date"`
- // PsnInsuStas string `json:"psn_insu_stas"`
- // PsnType string `json:"psn_type"`
- // } `json:"insuinfo"`
- // } `json:"output"`
- // RefmsgTime string `json:"refmsg_time"`
- // RespondTime string `json:"respond_time"`
- // Signtype interface{} `json:"signtype"`
- // WarnInfo interface{} `json:"warn_info"`
- //}
-
- func AddContractSignatory(contractId string, signers string, contract models.NewContract) string {
-
- var url string
-
- url = "http://demo.itruscloud.com/apigate/contractpaasapi/contract/addSignerByFile"
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
-
- signFiles := make(map[string]interface{})
-
- //创建合同返回
- signFiles["docId"] = "158807311102510183"
-
- inputDataArr := make([]map[string]interface{}, 0)
-
- for _, item := range signFiles {
- fmt.Println("item", item)
- xySignControls := make(map[string]interface{})
- xySignControls["key"] = "1"
- xySignControls["type"] = "autograph"
- xySignControls["pageNum"] = 1
- xySignControls["positionX"] = "120F"
- xySignControls["positionY"] = "120F"
- inputDataArr = append(inputDataArr, xySignControls)
-
- }
- inputDataArrTwo := make([]map[string]interface{}, 0)
- for _, item := range signFiles {
- fmt.Println(item)
- keywordSignControls := make(map[string]interface{})
- keywordSignControls["key"] = "2"
- keywordSignControls["type"] = "date"
- keywordSignControls["pageNum"] = 1
- keywordSignControls["keyword"] = "王志文"
- keywordSignControls["offsetX"] = "100F"
- keywordSignControls["offsetY"] = "100F"
- inputDataArrTwo = append(inputDataArrTwo, keywordSignControls)
- }
- signFiles["xySignControls"] = inputDataArr
- signFiles["keywordSignControls"] = inputDataArrTwo
- inputDataArrThree := make([]map[string]interface{}, 0)
- inputDataArrThree = append(inputDataArrThree, signFiles)
-
- signersFiles := make(map[string]interface{})
-
- signersFiles["userId"] = "PBRLMBFVIRR3BV8JGGOX9C7N"
- signersFiles["signerType"] = "1"
- signersFiles["enterpriseId"] = "BRWAABXW3RUD4PGCYEQWRRK8"
- signersFiles["sequence"] = "8"
- signersFiles["sendMsg"] = false
- signersFiles["setting"] = true
- signersFiles["signFiles"] = inputDataArrThree
-
- inputDataArrFour := make([]map[string]interface{}, 0)
-
- inputDataArrFour = append(inputDataArrFour, signersFiles)
-
- maprequest := make(map[string]interface{})
- maprequest["contractId"] = "158807311102510182"
- maprequest["signers"] = inputDataArrFour
-
- byterequest, _ := json.Marshal(maprequest)
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- }
-
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
-
- return str
- }
-
- func CreateBackStageSign(contractId string, signers string) string {
-
- var url string
-
- url = "http://demo.itruscloud.com/apigate/contractpaasapi/contract/signByFile"
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
-
- sealTimestampFiles := make(map[string]interface{})
- inputDataArr := make([]map[string]interface{}, 0)
- signFiles := make(map[string]interface{})
-
- keywordSignControls := make(map[string]interface{})
- keywordSignControls["controlsKey"] = "2"
- keywordSignControls["pattern"] = 1
- keywordSignControls["color"] = "#FF0000"
- inputDataArr = append(inputDataArr, keywordSignControls)
-
- sealTimestampFiles["allAddTimestamp"] = false
- sealTimestampFiles["someTimestampStyle"] = inputDataArr
-
- inputDataArrOne := make([]map[string]interface{}, 0)
-
- keySignControls := make(map[string]interface{})
- keySignControls["controlsKey"] = "1"
- keySignControls["fontType"] = 1
- keySignControls["fontSize"] = 8.5
- keySignControls["fontColor"] = "#56600F"
- keySignControls["alignment"] = 1
- inputDataArrOne = append(inputDataArrOne, keySignControls)
-
- signFiles["fonts"] = inputDataArrOne
- signFiles["showTimestamp"] = false
- signFiles["sealTimestamp"] = sealTimestampFiles
- signControl := make(map[string]interface{})
- signControl["1"] = "{sealId:157474548357267755}"
- signControl["2"] = "姓名"
-
- fmt.Println("signContorlwqowowo", signControl)
- signFiles["signControl"] = signControl
- signFiles["docId"] = "158807311102510183"
- inputDataArrThree := make([]map[string]interface{}, 0)
- inputDataArrThree = append(inputDataArrThree, signFiles)
-
- signer := make(map[string]interface{})
-
- //添加合同签署人接口返回
- signer["signerId"] = "158807462500107405"
- signer["isUserWishes"] = true
- signer["userWishesWay"] = 1
- signer["codeNumber"] = "msg202309081937527315153"
- signer["verifyCode"] = "252234"
- signer["signFiles"] = inputDataArrThree
- maprequest := make(map[string]interface{})
- maprequest["contractId"] = "158807311102510182"
- maprequest["signer"] = signer
-
- byterequest, _ := json.Marshal(maprequest)
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- }
-
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
-
- return str
- }
-
- func GetVerificationCode() string {
-
- var url string
-
- url = "http://demo.itruscloud.com/apigate/contractpaasapi/contract/sendSmsCode"
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
-
- maprequest := make(map[string]interface{})
- maprequest["contractId"] = "158807311102510182"
- maprequest["userId"] = "PBRLMBFVIRR3BV8JGGOX9C7N"
-
- byterequest, _ := json.Marshal(maprequest)
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- }
-
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
-
- return str
- }
-
- func CreateEnterprise() string {
-
- var url string
-
- url = "http://demo.itruscloud.com/apigate/contractpaasapi/contract/sendSmsCode"
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
-
- maprequest := make(map[string]interface{})
- maprequest["contractId"] = "157413765980094742"
- maprequest["userId"] = "PBRLMBFVIRR3BV8JGGOX9C7N"
- maprequest["sealType"] = 1
- maprequest["sealName"] = "测试用章"
- maprequest["sealBase64"] = ""
- maprequest["color"] = 1
- maprequest["width"] = 40
- maprequest["authUserId"] = ""
- maprequest["sealCreateType"] = false
- byterequest, _ := json.Marshal(maprequest)
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- }
-
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
-
- return str
- }
-
- func GetTestThrityMent(org_id int64) (base []*models.XtBaseDrug, err error) {
-
- err = XTReadDB().Where("org_id = ? and status=1", org_id).Find(&base).Error
-
- return base, err
- }
-
- func UpdateDrugWarehouseInfoByDrugId(drug_id int64, min_price float64) error {
-
- err := XTWriteDB().Model(&models.XtDrugWarehouseInfo{}).Where("drug_id = ? and (stock_max_number>0 or stock_min_number>0) and status= 1 and is_check=1 and org_id =10375", drug_id).Updates(map[string]interface{}{"retail_price": min_price}).Error
-
- return err
- }
-
- func GetEnterPriseByUserOrgId(user_org_id int64) (models.XtDeviceEnterprise, error) {
-
- enterprise := models.XtDeviceEnterprise{}
-
- err := XTReadDB().Where("user_org_id = ? and status =1", user_org_id).Find(&enterprise).Error
-
- return enterprise, err
- }
-
- func CreateEnterPrise(enterprise models.XtDeviceEnterprise) error {
-
- err := XTWriteDB().Create(&enterprise).Error
-
- return err
- }
-
- func SaveEnerPrise(enterprise models.XtDeviceEnterprise) error {
-
- err := XTWriteDB().Save(&enterprise).Error
-
- return err
- }
-
- func CreateNewEnterPriseRealName(enterprise models.XtDeviceEnterprise) (string, string) {
-
- var url string
-
- url = "http://demo.itruscloud.com/apigate/contractpaasapi/enterprise/createEnterpriseRealName"
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
-
- maprequest := make(map[string]interface{})
-
- customerReq := make(map[string]interface{})
- customerReq["idCardType"] = "N"
- customerReq["idCardNum"] = "430526199408156511"
-
- maprequest["enterpriseName"] = enterprise.EnterpriseName
- maprequest["authentication"] = true
- maprequest["customerAuthReq"] = customerReq
-
- fmt.Println("maprequest", maprequest)
- byterequest, _ := json.Marshal(maprequest)
-
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- }
-
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
-
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(respBytes)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- }
- var enterpriseId string
- enterpriseId = respJSON["data"].(map[string]interface{})["enterpriseId"].(string)
- fmt.Println("enterpriseId", enterpriseId)
- return str, enterpriseId
- }
-
- func GetNewSignNameByPhone(phone string) (string, string) {
-
- var url string
- url = "http://demo-open.itruscloud.com/apigate/smsService/sendingSms"
- var content string
- content = "123456"
- var autograph string
- autograph = "【天威诚信】"
-
- maprequest := make(map[string]interface{})
-
- maprequest["phone"] = phone
- maprequest["content"] = content
- maprequest["autograph"] = autograph
-
- byterequest, _ := json.Marshal(maprequest)
-
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
-
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- fmt.Println(signatureStr)
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- }
-
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
-
- var respJSON map[string]interface{}
-
- if err := json.Unmarshal([]byte(string(respBytes)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- }
- var orderNumber string
- orderNumber = respJSON["orderNumber"].(string)
- fmt.Println("orderNumberWOWOWOWOWO", orderNumber)
- return str, orderNumber
- }
-
- func SavePersonEnterPrise(enterprise models.XtDevicePersonEnterprise) error {
-
- err := XTWriteDB().Save(&enterprise).Error
-
- return err
- }
-
- func GetLastPersonEnterPrise(admin_user_id int64, orgId int64) (models.XtDevicePersonEnterprise, error) {
-
- enterprise := models.XtDevicePersonEnterprise{}
-
- err := XTReadDB().Where("admin_user_id = ? and user_org_id = ? and status = 1", admin_user_id, orgId).Find(&enterprise).Error
-
- return enterprise, err
- }
-
- func CreateNewUserName(phone string, disPlayName string, code string, orderNumber string, id_card_number string) (string, string) {
-
- var url string
-
- url = "http://demo.itruscloud.com/apigate/contractpaasapi/user/createUserRealName"
-
- var authentication string
- //测试环境用true
- authentication = "true"
-
- maprequest := make(map[string]interface{})
-
- twAuthReq := make(map[string]interface{})
-
- apiAuthReq := make(map[string]interface{})
-
- customerReq := make(map[string]interface{})
-
- fmt.Println("身份证id_card_number", id_card_number)
- customerReq["idCardType"] = "0"
- customerReq["idCardNum"] = id_card_number
-
- apiAuthReq["realNameType"] = 3
- apiAuthReq["idCardType"] = "0"
- apiAuthReq["idCardNum"] = id_card_number
- apiAuthReq["bankCard"] = "6225551675364804"
- //验证码流水号
- apiAuthReq["codeNumber"] = orderNumber
- //验证码
- apiAuthReq["verifyCode"] = code
-
- twAuthReq["oneLineAuth"] = "false"
-
- twAuthReq["apiAuthReq"] = apiAuthReq
-
- maprequest["phone"] = phone
- maprequest["displayName"] = disPlayName
- maprequest["authentication"] = authentication
-
- maprequest["twAuthReq"] = twAuthReq
- maprequest["customerAuthReq"] = customerReq
-
- byterequest, _ := json.Marshal(maprequest)
-
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
-
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- fmt.Println(signatureStr)
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- }
- fmt.Println("请求参数", request)
- fmt.Println("Content-Signature", signatureStr)
- fmt.Println("appID", appId)
- fmt.Println("serviceCode", serviceCode)
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
-
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(respBytes)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- }
- var UserId string
- UserId = respJSON["data"].(map[string]interface{})["userId"].(string)
- fmt.Println("str", UserId)
- return str, UserId
-
- }
-
- func CreateNewPersionSeal(userId string) (string, string) {
-
- maprequest := make(map[string]interface{})
-
- maprequest["userId"] = userId
-
- maprequest["personSealType"] = 1
-
- maprequest["personSealName"] = "小马印章"
-
- var url string
-
- url = "http://demo.itruscloud.com/apigate/contractpaasapi/user/createPersonSeal"
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
- byterequest, _ := json.Marshal(maprequest)
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- fmt.Println(signatureStr)
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- }
-
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
-
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(respBytes)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- }
- var personSealId string
- personSealId = respJSON["data"].(map[string]interface{})["personSealId"].(string)
- fmt.Println("str", personSealId)
- return str, personSealId
- }
-
- func CreateSKDPersionSeal(userId string, user_name string) (string, string) {
-
- maprequest := make(map[string]interface{})
-
- //印章字体 1宋体(默认)2 黑体
- maprequest["fontType"] = 1
- //个人姓名(1-42位字符)
- maprequest["personName"] = user_name
- var url string
- url = "http://localhost:8890/sdk/seal/createPersonSeal"
- appId := beego.AppConfig.String("sign_appid")
-
- fmt.Println("appId", appId)
- serviceKye := beego.AppConfig.String("serviceKye")
- fmt.Println("serviceKye", serviceKye)
- serviceCode := beego.AppConfig.String("serviceCode")
-
- fmt.Println("serviceCode", serviceCode)
- byterequest, _ := json.Marshal(maprequest)
- reader := bytes.NewReader(byterequest)
-
- signatureStr, ERR := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- fmt.Println(ERR)
-
- request, err := http.NewRequest("POST", url, reader)
- fmt.Println("errwowowoowowowow", err)
- if err != nil {
- fmt.Println(err.Error())
- }
-
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
- fmt.Println("strwoooooooooooooooooooo", str)
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(respBytes)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- }
- var sealBase64 string
- sealBase64 = respJSON["data"].(map[string]interface{})["sealBase64"].(string)
-
- return str, sealBase64
- }
-
- func UpdatePerseEnterPriseById(id int64, personSealId string) error {
-
- err := XTWriteDB().Model(models.XtDevicePersonEnterprise{}).Where("id= ? and status =1", id).Updates(map[string]interface{}{"person_seal_id": personSealId}).Error
-
- return err
- }
-
- func CreateNewEnterPrise(enterpriseId string, userId string) (string, string) {
-
- var url string
-
- url = "http://demo.itruscloud.com/apigate/contractpaasapi/enterprise/createSeal"
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
-
- fmt.Println("enterpriseId", enterpriseId)
- fmt.Println("userId", userId)
- maprequest := make(map[string]interface{})
- maprequest["enterpriseId"] = enterpriseId
- maprequest["userId"] = userId
- maprequest["sealType"] = 1
- maprequest["sealName"] = "测试用章"
-
- fmt.Println("request23222222222222222", maprequest)
- byterequest, _ := json.Marshal(maprequest)
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- request, err := http.NewRequest("POST", url, reader)
-
- fmt.Println("中国人民欢迎您", request)
- if err != nil {
- fmt.Println(err.Error())
- }
-
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
- fmt.Println("strwowowowowo", str)
-
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(respBytes)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- }
- var sealId string
- sealId = respJSON["data"].(map[string]interface{})["sealId"].(string)
- fmt.Println("sealId", sealId)
- return str, sealId
- }
-
- func CreateSDKEnterPrise() (string, string) {
-
- var url string
- url = "http://localhost:8890/sdk/seal/createEnterpriseSeal"
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
-
- maprequest := make(map[string]interface{})
-
- maprequest["sealType"] = 1
- maprequest["enterpriseName"] = "深圳伊森时光科技有限公司"
- maprequest["horizontalText"] = "财务专用章"
-
- byterequest, _ := json.Marshal(maprequest)
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- fmt.Println("signatureStr", signatureStr)
- request, err := http.NewRequest("POST", url, reader)
-
- if err != nil {
- fmt.Println(err.Error())
- }
-
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
-
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(respBytes)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- }
- var sealId string
- //sealId = respJSON["data"].(map[string]interface{})["sealId"].(string)
- //fmt.Println("sealId", sealId)
- return str, sealId
- }
-
- func UpdatePersonEnterPrise(id int64, sealId string) error {
-
- err := XTWriteDB().Model(models.XtDevicePersonEnterprise{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"seal_id": sealId}).Error
- return err
- }
-
- func GetContractId() string {
-
- var url string
-
- url = "http://demo.itruscloud.com/apigate/contractpaasapi/contract/search"
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
-
- maprequest := make(map[string]interface{})
- maprequest["contractId"] = "158799561907766048"
- maprequest["responseContractFile"] = true
-
- fmt.Println("request23222222222222222", maprequest)
- byterequest, _ := json.Marshal(maprequest)
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- request, err := http.NewRequest("POST", url, reader)
-
- fmt.Println("request23222222222222222", request)
- if err != nil {
- fmt.Println(err.Error())
- }
-
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
- fmt.Println("strwowowowowo", str)
-
- return str
- }
-
- func EndEnterPrise() string {
- var url string
-
- url = "http://demo.itruscloud.com/apigate/contractpaasapi/contract/finished"
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
-
- maprequest := make(map[string]interface{})
- maprequest["contractId"] = "157475501840007476"
-
- byterequest, _ := json.Marshal(maprequest)
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- request, err := http.NewRequest("POST", url, reader)
-
- if err != nil {
- fmt.Println(err.Error())
- }
-
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
- fmt.Println("strwowowowowo", str)
-
- return str
- }
-
- func GetEnterPriseDetail() (string, string) {
-
- var url string
-
- url = "http://demo.itruscloud.com/apigate/contractpaasapi/contract/preview"
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
-
- maprequest := make(map[string]interface{})
- maprequest["contractId"] = "158807311102510182"
-
- byterequest, _ := json.Marshal(maprequest)
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- request, err := http.NewRequest("POST", url, reader)
-
- if err != nil {
- fmt.Println(err.Error())
- }
-
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
- fmt.Println("strwowowowowo", str)
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(respBytes)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- }
- var urlOne string
- urlOne = respJSON["data"].(map[string]interface{})["url"].(string)
- fmt.Println("url", urlOne)
- return str, urlOne
- }
-
- func CreateNewUploadPact(name string) string {
-
- var url string
-
- url = "http://demo.itruscloud.com/apigate/contractpaasapi/contract/createByFile"
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
-
- maprequest := make(map[string]interface{})
-
- //maprequest["contractCode"] = "102020620701056856"
-
- maprequest["contractName"] = "手机购买交易合同"
-
- maprequest["signCount"] = 10
-
- maprequest["docName"] = "美国员工保密协议"
-
- //file := "C:/Users/28169/Desktop/打印单.pdf"
- //
- //fileBytes, err := ioutil.ReadFile(file) // 读取file
- //
- //contractBase64 := base64.StdEncoding.EncodeToString(fileBytes) // 加密成base64字符串
-
- //fmt.Println(contractBase64)
- maprequest["contractBase64"] = name
-
- //添加企业成员 里面的USERID
- maprequest["creator"] = "PBRLMBFVIRR3BV8JGGOX9C7N"
-
- maprequest["enterpriseId"] = "BRWAABXW3RUD4PGCYEQWRRK8"
-
- maprequest["signValidDays"] = 90
-
- maprequest["sysnUrl"] = "https://kuyi.shengws.com/chenxuemin1.png"
-
- maprequest["asyncUrl"] = "https://kuyi.shengws.com/chenxuemin1.png"
-
- byterequest, _ := json.Marshal(maprequest)
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- }
-
- request.Header.Set("appId", appId)
- request.Header.Set("serviceCode", serviceCode)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
-
- fmt.Println("strwwoowowow", str)
- return str
- }
-
- func GetDataConfigDisinfectionFluid(org_id int64) (models.Dataconfig, error) {
-
- dataconfig := models.Dataconfig{}
-
- err := XTReadDB().Where("org_id = ? and status =1 and id =12536", org_id).Find(&dataconfig).Error
-
- return dataconfig, err
- }
-
- func CreateQianshuUserName(user_name string, phone string, id_card_number string) (string, string) {
-
- var url string
-
- url = "http://localhost:8890/sdk/user/create"
- //var account string
- //
- //account = "13318464642"
-
- //var realName string
- //
- //realName = "马文强"
-
- maprequest := make(map[string]interface{})
-
- maprequest["account"] = phone
-
- //账号类型:1手机号,2邮箱
- maprequest["accountType"] = 1
-
- maprequest["realName"] = user_name
-
- //签署人类型 1个人 2.企业
- maprequest["signerType"] = 1
-
- // 0表示 身份证
- maprequest["cardType"] = 0
-
- //maprequest["cardNumber"] = "430526199408156511"
-
- maprequest["cardNumber"] = id_card_number
-
- byterequest, _ := json.Marshal(maprequest)
-
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- serviceCode := beego.AppConfig.String("serviceCode")
-
- reader := bytes.NewReader(byterequest)
-
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- }
- fmt.Println("请求参数", request)
- fmt.Println("Content-Signature", signatureStr)
- request.Header.Set("appId", appId)
- request.Header.Set("appKey", serviceKye)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
-
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(respBytes)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- }
- var UserId string
- UserId = respJSON["data"].(map[string]interface{})["userId"].(string)
- fmt.Println("str", UserId)
- return str, UserId
- }
-
- func CreateSdkSendInformation() (string, string) {
-
- var url string
-
- url = "http://localhost:8890/sdk/msg/sendMsg"
- maprequest := make(map[string]interface{})
-
- maprequest["phone"] = "13318464642"
-
- maprequest["signType"] = "pdf"
-
- byterequest, _ := json.Marshal(maprequest)
-
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- reader := bytes.NewReader(byterequest)
- serviceCode := beego.AppConfig.String("serviceCode")
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- }
- fmt.Println("请求参数", request)
- fmt.Println("Content-Signature", signatureStr)
-
- request.Header.Set("appId", appId)
- request.Header.Set("appKey", serviceKye)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
-
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
-
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(respBytes)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- }
- var orderId string
- //orderId = respJSON["data"].(map[string]interface{})["orderId"].(string)
- //fmt.Println("str", orderId)
- return str, orderId
- }
-
- func SavePdfInformation(name string) (string, string) {
-
- var url string
-
- url = "http://localhost:8890/sdk/pdf/sign"
- maprequest := make(map[string]interface{})
-
- Receiver := make(map[string]interface{})
-
- //业务单号
- maprequest["orderId"] = "13318464642"
-
- maprequest["signTitle"] = "举报合同"
-
- //file := "C:/Users/28169/Desktop/9.pdf"
- //file := "/swspan/gopath/src/XT_New/static/16.pdf"
- //fileBytes, _ := ioutil.ReadFile(file) // 读取file
- //
- //contractBase64 := base64.StdEncoding.EncodeToString(fileBytes) // 加密成base64字符串
-
- //fmt.Println("contractBase64", contractBase64)
-
- //文件获取方式
- maprequest["fileType"] = 3
-
- //maprequest["pdfBase64"] = name
- //合同内容
- maprequest["fileContent"] = "https://kuyi.shengws.com/20.pdf"
-
- //签署用户人ID
- maprequest["userId"] = "JMO9U8JH4TN8E3QOI0GUVUF2"
-
- //业务单号
- maprequest["receiver"] = Receiver
-
- //签署人账号
- Receiver["account"] = "13318464642"
- //签署个人类型 1.个人 2.企业
- Receiver["signerType"] = 1
-
- //签署人姓名
- Receiver["realName "] = "马文强"
-
- // 证件类型
- Receiver["cardType"] = 0
-
- //证件编码
- Receiver["cardNumber"] = "430526199408156511"
-
- stepStamper := make(map[string]interface{})
-
- keywordSignControls := make([]map[string]interface{}, 0)
-
- //预冲者样式
- inputArrOne := make(map[string]interface{})
- inputArrOne["sealName"] = "1"
- inputArrOne["keyword"] = "穿刺者"
- inputArrOne["pages"] = "0"
- inputArrOne["offsetX"] = "50"
- inputArrOne["offsetY"] = "0"
-
- keywordSignControls = append(keywordSignControls, inputArrOne)
- stepStamper["keywordSignControls"] = keywordSignControls
- //医生签名
- //inputArr := make(map[string]interface{})
- //inputArr["sealName"] = "2"
- //inputArr["keyword"] = "医生签名"
- //inputArr["pages"] = "1"
- //inputArr["offsetX"] = "100"
- //inputArr["offsetY"] = "0"
- //
- //keywordSignControls = append(keywordSignControls, inputArr)
- //
- //上机者
- //inputArrSix := make(map[string]interface{})
- //inputArrSix["sealName"] = "3"
- //inputArrSix["keyword"] = "护士签名"
- //inputArrSix["pages"] = "1"
- //inputArrSix["offsetX"] = "100"
- //inputArrSix["offsetY"] = "0"
- //
- //keywordSignControls = append(keywordSignControls, inputArrSix)
-
- ////医生签名
- //inputArrSeven := make(map[string]interface{})
- //inputArrSeven["sealName"] = "4"
- //inputArrSeven["keyword"] = "核对护士签名"
- //inputArrSeven["pages"] = "1"
- //inputArrSeven["offsetX"] = "100"
- //inputArrSeven["offsetY"] = "0"
- //
- //keywordSignControls = append(keywordSignControls, inputArrSeven)
-
- //stepStamper["keywordSignControls"] = keywordSignControls
- //
-
- //crossSignControls := make([]map[string]interface{}, 0)
- //
- //inputArrTwo := make(map[string]interface{})
- //inputArrTwo["sealName"] = "1"
- //inputArrTwo["positionX"] = "0"
- //inputArrTwo["positionY"] = "0"
- //inputArrTwo["pages"] = "0"
- //crossSignControls = append(crossSignControls, inputArrTwo)
- //
- //stepStamper["crossSignControls"] = crossSignControls
- //
- //xySignControls := make([]map[string]interface{}, 0)
- //inputArrThree := make(map[string]interface{})
- //inputArrThree["sealName"] = "1"
- //inputArrThree["positionX"] = "200"
- //inputArrThree["positionY"] = "100"
- //inputArrThree["pages"] = "0"
- //
- //xySignControls = append(xySignControls, inputArrThree)
- ////
- //stepStamper["xySignControls"] = xySignControls
- //
- maprequest["stepStamper"] = stepStamper
-
- seals := make([]map[string]interface{}, 0)
-
- //预冲者
- sealImagesList := make(map[string]interface{})
- fileOne := "/swspan/gopath/src/XT_New/static/huangzihui.jpg"
- fileBytesOne, _ := ioutil.ReadFile(fileOne) // 读取file
- contractBase64One := base64.StdEncoding.EncodeToString(fileBytesOne) // 加密成base64字符串
- sealImagesList["sealBase64"] = contractBase64One
- //控制签名的大小
- sealImagesList["width"] = "50"
- sealImagesList["height"] = "50"
- sealImagesList["verticalAlign"] = "middle"
-
- sealTextsList := make(map[string]interface{})
- sealTextsList["text"] = "2023年8月8日"
- sealTextsList["fontSize"] = "12"
- sealTextsList["fontColor"] = "#333333"
- sealTextsList["isTextArea"] = true
- sealTextsList["textAlign"] = 0
- sealTextsList["width"] = 150
- sealTextsList["height"] = 20
-
- sealsObj := make(map[string]interface{})
- sealsObj["sealWidth"] = "150"
- sealsObj["sealHeight"] = "150"
- sealsObj["sealName"] = "1"
- sealsObj["sealImage"] = sealImagesList
- sealsObj["sealText"] = sealTextsList
- seals = append(seals, sealsObj)
-
- //穿刺者
- //sealImagesListOne := make(map[string]interface{})
- //
- //fileTwo := "/swspan/gopath/src/XT_New/static/huangjunji.jpg"
- //
- //fileBytesTwo, _ := ioutil.ReadFile(fileTwo) // 读取file
- //
- //contractBase64Two := base64.StdEncoding.EncodeToString(fileBytesTwo) // 加密成base64字符串
- //sealImagesListOne["sealBase64"] = contractBase64Two
- ////控制签名的大小
- //sealImagesListOne["width"] = "50"
- //sealImagesListOne["height"] = "50"
- //sealImagesListOne["verticalAlign"] = "middle"
- //
- //sealTextsListOne := make(map[string]interface{})
- //sealTextsListOne["text"] = "2023年8月8日"
- //sealTextsListOne["fontSize"] = "100"
- //sealTextsListOne["fontColor"] = "100"
- //sealTextsListOne["isTextArea"] = true
- //sealTextsListOne["textAlign"] = 0
- //sealTextsListOne["width"] = 150
- //sealTextsListOne["height"] = 20
- //
- //sealsObjOne := make(map[string]interface{})
- //
- //sealsObjOne["sealWidth"] = "150"
- //sealsObjOne["sealHeight"] = "150"
- //sealsObjOne["sealName"] = "2"
- //sealsObjOne["sealImage"] = sealImagesListOne
- //sealsObjOne["sealText"] = sealTextsListOne
- //seals = append(seals, sealsObjOne)
- //间隔签名
-
- //上机者
- //sealImagesListTwo := make(map[string]interface{})
- //fileThree := "/swspan/gopath/src/XT_New/static/jianfeixia.jpg"
- //fileBytesThree, _ := ioutil.ReadFile(fileThree) // 读取file
- //contractBase64Three := base64.StdEncoding.EncodeToString(fileBytesThree) // 加密成base64字符串
- //sealImagesListTwo["sealBase64"] = contractBase64Three
- ////控制签名的大小
- //sealImagesListTwo["width"] = "50"
- //sealImagesListTwo["height"] = "50"
- //sealImagesListTwo["verticalAlign"] = "middle"
- //
- //sealTextsListTwo := make(map[string]interface{})
- //sealTextsListTwo["text"] = "2023年8月8日"
- //sealTextsListTwo["fontSize"] = "100"
- //sealTextsListTwo["fontColor"] = "100"
- //sealTextsListTwo["isTextArea"] = true
- //sealTextsListTwo["textAlign"] = 0
- //sealTextsListTwo["width"] = 150
- //sealTextsListTwo["height"] = 20
- //
- //sealsObjTwo := make(map[string]interface{})
- //
- //sealsObjTwo["sealWidth"] = "150"
- //sealsObjTwo["sealHeight"] = "150"
- //sealsObjTwo["sealName"] = "3"
- //sealsObjTwo["sealImage"] = sealImagesListTwo
- //sealsObjTwo["sealText"] = sealTextsListTwo
- //seals = append(seals, sealsObjTwo)
-
- //医生签名
- //sealImagesListThree := make(map[string]interface{})
- //fileFour := "/swspan/gopath/src/XT_New/static/jianfeixia.jpg"
- //fileBytesFour, _ := ioutil.ReadFile(fileFour) // 读取file
- //contractBase64Tour := base64.StdEncoding.EncodeToString(fileBytesFour) // 加密成base64字符串
- //sealImagesListThree["sealBase64"] = contractBase64Tour
- ////控制签名的大小
- //sealImagesListThree["width"] = "50"
- //sealImagesListThree["height"] = "50"
- //sealImagesListThree["verticalAlign"] = "middle"
- //
- //sealTextsListThree := make(map[string]interface{})
- //sealTextsListThree["text"] = "2023年8月8日"
- //sealTextsListThree["fontSize"] = "100"
- //sealTextsListThree["fontColor"] = "100"
- //sealTextsListThree["isTextArea"] = true
- //sealTextsListThree["textAlign"] = 0
- //sealTextsListThree["width"] = 150
- //sealTextsListThree["height"] = 20
- //
- //sealsObjThree := make(map[string]interface{})
- //
- //sealsObjThree["sealWidth"] = "150"
- //sealsObjThree["sealHeight"] = "150"
- //sealsObjThree["sealName"] = "4"
- //sealsObjThree["sealImage"] = sealImagesListThree
- //sealsObjThree["sealText"] = sealTextsListThree
- //seals = append(seals, sealsObjThree)
-
- maprequest["seals"] = seals
-
- maprequest["isUserWishes"] = true
- maprequest["phone"] = "13318464642"
- maprequest["verificationCode"] = "18888888888"
-
- byterequest, _ := json.Marshal(maprequest)
-
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- reader := bytes.NewReader(byterequest)
- serviceCode := beego.AppConfig.String("serviceCode")
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- }
- fmt.Println("请求参数", request)
- fmt.Println("Content-Signature", signatureStr)
-
- request.Header.Set("appId", appId)
- request.Header.Set("appKey", serviceKye)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
-
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
- fmt.Println("报错提示", str)
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(respBytes)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- }
- var pdfBase64 string
- pdfBase64 = respJSON["data"].(map[string]interface{})["pdfBase64"].(string)
-
- return str, pdfBase64
- }
-
- func ToCheckInformation(contractBase64 string) string {
-
- var url string
-
- url = "http://localhost:8890/sdk/pdf/verify"
- maprequest := make(map[string]interface{})
-
- //file := "/swspan/gopath/src/XT_New/static/a.pdf"
- //
- //fileBytes, _ := ioutil.ReadFile(file) // 读取file
- //
- //contractBase64 := base64.StdEncoding.EncodeToString(fileBytes) // 加密成base64字符串
-
- maprequest["fileType"] = 1
-
- maprequest["fileContent"] = contractBase64
-
- byterequest, _ := json.Marshal(maprequest)
-
- appId := beego.AppConfig.String("sign_appid")
-
- serviceKye := beego.AppConfig.String("serviceKye")
-
- reader := bytes.NewReader(byterequest)
- serviceCode := beego.AppConfig.String("serviceCode")
- signatureStr, _ := generateHMACSHA1SignatureOne(maprequest, serviceKye, serviceCode)
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- }
- fmt.Println("请求参数", request)
- fmt.Println("Content-Signature", signatureStr)
-
- request.Header.Set("appId", appId)
- request.Header.Set("appKey", serviceKye)
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("Content-Signature", signatureStr)
- client := http.Client{}
-
- resp, err := client.Do(request)
-
- if err != nil {
- fmt.Println(err.Error())
-
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
-
- }
- str := string(respBytes)
-
- var respJSON map[string]interface{}
- if err := json.Unmarshal([]byte(string(respBytes)), &respJSON); err != nil {
- utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- }
-
- return str
- }
-
- func GetLastAdminUserName(doctor, orgid int64) string {
- var tmp models.VmUserAdminRole
- XTReadDB().Model(&models.VmUserAdminRole{}).Where("admin_user_id = ? and org_id = ? and status = 1", doctor, orgid).Last(&tmp)
- return tmp.UserName
- }
-
- func GetLastAdminUserIdCardNumber(doctor, orgid int64) string {
- var tmp models.VmUserAdminRole
- XTReadDB().Model(&models.VmUserAdminRole{}).Where("admin_user_id = ? and org_id = ? and status = 1", doctor, orgid).Last(&tmp)
- return tmp.JobNumber
- }
-
- func CreateEnterpriseUserName(enterprise models.XtDevicePersonEnterprise) error {
-
- err := XTWriteDB().Create(&enterprise).Error
-
- return err
- }
-
- func UpdatePersionEnterPrise(id int64, userId string) error {
-
- err := XTWriteDB().Model(&models.XtDevicePersonEnterprise{}).Where("id=? and status =1", id).Updates(map[string]interface{}{"user_id": userId}).Error
- return err
- }
-
- func SingleImg2Pdf(pathStr string) {
- //pdf := gofpdf.New("P", "mm", "A4", "")
- //pdf.AddPage()
- //pdf.SetFont("Arial", "", 11)
- //pdf.Image(pathStr, 10, 10, pdf.GetPageSizeStr("A4").Wd-20, 0, false, "", 0, "")
- //// pdf.Text(50, 20, "logo.png")
- //fileNameAll := path.Base(pathStr)
- //fileSuffix := path.Ext(pathStr)
- //fileStr := fmt.Sprintf("./pdfs/%s.pdf", fileNameAll[0:len(fileNameAll)-len(fileSuffix)])
- //err := pdf.OutputFileAndClose(fileStr)
- //fmt.Println(err)
- }
-
- func GetAllPatientNew(org_id int64) (new []*models.XtPatients, err error) {
-
- err = XTReadDB().Where("user_org_id = ? and status=1", org_id).Find(&new).Error
- return new, err
- }
-
- func UpdatePatientNew(id int64, firstleterr string) error {
-
- err := XTWriteDB().Model(models.XtPatients{}).Where("id = ? and status=1", id).Updates(map[string]interface{}{"first_letter": firstleterr}).Error
- return err
- }
-
- func GeteAllBaseList(user_org_id int64) (list []*models.BaseDrugLib, err error) {
-
- err = XTWriteDB().Model(&list).Where("org_id = ? and status =1", user_org_id).Find(&list).Error
- return list, err
- }
-
- func UpdateBaseList(id int64, firstleterr string) error {
-
- err := XTWriteDB().Model(&models.BaseDrugLib{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"first_letter": firstleterr}).Error
- return err
- }
-
- func GetAutoDrugList(user_org_id int64) (advice []*models.HisDoctorAdviceInfo, err error) {
-
- err = XTReadDB().Where("user_org_id =? and status =1 and advice_date = 1700582400 and drug_id =239", user_org_id).Find(&advice).Error
-
- return advice, err
- }
-
- func GetDrugAutoWarehouseOutList(patient_id int64, user_org_id int64, drug_id int64, advice_date int64) (models.DrugWarehouseOutInfo, error) {
-
- info := models.DrugWarehouseOutInfo{}
-
- err2 := XTReadDB().Where("patient_id = ? and org_id = ? and drug_id = ? and sys_record_time =? and status=1", patient_id, user_org_id, drug_id, advice_date).Find(&info).Error
-
- return info, err2
- }
-
- func UpdateSchPatient(patient_id int64, schedule_date int64, user_org_id int64, DialysisMachineName string) error {
-
- err := XTWriteDB().Model(&models.XtSchedule{}).Where("patient_id =? and schedule_date =? and user_org_id =?", patient_id, schedule_date, user_org_id).Updates(map[string]interface{}{"dialysis_machine_name": DialysisMachineName}).Error
- return err
- }
-
- func GetNewAllpatient(org_id int64) (list []*models.XtPatientsNew, err error) {
-
- err = XTReadDB().Where("status =1 and user_org_id =?", org_id).Find(&list).Error
-
- return list, err
- }
-
- func UpdateAllPatient(id int64, diagose string, orgid int64) error {
-
- err := XTWriteDB().Model(models.XtPatients{}).Where("id = ? and user_org_id = ?", id, orgid).Updates(map[string]interface{}{"diagnose": diagose}).Error
- return err
- }
-
- func GetAllDialysisOrderTwo(user_org_id int64) (list []*models.XtDialysisOrder, err error) {
-
- err = XTReadDB().Where("user_org_id = ? and status =1 and dialysis_date=1730736000", user_org_id).Find(&list).Error
-
- return list, err
- }
-
- func GetAllDialysisPrescription(patient_id int64) (list []*models.XtDialysisPrescription, err error) {
-
- err = XTReadDB().Where("patient_id = ? and status=1", patient_id).Find(&list).Error
-
- return list, err
- }
-
- func GetPatientLapseList() (list []*models.XtPatients, err error) {
-
- err = XTReadDB().Where("(lapseto =2 or lapseto =3) and status=1 and user_org_id !=10503 and user_org_id !=10447").Find(&list).Error
-
- return list, err
- }
-
- func GetHisDoctorAdviceNoCheck(user_org_id int64) (advice []*models.HisDoctorAdviceInfo, err error) {
-
- err = XTReadDB().Where("user_org_id = ? and status=1 and checker = 0", user_org_id).Find(&advice).Error
-
- return advice, err
- }
-
- func UpdateHisAdvice(patient_id int64, advice_date int64, user_org_id int64, creater int64, check_date int64) (models.HisDoctorAdviceInfo, error) {
-
- adviceInfo := models.HisDoctorAdviceInfo{}
-
- err := XTWriteDB().Model(&adviceInfo).Where("patient_id = ? and advice_date = ? and user_org_id = ? and status=1", patient_id, advice_date, user_org_id).Updates(map[string]interface{}{"checker": creater, "check_state": 1, "check_time": check_date}).Error
-
- return adviceInfo, err
- }
-
- func GetPatientScheduleListByItem(patient_id int64) (list []*models.XtSchedule, err error) {
-
- err = XTReadDB().Where("patient_id = ? and status=1", patient_id).Find(&list).Error
-
- return list, err
-
- }
-
- func UpdateSchedulePrescrition(patient_id int64, record_date int64, user_org_id int64, mode_id int64) (models.XtSchedule, error) {
-
- schedule := models.XtSchedule{}
-
- err := XTWriteDB().Model(&schedule).Where("patient_id = ? and schedule_date = ? and status=1 and user_org_id =?", patient_id, record_date, user_org_id).Updates(map[string]interface{}{"mode_id": mode_id}).Error
-
- return schedule, err
- }
-
- func GetAllDialysisOrder(patient_id int64, start_time int64, end_time int64) (list []*models.XtDialysisOrder, err error) {
-
- err = XTReadDB().Where("patient_id = ? and status =1 and dialysis_date>=1199116800 and dialysis_date<=?", patient_id, end_time).Find(&list).Error
-
- return list, err
- }
-
- func GetLastScheduleByUserOrg(patient_id int64, schedule_date int64, user_org_id int64, bed_id int64, zone_id int64, shcedule_type int64) (models.Schedule, error) {
-
- schedule := models.Schedule{}
- err := XTReadDB().Where("patient_id = ? and schedule_date = ?", patient_id, schedule_date).First(&schedule).Error
-
- return schedule, err
- }
-
- func UpdateScheduleByOrder(patient_id int64, schedule_date int64, user_org_id int64, bed_id int64, zone_id int64, shcedule_type int64, id int64, mode_id int64) error {
-
- err := XTWriteDB().Model(&models.XtSchedule{}).Where("id = ?", id).Updates(map[string]interface{}{"bed_id": bed_id, "partition_id": zone_id, "schedule_type": shcedule_type, "status": 1, "mode_id": mode_id}).Error
- return err
- }
-
- func GetScheduleListByOrder(user_org_id int64) (list []*models.XtSchedule, err error) {
-
- err = XTReadDB().Where("user_org_id = ? and schedule_date >=? and status =1 and schedule_date<=?", 10579, 1703260800, 1703347200).Find(&list).Error
- return list, err
- }
-
- func GetDialysisSoluton(patient_id int64, mode_id int64) (models.DialysisSolution, error) {
-
- solution := models.DialysisSolution{}
- err := XTReadDB().Where("patient_id =? and mode_id =? and status =1 and solution_status = 1", patient_id, mode_id).Find(&solution).Error
- return solution, err
- }
-
- func UpdateDialysisSchedule(id int64, dialysis_machine_name string) error {
-
- err := XTWriteDB().Model(models.XtSchedule{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"dialysis_machine_name": dialysis_machine_name}).Error
- return err
- }
-
- func GetPrescriptionListOne(user_org_id int64) (prescription []*models.DialysisPrescription, err error) {
-
- err = XTReadDB().Model(&prescription).Where("user_org_id = ? and status= 1 and record_date =? and status=1", 10579, 1701360000).Find(&prescription).Error
- return prescription, err
- }
-
- func GetPatientScheduleById(patient_id int64, schedule_date int64) (models.XtSchedule, error) {
-
- schedule := models.XtSchedule{}
-
- err := XTReadDB().Where("patient_id= ? and schedule_date = ? and status =1 and user_org_id =10579", patient_id, schedule_date).First(&schedule).Error
-
- return schedule, err
- }
-
- func UpdateDialysisScheduleOne(id int64, mode_id int64, dialysis_machine_name string) error {
-
- err := XTWriteDB().Model(models.XtSchedule{}).Where("id = ? and status =1", id).Updates(map[string]interface{}{"dialysis_machine_name": dialysis_machine_name, "mode_id": mode_id}).Error
- return err
- }
-
- func GetDialysisOrderTotalCount() (order []*models.XtDialysisOrderLost, err error) {
-
- err = XTReadDB().Select("patient_id,Count(id) as count").Where("user_org_id = ? and status =1", 10265).Group("patient_id").Find(&order).Error
-
- return order, err
- }
-
- func ModifyPatient(patient_id int64, count int64) (models.XtPatients, error) {
-
- patients := models.XtPatients{}
- err := XTReadDB().Model(&models.XtPatients{}).Where("id = ? and status =1", patient_id).Updates(map[string]interface{}{"total_dialysis": count}).Error
- return patients, err
- }
-
- func UpdateDrugWarehouseInfoByDrug(drug_id int64, reatial_price float64, user_org_id int64) (models.DrugWarehouseInfo, error) {
-
- drugWarehouseInfo := models.DrugWarehouseInfo{}
-
- err := XTWriteDB().Model(&drugWarehouseInfo).Where("drug_id = ? and org_id =?", drug_id, user_org_id).Updates(map[string]interface{}{"retail_price": reatial_price}).Error
-
- return drugWarehouseInfo, err
- }
-
- func UpdasteGoodWarehouseInfoByGood(good_id int64, packing_price float64, org_id int64) (models.WarehousingInfo, error) {
-
- info := models.WarehousingInfo{}
- err := XTWriteDB().Model(&models.WarehousingInfo{}).Where("good_id=? and org_id = ? and status =1", good_id, org_id).Updates(map[string]interface{}{"packing_price": packing_price}).Error
- return info, err
- }
-
- func UpdateHisDoctorAdviceOne(drug_id int64, retail_price float64, user_org_id int64) (models.HisDoctorAdvice, error) {
-
- advice := models.HisDoctorAdvice{}
-
- err := XTWriteDB().Model(&models.HisDoctorAdvice{}).Where("drug_id = ? and user_org_id = ? and status=1", drug_id, user_org_id).Updates(map[string]interface{}{"price": retail_price}).Error
- return advice, err
- }
-
- func GetWarehouseOutOrderList() (out []*models.WarehouseOut, err error) {
-
- err = XTReadDB().Where("status=1").Find(&out).Error
- return out, err
- }
-
- func UpdateWarehouseOutOrderInfo(id int64, warehouse_out_order_number string) error {
-
- err := XTWriteDB().Model(&models.WarehouseOutInfo{}).Where("warehouse_out_id = ? and status=1", id).Updates(map[string]interface{}{"warehouse_out_order_number": warehouse_out_order_number}).Error
- return err
- }
-
- func GetDialysisOrderListOne(patient_id int64) (order []*models.DialysisOrder, err error) {
-
- err = XTReadDB().Where("patient_id = ? and status=1 and user_org_id =10495", patient_id).Find(&order).Error
-
- return order, err
- }
-
- func UpdateSchedulePatient(patient_id int64, schedule_date int64, zone_id int64, bed_id int64) error {
-
- err := XTWriteDB().Model(&models.XtSchedule{}).Where("patient_id = ? and schedule_date =? and partition_id = ? and bed_id =?", patient_id, schedule_date, zone_id, bed_id).Updates(map[string]interface{}{"status": 1}).Error
- return err
- }
-
- func GetDialysisOrderByUserOrgId() (order []*models.XtDialysisOrder, err error) {
-
- err = XTReadDB().Where("status=1").Group("user_org_id").Find(&order).Error
-
- return order, err
- }
-
- func GetFieldConfigGroupList(module int64) (filedConfig []*models.FiledConfig, err error) {
-
- err = XTReadDB().Where("module = ?", module).Group("filed_name").Order("filed_name_cn asc").Find(&filedConfig).Error
-
- return filedConfig, err
- }
-
- func GetFieldConfigByOrgId(org_id int64, field_name_cn string, module int64) (fiedConfig models.FiledConfig, err error) {
-
- err = XTReadDB().Where("org_id = ? and filed_name_cn = ? and module =?", org_id, field_name_cn, module).Find(&fiedConfig).Error
-
- return fiedConfig, err
- }
-
- func CretedConfig(config models.FiledConfig) error {
-
- err := XTWriteDB().Create(&config).Error
-
- return err
- }
-
- func GetFieldConfigList(user_org_id int64) (filedConfig []*models.FiledConfig, err error) {
-
- err = XTReadDB().Where("org_id =?", user_org_id).Find(&filedConfig).Error
-
- return filedConfig, err
-
- }
-
- func GetAllCheckQuery() (query []*models.XtDrugQuery, err error) {
-
- err = XTReadDB().Where("status=1").Find(&query).Error
-
- return query, err
- }
-
- func GetAllDoctorAdviceQueryList(user_org_id int64, advice_date int64) (advice []*models.HisDoctorAdvice, err error) {
-
- err = XTReadDB().Where("user_org_id = ? and advice_date = ? and status=1", user_org_id, advice_date).Find(&advice).Error
-
- return advice, err
- }
-
- func GetDrugListById(drug_id int64, advice_date int64, patient_id int64) (advice []*models.HisDoctorAdvice, err error) {
-
- err = XTReadDB().Where("drug_id = ? and status =1 and advice_date = ? and patient_id =?", drug_id, advice_date, patient_id).Find(&advice).Error
-
- return advice, err
- }
-
- func GetDrugWarehouseOutQueryListById(drug_id int64, sys_record_date int64, patient_id int64) (outinfo []*models.DrugWarehouseOutInfo, err error) {
-
- err = XTReadDB().Where("drug_id = ? and sys_record_time = ? and status =1 and patient_id = ?", drug_id, sys_record_date, patient_id).Find(&outinfo).Error
-
- return outinfo, err
- }
-
- func CreateCheckQuery(query models.XtDrugCheckQuery) error {
-
- err := XTWriteDB().Create(&query).Error
-
- return err
- }
-
- func GetAllPrescriptionProjectList(user_org_id int64, record_date int64) (project []*models.HisPrescriptionProject, err error) {
-
- err = XTReadDB().Where("user_org_id = ? and record_date = ? and status =1 and type =3", user_org_id, record_date).Find(&project).Error
-
- return project, err
- }
-
- func GetProjectListByPatient(patient_id int64, project_id int64, record_date int64) (project []*models.HisPrescriptionProject, err error) {
-
- err = XTReadDB().Where("patient_id =? and project_id = ? and record_date =?", patient_id, project_id, record_date).Find(&project).Error
-
- return project, err
- }
-
- func GetWarehosueOutQueryList(patient_id int64, project_id int64, record_date int64) (out []*models.WarehouseOutInfo, err error) {
-
- err = XTReadDB().Where("patient_id = ? and good_id = ? and sys_record_time = ? and status=1", patient_id, project_id, record_date).Find(&out).Error
- return out, err
- }
-
- func CreteStockCheckQuery(query models.XtStockCheckQuery) error {
-
- err := XTWriteDB().Create(&query).Error
-
- return err
- }
|