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(10579)
  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(10587)
  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. //order, _ := service.GetDialysisOrderTotalCount()
  981. //
  982. //for _, item := range order {
  983. //
  984. // service.ModifyPatient(item.PatientId, item.Count)
  985. //}
  986. list, _ := service.GetNewAllpatient(orgId)
  987. for _, item := range list {
  988. service.UpdateAllPatient(item.BloodId, item.Diagnose, item.UserOrgId)
  989. }
  990. //list, _ := service.GetAllDialysisOrder(10579)
  991. //for _, item := range list {
  992. // service.UpdateScheduleByOrder(item.PatientId, item.DialysisDate, 10579, item.BedId, item.ZoneId, item.SchedualType)
  993. //}
  994. //drugList, _ := service.GetAllBaseDrugList(10571)
  995. //for _, item := range drugList {
  996. // //service.UpdateDrugWarehouseInfoByDrug(item.ID, item.MinPrice, item.OrgId)
  997. //
  998. // service.UpdateHisDoctorAdviceOne(item.ID, item.MinPrice, item.OrgId)
  999. //}
  1000. //goodList, _ := service.GetAllGoodList(10571)
  1001. //for _, item := range goodList {
  1002. // service.UpdasteGoodWarehouseInfoByGood(item.ID, item.PackingPrice, item.OrgId)
  1003. //}
  1004. this.ServeSuccessJSON(map[string]interface{}{
  1005. "msg": "ok",
  1006. })
  1007. }
  1008. func (this *SignApiController) ToAutoJiaYou() {
  1009. list, _ := service.GetPrescriptionListOne(10579)
  1010. for _, item := range list {
  1011. schedule, _ := service.GetPatientScheduleById(item.PatientId, item.RecordDate)
  1012. var DialysisMachineName string
  1013. if len(item.DialysisDialyszers) > 0 {
  1014. DialysisMachineName = item.DialysisDialyszers
  1015. }
  1016. if len(item.DialysisIrrigation) > 0 {
  1017. DialysisMachineName = DialysisMachineName + "," + item.DialysisIrrigation
  1018. }
  1019. if len(item.DialysisStrainer) > 0 {
  1020. DialysisMachineName = DialysisMachineName + "," + item.DialysisStrainer
  1021. }
  1022. DialysisMachineName = DialysisMachineName
  1023. service.UpdateDialysisScheduleOne(schedule.ID, item.ModeId, DialysisMachineName)
  1024. }
  1025. }