sign_api_controller.go 37KB

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