sign_api_controller.go 40KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350
  1. package controllers
  2. import (
  3. "encoding/base64"
  4. "encoding/json"
  5. "fmt"
  6. "io/ioutil"
  7. "time"
  8. "XT_New/models"
  9. "XT_New/service"
  10. "github.com/astaxie/beego"
  11. )
  12. type SignApiController struct {
  13. BaseAuthAPIController
  14. }
  15. func SignApiRegistRouters() {
  16. //获取短信验证码
  17. beego.Router("/api/sign/getsign", &SignApiController{}, "Get:GetSign")
  18. //创建个人用户并实名
  19. beego.Router("/api/sign/createrusername", &SignApiController{}, "Get:CreateUserName")
  20. //创建企业用户并实名
  21. beego.Router("/api/sign/createenterpriserealname", &SignApiController{}, "Get:CreateEnterPriseRealName")
  22. //添加企业成员
  23. beego.Router("/api/sign/createuserid", &SignApiController{}, "Get:CreateUserId")
  24. //创建个人印章
  25. beego.Router("/api/sign/createpersionseal", &SignApiController{}, "Get:CreatePersionSeal")
  26. //上传文件创建创建合同
  27. beego.Router("/api/sign/createuploadpact", &SignApiController{}, "Get:CreateUploadPact")
  28. //添加合同签署人
  29. beego.Router("/api/sign/addcontractsignatory", &SignApiController{}, "Get:AddContractSignatory")
  30. //获取短信验证
  31. beego.Router("/api/sign/getverificationcode", &SignApiController{}, "Get:GetVerificationCode")
  32. //后台签署(返回签署文件)
  33. beego.Router("/api/sign/createbackstagesign", &SignApiController{}, "Get:CreateBackStageSign")
  34. //署意愿认证-短信验证
  35. beego.Router("/api/sign/totestelment", &SignApiController{}, "Get:CreateEnterprise")
  36. //测试PDF
  37. beego.Router("/api/sign/totestthrityment", &SignApiController{}, "Get:GetTestThrityMent")
  38. //CA企业认证
  39. beego.Router("/api/sign/saveenerprise", &SignApiController{}, "Post:SaveEnerprise")
  40. //
  41. beego.Router("/api/sign/getenerprisebyid", &SignApiController{}, "Get:GetEnerPriseById")
  42. beego.Router("/api/sign/getmobilecode", &SignApiController{}, "Get:GetMobileCode")
  43. beego.Router("/api/sign/getpersionenterprise", &SignApiController{}, "Post:GetPersionEnterPrise")
  44. beego.Router("/api/sign/getpersenterprisebyid", &SignApiController{}, "Get:GetPerseEnterPriseById")
  45. beego.Router("/api/device/sign/creterpersionseal", &SignApiController{}, "Get:CreateNewPersionSeal")
  46. beego.Router("/api/device/sign/createnewenterprise", &SignApiController{}, "Get:CreateNewEnterPrise")
  47. beego.Router("/api/device/contractid", &SignApiController{}, "Get:GetContractId")
  48. beego.Router("/api/device/endenterprise", &SignApiController{}, "Get:EndEnterPrise")
  49. beego.Router("/api/device/getenterprisedetail", &SignApiController{}, "Get:GetEnterPriseDetail")
  50. beego.Router("/api/device/uploadprintorder", &SignApiController{}, "Post:UploadPrintOrder")
  51. //sdk 版本
  52. beego.Router("/api/device/createqianshuusername", &SignApiController{}, "Post:CreateQianshuUserName")
  53. //发送消息
  54. beego.Router("/api/device/createskdsendinformation", &SignApiController{}, "Post:CreateSdkSendInformation")
  55. //删除
  56. beego.Router("/api/device/tosavepdfinformation", &SignApiController{}, "Get:SavePdfInformation")
  57. beego.Router("/api/device/tocheckinformation", &SignApiController{}, "Get:ToCheckInformation")
  58. beego.Router("/api/device/toautodrug", &SignApiController{}, "Get:ToAutoDrug")
  59. beego.Router("/api/device/toautodiagnose", &SignApiController{}, "Get:ToAutoDiagnose")
  60. //加油
  61. beego.Router("/api/device/toautojiayou", &SignApiController{}, "Get:ToAutoJiaYou")
  62. //显示字段脚本
  63. beego.Router("/api/device/getfieldconfiglist", &SignApiController{}, "Get:GetFieldConfigList")
  64. }
  65. // 短信服务接口
  66. func (this *SignApiController) GetSign() {
  67. phone := this.GetString("phone")
  68. fmt.Println("phone", phone)
  69. var tempphone string
  70. tempphone = "13318464642"
  71. sign := service.GetSignNameByPhone(tempphone)
  72. this.ServeSuccessJSON(map[string]interface{}{
  73. "sign": sign,
  74. })
  75. return
  76. }
  77. type Result2121 struct {
  78. Phone string `json:"phone"`
  79. DisPlayName string `json:"dis_play_name"`
  80. Authentication string `json:"authentication"`
  81. TwAuthReq struct {
  82. OneLineAuth string `json:"oneLineAuth"`
  83. ApiAuthReq struct {
  84. RealName float64 `json:"real_name"`
  85. IdCardType string `json:"id_card_type"`
  86. IdCardNum string `json:"id_card_num"`
  87. BankCard string `json:"bank_card"`
  88. CodeNumber string `json:"code_number"`
  89. VerifyCode string `json:"verify_code"`
  90. } `json:"apiAuthReq"`
  91. } `json:"twAuthReq"`
  92. }
  93. type MapData struct {
  94. dat struct {
  95. Code float64 `json:"code"`
  96. data struct {
  97. userId string `json:"userId"`
  98. }
  99. }
  100. }
  101. // 创建个人用户并实名
  102. func (this *SignApiController) CreateUserName() {
  103. phone := this.GetString("phone")
  104. disPlayName := this.GetString("disPlayName")
  105. sign, userId := service.CreateUserName(phone, disPlayName)
  106. var dat map[string]interface{}
  107. if err := json.Unmarshal([]byte(sign), &dat); err == nil {
  108. fmt.Println(dat)
  109. } else {
  110. fmt.Println(err)
  111. }
  112. this.ServeSuccessJSON(map[string]interface{}{
  113. "sign": sign,
  114. "dat": dat,
  115. "userId": userId,
  116. })
  117. return
  118. }
  119. // 创建个人印章
  120. func (this *SignApiController) CreatePersionSeal() {
  121. user_id := this.GetString("user_id")
  122. person_seal_type, _ := this.GetInt64("person_seal_type")
  123. person_seal_name := this.GetString("person_seal_name")
  124. person_seal_base := this.GetString("person_seal_base")
  125. color, _ := this.GetInt64("color")
  126. alpha, _ := this.GetInt64("alpha")
  127. width, _ := this.GetInt64("width")
  128. height, _ := this.GetInt64("height")
  129. border, _ := this.GetInt64("border")
  130. font_type, _ := this.GetInt64("font_type")
  131. sign, personSealId := service.CreatePersionSeal(user_id, person_seal_type, person_seal_name, person_seal_base, color, alpha, width, height, border, font_type)
  132. var dat map[string]interface{}
  133. if err := json.Unmarshal([]byte(sign), &dat); err == nil {
  134. fmt.Println(dat)
  135. } else {
  136. fmt.Println(err)
  137. }
  138. this.ServeSuccessJSON(map[string]interface{}{
  139. "sign": sign,
  140. "dat": dat,
  141. "personSealId": personSealId,
  142. })
  143. return
  144. }
  145. func (this *SignApiController) CreateUploadPact() {
  146. contractcode := this.GetString("contractcode")
  147. contractname := this.GetString("contractname")
  148. signcount, _ := this.GetInt64("signcount")
  149. docname := this.GetString("docname")
  150. contractbase := this.GetString("contractbase")
  151. creator := this.GetString("creator")
  152. enterpriseid := this.GetString("enterpriseid")
  153. signvalidays, _ := this.GetInt64("signvalidays")
  154. sysncurl := this.GetString("sysncurl")
  155. asyncurl := this.GetString("asyncurl")
  156. sign := service.CreateUploadPact(contractcode, contractname, signcount, docname, contractbase, creator, enterpriseid, signvalidays, sysncurl, asyncurl)
  157. this.ServeSuccessJSON(map[string]interface{}{
  158. "sign": sign,
  159. })
  160. return
  161. }
  162. // 添加企业成员
  163. func (this *SignApiController) CreateUserId() {
  164. userId := this.GetString("userId")
  165. displayName := this.GetString("displayName")
  166. sign := service.CreateUserId(userId, displayName)
  167. this.ServeSuccessJSON(map[string]interface{}{
  168. "sign": sign,
  169. })
  170. return
  171. }
  172. func (this *SignApiController) CreateEnterPriseRealName() {
  173. enterprisename := this.GetString("enterprisename")
  174. sign := service.CreateEnterPriseRealName(enterprisename)
  175. this.ServeSuccessJSON(map[string]interface{}{
  176. "sign": sign,
  177. })
  178. return
  179. }
  180. // 添加合同签署人
  181. func (this *SignApiController) AddContractSignatory() {
  182. contractId := this.GetString("contractId")
  183. signers := this.GetString("signers")
  184. var newContract models.NewContract
  185. newContract.ContractId = "156001444267295949"
  186. sign := service.AddContractSignatory(contractId, signers, newContract)
  187. this.ServeSuccessJSON(map[string]interface{}{
  188. "sign": sign,
  189. })
  190. return
  191. }
  192. type Struct2401 struct {
  193. someTimestampStyle []someTimestampStyle
  194. }
  195. type someTimestampStyle struct {
  196. ControlsKey string
  197. Pattern string
  198. Color string
  199. }
  200. func (this *SignApiController) CreateBackStageSign() {
  201. contractId := this.GetString("contractId")
  202. signers := this.GetString("signers")
  203. sign := service.CreateBackStageSign(contractId, signers)
  204. this.ServeSuccessJSON(map[string]interface{}{
  205. "sign": sign,
  206. })
  207. return
  208. }
  209. func (this *SignApiController) GetVerificationCode() {
  210. sign := service.GetVerificationCode()
  211. this.ServeSuccessJSON(map[string]interface{}{
  212. "sign": sign,
  213. })
  214. return
  215. }
  216. func (this *SignApiController) CreateEnterprise() {
  217. sign := service.CreateEnterprise()
  218. this.ServeSuccessJSON(map[string]interface{}{
  219. "sign": sign,
  220. })
  221. return
  222. }
  223. func (this *SignApiController) GetTestThrityMent() {
  224. //pdf := gofpdf.New("P", "mm", "A4", "")
  225. //pdf.AddPage()
  226. //pdf.SetFont("Arial", "B", 16)
  227. //pdf.Cell(40, 10, "Hello, World!")
  228. //pdf.OutputFileAndClose("output.pdf")
  229. //
  230. //this.ServeSuccessJSON(map[string]interface{}{
  231. // "sign": "msg",
  232. //})
  233. //return
  234. }
  235. func loremList() []string {
  236. return []string{
  237. "我爱你中国" +
  238. "tempor incididunt ut labore et dolore magna aliqua.",
  239. "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut " +
  240. "aliquip ex ea commodo consequat.",
  241. "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum " +
  242. "dolore eu fugiat nulla pariatur.",
  243. "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui " +
  244. "officia deserunt mollit anim id est laborum.",
  245. }
  246. }
  247. func (this *SignApiController) SaveEnerprise() {
  248. orgId := this.GetAdminUserInfo().CurrentOrgId
  249. creater := this.GetAdminUserInfo().AdminUser.Id
  250. dataBody := make(map[string]interface{}, 0)
  251. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  252. fmt.Println("err", err)
  253. id := int64(dataBody["id"].(float64))
  254. org_type := int64(dataBody["org_type"].(float64))
  255. enterprise_name := dataBody["enterprise_name"].(string)
  256. code := dataBody["code"].(string)
  257. org_code := dataBody["org_code"].(string)
  258. legal_person_name := dataBody["legal_person_name"].(string)
  259. legal_id_card_num := dataBody["legal_id_card_num"].(string)
  260. legal_phone := dataBody["legal_phone"].(string)
  261. enterprise := models.XtDeviceEnterprise{
  262. ID: id,
  263. UserOrgId: orgId,
  264. OrgType: org_type,
  265. EnterpriseName: enterprise_name,
  266. Code: code,
  267. OrgCode: org_code,
  268. LegalPersonName: legal_person_name,
  269. LegalIdCardNum: legal_id_card_num,
  270. LegalPhone: legal_phone,
  271. Creater: creater,
  272. Ctime: time.Now().Unix(),
  273. Mtime: 0,
  274. Enterpriseid: "",
  275. Status: 1,
  276. }
  277. service.SaveEnerPrise(enterprise)
  278. //查找该机构有没有认证信息
  279. lastenterprise, _ := service.GetEnterPriseByUserOrgId(orgId)
  280. //调用企业认证接口
  281. if lastenterprise.ID > 0 {
  282. enterPrise, enterpriseid := service.CreateNewEnterPriseRealName(lastenterprise)
  283. fmt.Println("enterprise2ooo2oo2o2o2o", enterPrise)
  284. updateEnterprise := models.XtDeviceEnterprise{
  285. ID: enterprise.ID,
  286. UserOrgId: orgId,
  287. OrgType: org_type,
  288. EnterpriseName: enterprise_name,
  289. Code: code,
  290. OrgCode: org_code,
  291. LegalPersonName: legal_person_name,
  292. LegalIdCardNum: legal_id_card_num,
  293. LegalPhone: legal_phone,
  294. Creater: creater,
  295. Ctime: time.Now().Unix(),
  296. Mtime: 0,
  297. Enterpriseid: enterpriseid,
  298. Status: 1,
  299. }
  300. service.SaveEnerPrise(updateEnterprise)
  301. this.ServeSuccessJSON(map[string]interface{}{
  302. "enterPrise": enterPrise,
  303. })
  304. return
  305. }
  306. }
  307. func (this *SignApiController) GetEnerPriseById() {
  308. orgId := this.GetAdminUserInfo().CurrentOrgId
  309. enterPrise, _ := service.GetEnterPriseByUserOrgId(orgId)
  310. this.ServeSuccessJSON(map[string]interface{}{
  311. "enterPrise": enterPrise,
  312. })
  313. return
  314. }
  315. func (this *SignApiController) GetMobileCode() {
  316. phone := this.GetString("phone")
  317. sign, orderNumber := service.GetNewSignNameByPhone(phone)
  318. this.ServeSuccessJSON(map[string]interface{}{
  319. "sign": sign,
  320. "orderNumber": orderNumber,
  321. })
  322. return
  323. }
  324. func (this *SignApiController) GetPersionEnterPrise() {
  325. orgId := this.GetAdminUserInfo().CurrentOrgId
  326. creater := this.GetAdminUserInfo().AdminUser.Id
  327. dataBody := make(map[string]interface{}, 0)
  328. err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
  329. fmt.Println("err", err)
  330. id := int64(dataBody["id"].(float64))
  331. admin_user_id := int64(dataBody["admin_user_id"].(float64))
  332. code := dataBody["code"].(string)
  333. display_name := dataBody["display_name"].(string)
  334. id_card_num := dataBody["id_card_num"].(string)
  335. phone := dataBody["phone"].(string)
  336. enterprise := models.XtDevicePersonEnterprise{
  337. ID: id,
  338. AdminUserId: admin_user_id,
  339. DisplayName: display_name,
  340. Phone: phone,
  341. IdCardNum: id_card_num,
  342. UserOrgId: orgId,
  343. Status: 1,
  344. Creater: creater,
  345. Ctime: time.Now().Unix(),
  346. Mtime: 0,
  347. UserId: "",
  348. }
  349. service.SavePersonEnterPrise(enterprise)
  350. lastEnterPrise, _ := service.GetLastPersonEnterPrise(admin_user_id, orgId)
  351. _, orderNumber := service.GetNewSignNameByPhone(phone)
  352. personEnterPrse, UserId := service.CreateNewUserName(lastEnterPrise.Phone, lastEnterPrise.DisplayName, code, orderNumber, lastEnterPrise.IdCardNum)
  353. firstenterprise := models.XtDevicePersonEnterprise{
  354. ID: id,
  355. AdminUserId: admin_user_id,
  356. DisplayName: display_name,
  357. Phone: phone,
  358. IdCardNum: id_card_num,
  359. UserOrgId: orgId,
  360. Status: 1,
  361. Creater: creater,
  362. Ctime: time.Now().Unix(),
  363. Mtime: 0,
  364. UserId: UserId,
  365. }
  366. service.SavePersonEnterPrise(firstenterprise)
  367. this.ServeSuccessJSON(map[string]interface{}{
  368. "personEnterPrse": personEnterPrse,
  369. })
  370. return
  371. }
  372. func (this *SignApiController) GetPerseEnterPriseById() {
  373. orgId := this.GetAdminUserInfo().CurrentOrgId
  374. admin_user_id, _ := this.GetInt64("admin_user_id")
  375. lastPerson, _ := service.GetLastPersonEnterPrise(admin_user_id, orgId)
  376. this.ServeSuccessJSON(map[string]interface{}{
  377. "lastPerson": lastPerson,
  378. })
  379. return
  380. }
  381. func (this *SignApiController) CreateNewPersionSeal() {
  382. orgId := this.GetAdminUserInfo().CurrentOrgId
  383. admin_user_id, _ := this.GetInt64("admin_user_id")
  384. creater := this.GetAdminUserInfo().AdminUser.Id
  385. userName := service.GetLastAdminUserName(admin_user_id, orgId)
  386. //查询医护是否完成认证
  387. lastPerson, _ := service.GetLastPersonEnterPrise(admin_user_id, orgId)
  388. if lastPerson.ID > 0 {
  389. this.ServeDynamicFailJsonSend("已完成认证,无需再次认证")
  390. return
  391. }
  392. if lastPerson.ID == 0 {
  393. //去认证
  394. personSeal, sealBase64 := service.CreateSKDPersionSeal(lastPerson.UserId, userName)
  395. fmt.Println("sealBase64", sealBase64)
  396. enterprise := models.XtDevicePersonEnterprise{
  397. AdminUserId: admin_user_id,
  398. DisplayName: "",
  399. Phone: "",
  400. IdCardNum: "",
  401. UserOrgId: orgId,
  402. Status: 1,
  403. Creater: creater,
  404. Ctime: time.Now().Unix(),
  405. Mtime: 0,
  406. UserId: "",
  407. Personsealid: "",
  408. Sealid: "",
  409. UserName: userName,
  410. Sealbase64: sealBase64,
  411. }
  412. service.CreateEnterpriseUserName(enterprise)
  413. this.ServeSuccessJSON(map[string]interface{}{
  414. "personSeal": personSeal,
  415. })
  416. return
  417. }
  418. }
  419. func (this *SignApiController) CreateNewEnterPrise() {
  420. //orgId := this.GetAdminUserInfo().CurrentOrgId
  421. //
  422. //admin_user_id, _ := this.GetInt64("admin_user_id")
  423. //
  424. //enterPrise, _ := service.GetEnterPriseByUserOrgId(orgId)
  425. //fmt.Println("地址日活", enterPrise.Enterpriseid)
  426. //lastPerson, _ := service.GetLastPersonEnterPrise(admin_user_id, orgId)
  427. //
  428. //newEnterPrise, sealId := service.CreateNewEnterPrise(enterPrise.Enterpriseid, lastPerson.UserId)
  429. //
  430. //fmt.Println("newEnterPrise",newEnterPrise)
  431. //service.UpdatePersonEnterPrise(lastPerson.ID, sealId)
  432. newEnterPrise, _ := service.CreateSDKEnterPrise()
  433. //var url string
  434. //url = "http://localhost:8890/sdk/seal/createEnterpriseSeal"
  435. //appId := beego.AppConfig.String("sign_appid")
  436. //
  437. //serviceKye := beego.AppConfig.String("serviceKye")
  438. //
  439. //serviceCode := beego.AppConfig.String("serviceCode")
  440. //
  441. //maprequest := make(map[string]interface{})
  442. //
  443. //maprequest["sealType"] = 1
  444. //maprequest["enterpriseName"] = "深圳伊森时光科技有限公司"
  445. //maprequest["horizontalText"] = "财务专用章"
  446. //
  447. //byterequest, _ := json.Marshal(maprequest)
  448. //reader := bytes.NewReader(byterequest)
  449. //
  450. //signatureStr, _ := service.GenerateHMACSHA1SignatureTwo(maprequest, serviceKye, serviceCode)
  451. //fmt.Println("signatureStr", signatureStr)
  452. //request, err := http.NewRequest("POST", url, reader)
  453. //
  454. //fmt.Println("request23222222222222222", request)
  455. //if err != nil {
  456. // fmt.Println(err.Error())
  457. //}
  458. //
  459. //request.Header.Set("appId", appId)
  460. //request.Header.Set("serviceCode", serviceCode)
  461. //request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  462. //request.Header.Set("Content-Signature", signatureStr)
  463. //client := http.Client{}
  464. //
  465. //resp, err := client.Do(request)
  466. //if err != nil {
  467. // fmt.Println(err.Error())
  468. //
  469. //}
  470. //respBytes, err := ioutil.ReadAll(resp.Body)
  471. //if err != nil {
  472. // fmt.Println(err.Error())
  473. //
  474. //}
  475. //str := string(respBytes)
  476. //fmt.Println("strwowowowowo", str)
  477. //
  478. //var respJSON map[string]interface{}
  479. //if err := json.Unmarshal([]byte(string(respBytes)), &respJSON); err != nil {
  480. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  481. //}
  482. this.ServeSuccessJSON(map[string]interface{}{
  483. "newEnterPrise": newEnterPrise,
  484. })
  485. return
  486. }
  487. func (this *SignApiController) GetContractId() {
  488. sign := service.GetContractId()
  489. this.ServeSuccessJSON(map[string]interface{}{
  490. "sign": sign,
  491. })
  492. return
  493. }
  494. func (this *SignApiController) EndEnterPrise() {
  495. sign := service.EndEnterPrise()
  496. this.ServeSuccessJSON(map[string]interface{}{
  497. "sign": sign,
  498. })
  499. return
  500. }
  501. func (this *SignApiController) GetEnterPriseDetail() {
  502. sign, url := service.GetEnterPriseDetail()
  503. this.ServeSuccessJSON(map[string]interface{}{
  504. "sign": sign,
  505. "url": url,
  506. })
  507. return
  508. }
  509. func (this *SignApiController) UploadPrintOrder() {
  510. orderList, _ := service.GetDialysisOrderListOne(21741)
  511. for _, item := range orderList {
  512. service.UpdateSchedulePatient(item.PatientId, item.DialysisDate, item.ZoneId, item.BedID)
  513. }
  514. //list, _ := service.GetAllPatientNew(10375)
  515. //for _, item := range list {
  516. //
  517. // hans := item.Name // 要转换的汉字字符串
  518. // // 创建一个拼音转换器
  519. // p := pinyin.NewArgs()
  520. //
  521. // // 将汉字转为拼音
  522. // pinyinSlice := pinyin.Pinyin(hans, p)
  523. //
  524. // // 输出拼音
  525. // fmt.Println("Pinyin:", pinyinSlice)
  526. //
  527. // // 获取首字母
  528. // firstLetter := ""
  529. // for _, py := range pinyinSlice {
  530. // if len(py) > 0 {
  531. // firstLetter += string(py[0][0])
  532. // }
  533. // }
  534. //
  535. // item.FirstLetter = firstLetter
  536. // service.UpdatePatientNew(item.ID, item.FirstLetter)
  537. // // 输出首字母
  538. // //fmt.Println("First Letter:", firstLetter)
  539. //}
  540. //baseList, _ := service.GeteAllBaseList(10375)
  541. //for _, item := range baseList {
  542. // hans := item.DrugName // 要转换的汉字字符串
  543. // // 创建一个拼音转换器
  544. // p := pinyin.NewArgs()
  545. // // 将汉字转为拼音
  546. // pinyinSlice := pinyin.Pinyin(hans, p)
  547. // // 获取首字母
  548. // firstLetter := ""
  549. // for _, py := range pinyinSlice {
  550. // if len(py) > 0 {
  551. // firstLetter += string(py[0][0])
  552. // }
  553. // }
  554. // item.FirstLetter = firstLetter
  555. // service.UpdateBaseList(item.ID, item.FirstLetter)
  556. //}
  557. //pdf := gofpdf.New("P", "mm", "A4", "")
  558. //pdf.AddPage()
  559. //pdf.Text(5, 10, "血液净化治疗记录单")
  560. //
  561. //pdf.AddUTF8Font("simfang", "", "D:/go/src/pkg/mod/github.com/jung-kurt/gofpdf@v1.16.2/font/simfang.ttf")
  562. //pdf.SetFont("simfang", "", 20)
  563. //var title = "血液透析(滤过)记录表单"
  564. ////表格居中显示
  565. //pdf.Text(70, 10, title)
  566. //wd := pdf.GetStringWidth(title) + 100
  567. //fmt.Println("wd", wd)
  568. //pdf.SetY(100) //先要设置 Y,然后再设置 X。否则,会导致 X 失效
  569. //pdf.SetX((210 - wd) / 2) //水平居中的算法
  570. //var numuber = "张三"
  571. ////表格居中显示
  572. //pdf.SetFont("", "", 14) // 设置加粗字体和字号
  573. //pdf.Text(10, 20, "姓名:"+numuber)
  574. //pdf.SetFont("", "", 14) // 设置加粗字体和字号
  575. //pdf.Text(35, 20, "性别:"+"男")
  576. //pdf.SetFont("", "", 14) // 设置正常字体和字号
  577. //pdf.Text(60, 20, "年龄:"+"18")
  578. //pdf.SetFont("", "", 14) // 设置正常字体和字号
  579. //pdf.Text(90, 20, "门诊:"+"住院")
  580. //pdf.SetFont("", "", 14) // 设置正常字体和字号
  581. //pdf.Text(120, 20, "病区:"+"A区")
  582. //pdf.SetFont("", "", 14) // 设置正常字体和字号
  583. //pdf.Text(150, 20, "床号:"+"1号")
  584. //pdf.SetFont("", "", 14) // 设置正常字体和字号
  585. //pdf.Text(180, 20, "透析号:")
  586. //pdf.SetFont("", "", 14) // 设置正常字体和字号
  587. //pdf.Text(210, 20, "住院号/门诊号:")
  588. //pdf.SetFont("", "", 14) // 设置正常字体和字号
  589. ////表格居中显示
  590. //pdf.SetFont("", "", 14) // 设置加粗字体和字号
  591. //pdf.Text(10, 30, "入科方式:"+numuber)
  592. //pdf.SetFont("", "", 14) // 设置加粗字体和字号
  593. //pdf.Text(60, 30, "诊断:")
  594. //
  595. //pdf.AddUTF8Font("simfang", "", "D:/go/src/pkg/mod/github.com/jung-kurt/gofpdf@v1.16.2/font/simfang.ttf")
  596. //pdf.SetFont("simfang", "", 16) // 设置字体、字号
  597. //pdf.SetFillColor(200, 200, 200)
  598. ////// 设置起始位置
  599. //var x = 10.0
  600. //var y = 40.0
  601. //pdf.SetXY(x, y)
  602. //// 设置填充颜色
  603. //pdf.CellFormat(200, 15, "透析前情况", "1", 0, "CM", false, 0, "") // 使用CellFormat()方法创建表格单元格
  604. //param1: 单元格的宽,为0时表示一行,单位根据new()里面设置的来
  605. //param2: 单元格的高,不能为0,单位根据new()里面设置的来
  606. //param3: 单元格内容
  607. //param4: 边框样式,一个空字符串表示无边框,“1”表示全边框,一个或多个“L”,“T”,“R”和“B”分别表示边界左,上,右,下
  608. //param5: 表示调用后当前位置的位置。可能的值为0,接着当前行继续,1换行,2目前没有试过
  609. //param6: 字体的位置,水平对齐包括"L", “C"或"R”(左,中,右)。垂直对齐由包含控制"T", “M”, “B"或"A”(上,中,下,基线),可以组合,比如说LT,CM等等
  610. //param7: 是否填充单元格,需要调用SetFillColor()方法.默认false
  611. //param8: 内部超链接,没用过
  612. //param9: 超链接,没用过
  613. //pdf.AddUTF8Font("simfang", "", "D:/go/src/pkg/mod/github.com/jung-kurt/gofpdf@v1.16.2/font/simfang.ttf")
  614. //pdf.SetFont("simfang", "", 8) // 设置字体、字号
  615. //pdf.SetFillColor(200, 200, 200) // 设置填充颜色
  616. //
  617. //// 设置起始位置
  618. //var x = 10.0
  619. //var y = 40.0
  620. ////创建8行2列的表格
  621. //
  622. //for j := 0; j < 1; j++ {
  623. // // 填充每个单元格的内容
  624. // pdf.SetXY(x, y) // 设置当前位置
  625. // pdf.CellFormat(20, 15, "时间", "1", 0, "CM", false, 0, "") // 使用CellFormat()方法创建表格单元格
  626. // pdf.CellFormat(20, 15, "血压(mmHg)", "1", 0, "CM", false, 0, "")
  627. // pdf.CellFormat(20, 15, "脉搏(次/分)", "1", 0, "CM", false, 0, "")
  628. // pdf.CellFormat(20, 15, "呼吸(次/分)", "1", 0, "CM", false, 0, "")
  629. // pdf.CellFormat(20, 15, "血流量(ml/min)", "1", 0, "CM", false, 0, "")
  630. // pdf.CellFormat(20, 15, "静脉压(mmHg)", "1", 0, "CM", false, 0, "")
  631. // pdf.CellFormat(20, 15, "跨膜压(mmHg)", "1", 0, "CM", false, 0, "")
  632. // pdf.CellFormat(20, 15, "透析液温(℃)", "1", 0, "CM", false, 0, "")
  633. // pdf.CellFormat(20, 15, "钠浓度(mmol/L)", "1", 0, "CM", false, 0, "")
  634. // pdf.CellFormat(20, 15, "超滤量(ml) ", "1", 0, "CM", false, 0, "")
  635. // pdf.CellFormat(35, 15, "病情变化及处理", "1", 0, "CM", false, 0, "")
  636. //
  637. // y += 15 // 下一行起始位置的y坐标增加60(单元格高度)
  638. //}
  639. //for j := 0; j < 1; j++ {
  640. // // 填充每个单元格的内容
  641. // pdf.SetXY(x, y) // 设置当前位置
  642. // pdf.CellFormat(20, 15, "13:57", "1", 0, "CM", false, 0, "") // 使用CellFormat()方法创建表格单元格
  643. // pdf.CellFormat(20, 15, "120/90", "1", 0, "CM", false, 0, "")
  644. // pdf.CellFormat(20, 15, "64", "1", 0, "CM", false, 0, "")
  645. // pdf.CellFormat(20, 15, "100", "1", 0, "CM", false, 0, "")
  646. // pdf.CellFormat(20, 15, "100", "1", 0, "CM", false, 0, "")
  647. // pdf.CellFormat(20, 15, "100", "1", 0, "CM", false, 0, "")
  648. // pdf.CellFormat(20, 15, "90", "1", 0, "CM", false, 0, "")
  649. // pdf.CellFormat(20, 15, "36.5", "1", 0, "CM", false, 0, "")
  650. // pdf.CellFormat(20, 15, "26", "1", 0, "CM", false, 0, "")
  651. // pdf.CellFormat(20, 15, "100", "1", 0, "CM", false, 0, "")
  652. // pdf.CellFormat(35, 15, "及时九嶷山", "1", 0, "CM", false, 0, "")
  653. //
  654. // y += 15 // 下一行起始位置的y坐标增加60(单元格高度)
  655. //}
  656. //x += 200.0 // 下一列起始位置的x坐标增加190(单元格宽度)
  657. //y = 10.0 // 行起始位置的y坐标重置为10
  658. //
  659. //pdf.Ln(2)
  660. //if err := pdf.OutputFileAndClose("6.pdf"); err != nil {
  661. // panic(err.Error())
  662. //}
  663. // 此处可以继续绘制表格的其他部分,例如内容行等。
  664. // ...
  665. // 保存PDF文档到文件
  666. //err := pdf.OutputFileAndClose("treatment_sheet_with_header.pdf")
  667. //if err != nil {
  668. // panic(err)
  669. //}
  670. this.ServeSuccessJSON(map[string]interface{}{
  671. //"sign": information,
  672. //"pdfBase64": pdfBase64,
  673. //"name": name,
  674. })
  675. }
  676. func (this *SignApiController) CreateQianshuUserName() {
  677. admin_user_id, _ := this.GetInt64("admin_user_id")
  678. orgId := this.GetAdminUserInfo().CurrentOrgId
  679. userName := service.GetLastAdminUserName(admin_user_id, orgId)
  680. idCardNumber := service.GetLastAdminUserIdCardNumber(admin_user_id, orgId)
  681. adminRole, _ := service.GetMobile(admin_user_id)
  682. //查询该医护人员是否已经签署了
  683. lastPerson, _ := service.GetLastPersonEnterPrise(admin_user_id, orgId)
  684. if len(lastPerson.UserId) > 0 {
  685. this.ServeDynamicFailJsonSend("已完成签署,无需再次签署")
  686. return
  687. }
  688. if len(lastPerson.UserId) == 0 {
  689. //去签署
  690. sign, userId := service.CreateQianshuUserName(userName, adminRole.Mobile, idCardNumber)
  691. err := service.UpdatePersionEnterPrise(lastPerson.ID, userId)
  692. fmt.Println(err)
  693. this.ServeSuccessJSON(map[string]interface{}{
  694. "sign": sign,
  695. "userId": userId,
  696. })
  697. }
  698. }
  699. func (this *SignApiController) CreateSdkSendInformation() {
  700. information, orderId := service.CreateSdkSendInformation()
  701. this.ServeSuccessJSON(map[string]interface{}{
  702. "information": information,
  703. "orderId": orderId,
  704. })
  705. }
  706. func (this *SignApiController) SavePdfInformation() {
  707. var name string
  708. information, pdfBase64 := service.SavePdfInformation(name)
  709. informationOne := service.ToCheckInformation(pdfBase64)
  710. maprequest := make(map[string]interface{})
  711. Receiver := make(map[string]interface{})
  712. //业务单号
  713. maprequest["orderId"] = "13318464642"
  714. maprequest["signTitle"] = "举报合同"
  715. //file := "C:/Users/28169/Desktop/2.pdf"
  716. file := "/swspan/gopath/src/XT_New/static/6.pdf"
  717. fileBytes, _ := ioutil.ReadFile(file) // 读取file
  718. contractBase64 := base64.StdEncoding.EncodeToString(fileBytes) // 加密成base64字符串
  719. //文件获取方式
  720. maprequest["fileType"] = 1
  721. maprequest["pdfBase64"] = contractBase64
  722. //合同内容
  723. maprequest["fileContent"] = contractBase64
  724. //签署用户人ID
  725. maprequest["userId"] = "JMO9U8JH4TN8E3QOI0GUVUF2"
  726. //业务单号
  727. maprequest["receiver"] = Receiver
  728. //签署人账号
  729. Receiver["account"] = "13318464642"
  730. //签署个人类型 1.个人 2.企业
  731. Receiver["signerType"] = 1
  732. //签署人姓名
  733. Receiver["realName "] = "马文强"
  734. // 证件类型
  735. Receiver["cardType"] = 0
  736. //证件编码
  737. Receiver["cardNumber"] = "430526199408156511"
  738. stepStamper := make(map[string]interface{})
  739. keywordSignControls := make([]map[string]interface{}, 0)
  740. //预冲者样式
  741. inputArrOne := make(map[string]interface{})
  742. inputArrOne["sealName"] = "1"
  743. inputArrOne["keyword"] = "医生签名"
  744. inputArrOne["pages"] = "0"
  745. inputArrOne["offsetX"] = "100"
  746. inputArrOne["offsetY"] = "100"
  747. keywordSignControls = append(keywordSignControls, inputArrOne)
  748. //穿刺者样式
  749. //inputArr := make(map[string]interface{})
  750. //inputArr["sealName"] = "2"
  751. //inputArr["keyword"] = "治疗护士"
  752. //inputArr["pages"] = "1"
  753. //inputArr["offsetX"] = "100"
  754. //inputArr["offsetY"] = "0"
  755. //
  756. //keywordSignControls = append(keywordSignControls, inputArr)
  757. //
  758. ////上机者
  759. //inputArrSix := make(map[string]interface{})
  760. //inputArrSix["sealName"] = "3"
  761. //inputArrSix["keyword"] = "核对护士"
  762. //inputArrSix["pages"] = "1"
  763. //inputArrSix["offsetX"] = "100"
  764. //inputArrSix["offsetY"] = "0"
  765. //
  766. //keywordSignControls = append(keywordSignControls, inputArrSix)
  767. //
  768. //stepStamper["keywordSignControls"] = keywordSignControls
  769. //
  770. ////医生签名
  771. //inputArrSeven := make(map[string]interface{})
  772. //inputArrSeven["sealName"] = "4"
  773. //inputArrSeven["keyword"] = "医生签名"
  774. //inputArrSeven["pages"] = "1"
  775. //inputArrSeven["offsetX"] = "100"
  776. //inputArrSeven["offsetY"] = "0"
  777. //
  778. //keywordSignControls = append(keywordSignControls, inputArrSeven)
  779. //
  780. //stepStamper["keywordSignControls"] = keywordSignControls
  781. //crossSignControls := make([]map[string]interface{}, 0)
  782. //
  783. //inputArrTwo := make(map[string]interface{})
  784. //inputArrTwo["sealName"] = "1"
  785. //inputArrTwo["positionX"] = "0"
  786. //inputArrTwo["positionY"] = "0"
  787. //inputArrTwo["pages"] = "0"
  788. //crossSignControls = append(crossSignControls, inputArrTwo)
  789. //
  790. //stepStamper["crossSignControls"] = crossSignControls
  791. //
  792. xySignControls := make([]map[string]interface{}, 0)
  793. inputArrThree := make(map[string]interface{})
  794. inputArrThree["sealName"] = "1"
  795. inputArrThree["positionX"] = "100"
  796. inputArrThree["positionY"] = "0"
  797. inputArrThree["pages"] = "0"
  798. xySignControls = append(xySignControls, inputArrThree)
  799. stepStamper["xySignControls"] = xySignControls
  800. maprequest["stepStamper"] = stepStamper
  801. seals := make([]map[string]interface{}, 0)
  802. //预冲者
  803. sealImagesList := make(map[string]interface{})
  804. fileOne := "/swspan/gopath/src/XT_New/static/huangzihui.jpg"
  805. fileBytesOne, _ := ioutil.ReadFile(fileOne) // 读取file
  806. contractBase64One := base64.StdEncoding.EncodeToString(fileBytesOne) // 加密成base64字符串
  807. sealImagesList["sealBase64"] = contractBase64One
  808. //控制签名的大小
  809. sealImagesList["width"] = "50"
  810. sealImagesList["height"] = "50"
  811. sealImagesList["verticalAlign"] = "middle"
  812. sealTextsList := make(map[string]interface{})
  813. sealTextsList["text"] = "2023年8月8日"
  814. sealTextsList["fontSize"] = "100"
  815. sealTextsList["fontColor"] = "#333333"
  816. sealTextsList["isTextArea"] = true
  817. sealTextsList["textAlign"] = 0
  818. sealTextsList["width"] = 150
  819. sealTextsList["height"] = 20
  820. sealsObj := make(map[string]interface{})
  821. sealsObj["sealWidth"] = "150"
  822. sealsObj["sealHeight"] = "150"
  823. sealsObj["sealName"] = "1"
  824. sealsObj["sealImage"] = sealImagesList
  825. sealsObj["sealText"] = sealTextsList
  826. seals = append(seals, sealsObj)
  827. //穿刺者
  828. //sealImagesListOne := make(map[string]interface{})
  829. //
  830. //fileTwo := "/swspan/gopath/src/XT_New/static/huangjunji.jpg"
  831. //
  832. //fileBytesTwo, _ := ioutil.ReadFile(fileTwo) // 读取file
  833. //
  834. //contractBase64Two := base64.StdEncoding.EncodeToString(fileBytesTwo) // 加密成base64字符串
  835. //sealImagesListOne["sealBase64"] = contractBase64Two
  836. ////控制签名的大小
  837. //sealImagesListOne["width"] = "50"
  838. //sealImagesListOne["height"] = "50"
  839. //sealImagesListOne["verticalAlign"] = "middle"
  840. //
  841. //sealTextsListOne := make(map[string]interface{})
  842. //sealTextsListOne["text"] = "2023年8月8日"
  843. //sealTextsListOne["fontSize"] = "100"
  844. //sealTextsListOne["fontColor"] = "100"
  845. //sealTextsListOne["isTextArea"] = true
  846. //sealTextsListOne["textAlign"] = 0
  847. //sealTextsListOne["width"] = 150
  848. //sealTextsListOne["height"] = 20
  849. //
  850. //sealsObjOne := make(map[string]interface{})
  851. //
  852. //sealsObjOne["sealWidth"] = "150"
  853. //sealsObjOne["sealHeight"] = "150"
  854. //sealsObjOne["sealName"] = "2"
  855. //sealsObjOne["sealImage"] = sealImagesListOne
  856. //sealsObjOne["sealText"] = sealTextsListOne
  857. //seals = append(seals, sealsObjOne)
  858. //间隔签名
  859. //上机者
  860. //sealImagesListTwo := make(map[string]interface{})
  861. //fileThree := "/swspan/gopath/src/XT_New/static/jianfeixia.jpg"
  862. //fileBytesThree, _ := ioutil.ReadFile(fileThree) // 读取file
  863. //contractBase64Three := base64.StdEncoding.EncodeToString(fileBytesThree) // 加密成base64字符串
  864. //sealImagesListTwo["sealBase64"] = contractBase64Three
  865. ////控制签名的大小
  866. //sealImagesListTwo["width"] = "50"
  867. //sealImagesListTwo["height"] = "50"
  868. //sealImagesListTwo["verticalAlign"] = "middle"
  869. //
  870. //sealTextsListTwo := make(map[string]interface{})
  871. //sealTextsListTwo["text"] = "2023年8月8日"
  872. //sealTextsListTwo["fontSize"] = "100"
  873. //sealTextsListTwo["fontColor"] = "100"
  874. //sealTextsListTwo["isTextArea"] = true
  875. //sealTextsListTwo["textAlign"] = 0
  876. //sealTextsListTwo["width"] = 150
  877. //sealTextsListTwo["height"] = 20
  878. //
  879. //sealsObjTwo := make(map[string]interface{})
  880. //
  881. //sealsObjTwo["sealWidth"] = "150"
  882. //sealsObjTwo["sealHeight"] = "150"
  883. //sealsObjTwo["sealName"] = "3"
  884. //sealsObjTwo["sealImage"] = sealImagesListTwo
  885. //sealsObjTwo["sealText"] = sealTextsListTwo
  886. //seals = append(seals, sealsObjTwo)
  887. //医生签名
  888. //sealImagesListThree := make(map[string]interface{})
  889. //fileFour := "/swspan/gopath/src/XT_New/static/jianfeixia.jpg"
  890. //fileBytesFour, _ := ioutil.ReadFile(fileFour) // 读取file
  891. //contractBase64Tour := base64.StdEncoding.EncodeToString(fileBytesFour) // 加密成base64字符串
  892. //sealImagesListThree["sealBase64"] = contractBase64Tour
  893. ////控制签名的大小
  894. //sealImagesListThree["width"] = "50"
  895. //sealImagesListThree["height"] = "50"
  896. //sealImagesListThree["verticalAlign"] = "middle"
  897. //
  898. //sealTextsListThree := make(map[string]interface{})
  899. //sealTextsListThree["text"] = "2023年8月8日"
  900. //sealTextsListThree["fontSize"] = "100"
  901. //sealTextsListThree["fontColor"] = "100"
  902. //sealTextsListThree["isTextArea"] = true
  903. //sealTextsListThree["textAlign"] = 0
  904. //sealTextsListThree["width"] = 150
  905. //sealTextsListThree["height"] = 20
  906. //
  907. //sealsObjThree := make(map[string]interface{})
  908. //
  909. //sealsObjThree["sealWidth"] = "150"
  910. //sealsObjThree["sealHeight"] = "150"
  911. //sealsObjThree["sealName"] = "4"
  912. //sealsObjThree["sealImage"] = sealImagesListThree
  913. //sealsObjThree["sealText"] = sealTextsListThree
  914. //seals = append(seals, sealsObjThree)
  915. maprequest["seals"] = seals
  916. maprequest["isUserWishes"] = true
  917. maprequest["phone"] = "13318464642"
  918. maprequest["verificationCode"] = "18888888888"
  919. this.ServeSuccessJSON(map[string]interface{}{
  920. "information": information,
  921. "orderId": pdfBase64,
  922. "informationOne": informationOne,
  923. "maprequest": maprequest,
  924. })
  925. }
  926. func (this *SignApiController) ToCheckInformation() {
  927. var name string
  928. information, pdfBase64 := service.SavePdfInformation(name)
  929. informationOne := service.ToCheckInformation(pdfBase64)
  930. this.ServeSuccessJSON(map[string]interface{}{
  931. "information": information,
  932. "informationOne": informationOne,
  933. })
  934. }
  935. func (this *SignApiController) ToAutoDrug() {
  936. //advice, _ := service.GetAutoDrugList(9919)
  937. //
  938. //for _, item := range advice {
  939. // //查找该患者是否出库过
  940. // outList, _ := service.GetDrugAutoWarehouseOutList(item.PatientId, item.UserOrgId, item.DrugId, item.AdviceDate)
  941. // if outList.ID == 0 {
  942. // service.HisDrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
  943. // }
  944. //}
  945. //prescriptionList, _ := service.GetAllPrescriptionList(10579)
  946. list, _ := service.GetScheduleListByOrder(10579)
  947. for _, item := range list {
  948. soluton, _ := service.GetDialysisSoluton(item.PatientId, item.ModeId)
  949. var DialysisMachineName string
  950. if len(soluton.DialysisDialyszers) > 0 {
  951. DialysisMachineName = soluton.DialysisDialyszers
  952. }
  953. //if len(soluton.DialyzerPerfusionApparatus) > 0 {
  954. // DialysisMachineName = DialysisMachineName + "," + soluton.DialyzerPerfusionApparatus
  955. //}
  956. if len(soluton.DialysisIrrigation) > 0 {
  957. DialysisMachineName = DialysisMachineName + "," + soluton.DialysisIrrigation
  958. }
  959. if len(soluton.DialysisStrainer) > 0 {
  960. DialysisMachineName = DialysisMachineName + "," + soluton.DialysisStrainer
  961. }
  962. DialysisMachineName = DialysisMachineName
  963. service.UpdateDialysisSchedule(item.ID, DialysisMachineName)
  964. }
  965. //for _, item := range prescriptionList {
  966. // var DialysisMachineName string
  967. // if len(item.DialysisDialyszers) > 0 {
  968. // DialysisMachineName = item.DialysisDialyszers
  969. // }
  970. // if len(item.DialyzerPerfusionApparatus) > 0 {
  971. // DialysisMachineName = DialysisMachineName + "," + item.DialyzerPerfusionApparatus
  972. // }
  973. //
  974. // if len(item.DialysisIrrigation) > 0 {
  975. // DialysisMachineName = DialysisMachineName + "," + item.DialysisIrrigation
  976. // }
  977. //
  978. // if len(item.DialysisStrainer) > 0 {
  979. // DialysisMachineName = DialysisMachineName + "," + item.DialysisStrainer
  980. // }
  981. // DialysisMachineName = DialysisMachineName
  982. // service.UpdateSchPatient(item.PatientId, item.RecordDate, item.UserOrgId, DialysisMachineName)
  983. //}
  984. this.ServeSuccessJSON(map[string]interface{}{
  985. "msg": "ok",
  986. })
  987. }
  988. func (this *SignApiController) ToAutoDiagnose() {
  989. orgId := this.GetAdminUserInfo().CurrentOrgId
  990. //order, _ := service.GetDialysisOrderTotalCount()
  991. //
  992. //for _, item := range order {
  993. //
  994. // service.ModifyPatient(item.PatientId, item.Count)
  995. //}
  996. //list, _ := service.GetNewAllpatient(orgId)
  997. //
  998. //for _, item := range list {
  999. // service.UpdateAllPatient(item.BloodId, item.Diagnose, item.UserOrgId)
  1000. //}
  1001. list, _ := service.GetAllDialysisOrder(14749)
  1002. for _, item := range list {
  1003. schedule, _ := service.GetLastScheduleByUserOrg(item.PatientId, item.DialysisDate, orgId, item.BedId, item.ZoneId, item.SchedualType)
  1004. service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, orgId, item.BedId, item.ZoneId, item.SchedualType, schedule.ID)
  1005. }
  1006. //drugList, _ := service.GetAllBaseDrugList(10318)
  1007. //for _, item := range drugList {
  1008. // service.UpdateDrugWarehouseInfoByDrug(item.ID, item.MinPrice, item.OrgId)
  1009. //
  1010. // //service.UpdateHisDoctorAdviceOne(item.ID, item.MinPrice, item.OrgId)
  1011. //}
  1012. //goodList, _ := service.GetAllGoodList(10571)
  1013. //for _, item := range goodList {
  1014. // service.UpdasteGoodWarehouseInfoByGood(item.ID, item.PackingPrice, item.OrgId)
  1015. //}
  1016. this.ServeSuccessJSON(map[string]interface{}{
  1017. "msg": "ok",
  1018. })
  1019. }
  1020. func (this *SignApiController) ToAutoJiaYou() {
  1021. list, _ := service.GetPrescriptionListOne(10579)
  1022. for _, item := range list {
  1023. schedule, _ := service.GetPatientScheduleById(item.PatientId, item.RecordDate)
  1024. var DialysisMachineName string
  1025. if len(item.DialysisDialyszers) > 0 {
  1026. DialysisMachineName = item.DialysisDialyszers
  1027. }
  1028. if len(item.DialysisIrrigation) > 0 {
  1029. DialysisMachineName = DialysisMachineName + "," + item.DialysisIrrigation
  1030. }
  1031. if len(item.DialysisStrainer) > 0 {
  1032. DialysisMachineName = DialysisMachineName + "," + item.DialysisStrainer
  1033. }
  1034. DialysisMachineName = DialysisMachineName
  1035. service.UpdateDialysisScheduleOne(schedule.ID, item.ModeId, DialysisMachineName)
  1036. }
  1037. }
  1038. func (this *SignApiController) GetFieldConfigList() {
  1039. orderList, _ := service.GetDialysisOrderByUserOrgId()
  1040. if len(orderList) > 0 {
  1041. filedConfigList, _ := service.GetFieldConfigList(9442)
  1042. for _, item := range orderList {
  1043. for _, it := range filedConfigList {
  1044. //查询该机构该模式是否有这个字段
  1045. fiedConfigObj, _ := service.GetFieldConfigByOrgId(item.UserOrgId, it.FiledNameCn, it.Module)
  1046. if fiedConfigObj.ID == 0 {
  1047. config := models.FiledConfig{
  1048. OrgId: item.UserOrgId,
  1049. Module: it.Module,
  1050. FiledName: it.FiledName,
  1051. FiledNameCn: it.FiledNameCn,
  1052. IsShow: 2,
  1053. CreateTime: time.Now().Unix(),
  1054. UpdateTime: time.Now().Unix(),
  1055. SysModule: it.SysModule,
  1056. IsWrite: it.IsWrite,
  1057. IsSecondMenu: it.IsSecondMenu,
  1058. }
  1059. service.CretedConfig(config)
  1060. }
  1061. }
  1062. }
  1063. }
  1064. //filedConfig, _ := service.GetFieldConfigGroupList(7)
  1065. //if len(filedConfig) > 0 {
  1066. // for _, item := range filedConfig {
  1067. // //查询该机构
  1068. // fiedConfigObj, _ := service.GetFieldConfigByOrgId(9442, item.FiledNameCn, item.Module)
  1069. //
  1070. // if fiedConfigObj.ID == 0 {
  1071. //
  1072. // config := models.FiledConfig{
  1073. // OrgId: 9442,
  1074. // Module: item.Module,
  1075. // FiledName: item.FiledName,
  1076. // FiledNameCn: item.FiledNameCn,
  1077. // IsShow: 2,
  1078. // CreateTime: time.Now().Unix(),
  1079. // UpdateTime: time.Now().Unix(),
  1080. // SysModule: item.SysModule,
  1081. // IsWrite: item.IsWrite,
  1082. // IsSecondMenu: item.IsSecondMenu,
  1083. // }
  1084. //
  1085. // service.CretedConfig(config)
  1086. // }
  1087. // }
  1088. //}
  1089. this.ServeSuccessJSON(map[string]interface{}{
  1090. "msg": "ok",
  1091. })
  1092. }