Browse Source

Merge branch '20230223_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20230223_xt_api_new_branch

陈少旭 1 year ago
parent
commit
e25540fdc8

+ 81 - 79
controllers/sign_api_controller.go View File

@@ -8,6 +8,7 @@ import (
8 8
 	"fmt"
9 9
 	"github.com/astaxie/beego"
10 10
 	"github.com/jung-kurt/gofpdf"
11
+	"github.com/mozillazg/go-pinyin"
11 12
 	"io/ioutil"
12 13
 	"time"
13 14
 )
@@ -658,80 +659,81 @@ func (this *SignApiController) GetEnterPriseDetail() {
658 659
 func (this *SignApiController) UploadPrintOrder() {
659 660
 
660 661
 	fmt.Println("WOOWOWOWOWOWOWOWOWOWOWWOOWOWWO")
661
-	//list, _ := service.GetAllPatientNew(10188)
662
-	//for _, item := range list {
663
-	//
664
-	//	hans := item.Name // 要转换的汉字字符串
665
-	//	// 创建一个拼音转换器
666
-	//	p := pinyin.NewArgs()
667
-	//
668
-	//	// 将汉字转为拼音
669
-	//	pinyinSlice := pinyin.Pinyin(hans, p)
670
-	//
671
-	//	// 输出拼音
672
-	//	fmt.Println("Pinyin:", pinyinSlice)
662
+	list, _ := service.GetAllPatientNew(10579)
663
+	for _, item := range list {
664
+
665
+		hans := item.Name // 要转换的汉字字符串
666
+		// 创建一个拼音转换器
667
+
668
+		p := pinyin.NewArgs()
669
+
670
+		// 将汉字转为拼音
671
+		pinyinSlice := pinyin.Pinyin(hans, p)
672
+
673
+		// 输出拼音
674
+		fmt.Println("Pinyin:", pinyinSlice)
675
+
676
+		// 获取首字母
677
+		firstLetter := ""
678
+		for _, py := range pinyinSlice {
679
+			if len(py) > 0 {
680
+				firstLetter += string(py[0][0])
681
+			}
682
+		}
683
+
684
+		item.FirstLetter = firstLetter
685
+		service.UpdatePatientNew(item.ID, item.FirstLetter)
686
+		// 输出首字母
687
+		//fmt.Println("First Letter:", firstLetter)
688
+	}
689
+
690
+	//pdf := gofpdf.New("P", "mm", "A4", "")
691
+	//pdf.AddPage()
692
+	//pdf.Text(5, 10, "血液净化治疗记录单")
673 693
 	//
674
-	//	// 获取首字母
675
-	//	firstLetter := ""
676
-	//	for _, py := range pinyinSlice {
677
-	//		if len(py) > 0 {
678
-	//			firstLetter += string(py[0][0])
679
-	//		}
680
-	//	}
694
+	//pdf.AddUTF8Font("simfang", "", "D:/go/src/pkg/mod/github.com/jung-kurt/gofpdf@v1.16.2/font/simfang.ttf")
695
+	//pdf.SetFont("simfang", "", 20)
696
+	//var title = "血液透析(滤过)记录表单"
697
+	////表格居中显示
698
+	//pdf.Text(70, 10, title)
699
+	//wd := pdf.GetStringWidth(title) + 100
700
+	//fmt.Println("wd", wd)
701
+	//pdf.SetY(100)            //先要设置 Y,然后再设置 X。否则,会导致 X 失效
702
+	//pdf.SetX((210 - wd) / 2) //水平居中的算法
703
+	//var numuber = "张三"
704
+	////表格居中显示
705
+	//pdf.SetFont("", "", 14) // 设置加粗字体和字号
706
+	//pdf.Text(10, 20, "姓名:"+numuber)
707
+	//pdf.SetFont("", "", 14) // 设置加粗字体和字号
708
+	//pdf.Text(35, 20, "性别:"+"男")
709
+	//pdf.SetFont("", "", 14) // 设置正常字体和字号
710
+	//pdf.Text(60, 20, "年龄:"+"18")
711
+	//pdf.SetFont("", "", 14) // 设置正常字体和字号
712
+	//pdf.Text(90, 20, "门诊:"+"住院")
713
+	//pdf.SetFont("", "", 14) // 设置正常字体和字号
714
+	//pdf.Text(120, 20, "病区:"+"A区")
715
+	//pdf.SetFont("", "", 14) // 设置正常字体和字号
716
+	//pdf.Text(150, 20, "床号:"+"1号")
717
+	//pdf.SetFont("", "", 14) // 设置正常字体和字号
718
+	//pdf.Text(180, 20, "透析号:")
719
+	//pdf.SetFont("", "", 14) // 设置正常字体和字号
720
+	//pdf.Text(210, 20, "住院号/门诊号:")
721
+	//pdf.SetFont("", "", 14) // 设置正常字体和字号
722
+	////表格居中显示
723
+	//pdf.SetFont("", "", 14) // 设置加粗字体和字号
724
+	//pdf.Text(10, 30, "入科方式:"+numuber)
725
+	//pdf.SetFont("", "", 14) // 设置加粗字体和字号
726
+	//pdf.Text(60, 30, "诊断:")
681 727
 	//
682
-	//	item.FirstLetter = firstLetter
683
-	//	service.UpdatePatientNew(item.ID, item.FirstLetter)
684
-	//	// 输出首字母
685
-	//	//fmt.Println("First Letter:", firstLetter)
686
-	//}
687
-
688
-	pdf := gofpdf.New("P", "mm", "A4", "")
689
-	pdf.AddPage()
690
-	pdf.Text(5, 10, "血液净化治疗记录单")
691
-
692
-	pdf.AddUTF8Font("simfang", "", "D:/go/src/pkg/mod/github.com/jung-kurt/gofpdf@v1.16.2/font/simfang.ttf")
693
-	pdf.SetFont("simfang", "", 20)
694
-	var title = "血液透析(滤过)记录表单"
695
-	//表格居中显示
696
-	pdf.Text(70, 10, title)
697
-	wd := pdf.GetStringWidth(title) + 100
698
-	fmt.Println("wd", wd)
699
-	pdf.SetY(100)            //先要设置 Y,然后再设置 X。否则,会导致 X 失效
700
-	pdf.SetX((210 - wd) / 2) //水平居中的算法
701
-	var numuber = "张三"
702
-	//表格居中显示
703
-	pdf.SetFont("", "", 14) // 设置加粗字体和字号
704
-	pdf.Text(10, 20, "姓名:"+numuber)
705
-	pdf.SetFont("", "", 14) // 设置加粗字体和字号
706
-	pdf.Text(35, 20, "性别:"+"男")
707
-	pdf.SetFont("", "", 14) // 设置正常字体和字号
708
-	pdf.Text(60, 20, "年龄:"+"18")
709
-	pdf.SetFont("", "", 14) // 设置正常字体和字号
710
-	pdf.Text(90, 20, "门诊:"+"住院")
711
-	pdf.SetFont("", "", 14) // 设置正常字体和字号
712
-	pdf.Text(120, 20, "病区:"+"A区")
713
-	pdf.SetFont("", "", 14) // 设置正常字体和字号
714
-	pdf.Text(150, 20, "床号:"+"1号")
715
-	pdf.SetFont("", "", 14) // 设置正常字体和字号
716
-	pdf.Text(180, 20, "透析号:")
717
-	pdf.SetFont("", "", 14) // 设置正常字体和字号
718
-	pdf.Text(210, 20, "住院号/门诊号:")
719
-	pdf.SetFont("", "", 14) // 设置正常字体和字号
720
-	//表格居中显示
721
-	pdf.SetFont("", "", 14) // 设置加粗字体和字号
722
-	pdf.Text(10, 30, "入科方式:"+numuber)
723
-	pdf.SetFont("", "", 14) // 设置加粗字体和字号
724
-	pdf.Text(60, 30, "诊断:")
725
-
726
-	pdf.AddUTF8Font("simfang", "", "D:/go/src/pkg/mod/github.com/jung-kurt/gofpdf@v1.16.2/font/simfang.ttf")
727
-	pdf.SetFont("simfang", "", 16) // 设置字体、字号
728
-	pdf.SetFillColor(200, 200, 200)
729
-	//// 设置起始位置
730
-	var x = 10.0
731
-	var y = 40.0
732
-	pdf.SetXY(x, y)
733
-	// 设置填充颜色
734
-	pdf.CellFormat(200, 15, "透析前情况", "1", 0, "CM", false, 0, "") // 使用CellFormat()方法创建表格单元格
728
+	//pdf.AddUTF8Font("simfang", "", "D:/go/src/pkg/mod/github.com/jung-kurt/gofpdf@v1.16.2/font/simfang.ttf")
729
+	//pdf.SetFont("simfang", "", 16) // 设置字体、字号
730
+	//pdf.SetFillColor(200, 200, 200)
731
+	////// 设置起始位置
732
+	//var x = 10.0
733
+	//var y = 40.0
734
+	//pdf.SetXY(x, y)
735
+	//// 设置填充颜色
736
+	//pdf.CellFormat(200, 15, "透析前情况", "1", 0, "CM", false, 0, "") // 使用CellFormat()方法创建表格单元格
735 737
 
736 738
 	//param1: 单元格的宽,为0时表示一行,单位根据new()里面设置的来
737 739
 	//param2: 单元格的高,不能为0,单位根据new()里面设置的来
@@ -790,18 +792,18 @@ func (this *SignApiController) UploadPrintOrder() {
790 792
 	//
791 793
 	//pdf.Ln(2)
792 794
 
793
-	if err := pdf.OutputFileAndClose("6.pdf"); err != nil {
794
-		panic(err.Error())
795
-	}
795
+	//if err := pdf.OutputFileAndClose("6.pdf"); err != nil {
796
+	//	panic(err.Error())
797
+	//}
796 798
 
797 799
 	// 此处可以继续绘制表格的其他部分,例如内容行等。
798 800
 	// ...
799 801
 
800 802
 	// 保存PDF文档到文件
801
-	err := pdf.OutputFileAndClose("treatment_sheet_with_header.pdf")
802
-	if err != nil {
803
-		panic(err)
804
-	}
803
+	//err := pdf.OutputFileAndClose("treatment_sheet_with_header.pdf")
804
+	//if err != nil {
805
+	//	panic(err)
806
+	//}
805 807
 
806 808
 	this.ServeSuccessJSON(map[string]interface{}{
807 809
 		//"sign":      information,

+ 1 - 0
models/patient_models.go View File

@@ -1202,6 +1202,7 @@ type XtPatients struct {
1202 1202
 	ScheduleRemark               string  `gorm:"column:schedule_remark" json:"schedule_remark" form:"schedule_remark"`
1203 1203
 	TreatmentPlan                string  `gorm:"column:treatment_plan" json:"treatment_plan" form:"treatment_plan"`
1204 1204
 	Url                          string  `gorm:"column:url" json:"url" form:"url"`
1205
+	FirstLetter                  string  `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
1205 1206
 }
1206 1207
 
1207 1208
 func (XtPatients) TableName() string {

+ 2 - 2
service/patient_service.go View File

@@ -1613,7 +1613,7 @@ func GetPatientByKeyWord(orgID int64, keywords string) (patient []*models.Patien
1613 1613
 
1614 1614
 	if len(keywords) > 0 {
1615 1615
 		likekey := "%" + keywords + "%"
1616
-		err = db.Where("name LIKE ? OR dialysis_no LIKE ? ", likekey, likekey).Find(&patient).Error
1616
+		err = db.Where("name LIKE ? OR dialysis_no LIKE ? OR first_letter LIKE ?", likekey, likekey, likekey).Find(&patient).Error
1617 1617
 	} else {
1618 1618
 		err = db.Find(&patient).Error
1619 1619
 	}
@@ -1952,7 +1952,7 @@ func GetPatientsByKey(orgID int64, keywords string) (patient []*models.Patients,
1952 1952
 	db := readDb.Model(&models.Patients{}).Where("user_org_id=? and status=1 and lapseto = 1 ", orgID)
1953 1953
 	if len(keywords) > 0 {
1954 1954
 		likekey := "%" + keywords + "%"
1955
-		err = db.Where("(name LIKE ? OR dialysis_no LIKE ?)", likekey, likekey).Find(&patient).Error
1955
+		err = db.Where("(name LIKE ? OR dialysis_no LIKE ? OR first_letter LIKE ?)", likekey, likekey, likekey).Find(&patient).Error
1956 1956
 	} else {
1957 1957
 		err = db.Find(&patient).Error
1958 1958
 	}

+ 1 - 0
service/self_drug_service.go View File

@@ -552,6 +552,7 @@ type Drugs struct {
552 552
 	DoseUnit              string   `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
553 553
 	MaxUnit               string   `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
554 554
 	DrugDoseUnit          int64    `grom:"column:drug_dose_unit" json:"drug_dose_unit" form:"drug_dose_unit"`
555
+	FirstLetter           string   `gorm:"column:first_letter" json:"first_letter" form:"first_letter"`
555 556
 }
556 557
 
557 558
 func (Drugs) TableName() string {