123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671 |
- package controllers
-
- import (
- "encoding/base64"
- "encoding/json"
- "fmt"
- "io/ioutil"
- "strconv"
- "time"
-
- "XT_New/models"
- "XT_New/service"
- "XT_New/utils"
- "github.com/astaxie/beego"
- )
-
- type SignApiController struct {
- BaseAuthAPIController
- }
-
- func SignApiRegistRouters() {
-
- //获取短信验证码
- beego.Router("/api/sign/getsign", &SignApiController{}, "Get:GetSign")
-
- //创建个人用户并实名
- beego.Router("/api/sign/createrusername", &SignApiController{}, "Get:CreateUserName")
-
- //创建企业用户并实名
- beego.Router("/api/sign/createenterpriserealname", &SignApiController{}, "Get:CreateEnterPriseRealName")
-
- //添加企业成员
- beego.Router("/api/sign/createuserid", &SignApiController{}, "Get:CreateUserId")
-
- //创建个人印章
- beego.Router("/api/sign/createpersionseal", &SignApiController{}, "Get:CreatePersionSeal")
-
- //上传文件创建创建合同
- beego.Router("/api/sign/createuploadpact", &SignApiController{}, "Get:CreateUploadPact")
-
- //添加合同签署人
- beego.Router("/api/sign/addcontractsignatory", &SignApiController{}, "Get:AddContractSignatory")
-
- //获取短信验证
- beego.Router("/api/sign/getverificationcode", &SignApiController{}, "Get:GetVerificationCode")
-
- //后台签署(返回签署文件)
- beego.Router("/api/sign/createbackstagesign", &SignApiController{}, "Get:CreateBackStageSign")
-
- //署意愿认证-短信验证
- beego.Router("/api/sign/totestelment", &SignApiController{}, "Get:CreateEnterprise")
-
- //测试PDF
- beego.Router("/api/sign/totestthrityment", &SignApiController{}, "Get:GetTestThrityMent")
-
- //CA企业认证
- beego.Router("/api/sign/saveenerprise", &SignApiController{}, "Post:SaveEnerprise")
-
- //
- beego.Router("/api/sign/getenerprisebyid", &SignApiController{}, "Get:GetEnerPriseById")
-
- beego.Router("/api/sign/getmobilecode", &SignApiController{}, "Get:GetMobileCode")
-
- beego.Router("/api/sign/getpersionenterprise", &SignApiController{}, "Post:GetPersionEnterPrise")
-
- beego.Router("/api/sign/getpersenterprisebyid", &SignApiController{}, "Get:GetPerseEnterPriseById")
-
- beego.Router("/api/device/sign/creterpersionseal", &SignApiController{}, "Get:CreateNewPersionSeal")
-
- beego.Router("/api/device/sign/createnewenterprise", &SignApiController{}, "Get:CreateNewEnterPrise")
-
- beego.Router("/api/device/contractid", &SignApiController{}, "Get:GetContractId")
-
- beego.Router("/api/device/endenterprise", &SignApiController{}, "Get:EndEnterPrise")
-
- beego.Router("/api/device/getenterprisedetail", &SignApiController{}, "Get:GetEnterPriseDetail")
-
- beego.Router("/api/device/uploadprintorder", &SignApiController{}, "Post:UploadPrintOrder")
-
- //sdk 版本
- beego.Router("/api/device/createqianshuusername", &SignApiController{}, "Post:CreateQianshuUserName")
-
- //发送消息
- beego.Router("/api/device/createskdsendinformation", &SignApiController{}, "Post:CreateSdkSendInformation")
-
- //删除
- beego.Router("/api/device/tosavepdfinformation", &SignApiController{}, "Get:SavePdfInformation")
-
- beego.Router("/api/device/tocheckinformation", &SignApiController{}, "Get:ToCheckInformation")
-
- beego.Router("/api/device/toautodrug", &SignApiController{}, "Get:ToAutoDrug")
-
- beego.Router("/api/device/toautodiagnose", &SignApiController{}, "Get:ToAutoDiagnose")
-
- //加油
- beego.Router("/api/device/toautojiayou", &SignApiController{}, "Get:ToAutoJiaYou")
-
- //显示字段脚本
- beego.Router("/api/device/getfieldconfiglist", &SignApiController{}, "Get:GetFieldConfigList")
-
- beego.Router("/api/device/tocheckquery", &SignApiController{}, "Get:ToCheckQuery")
-
- }
-
- // 短信服务接口
- func (this *SignApiController) GetSign() {
-
- phone := this.GetString("phone")
- fmt.Println("phone", phone)
- var tempphone string
- tempphone = "13318464642"
- sign := service.GetSignNameByPhone(tempphone)
- this.ServeSuccessJSON(map[string]interface{}{
- "sign": sign,
- })
- return
-
- }
-
- type Result2121 struct {
- Phone string `json:"phone"`
- DisPlayName string `json:"dis_play_name"`
- Authentication string `json:"authentication"`
- TwAuthReq struct {
- OneLineAuth string `json:"oneLineAuth"`
- ApiAuthReq struct {
- RealName float64 `json:"real_name"`
- IdCardType string `json:"id_card_type"`
- IdCardNum string `json:"id_card_num"`
- BankCard string `json:"bank_card"`
- CodeNumber string `json:"code_number"`
- VerifyCode string `json:"verify_code"`
- } `json:"apiAuthReq"`
- } `json:"twAuthReq"`
- }
-
- type MapData struct {
- dat struct {
- Code float64 `json:"code"`
- data struct {
- userId string `json:"userId"`
- }
- }
- }
-
- // 创建个人用户并实名
- func (this *SignApiController) CreateUserName() {
-
- phone := this.GetString("phone")
- disPlayName := this.GetString("disPlayName")
-
- sign, userId := service.CreateUserName(phone, disPlayName)
-
- var dat map[string]interface{}
-
- if err := json.Unmarshal([]byte(sign), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "sign": sign,
- "dat": dat,
- "userId": userId,
- })
- return
- }
-
- // 创建个人印章
- func (this *SignApiController) CreatePersionSeal() {
-
- user_id := this.GetString("user_id")
- person_seal_type, _ := this.GetInt64("person_seal_type")
- person_seal_name := this.GetString("person_seal_name")
- person_seal_base := this.GetString("person_seal_base")
- color, _ := this.GetInt64("color")
- alpha, _ := this.GetInt64("alpha")
- width, _ := this.GetInt64("width")
- height, _ := this.GetInt64("height")
- border, _ := this.GetInt64("border")
- font_type, _ := this.GetInt64("font_type")
-
- sign, personSealId := service.CreatePersionSeal(user_id, person_seal_type, person_seal_name, person_seal_base, color, alpha, width, height, border, font_type)
- var dat map[string]interface{}
- if err := json.Unmarshal([]byte(sign), &dat); err == nil {
- fmt.Println(dat)
- } else {
- fmt.Println(err)
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "sign": sign,
- "dat": dat,
- "personSealId": personSealId,
- })
- return
-
- }
-
- func (this *SignApiController) CreateUploadPact() {
-
- contractcode := this.GetString("contractcode")
-
- contractname := this.GetString("contractname")
-
- signcount, _ := this.GetInt64("signcount")
-
- docname := this.GetString("docname")
-
- contractbase := this.GetString("contractbase")
-
- creator := this.GetString("creator")
-
- enterpriseid := this.GetString("enterpriseid")
-
- signvalidays, _ := this.GetInt64("signvalidays")
-
- sysncurl := this.GetString("sysncurl")
-
- asyncurl := this.GetString("asyncurl")
-
- sign := service.CreateUploadPact(contractcode, contractname, signcount, docname, contractbase, creator, enterpriseid, signvalidays, sysncurl, asyncurl)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "sign": sign,
- })
- return
- }
-
- // 添加企业成员
- func (this *SignApiController) CreateUserId() {
-
- userId := this.GetString("userId")
- displayName := this.GetString("displayName")
-
- sign := service.CreateUserId(userId, displayName)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "sign": sign,
- })
- return
-
- }
-
- func (this *SignApiController) CreateEnterPriseRealName() {
-
- enterprisename := this.GetString("enterprisename")
-
- sign := service.CreateEnterPriseRealName(enterprisename)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "sign": sign,
- })
- return
- }
-
- // 添加合同签署人
- func (this *SignApiController) AddContractSignatory() {
-
- contractId := this.GetString("contractId")
-
- signers := this.GetString("signers")
-
- var newContract models.NewContract
-
- newContract.ContractId = "156001444267295949"
-
- sign := service.AddContractSignatory(contractId, signers, newContract)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "sign": sign,
- })
- return
-
- }
-
- type Struct2401 struct {
- someTimestampStyle []someTimestampStyle
- }
-
- type someTimestampStyle struct {
- ControlsKey string
- Pattern string
- Color string
- }
-
- func (this *SignApiController) CreateBackStageSign() {
-
- contractId := this.GetString("contractId")
-
- signers := this.GetString("signers")
- sign := service.CreateBackStageSign(contractId, signers)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "sign": sign,
- })
- return
- }
-
- func (this *SignApiController) GetVerificationCode() {
-
- sign := service.GetVerificationCode()
- this.ServeSuccessJSON(map[string]interface{}{
- "sign": sign,
- })
- return
- }
-
- func (this *SignApiController) CreateEnterprise() {
-
- sign := service.CreateEnterprise()
- this.ServeSuccessJSON(map[string]interface{}{
- "sign": sign,
- })
- return
- }
-
- func (this *SignApiController) GetTestThrityMent() {
-
- //pdf := gofpdf.New("P", "mm", "A4", "")
- //pdf.AddPage()
- //pdf.SetFont("Arial", "B", 16)
- //pdf.Cell(40, 10, "Hello, World!")
- //pdf.OutputFileAndClose("output.pdf")
- //
- //this.ServeSuccessJSON(map[string]interface{}{
- // "sign": "msg",
- //})
- //return
- }
-
- func loremList() []string {
- return []string{
- "我爱你中国" +
- "tempor incididunt ut labore et dolore magna aliqua.",
- "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut " +
- "aliquip ex ea commodo consequat.",
- "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum " +
- "dolore eu fugiat nulla pariatur.",
- "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui " +
- "officia deserunt mollit anim id est laborum.",
- }
- }
-
- func (this *SignApiController) SaveEnerprise() {
-
- orgId := this.GetAdminUserInfo().CurrentOrgId
-
- creater := this.GetAdminUserInfo().AdminUser.Id
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- fmt.Println("err", err)
-
- id := int64(dataBody["id"].(float64))
- org_type := int64(dataBody["org_type"].(float64))
-
- enterprise_name := dataBody["enterprise_name"].(string)
-
- code := dataBody["code"].(string)
-
- org_code := dataBody["org_code"].(string)
-
- legal_person_name := dataBody["legal_person_name"].(string)
-
- legal_id_card_num := dataBody["legal_id_card_num"].(string)
-
- legal_phone := dataBody["legal_phone"].(string)
-
- enterprise := models.XtDeviceEnterprise{
- ID: id,
- UserOrgId: orgId,
- OrgType: org_type,
- EnterpriseName: enterprise_name,
- Code: code,
- OrgCode: org_code,
- LegalPersonName: legal_person_name,
- LegalIdCardNum: legal_id_card_num,
- LegalPhone: legal_phone,
- Creater: creater,
- Ctime: time.Now().Unix(),
- Mtime: 0,
- Enterpriseid: "",
- Status: 1,
- }
- service.SaveEnerPrise(enterprise)
-
- //查找该机构有没有认证信息
- lastenterprise, _ := service.GetEnterPriseByUserOrgId(orgId)
-
- //调用企业认证接口
- if lastenterprise.ID > 0 {
- enterPrise, enterpriseid := service.CreateNewEnterPriseRealName(lastenterprise)
- fmt.Println("enterprise2ooo2oo2o2o2o", enterPrise)
- updateEnterprise := models.XtDeviceEnterprise{
- ID: enterprise.ID,
- UserOrgId: orgId,
- OrgType: org_type,
- EnterpriseName: enterprise_name,
- Code: code,
- OrgCode: org_code,
- LegalPersonName: legal_person_name,
- LegalIdCardNum: legal_id_card_num,
- LegalPhone: legal_phone,
- Creater: creater,
- Ctime: time.Now().Unix(),
- Mtime: 0,
- Enterpriseid: enterpriseid,
- Status: 1,
- }
- service.SaveEnerPrise(updateEnterprise)
- this.ServeSuccessJSON(map[string]interface{}{
- "enterPrise": enterPrise,
- })
- return
- }
- }
-
- func (this *SignApiController) GetEnerPriseById() {
-
- orgId := this.GetAdminUserInfo().CurrentOrgId
-
- enterPrise, _ := service.GetEnterPriseByUserOrgId(orgId)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "enterPrise": enterPrise,
- })
- return
- }
-
- func (this *SignApiController) GetMobileCode() {
-
- phone := this.GetString("phone")
-
- sign, orderNumber := service.GetNewSignNameByPhone(phone)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "sign": sign,
- "orderNumber": orderNumber,
- })
- return
- }
-
- func (this *SignApiController) GetPersionEnterPrise() {
-
- orgId := this.GetAdminUserInfo().CurrentOrgId
-
- creater := this.GetAdminUserInfo().AdminUser.Id
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- fmt.Println("err", err)
-
- id := int64(dataBody["id"].(float64))
- admin_user_id := int64(dataBody["admin_user_id"].(float64))
-
- code := dataBody["code"].(string)
-
- display_name := dataBody["display_name"].(string)
-
- id_card_num := dataBody["id_card_num"].(string)
-
- phone := dataBody["phone"].(string)
-
- enterprise := models.XtDevicePersonEnterprise{
- ID: id,
- AdminUserId: admin_user_id,
- DisplayName: display_name,
- Phone: phone,
- IdCardNum: id_card_num,
- UserOrgId: orgId,
- Status: 1,
- Creater: creater,
- Ctime: time.Now().Unix(),
- Mtime: 0,
- UserId: "",
- }
-
- service.SavePersonEnterPrise(enterprise)
-
- lastEnterPrise, _ := service.GetLastPersonEnterPrise(admin_user_id, orgId)
-
- _, orderNumber := service.GetNewSignNameByPhone(phone)
-
- personEnterPrse, UserId := service.CreateNewUserName(lastEnterPrise.Phone, lastEnterPrise.DisplayName, code, orderNumber, lastEnterPrise.IdCardNum)
-
- firstenterprise := models.XtDevicePersonEnterprise{
- ID: id,
- AdminUserId: admin_user_id,
- DisplayName: display_name,
- Phone: phone,
- IdCardNum: id_card_num,
- UserOrgId: orgId,
- Status: 1,
- Creater: creater,
- Ctime: time.Now().Unix(),
- Mtime: 0,
- UserId: UserId,
- }
-
- service.SavePersonEnterPrise(firstenterprise)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "personEnterPrse": personEnterPrse,
- })
- return
- }
-
- func (this *SignApiController) GetPerseEnterPriseById() {
-
- orgId := this.GetAdminUserInfo().CurrentOrgId
-
- admin_user_id, _ := this.GetInt64("admin_user_id")
-
- lastPerson, _ := service.GetLastPersonEnterPrise(admin_user_id, orgId)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "lastPerson": lastPerson,
- })
- return
- }
-
- func (this *SignApiController) CreateNewPersionSeal() {
-
- orgId := this.GetAdminUserInfo().CurrentOrgId
-
- admin_user_id, _ := this.GetInt64("admin_user_id")
-
- creater := this.GetAdminUserInfo().AdminUser.Id
-
- userName := service.GetLastAdminUserName(admin_user_id, orgId)
- //查询医护是否完成认证
- lastPerson, _ := service.GetLastPersonEnterPrise(admin_user_id, orgId)
-
- if lastPerson.ID > 0 {
- this.ServeDynamicFailJsonSend("已完成认证,无需再次认证")
- return
- }
-
- if lastPerson.ID == 0 {
- //去认证
- personSeal, sealBase64 := service.CreateSKDPersionSeal(lastPerson.UserId, userName)
-
- fmt.Println("sealBase64", sealBase64)
- enterprise := models.XtDevicePersonEnterprise{
- AdminUserId: admin_user_id,
- DisplayName: "",
- Phone: "",
- IdCardNum: "",
- UserOrgId: orgId,
- Status: 1,
- Creater: creater,
- Ctime: time.Now().Unix(),
- Mtime: 0,
- UserId: "",
- Personsealid: "",
- Sealid: "",
- UserName: userName,
- Sealbase64: sealBase64,
- }
- service.CreateEnterpriseUserName(enterprise)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "personSeal": personSeal,
- })
- return
- }
-
- }
-
- func (this *SignApiController) CreateNewEnterPrise() {
-
- //orgId := this.GetAdminUserInfo().CurrentOrgId
- //
- //admin_user_id, _ := this.GetInt64("admin_user_id")
- //
- //enterPrise, _ := service.GetEnterPriseByUserOrgId(orgId)
- //fmt.Println("地址日活", enterPrise.Enterpriseid)
- //lastPerson, _ := service.GetLastPersonEnterPrise(admin_user_id, orgId)
- //
- //newEnterPrise, sealId := service.CreateNewEnterPrise(enterPrise.Enterpriseid, lastPerson.UserId)
- //
- //fmt.Println("newEnterPrise",newEnterPrise)
- //service.UpdatePersonEnterPrise(lastPerson.ID, sealId)
-
- newEnterPrise, _ := service.CreateSDKEnterPrise()
-
- //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, _ := service.GenerateHMACSHA1SignatureTwo(maprequest, serviceKye, serviceCode)
- //fmt.Println("signatureStr", signatureStr)
- //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)
- //
- //var respJSON map[string]interface{}
- //if err := json.Unmarshal([]byte(string(respBytes)), &respJSON); err != nil {
- // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
- //}
-
- this.ServeSuccessJSON(map[string]interface{}{
- "newEnterPrise": newEnterPrise,
- })
- return
-
- }
-
- func (this *SignApiController) GetContractId() {
-
- sign := service.GetContractId()
- this.ServeSuccessJSON(map[string]interface{}{
- "sign": sign,
- })
- return
- }
-
- func (this *SignApiController) EndEnterPrise() {
-
- sign := service.EndEnterPrise()
-
- this.ServeSuccessJSON(map[string]interface{}{
- "sign": sign,
- })
- return
- }
-
- func (this *SignApiController) GetEnterPriseDetail() {
-
- sign, url := service.GetEnterPriseDetail()
- this.ServeSuccessJSON(map[string]interface{}{
- "sign": sign,
- "url": url,
- })
- return
- }
-
- func (this *SignApiController) UploadPrintOrder() {
-
- orderList, _ := service.GetDialysisOrderListOne(21741)
-
- for _, item := range orderList {
- service.UpdateSchedulePatient(item.PatientId, item.DialysisDate, item.ZoneId, item.BedID)
- }
-
- //list, _ := service.GetAllPatientNew(10375)
- //for _, item := range list {
- //
- // hans := item.Name // 要转换的汉字字符串
- // // 创建一个拼音转换器
- // p := pinyin.NewArgs()
- //
- // // 将汉字转为拼音
- // pinyinSlice := pinyin.Pinyin(hans, p)
- //
- // // 输出拼音
- // fmt.Println("Pinyin:", pinyinSlice)
- //
- // // 获取首字母
- // firstLetter := ""
- // for _, py := range pinyinSlice {
- // if len(py) > 0 {
- // firstLetter += string(py[0][0])
- // }
- // }
- //
- // item.FirstLetter = firstLetter
- // service.UpdatePatientNew(item.ID, item.FirstLetter)
- // // 输出首字母
- // //fmt.Println("First Letter:", firstLetter)
- //}
-
- //baseList, _ := service.GeteAllBaseList(10375)
- //for _, item := range baseList {
- // hans := item.DrugName // 要转换的汉字字符串
- // // 创建一个拼音转换器
- // p := pinyin.NewArgs()
- // // 将汉字转为拼音
- // pinyinSlice := pinyin.Pinyin(hans, p)
- // // 获取首字母
- // firstLetter := ""
- // for _, py := range pinyinSlice {
- // if len(py) > 0 {
- // firstLetter += string(py[0][0])
- // }
- // }
- // item.FirstLetter = firstLetter
- // service.UpdateBaseList(item.ID, item.FirstLetter)
- //}
- //pdf := gofpdf.New("P", "mm", "A4", "")
- //pdf.AddPage()
- //pdf.Text(5, 10, "血液净化治疗记录单")
- //
- //pdf.AddUTF8Font("simfang", "", "D:/go/src/pkg/mod/github.com/jung-kurt/gofpdf@v1.16.2/font/simfang.ttf")
- //pdf.SetFont("simfang", "", 20)
- //var title = "血液透析(滤过)记录表单"
- ////表格居中显示
- //pdf.Text(70, 10, title)
- //wd := pdf.GetStringWidth(title) + 100
- //fmt.Println("wd", wd)
- //pdf.SetY(100) //先要设置 Y,然后再设置 X。否则,会导致 X 失效
- //pdf.SetX((210 - wd) / 2) //水平居中的算法
- //var numuber = "张三"
- ////表格居中显示
- //pdf.SetFont("", "", 14) // 设置加粗字体和字号
- //pdf.Text(10, 20, "姓名:"+numuber)
- //pdf.SetFont("", "", 14) // 设置加粗字体和字号
- //pdf.Text(35, 20, "性别:"+"男")
- //pdf.SetFont("", "", 14) // 设置正常字体和字号
- //pdf.Text(60, 20, "年龄:"+"18")
- //pdf.SetFont("", "", 14) // 设置正常字体和字号
- //pdf.Text(90, 20, "门诊:"+"住院")
- //pdf.SetFont("", "", 14) // 设置正常字体和字号
- //pdf.Text(120, 20, "病区:"+"A区")
- //pdf.SetFont("", "", 14) // 设置正常字体和字号
- //pdf.Text(150, 20, "床号:"+"1号")
- //pdf.SetFont("", "", 14) // 设置正常字体和字号
- //pdf.Text(180, 20, "透析号:")
- //pdf.SetFont("", "", 14) // 设置正常字体和字号
- //pdf.Text(210, 20, "住院号/门诊号:")
- //pdf.SetFont("", "", 14) // 设置正常字体和字号
- ////表格居中显示
- //pdf.SetFont("", "", 14) // 设置加粗字体和字号
- //pdf.Text(10, 30, "入科方式:"+numuber)
- //pdf.SetFont("", "", 14) // 设置加粗字体和字号
- //pdf.Text(60, 30, "诊断:")
- //
- //pdf.AddUTF8Font("simfang", "", "D:/go/src/pkg/mod/github.com/jung-kurt/gofpdf@v1.16.2/font/simfang.ttf")
- //pdf.SetFont("simfang", "", 16) // 设置字体、字号
- //pdf.SetFillColor(200, 200, 200)
- ////// 设置起始位置
- //var x = 10.0
- //var y = 40.0
- //pdf.SetXY(x, y)
- //// 设置填充颜色
- //pdf.CellFormat(200, 15, "透析前情况", "1", 0, "CM", false, 0, "") // 使用CellFormat()方法创建表格单元格
-
- //param1: 单元格的宽,为0时表示一行,单位根据new()里面设置的来
- //param2: 单元格的高,不能为0,单位根据new()里面设置的来
- //param3: 单元格内容
- //param4: 边框样式,一个空字符串表示无边框,“1”表示全边框,一个或多个“L”,“T”,“R”和“B”分别表示边界左,上,右,下
- //param5: 表示调用后当前位置的位置。可能的值为0,接着当前行继续,1换行,2目前没有试过
- //param6: 字体的位置,水平对齐包括"L", “C"或"R”(左,中,右)。垂直对齐由包含控制"T", “M”, “B"或"A”(上,中,下,基线),可以组合,比如说LT,CM等等
- //param7: 是否填充单元格,需要调用SetFillColor()方法.默认false
- //param8: 内部超链接,没用过
- //param9: 超链接,没用过
- //pdf.AddUTF8Font("simfang", "", "D:/go/src/pkg/mod/github.com/jung-kurt/gofpdf@v1.16.2/font/simfang.ttf")
- //pdf.SetFont("simfang", "", 8) // 设置字体、字号
- //pdf.SetFillColor(200, 200, 200) // 设置填充颜色
- //
- //// 设置起始位置
- //var x = 10.0
- //var y = 40.0
- ////创建8行2列的表格
- //
- //for j := 0; j < 1; j++ {
- // // 填充每个单元格的内容
- // pdf.SetXY(x, y) // 设置当前位置
- // pdf.CellFormat(20, 15, "时间", "1", 0, "CM", false, 0, "") // 使用CellFormat()方法创建表格单元格
- // pdf.CellFormat(20, 15, "血压(mmHg)", "1", 0, "CM", false, 0, "")
- // pdf.CellFormat(20, 15, "脉搏(次/分)", "1", 0, "CM", false, 0, "")
- // pdf.CellFormat(20, 15, "呼吸(次/分)", "1", 0, "CM", false, 0, "")
- // pdf.CellFormat(20, 15, "血流量(ml/min)", "1", 0, "CM", false, 0, "")
- // pdf.CellFormat(20, 15, "静脉压(mmHg)", "1", 0, "CM", false, 0, "")
- // pdf.CellFormat(20, 15, "跨膜压(mmHg)", "1", 0, "CM", false, 0, "")
- // pdf.CellFormat(20, 15, "透析液温(℃)", "1", 0, "CM", false, 0, "")
- // pdf.CellFormat(20, 15, "钠浓度(mmol/L)", "1", 0, "CM", false, 0, "")
- // pdf.CellFormat(20, 15, "超滤量(ml) ", "1", 0, "CM", false, 0, "")
- // pdf.CellFormat(35, 15, "病情变化及处理", "1", 0, "CM", false, 0, "")
- //
- // y += 15 // 下一行起始位置的y坐标增加60(单元格高度)
- //}
- //for j := 0; j < 1; j++ {
- // // 填充每个单元格的内容
- // pdf.SetXY(x, y) // 设置当前位置
- // pdf.CellFormat(20, 15, "13:57", "1", 0, "CM", false, 0, "") // 使用CellFormat()方法创建表格单元格
- // pdf.CellFormat(20, 15, "120/90", "1", 0, "CM", false, 0, "")
- // pdf.CellFormat(20, 15, "64", "1", 0, "CM", false, 0, "")
- // pdf.CellFormat(20, 15, "100", "1", 0, "CM", false, 0, "")
- // pdf.CellFormat(20, 15, "100", "1", 0, "CM", false, 0, "")
- // pdf.CellFormat(20, 15, "100", "1", 0, "CM", false, 0, "")
- // pdf.CellFormat(20, 15, "90", "1", 0, "CM", false, 0, "")
- // pdf.CellFormat(20, 15, "36.5", "1", 0, "CM", false, 0, "")
- // pdf.CellFormat(20, 15, "26", "1", 0, "CM", false, 0, "")
- // pdf.CellFormat(20, 15, "100", "1", 0, "CM", false, 0, "")
- // pdf.CellFormat(35, 15, "及时九嶷山", "1", 0, "CM", false, 0, "")
- //
- // y += 15 // 下一行起始位置的y坐标增加60(单元格高度)
- //}
- //x += 200.0 // 下一列起始位置的x坐标增加190(单元格宽度)
- //y = 10.0 // 行起始位置的y坐标重置为10
- //
- //pdf.Ln(2)
-
- //if err := pdf.OutputFileAndClose("6.pdf"); err != nil {
- // panic(err.Error())
- //}
-
- // 此处可以继续绘制表格的其他部分,例如内容行等。
- // ...
-
- // 保存PDF文档到文件
- //err := pdf.OutputFileAndClose("treatment_sheet_with_header.pdf")
- //if err != nil {
- // panic(err)
- //}
-
- this.ServeSuccessJSON(map[string]interface{}{
- //"sign": information,
- //"pdfBase64": pdfBase64,
- //"name": name,
-
- })
-
- }
-
- func (this *SignApiController) CreateQianshuUserName() {
-
- admin_user_id, _ := this.GetInt64("admin_user_id")
-
- orgId := this.GetAdminUserInfo().CurrentOrgId
- userName := service.GetLastAdminUserName(admin_user_id, orgId)
-
- idCardNumber := service.GetLastAdminUserIdCardNumber(admin_user_id, orgId)
-
- adminRole, _ := service.GetMobile(admin_user_id)
-
- //查询该医护人员是否已经签署了
- lastPerson, _ := service.GetLastPersonEnterPrise(admin_user_id, orgId)
-
- if len(lastPerson.UserId) > 0 {
- this.ServeDynamicFailJsonSend("已完成签署,无需再次签署")
- return
- }
-
- if len(lastPerson.UserId) == 0 {
- //去签署
- sign, userId := service.CreateQianshuUserName(userName, adminRole.Mobile, idCardNumber)
-
- err := service.UpdatePersionEnterPrise(lastPerson.ID, userId)
- fmt.Println(err)
- this.ServeSuccessJSON(map[string]interface{}{
- "sign": sign,
- "userId": userId,
- })
-
- }
-
- }
-
- func (this *SignApiController) CreateSdkSendInformation() {
-
- information, orderId := service.CreateSdkSendInformation()
-
- this.ServeSuccessJSON(map[string]interface{}{
- "information": information,
- "orderId": orderId,
- })
- }
-
- func (this *SignApiController) SavePdfInformation() {
-
- var name string
- information, pdfBase64 := service.SavePdfInformation(name)
- informationOne := service.ToCheckInformation(pdfBase64)
-
- maprequest := make(map[string]interface{})
-
- Receiver := make(map[string]interface{})
-
- //业务单号
- maprequest["orderId"] = "13318464642"
-
- maprequest["signTitle"] = "举报合同"
-
- //file := "C:/Users/28169/Desktop/2.pdf"
- file := "/swspan/gopath/src/XT_New/static/6.pdf"
-
- fileBytes, _ := ioutil.ReadFile(file) // 读取file
-
- contractBase64 := base64.StdEncoding.EncodeToString(fileBytes) // 加密成base64字符串
-
- //文件获取方式
- maprequest["fileType"] = 1
-
- maprequest["pdfBase64"] = contractBase64
- //合同内容
- maprequest["fileContent"] = contractBase64
-
- //签署用户人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"] = "100"
- inputArrOne["offsetY"] = "100"
-
- keywordSignControls = append(keywordSignControls, inputArrOne)
-
- //穿刺者样式
- //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)
- //
- //stepStamper["keywordSignControls"] = keywordSignControls
- //
- ////医生签名
- //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"] = "100"
- inputArrThree["positionY"] = "0"
- 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"] = "100"
- 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"
-
- this.ServeSuccessJSON(map[string]interface{}{
-
- "information": information,
- "orderId": pdfBase64,
- "informationOne": informationOne,
- "maprequest": maprequest,
- })
-
- }
-
- func (this *SignApiController) ToCheckInformation() {
-
- var name string
- information, pdfBase64 := service.SavePdfInformation(name)
- informationOne := service.ToCheckInformation(pdfBase64)
-
- this.ServeSuccessJSON(map[string]interface{}{
- "information": information,
- "informationOne": informationOne,
- })
- }
-
- func (this *SignApiController) ToAutoDrug() {
-
- //advice, _ := service.GetAutoDrugList(9919)
- //
- //for _, item := range advice {
- // //查找该患者是否出库过
- // outList, _ := service.GetDrugAutoWarehouseOutList(item.PatientId, item.UserOrgId, item.DrugId, item.AdviceDate)
- // if outList.ID == 0 {
- // service.HisDrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
- // }
- //}
-
- //prescriptionList, _ := service.GetAllPrescriptionList(10579)
-
- list, _ := service.GetScheduleListByOrder(10579)
-
- for _, item := range list {
- soluton, _ := service.GetDialysisSoluton(item.PatientId, item.ModeId)
- var DialysisMachineName string
- if len(soluton.DialysisDialyszers) > 0 {
- DialysisMachineName = soluton.DialysisDialyszers
- }
- //if len(soluton.DialyzerPerfusionApparatus) > 0 {
- // DialysisMachineName = DialysisMachineName + "," + soluton.DialyzerPerfusionApparatus
- //}
-
- if len(soluton.DialysisIrrigation) > 0 {
- DialysisMachineName = DialysisMachineName + "," + soluton.DialysisIrrigation
- }
-
- if len(soluton.DialysisStrainer) > 0 {
- DialysisMachineName = DialysisMachineName + "," + soluton.DialysisStrainer
- }
- DialysisMachineName = DialysisMachineName
-
- service.UpdateDialysisSchedule(item.ID, DialysisMachineName)
- }
-
- //for _, item := range prescriptionList {
- // var DialysisMachineName string
- // if len(item.DialysisDialyszers) > 0 {
- // DialysisMachineName = item.DialysisDialyszers
- // }
- // if len(item.DialyzerPerfusionApparatus) > 0 {
- // DialysisMachineName = DialysisMachineName + "," + item.DialyzerPerfusionApparatus
- // }
- //
- // if len(item.DialysisIrrigation) > 0 {
- // DialysisMachineName = DialysisMachineName + "," + item.DialysisIrrigation
- // }
- //
- // if len(item.DialysisStrainer) > 0 {
- // DialysisMachineName = DialysisMachineName + "," + item.DialysisStrainer
- // }
- // DialysisMachineName = DialysisMachineName
- // service.UpdateSchPatient(item.PatientId, item.RecordDate, item.UserOrgId, DialysisMachineName)
- //}
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "ok",
- })
- }
-
- func (this *SignApiController) ToAutoDiagnose() {
-
- //orgId := this.GetAdminUserInfo().CurrentOrgId
-
- //order, _ := service.GetDialysisOrderTotalCount()
- //
- //for _, item := range order {
- //
- // service.ModifyPatient(item.PatientId, item.Count)
- //}
-
- //list, _ := service.GetNewAllpatient(orgId)
- //
- //for _, item := range list {
- // service.UpdateAllPatient(item.BloodId, item.Diagnose, item.UserOrgId)
- //}
-
- //list, _ := service.GetAllDialysisOrderTwo(10340)
- //
- //for _, item := range list {
- // schedule, _ := service.GetLastScheduleByUserOrg(item.PatientId, item.DialysisDate, orgId, item.BedId, item.ZoneId, item.SchedualType)
- // service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, orgId, item.BedId, item.ZoneId, item.SchedualType, schedule.ID)
- //}
-
- //drugList, _ := service.GetAllBaseDrugList(10318)
- //for _, item := range drugList {
- // service.UpdateDrugWarehouseInfoByDrug(item.ID, item.MinPrice, item.OrgId)
- //
- // //service.UpdateHisDoctorAdviceOne(item.ID, item.MinPrice, item.OrgId)
- //}
-
- //goodList, _ := service.GetAllGoodList(10571)
- //for _, item := range goodList {
- // service.UpdasteGoodWarehouseInfoByGood(item.ID, item.PackingPrice, item.OrgId)
- //}
-
- //list, _ := service.GetAllDialysisPrescription(29190)
- //
- //for _, item := range list {
- // service.UpdateSchedulePrescrition(item.PatientId, item.RecordDate, item.UserOrgId, item.ModeId)
- //}
-
- //list, _ := service.GetPatientLapseList()
- //
- //fmt.Println(list)
- //if len(list) > 0 {
- // for _, items := range list {
- // schedulelist, _ := service.GetPatientScheduleListByItem(items.ID)
- // if len(schedulelist) < 2 {
- // for _, it := range schedulelist {
- // orderList, _ := service.GetAllDialysisOrder(it.PatientId, 1731254400, 1731254400)
- // for _, item := range orderList {
- // schedule, _ := service.GetLastScheduleByUserOrg(item.PatientId, item.DialysisDate, item.UserOrgId, item.BedId, item.ZoneId, item.SchedualType)
- // prescribeOne, _ := service.GetDialysisPrescribeOne(item.UserOrgId, item.PatientId, item.DialysisDate)
- // service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, item.UserOrgId, item.BedId, item.ZoneId, item.SchedualType, schedule.ID, prescribeOne.ModeId)
- // }
- //
- // }
- // }
- // }
- //}
-
- //adviceList, _ := service.GetHisDoctorAdviceNoCheck(10721)
- //
- //if len(adviceList) > 0 {
- // for _, item := range adviceList {
- // checkObj, _ := service.GetDobuleCheckOne(item.UserOrgId, item.AdviceDate, item.PatientId)
- // service.UpdateHisAdvice(item.PatientId, item.AdviceDate, item.UserOrgId, checkObj.Creater, checkObj.CheckDate)
- // }
- //}
-
- //advice, _ := service.GetDoctorAdviceListByUserOrgId(10740, 1736179200)
- //
- //db := service.XTWriteDB()
- //tx := db.Begin()
- //defer func() {
- // if r := recover(); r != nil {
- // tx.Rollback()
- // } else {
- // tx.Commit()
- // }
- //}()
- //for _, item := range advice {
- //
- // //查找该患者是否出库了
- // outInfo, _ := service.GetSelfDrugWarehouseOutInfo(item.PatientId, item.DrugId, item.AdviceDate)
- // if outInfo.ID == 0 {
- // timeStr := time.Now().Format("2006-01-02")
- // timeArr := strings.Split(timeStr, "-")
- // total, _ := service.FindAllSelfDrugWarehouseOut(10740, tx)
- //
- // total = total + 1
- // warehousing_out_order := strconv.FormatInt(10740, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000"
- // number, _ := strconv.ParseInt(warehousing_out_order, 10, 64)
- // number = number + total
- // warehousing_out_order = "YPCKD" + strconv.FormatInt(number, 10)
- // operation_time := time.Now().Unix()
- //
- // creater := this.GetAdminUserInfo().AdminUser.Id
- //
- // //创建一个出库单
- // drugWarehouseOut := models.XtSelfDrugWarehouseOut{
- // WarehouseOutOrderNumber: warehousing_out_order,
- // OperationTime: operation_time,
- // OrgId: 10740,
- // Creater: creater,
- // Ctime: time.Now().Unix(),
- // Status: 1,
- // WarehouseOutTime: item.AdviceDate,
- // Type: 0,
- // PatientId: item.PatientId,
- // IsCheck: 1,
- // IsSys: 1,
- // }
- //
- // //查询今日是否有出库数据
- // lastWarehouseOut, _ := service.GetSelfDrugLastWarehouseOutTwety(10740, item.AdviceDate, tx, 1)
- //
- // if lastWarehouseOut.ID == 0 {
- // service.AddSelfSigleDrugWarehouseOut(&drugWarehouseOut, tx)
- // }
- //
- // //查询今日是否有出库数据
- // lastWarehouseOutOne, _ := service.GetSelfDrugLastWarehouseOutTwety(10740, item.AdviceDate, tx, 1)
- //
- // var warehousing_out_order_str string
- // if lastWarehouseOut.ID == 0 {
- // warehousing_out_order_str = warehousing_out_order
- // } else {
- // warehousing_out_order_str = lastWarehouseOut.WarehouseOutOrderNumber
- // }
- //
- // //查询库存是否
- // selfBasedrug, _ := service.GetSelfBasedrugByIdTwo(item.DrugId, item.UserOrgId)
- // var prescribing_number_total_one int64
- // //判断单位是否相等
- // if selfBasedrug.MaxUnit == item.PrescribingNumberUnit && selfBasedrug.MaxUnit != selfBasedrug.MinUnit {
- // prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
- // count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
- // //转化为最小单位
- // prescribing_number_total_one = count * selfBasedrug.MinNumber
- // }
- //
- // if selfBasedrug.MinUnit == item.PrescribingNumberUnit && selfBasedrug.MaxUnit != selfBasedrug.MinUnit {
- // prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
- // count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
- // prescribing_number_total_one = count
- //
- // }
- //
- // if selfBasedrug.MinUnit == item.PrescribingNumberUnit && selfBasedrug.MaxUnit == selfBasedrug.MinUnit {
- // prescribingNumber_temp := strconv.FormatFloat(math.Abs(item.PrescribingNumber), 'f', 0, 64)
- // count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
- // prescribing_number_total_one = count
- // }
- //
- // //出库
- // warehouseOutInfo := &models.XtSelfDrugWarehouseOutInfo{
- // WarehouseOutId: lastWarehouseOutOne.ID,
- // WarehouseOutOrderNumber: warehousing_out_order_str,
- // DrugId: item.DrugId,
- // Count: prescribing_number_total_one,
- // Price: 0,
- // TotalPrice: 0,
- // Status: 1,
- // Ctime: item.AdviceDate,
- // Mtime: item.AdviceDate,
- // Remark: "",
- // OrgId: item.UserOrgId,
- // Type: 0,
- // Manufacturer: selfBasedrug.Manufacturer,
- // Dealer: selfBasedrug.Dealer,
- // RetailPrice: 0,
- // RetailTotalPrice: 0,
- // CountUnit: selfBasedrug.MinUnit,
- // ExpiryDate: 0,
- // ProductDate: 0,
- // Number: "",
- // BatchNumber: "",
- // IsSys: 0,
- // WarehouseInfoId: 0,
- // AdminUserId: 0,
- // StockCount: "",
- // IsCheck: 1,
- // SysRecordTime: item.AdviceDate,
- // PatientId: item.PatientId,
- // AdviceId: item.ID,
- // ClassType: "",
- // }
- // var warehousingOutInfo []*models.XtSelfDrugWarehouseOutInfo
- // warehousingOutInfo = append(warehousingOutInfo, warehouseOutInfo)
- //
- // for _, it := range warehousingOutInfo {
- //
- // medical, _ := service.GetSelfBaseDrugMedical(it.DrugId, tx)
- // drup, _ := service.FindSelfBaseDrugLibRecord(it.OrgId, it.DrugId, tx)
- // //出库逻辑
- // service.AutoNewSelfDrugDeliverInfoFourtyTwo(item.UserOrgId, it.Count, &lastWarehouseOut, &drup, it, it.CountUnit, tx)
- //
- // //查询剩余库存
- // stockInfo, _ := service.GetSelfDrugAllStockInfo(it.PatientId, it.OrgId, it.DrugId, tx)
- // var sum_count int64
- // for _, its := range stockInfo {
- // if its.MaxUnit == medical.MaxUnit {
- // its.StockMaxNumber = its.StockMaxNumber * medical.MinNumber
- // }
- // sum_count += its.StockMaxNumber + its.StockMinNumber
- // }
- // service.UpdateSelfDrugStockCount(it.DrugId, it.OrgId, it.PatientId, sum_count, tx)
- // }
- // }
- //}
- //tx.Commit()
-
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "ok",
- })
-
- }
-
- func (this *SignApiController) ToAutoJiaYou() {
-
- list, _ := service.GetPrescriptionListOne(10579)
-
- for _, item := range list {
-
- schedule, _ := service.GetPatientScheduleById(item.PatientId, item.RecordDate)
- var DialysisMachineName string
- if len(item.DialysisDialyszers) > 0 {
- DialysisMachineName = item.DialysisDialyszers
- }
-
- if len(item.DialysisIrrigation) > 0 {
- DialysisMachineName = DialysisMachineName + "," + item.DialysisIrrigation
- }
-
- if len(item.DialysisStrainer) > 0 {
- DialysisMachineName = DialysisMachineName + "," + item.DialysisStrainer
- }
- DialysisMachineName = DialysisMachineName
-
- service.UpdateDialysisScheduleOne(schedule.ID, item.ModeId, DialysisMachineName)
- }
- }
-
- func (this *SignApiController) GetFieldConfigList() {
-
- orderList, _ := service.GetDialysisOrderByUserOrgId()
-
- if len(orderList) > 0 {
- filedConfigList, _ := service.GetFieldConfigList(9442)
-
- for _, item := range orderList {
- for _, it := range filedConfigList {
- //查询该机构该模式是否有这个字段
- fiedConfigObj, _ := service.GetFieldConfigByOrgId(item.UserOrgId, it.FiledNameCn, it.Module)
- if fiedConfigObj.ID == 0 {
- config := models.FiledConfig{
- OrgId: item.UserOrgId,
- Module: it.Module,
- FiledName: it.FiledName,
- FiledNameCn: it.FiledNameCn,
- IsShow: 2,
- CreateTime: time.Now().Unix(),
- UpdateTime: time.Now().Unix(),
- SysModule: it.SysModule,
- IsWrite: it.IsWrite,
- IsSecondMenu: it.IsSecondMenu,
- }
- service.CretedConfig(config)
- }
- }
- }
- }
-
- //filedConfig, _ := service.GetFieldConfigGroupList(7)
- //if len(filedConfig) > 0 {
- // for _, item := range filedConfig {
- // //查询该机构
- // fiedConfigObj, _ := service.GetFieldConfigByOrgId(9442, item.FiledNameCn, item.Module)
- //
- // if fiedConfigObj.ID == 0 {
- //
- // config := models.FiledConfig{
- // OrgId: 9442,
- // Module: item.Module,
- // FiledName: item.FiledName,
- // FiledNameCn: item.FiledNameCn,
- // IsShow: 2,
- // CreateTime: time.Now().Unix(),
- // UpdateTime: time.Now().Unix(),
- // SysModule: item.SysModule,
- // IsWrite: item.IsWrite,
- // IsSecondMenu: item.IsSecondMenu,
- // }
- //
- // service.CretedConfig(config)
- // }
- // }
- //}
-
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "ok",
- })
- }
-
- // 校验库存的脚本
- func (this *SignApiController) ToCheckQuery() {
-
- //获取监测监控的库存情况
-
- queryList, _ := service.GetAllCheckQuery()
-
- var recordDateStr = time.Now().Format("2006-01-02")
- recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
- if len(queryList) > 0 {
- for _, item := range queryList {
- //查询今日该机构总的医嘱数量
- adviceList, _ := service.GetAllDoctorAdviceQueryList(item.UserOrgId, recordDate.Unix())
- if len(adviceList) > 0 {
-
- for _, it := range adviceList {
- var prescription_count int64
- var out_count int64
- advice, _ := service.GetDrugListById(it.DrugId, it.AdviceDate, it.PatientId)
- medical, _ := service.GetBaseDrugMedical(it.DrugId)
- if len(advice) > 0 {
- for _, its := range advice {
- prescribingNumberSix := strconv.FormatFloat(its.PrescribingNumber, 'f', -1, 64)
- prescribingNumberSeven, _ := strconv.ParseInt(prescribingNumberSix, 10, 64)
- if its.PrescribingNumberUnit == medical.MaxUnit && medical.MaxUnit != medical.MinUnit {
- prescription_count += prescribingNumberSeven * medical.MinNumber
- }
-
- if its.PrescribingNumberUnit == medical.MinUnit && medical.MaxUnit != medical.MinUnit {
- prescription_count += prescribingNumberSeven
- }
-
- if its.PrescribingNumberUnit == medical.MaxUnit && medical.MaxUnit == medical.MinUnit {
- prescription_count += prescribingNumberSeven
- }
- }
- }
-
- outinfo, _ := service.GetDrugWarehouseOutQueryListById(it.DrugId, it.AdviceDate, it.PatientId)
-
- if len(outinfo) > 0 {
- for _, s := range outinfo {
- if s.CountUnit == medical.MaxUnit && medical.MaxUnit != medical.MinUnit {
- out_count += s.Count * medical.MinNumber
- }
-
- if s.CountUnit == medical.MinUnit && medical.MaxUnit != medical.MinUnit {
- out_count += s.Count
- }
-
- if s.CountUnit == medical.MaxUnit && medical.MaxUnit == medical.MinUnit {
- out_count += s.Count
- }
- }
- }
-
- patients, _ := service.GetPatientName(it.PatientId)
-
- var specifaciton_name string
-
- specifaciton_name = medical.Dose + medical.DoseUnit + "*" + strconv.FormatInt(medical.MinNumber, 10) + medical.MinUnit + "/" + medical.MaxUnit
-
- //如果当天医嘱数量和出库数量不一致,那么则插入到数据库
- if prescription_count != out_count {
-
- checkQuery := models.XtDrugCheckQuery{
- DrugId: it.DrugId,
- RecordDate: it.AdviceDate,
- AdviceCount: prescription_count,
- OutCount: out_count,
- PatientId: it.PatientId,
- UserOrgId: it.UserOrgId,
- ExecutionState: it.ExecutionState,
- IsMedicine: it.IsMedicine,
- DrugName: medical.DrugName,
- SpecificationName: specifaciton_name,
- Name: patients.Name,
- }
-
- service.CreateCheckQuery(checkQuery)
- }
-
- }
-
- }
-
- //查询今日改机构耗材的总的医嘱数量
- projectList, _ := service.GetAllPrescriptionProjectList(item.UserOrgId, recordDate.Unix())
- if len(projectList) > 0 {
-
- for _, item := range projectList {
- var prescription_count int64
- var out_count int64
- project, _ := service.GetProjectListByPatient(item.PatientId, item.ProjectId, item.RecordDate)
- for _, its := range project {
- count, _ := strconv.ParseInt(its.Count, 10, 64)
- prescription_count += count
- }
-
- outList, _ := service.GetWarehosueOutQueryList(item.PatientId, item.ProjectId, item.RecordDate)
- for _, s := range outList {
- out_count += s.Count
- }
-
- goodIdThirty, _ := service.GetGoodInformationByGoodIdThirty(item.ProjectId)
-
- patients, _ := service.GetPatientName(item.PatientId)
-
- //fmt.Println("hahhahahahahhh", item.ProjectId)
- //fmt.Println("prescription_count", prescription_count)
- //fmt.Println("out_count", out_count)
- if prescription_count != out_count {
-
- stockCheckQuery := models.XtStockCheckQuery{
- GoodId: item.ProjectId,
- RecordDate: item.RecordDate,
- AdviceCount: prescription_count,
- OutCount: out_count,
- PatientId: item.PatientId,
- UserOrgId: item.UserOrgId,
- GoodName: goodIdThirty.GoodName,
- SpecificationName: goodIdThirty.SpecificationName,
- Name: patients.Name,
- }
-
- service.CreteStockCheckQuery(stockCheckQuery)
- }
- }
-
- }
- }
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "msg": "ok",
- })
- }
|