sign_api_controller.go 37KB

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