sign_api_controller.go 36KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232
  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. fmt.Println("WOOWOWOWOWOWOWOWOWOWOWWOOWOWWO")
  508. list, _ := service.GetAllPatientNew(10587)
  509. for _, item := range list {
  510. hans := item.Name // 要转换的汉字字符串
  511. // 创建一个拼音转换器
  512. p := pinyin.NewArgs()
  513. // 将汉字转为拼音
  514. pinyinSlice := pinyin.Pinyin(hans, p)
  515. // 输出拼音
  516. fmt.Println("Pinyin:", pinyinSlice)
  517. // 获取首字母
  518. firstLetter := ""
  519. for _, py := range pinyinSlice {
  520. if len(py) > 0 {
  521. firstLetter += string(py[0][0])
  522. }
  523. }
  524. item.FirstLetter = firstLetter
  525. service.UpdatePatientNew(item.ID, item.FirstLetter)
  526. // 输出首字母
  527. //fmt.Println("First Letter:", firstLetter)
  528. }
  529. //baseList, _ := service.GeteAllBaseList(10567)
  530. //for _, item := range baseList {
  531. // hans := item.DrugName // 要转换的汉字字符串
  532. // // 创建一个拼音转换器
  533. // p := pinyin.NewArgs()
  534. // // 将汉字转为拼音
  535. // pinyinSlice := pinyin.Pinyin(hans, p)
  536. // // 获取首字母
  537. // firstLetter := ""
  538. // for _, py := range pinyinSlice {
  539. // if len(py) > 0 {
  540. // firstLetter += string(py[0][0])
  541. // }
  542. // }
  543. // item.FirstLetter = firstLetter
  544. // service.UpdateBaseList(item.ID, item.FirstLetter)
  545. //}
  546. //pdf := gofpdf.New("P", "mm", "A4", "")
  547. //pdf.AddPage()
  548. //pdf.Text(5, 10, "血液净化治疗记录单")
  549. //
  550. //pdf.AddUTF8Font("simfang", "", "D:/go/src/pkg/mod/github.com/jung-kurt/gofpdf@v1.16.2/font/simfang.ttf")
  551. //pdf.SetFont("simfang", "", 20)
  552. //var title = "血液透析(滤过)记录表单"
  553. ////表格居中显示
  554. //pdf.Text(70, 10, title)
  555. //wd := pdf.GetStringWidth(title) + 100
  556. //fmt.Println("wd", wd)
  557. //pdf.SetY(100) //先要设置 Y,然后再设置 X。否则,会导致 X 失效
  558. //pdf.SetX((210 - wd) / 2) //水平居中的算法
  559. //var numuber = "张三"
  560. ////表格居中显示
  561. //pdf.SetFont("", "", 14) // 设置加粗字体和字号
  562. //pdf.Text(10, 20, "姓名:"+numuber)
  563. //pdf.SetFont("", "", 14) // 设置加粗字体和字号
  564. //pdf.Text(35, 20, "性别:"+"男")
  565. //pdf.SetFont("", "", 14) // 设置正常字体和字号
  566. //pdf.Text(60, 20, "年龄:"+"18")
  567. //pdf.SetFont("", "", 14) // 设置正常字体和字号
  568. //pdf.Text(90, 20, "门诊:"+"住院")
  569. //pdf.SetFont("", "", 14) // 设置正常字体和字号
  570. //pdf.Text(120, 20, "病区:"+"A区")
  571. //pdf.SetFont("", "", 14) // 设置正常字体和字号
  572. //pdf.Text(150, 20, "床号:"+"1号")
  573. //pdf.SetFont("", "", 14) // 设置正常字体和字号
  574. //pdf.Text(180, 20, "透析号:")
  575. //pdf.SetFont("", "", 14) // 设置正常字体和字号
  576. //pdf.Text(210, 20, "住院号/门诊号:")
  577. //pdf.SetFont("", "", 14) // 设置正常字体和字号
  578. ////表格居中显示
  579. //pdf.SetFont("", "", 14) // 设置加粗字体和字号
  580. //pdf.Text(10, 30, "入科方式:"+numuber)
  581. //pdf.SetFont("", "", 14) // 设置加粗字体和字号
  582. //pdf.Text(60, 30, "诊断:")
  583. //
  584. //pdf.AddUTF8Font("simfang", "", "D:/go/src/pkg/mod/github.com/jung-kurt/gofpdf@v1.16.2/font/simfang.ttf")
  585. //pdf.SetFont("simfang", "", 16) // 设置字体、字号
  586. //pdf.SetFillColor(200, 200, 200)
  587. ////// 设置起始位置
  588. //var x = 10.0
  589. //var y = 40.0
  590. //pdf.SetXY(x, y)
  591. //// 设置填充颜色
  592. //pdf.CellFormat(200, 15, "透析前情况", "1", 0, "CM", false, 0, "") // 使用CellFormat()方法创建表格单元格
  593. //param1: 单元格的宽,为0时表示一行,单位根据new()里面设置的来
  594. //param2: 单元格的高,不能为0,单位根据new()里面设置的来
  595. //param3: 单元格内容
  596. //param4: 边框样式,一个空字符串表示无边框,“1”表示全边框,一个或多个“L”,“T”,“R”和“B”分别表示边界左,上,右,下
  597. //param5: 表示调用后当前位置的位置。可能的值为0,接着当前行继续,1换行,2目前没有试过
  598. //param6: 字体的位置,水平对齐包括"L", “C"或"R”(左,中,右)。垂直对齐由包含控制"T", “M”, “B"或"A”(上,中,下,基线),可以组合,比如说LT,CM等等
  599. //param7: 是否填充单元格,需要调用SetFillColor()方法.默认false
  600. //param8: 内部超链接,没用过
  601. //param9: 超链接,没用过
  602. //pdf.AddUTF8Font("simfang", "", "D:/go/src/pkg/mod/github.com/jung-kurt/gofpdf@v1.16.2/font/simfang.ttf")
  603. //pdf.SetFont("simfang", "", 8) // 设置字体、字号
  604. //pdf.SetFillColor(200, 200, 200) // 设置填充颜色
  605. //
  606. //// 设置起始位置
  607. //var x = 10.0
  608. //var y = 40.0
  609. ////创建8行2列的表格
  610. //
  611. //for j := 0; j < 1; j++ {
  612. // // 填充每个单元格的内容
  613. // pdf.SetXY(x, y) // 设置当前位置
  614. // pdf.CellFormat(20, 15, "时间", "1", 0, "CM", false, 0, "") // 使用CellFormat()方法创建表格单元格
  615. // pdf.CellFormat(20, 15, "血压(mmHg)", "1", 0, "CM", false, 0, "")
  616. // pdf.CellFormat(20, 15, "脉搏(次/分)", "1", 0, "CM", false, 0, "")
  617. // pdf.CellFormat(20, 15, "呼吸(次/分)", "1", 0, "CM", false, 0, "")
  618. // pdf.CellFormat(20, 15, "血流量(ml/min)", "1", 0, "CM", false, 0, "")
  619. // pdf.CellFormat(20, 15, "静脉压(mmHg)", "1", 0, "CM", false, 0, "")
  620. // pdf.CellFormat(20, 15, "跨膜压(mmHg)", "1", 0, "CM", false, 0, "")
  621. // pdf.CellFormat(20, 15, "透析液温(℃)", "1", 0, "CM", false, 0, "")
  622. // pdf.CellFormat(20, 15, "钠浓度(mmol/L)", "1", 0, "CM", false, 0, "")
  623. // pdf.CellFormat(20, 15, "超滤量(ml) ", "1", 0, "CM", false, 0, "")
  624. // pdf.CellFormat(35, 15, "病情变化及处理", "1", 0, "CM", false, 0, "")
  625. //
  626. // y += 15 // 下一行起始位置的y坐标增加60(单元格高度)
  627. //}
  628. //for j := 0; j < 1; j++ {
  629. // // 填充每个单元格的内容
  630. // pdf.SetXY(x, y) // 设置当前位置
  631. // pdf.CellFormat(20, 15, "13:57", "1", 0, "CM", false, 0, "") // 使用CellFormat()方法创建表格单元格
  632. // pdf.CellFormat(20, 15, "120/90", "1", 0, "CM", false, 0, "")
  633. // pdf.CellFormat(20, 15, "64", "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, "100", "1", 0, "CM", false, 0, "")
  637. // pdf.CellFormat(20, 15, "90", "1", 0, "CM", false, 0, "")
  638. // pdf.CellFormat(20, 15, "36.5", "1", 0, "CM", false, 0, "")
  639. // pdf.CellFormat(20, 15, "26", "1", 0, "CM", false, 0, "")
  640. // pdf.CellFormat(20, 15, "100", "1", 0, "CM", false, 0, "")
  641. // pdf.CellFormat(35, 15, "及时九嶷山", "1", 0, "CM", false, 0, "")
  642. //
  643. // y += 15 // 下一行起始位置的y坐标增加60(单元格高度)
  644. //}
  645. //x += 200.0 // 下一列起始位置的x坐标增加190(单元格宽度)
  646. //y = 10.0 // 行起始位置的y坐标重置为10
  647. //
  648. //pdf.Ln(2)
  649. //if err := pdf.OutputFileAndClose("6.pdf"); err != nil {
  650. // panic(err.Error())
  651. //}
  652. // 此处可以继续绘制表格的其他部分,例如内容行等。
  653. // ...
  654. // 保存PDF文档到文件
  655. //err := pdf.OutputFileAndClose("treatment_sheet_with_header.pdf")
  656. //if err != nil {
  657. // panic(err)
  658. //}
  659. this.ServeSuccessJSON(map[string]interface{}{
  660. //"sign": information,
  661. //"pdfBase64": pdfBase64,
  662. //"name": name,
  663. })
  664. }
  665. func (this *SignApiController) CreateQianshuUserName() {
  666. admin_user_id, _ := this.GetInt64("admin_user_id")
  667. orgId := this.GetAdminUserInfo().CurrentOrgId
  668. userName := service.GetLastAdminUserName(admin_user_id, orgId)
  669. idCardNumber := service.GetLastAdminUserIdCardNumber(admin_user_id, orgId)
  670. adminRole, _ := service.GetMobile(admin_user_id)
  671. //查询该医护人员是否已经签署了
  672. lastPerson, _ := service.GetLastPersonEnterPrise(admin_user_id, orgId)
  673. if len(lastPerson.UserId) > 0 {
  674. this.ServeDynamicFailJsonSend("已完成签署,无需再次签署")
  675. return
  676. }
  677. if len(lastPerson.UserId) == 0 {
  678. //去签署
  679. sign, userId := service.CreateQianshuUserName(userName, adminRole.Mobile, idCardNumber)
  680. err := service.UpdatePersionEnterPrise(lastPerson.ID, userId)
  681. fmt.Println(err)
  682. this.ServeSuccessJSON(map[string]interface{}{
  683. "sign": sign,
  684. "userId": userId,
  685. })
  686. }
  687. }
  688. func (this *SignApiController) CreateSdkSendInformation() {
  689. information, orderId := service.CreateSdkSendInformation()
  690. this.ServeSuccessJSON(map[string]interface{}{
  691. "information": information,
  692. "orderId": orderId,
  693. })
  694. }
  695. func (this *SignApiController) SavePdfInformation() {
  696. var name string
  697. information, pdfBase64 := service.SavePdfInformation(name)
  698. informationOne := service.ToCheckInformation(pdfBase64)
  699. maprequest := make(map[string]interface{})
  700. Receiver := make(map[string]interface{})
  701. //业务单号
  702. maprequest["orderId"] = "13318464642"
  703. maprequest["signTitle"] = "举报合同"
  704. //file := "C:/Users/28169/Desktop/2.pdf"
  705. file := "/swspan/gopath/src/XT_New/static/6.pdf"
  706. fileBytes, _ := ioutil.ReadFile(file) // 读取file
  707. contractBase64 := base64.StdEncoding.EncodeToString(fileBytes) // 加密成base64字符串
  708. //文件获取方式
  709. maprequest["fileType"] = 1
  710. maprequest["pdfBase64"] = contractBase64
  711. //合同内容
  712. maprequest["fileContent"] = contractBase64
  713. //签署用户人ID
  714. maprequest["userId"] = "JMO9U8JH4TN8E3QOI0GUVUF2"
  715. //业务单号
  716. maprequest["receiver"] = Receiver
  717. //签署人账号
  718. Receiver["account"] = "13318464642"
  719. //签署个人类型 1.个人 2.企业
  720. Receiver["signerType"] = 1
  721. //签署人姓名
  722. Receiver["realName "] = "马文强"
  723. // 证件类型
  724. Receiver["cardType"] = 0
  725. //证件编码
  726. Receiver["cardNumber"] = "430526199408156511"
  727. stepStamper := make(map[string]interface{})
  728. keywordSignControls := make([]map[string]interface{}, 0)
  729. //预冲者样式
  730. inputArrOne := make(map[string]interface{})
  731. inputArrOne["sealName"] = "1"
  732. inputArrOne["keyword"] = "医生签名"
  733. inputArrOne["pages"] = "0"
  734. inputArrOne["offsetX"] = "100"
  735. inputArrOne["offsetY"] = "100"
  736. keywordSignControls = append(keywordSignControls, inputArrOne)
  737. //穿刺者样式
  738. //inputArr := make(map[string]interface{})
  739. //inputArr["sealName"] = "2"
  740. //inputArr["keyword"] = "治疗护士"
  741. //inputArr["pages"] = "1"
  742. //inputArr["offsetX"] = "100"
  743. //inputArr["offsetY"] = "0"
  744. //
  745. //keywordSignControls = append(keywordSignControls, inputArr)
  746. //
  747. ////上机者
  748. //inputArrSix := make(map[string]interface{})
  749. //inputArrSix["sealName"] = "3"
  750. //inputArrSix["keyword"] = "核对护士"
  751. //inputArrSix["pages"] = "1"
  752. //inputArrSix["offsetX"] = "100"
  753. //inputArrSix["offsetY"] = "0"
  754. //
  755. //keywordSignControls = append(keywordSignControls, inputArrSix)
  756. //
  757. //stepStamper["keywordSignControls"] = keywordSignControls
  758. //
  759. ////医生签名
  760. //inputArrSeven := make(map[string]interface{})
  761. //inputArrSeven["sealName"] = "4"
  762. //inputArrSeven["keyword"] = "医生签名"
  763. //inputArrSeven["pages"] = "1"
  764. //inputArrSeven["offsetX"] = "100"
  765. //inputArrSeven["offsetY"] = "0"
  766. //
  767. //keywordSignControls = append(keywordSignControls, inputArrSeven)
  768. //
  769. //stepStamper["keywordSignControls"] = keywordSignControls
  770. //crossSignControls := make([]map[string]interface{}, 0)
  771. //
  772. //inputArrTwo := make(map[string]interface{})
  773. //inputArrTwo["sealName"] = "1"
  774. //inputArrTwo["positionX"] = "0"
  775. //inputArrTwo["positionY"] = "0"
  776. //inputArrTwo["pages"] = "0"
  777. //crossSignControls = append(crossSignControls, inputArrTwo)
  778. //
  779. //stepStamper["crossSignControls"] = crossSignControls
  780. //
  781. xySignControls := make([]map[string]interface{}, 0)
  782. inputArrThree := make(map[string]interface{})
  783. inputArrThree["sealName"] = "1"
  784. inputArrThree["positionX"] = "100"
  785. inputArrThree["positionY"] = "0"
  786. inputArrThree["pages"] = "0"
  787. xySignControls = append(xySignControls, inputArrThree)
  788. stepStamper["xySignControls"] = xySignControls
  789. maprequest["stepStamper"] = stepStamper
  790. seals := make([]map[string]interface{}, 0)
  791. //预冲者
  792. sealImagesList := make(map[string]interface{})
  793. fileOne := "/swspan/gopath/src/XT_New/static/huangzihui.jpg"
  794. fileBytesOne, _ := ioutil.ReadFile(fileOne) // 读取file
  795. contractBase64One := base64.StdEncoding.EncodeToString(fileBytesOne) // 加密成base64字符串
  796. sealImagesList["sealBase64"] = contractBase64One
  797. //控制签名的大小
  798. sealImagesList["width"] = "50"
  799. sealImagesList["height"] = "50"
  800. sealImagesList["verticalAlign"] = "middle"
  801. sealTextsList := make(map[string]interface{})
  802. sealTextsList["text"] = "2023年8月8日"
  803. sealTextsList["fontSize"] = "100"
  804. sealTextsList["fontColor"] = "#333333"
  805. sealTextsList["isTextArea"] = true
  806. sealTextsList["textAlign"] = 0
  807. sealTextsList["width"] = 150
  808. sealTextsList["height"] = 20
  809. sealsObj := make(map[string]interface{})
  810. sealsObj["sealWidth"] = "150"
  811. sealsObj["sealHeight"] = "150"
  812. sealsObj["sealName"] = "1"
  813. sealsObj["sealImage"] = sealImagesList
  814. sealsObj["sealText"] = sealTextsList
  815. seals = append(seals, sealsObj)
  816. //穿刺者
  817. //sealImagesListOne := make(map[string]interface{})
  818. //
  819. //fileTwo := "/swspan/gopath/src/XT_New/static/huangjunji.jpg"
  820. //
  821. //fileBytesTwo, _ := ioutil.ReadFile(fileTwo) // 读取file
  822. //
  823. //contractBase64Two := base64.StdEncoding.EncodeToString(fileBytesTwo) // 加密成base64字符串
  824. //sealImagesListOne["sealBase64"] = contractBase64Two
  825. ////控制签名的大小
  826. //sealImagesListOne["width"] = "50"
  827. //sealImagesListOne["height"] = "50"
  828. //sealImagesListOne["verticalAlign"] = "middle"
  829. //
  830. //sealTextsListOne := make(map[string]interface{})
  831. //sealTextsListOne["text"] = "2023年8月8日"
  832. //sealTextsListOne["fontSize"] = "100"
  833. //sealTextsListOne["fontColor"] = "100"
  834. //sealTextsListOne["isTextArea"] = true
  835. //sealTextsListOne["textAlign"] = 0
  836. //sealTextsListOne["width"] = 150
  837. //sealTextsListOne["height"] = 20
  838. //
  839. //sealsObjOne := make(map[string]interface{})
  840. //
  841. //sealsObjOne["sealWidth"] = "150"
  842. //sealsObjOne["sealHeight"] = "150"
  843. //sealsObjOne["sealName"] = "2"
  844. //sealsObjOne["sealImage"] = sealImagesListOne
  845. //sealsObjOne["sealText"] = sealTextsListOne
  846. //seals = append(seals, sealsObjOne)
  847. //间隔签名
  848. //上机者
  849. //sealImagesListTwo := make(map[string]interface{})
  850. //fileThree := "/swspan/gopath/src/XT_New/static/jianfeixia.jpg"
  851. //fileBytesThree, _ := ioutil.ReadFile(fileThree) // 读取file
  852. //contractBase64Three := base64.StdEncoding.EncodeToString(fileBytesThree) // 加密成base64字符串
  853. //sealImagesListTwo["sealBase64"] = contractBase64Three
  854. ////控制签名的大小
  855. //sealImagesListTwo["width"] = "50"
  856. //sealImagesListTwo["height"] = "50"
  857. //sealImagesListTwo["verticalAlign"] = "middle"
  858. //
  859. //sealTextsListTwo := make(map[string]interface{})
  860. //sealTextsListTwo["text"] = "2023年8月8日"
  861. //sealTextsListTwo["fontSize"] = "100"
  862. //sealTextsListTwo["fontColor"] = "100"
  863. //sealTextsListTwo["isTextArea"] = true
  864. //sealTextsListTwo["textAlign"] = 0
  865. //sealTextsListTwo["width"] = 150
  866. //sealTextsListTwo["height"] = 20
  867. //
  868. //sealsObjTwo := make(map[string]interface{})
  869. //
  870. //sealsObjTwo["sealWidth"] = "150"
  871. //sealsObjTwo["sealHeight"] = "150"
  872. //sealsObjTwo["sealName"] = "3"
  873. //sealsObjTwo["sealImage"] = sealImagesListTwo
  874. //sealsObjTwo["sealText"] = sealTextsListTwo
  875. //seals = append(seals, sealsObjTwo)
  876. //医生签名
  877. //sealImagesListThree := make(map[string]interface{})
  878. //fileFour := "/swspan/gopath/src/XT_New/static/jianfeixia.jpg"
  879. //fileBytesFour, _ := ioutil.ReadFile(fileFour) // 读取file
  880. //contractBase64Tour := base64.StdEncoding.EncodeToString(fileBytesFour) // 加密成base64字符串
  881. //sealImagesListThree["sealBase64"] = contractBase64Tour
  882. ////控制签名的大小
  883. //sealImagesListThree["width"] = "50"
  884. //sealImagesListThree["height"] = "50"
  885. //sealImagesListThree["verticalAlign"] = "middle"
  886. //
  887. //sealTextsListThree := make(map[string]interface{})
  888. //sealTextsListThree["text"] = "2023年8月8日"
  889. //sealTextsListThree["fontSize"] = "100"
  890. //sealTextsListThree["fontColor"] = "100"
  891. //sealTextsListThree["isTextArea"] = true
  892. //sealTextsListThree["textAlign"] = 0
  893. //sealTextsListThree["width"] = 150
  894. //sealTextsListThree["height"] = 20
  895. //
  896. //sealsObjThree := make(map[string]interface{})
  897. //
  898. //sealsObjThree["sealWidth"] = "150"
  899. //sealsObjThree["sealHeight"] = "150"
  900. //sealsObjThree["sealName"] = "4"
  901. //sealsObjThree["sealImage"] = sealImagesListThree
  902. //sealsObjThree["sealText"] = sealTextsListThree
  903. //seals = append(seals, sealsObjThree)
  904. maprequest["seals"] = seals
  905. maprequest["isUserWishes"] = true
  906. maprequest["phone"] = "13318464642"
  907. maprequest["verificationCode"] = "18888888888"
  908. this.ServeSuccessJSON(map[string]interface{}{
  909. "information": information,
  910. "orderId": pdfBase64,
  911. "informationOne": informationOne,
  912. "maprequest": maprequest,
  913. })
  914. }
  915. func (this *SignApiController) ToCheckInformation() {
  916. var name string
  917. information, pdfBase64 := service.SavePdfInformation(name)
  918. informationOne := service.ToCheckInformation(pdfBase64)
  919. this.ServeSuccessJSON(map[string]interface{}{
  920. "information": information,
  921. "informationOne": informationOne,
  922. })
  923. }
  924. func (this *SignApiController) ToAutoDrug() {
  925. //advice, _ := service.GetAutoDrugList(9919)
  926. //
  927. //for _, item := range advice {
  928. // //查找该患者是否出库过
  929. // outList, _ := service.GetDrugAutoWarehouseOutList(item.PatientId, item.UserOrgId, item.DrugId, item.AdviceDate)
  930. // if outList.ID == 0 {
  931. // service.HisDrugsDelivery(item.UserOrgId, item.ExecutionStaff, item)
  932. // }
  933. //}
  934. //prescriptionList, _ := service.GetAllPrescriptionList(10579)
  935. list, _ := service.GetScheduleListByOrder(10579)
  936. for _, item := range list {
  937. soluton, _ := service.GetDialysisSoluton(item.PatientId, item.ModeId)
  938. var DialysisMachineName string
  939. if len(soluton.DialysisDialyszers) > 0 {
  940. DialysisMachineName = soluton.DialysisDialyszers
  941. }
  942. //if len(soluton.DialyzerPerfusionApparatus) > 0 {
  943. // DialysisMachineName = DialysisMachineName + "," + soluton.DialyzerPerfusionApparatus
  944. //}
  945. if len(soluton.DialysisIrrigation) > 0 {
  946. DialysisMachineName = DialysisMachineName + "," + soluton.DialysisIrrigation
  947. }
  948. if len(soluton.DialysisStrainer) > 0 {
  949. DialysisMachineName = DialysisMachineName + "," + soluton.DialysisStrainer
  950. }
  951. DialysisMachineName = DialysisMachineName
  952. service.UpdateDialysisSchedule(item.ID, DialysisMachineName)
  953. }
  954. //for _, item := range prescriptionList {
  955. // var DialysisMachineName string
  956. // if len(item.DialysisDialyszers) > 0 {
  957. // DialysisMachineName = item.DialysisDialyszers
  958. // }
  959. // if len(item.DialyzerPerfusionApparatus) > 0 {
  960. // DialysisMachineName = DialysisMachineName + "," + item.DialyzerPerfusionApparatus
  961. // }
  962. //
  963. // if len(item.DialysisIrrigation) > 0 {
  964. // DialysisMachineName = DialysisMachineName + "," + item.DialysisIrrigation
  965. // }
  966. //
  967. // if len(item.DialysisStrainer) > 0 {
  968. // DialysisMachineName = DialysisMachineName + "," + item.DialysisStrainer
  969. // }
  970. // DialysisMachineName = DialysisMachineName
  971. // service.UpdateSchPatient(item.PatientId, item.RecordDate, item.UserOrgId, DialysisMachineName)
  972. //}
  973. this.ServeSuccessJSON(map[string]interface{}{
  974. "msg": "ok",
  975. })
  976. }
  977. func (this *SignApiController) ToAutoDiagnose() {
  978. orgId := this.GetAdminUserInfo().CurrentOrgId
  979. list, _ := service.GetNewAllpatient(orgId)
  980. for _, item := range list {
  981. service.UpdateAllPatient(item.BloodId, item.Diagnose, item.UserOrgId)
  982. }
  983. //list, _ := service.GetAllDialysisOrder(10579)
  984. //for _, item := range list {
  985. // service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, 10579, item.BedId, item.ZoneId, item.SchedualType)
  986. //}
  987. //this.ServeSuccessJSON(map[string]interface{}{
  988. // "msg": "ok",
  989. //})
  990. }