sign_api_controller.go 36KB

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