sign_api_controller.go 38KB

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