sign_api_controller.go 38KB

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