浏览代码

Merge branch 'master' of http://git.shengws.com/csx/gdyb

csx 1年前
父节点
当前提交
8e9cb85187
共有 2 个文件被更改,包括 21 次插入6 次删除
  1. 15 0
      controllers/sg/his_api_controller.go
  2. 6 6
      main.go

+ 15 - 0
controllers/sg/his_api_controller.go 查看文件

@@ -12354,3 +12354,18 @@ func (c *HisApiController) GetELeCertInfo(code string, operator_id string, opera
12354 12354
 	}
12355 12355
 	return DeleteExtraSpace(string(bytesData)), DeleteExtraSpace(string(pBusiCardInfo))
12356 12356
 }
12357
+
12358
+func DeleteExtraSpace(s string) string {
12359
+	//删除字符串中的多余空格,有多个空格时,仅保留一个空格
12360
+	s1 := strings.Replace(s, "  ", " ", -1)      //替换tab为空格
12361
+	regstr := "\\s{2,}"                          //两个及两个以上空格的正则表达式
12362
+	reg, _ := regexp.Compile(regstr)             //编译正则表达式
12363
+	s2 := make([]byte, len(s1))                  //定义字符数组切片
12364
+	copy(s2, s1)                                 //将字符串复制到切片
12365
+	spc_index := reg.FindStringIndex(string(s2)) //在字符串中搜索
12366
+	for len(spc_index) > 0 {                     //找到适配项
12367
+		s2 = append(s2[:spc_index[0]+1], s2[spc_index[1]:]...) //删除多余空格
12368
+		spc_index = reg.FindStringIndex(string(s2))            //继续在字符串中搜索
12369
+	}
12370
+	return string(s2)
12371
+}

+ 6 - 6
main.go 查看文件

@@ -5,7 +5,7 @@ import (
5 5
 	"fmt"
6 6
 	"gdyb/models"
7 7
 	_ "gdyb/routers"
8
-	//"gdyb/service"
8
+	"gdyb/service"
9 9
 
10 10
 	//"gdyb/service"
11 11
 	"github.com/astaxie/beego"
@@ -17,11 +17,11 @@ import (
17 17
 )
18 18
 
19 19
 func init() {
20
-	//service.ConnectDB()
21
-	//org_id, _ := beego.AppConfig.Int64("org_id")
22
-	//miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
23
-	//CreateLog(miConfig)
24
-	//UploadLog(miConfig)
20
+	service.ConnectDB()
21
+	org_id, _ := beego.AppConfig.Int64("org_id")
22
+	miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
23
+	CreateLog(miConfig)
24
+	UploadLog(miConfig)
25 25
 	//UploadSettleList(org_id)
26 26
 }
27 27
 func main() {