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
d7d97b1d55

BIN
XT_New.exe View File


+ 1 - 1
controllers/doctors_api_controller.go View File

82
 	patient_id, _ := c.GetInt64("patient_id")
82
 	patient_id, _ := c.GetInt64("patient_id")
83
 	excution_way, _ := c.GetInt64("excution_way")
83
 	excution_way, _ := c.GetInt64("excution_way")
84
 	execution_frequency := c.GetString("execution_frequency")
84
 	execution_frequency := c.GetString("execution_frequency")
85
+	keyword := c.GetString("keyword")
85
 	if adviceType != 1 && adviceType != 3 && adviceType != 2 {
86
 	if adviceType != 1 && adviceType != 3 && adviceType != 2 {
86
 		adviceType = 0
87
 		adviceType = 0
87
 	}
88
 	}
103
 	config, _ := service.GetHisDoctorConfig(orgID)
104
 	config, _ := service.GetHisDoctorConfig(orgID)
104
 	project_config, _ := service.GetHisProjectConfig(orgID)
105
 	project_config, _ := service.GetHisProjectConfig(orgID)
105
 
106
 
106
-	var keyword string
107
 	if config.IsOpen == 0 || config.IsOpen == 2 {
107
 	if config.IsOpen == 0 || config.IsOpen == 2 {
108
 		scheduals, err := service.MobileGetScheduleDoctorAdvicesOne(orgID, date.Unix(), adviceType, patientType, adminUserInfo.AdminUser.Id, delivery_way, schedule_type, partition_type, patient_id, excution_way, 0, execution_frequency, keyword)
108
 		scheduals, err := service.MobileGetScheduleDoctorAdvicesOne(orgID, date.Unix(), adviceType, patientType, adminUserInfo.AdminUser.Id, delivery_way, schedule_type, partition_type, patient_id, excution_way, 0, execution_frequency, keyword)
109
 		adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
109
 		adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)

+ 101 - 100
controllers/sign_api_controller.go View File

8
 	"fmt"
8
 	"fmt"
9
 	"github.com/astaxie/beego"
9
 	"github.com/astaxie/beego"
10
 	"github.com/jung-kurt/gofpdf"
10
 	"github.com/jung-kurt/gofpdf"
11
-	"github.com/mozillazg/go-pinyin"
12
 	"io/ioutil"
11
 	"io/ioutil"
13
 	"time"
12
 	"time"
14
 )
13
 )
658
 
657
 
659
 func (this *SignApiController) UploadPrintOrder() {
658
 func (this *SignApiController) UploadPrintOrder() {
660
 
659
 
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)
673
-
674
-		// 获取首字母
675
-		firstLetter := ""
676
-		for _, py := range pinyinSlice {
677
-			if len(py) > 0 {
678
-				firstLetter += string(py[0][0])
679
-			}
680
-		}
681
-
682
-		item.FirstLetter = firstLetter
683
-		service.UpdatePatientNew(item.ID, item.FirstLetter)
684
-		// 输出首字母
685
-		//fmt.Println("First Letter:", firstLetter)
686
-	}
687
-
688
-	//pdfg, _ := wkhtml.NewPDFGenerator()
660
+	fmt.Println("WOOWOWOWOWOWOWOWOWOWOWWOOWOWWO")
661
+	//list, _ := service.GetAllPatientNew(10188)
662
+	//for _, item := range list {
663
+	//
664
+	//	hans := item.Name // 要转换的汉字字符串
665
+	//	// 创建一个拼音转换器
666
+	//	p := pinyin.NewArgs()
689
 	//
667
 	//
690
-	//htmlStr := `<html><body><h1 style="color:red;">This is an html
691
-	// from pdf to test color<h1><img src="http://api.qrserver.com/v1/create-qr-
692
-	//code/?data=HelloWorld"   ></img></body></html>`
668
+	//	// 将汉字转为拼音
669
+	//	pinyinSlice := pinyin.Pinyin(hans, p)
693
 	//
670
 	//
694
-	//pdfg.AddPage(wkhtml.NewPageReader(strings.NewReader(htmlStr)))
671
+	//	// 输出拼音
672
+	//	fmt.Println("Pinyin:", pinyinSlice)
695
 	//
673
 	//
696
-	//// Create PDF document in internal buffer
697
-	//err = pdfg.Create()
674
+	//	// 获取首字母
675
+	//	firstLetter := ""
676
+	//	for _, py := range pinyinSlice {
677
+	//		if len(py) > 0 {
678
+	//			firstLetter += string(py[0][0])
679
+	//		}
680
+	//	}
698
 	//
681
 	//
699
-	////Your Pdf Name
700
-	//err = pdfg.WriteFile("./Your_pdfname.pdf")
701
-
702
-	//dataBody := make(map[string]interface{}, 0)
703
-	//err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
704
-	//fmt.Println(err)
705
-	//name := dataBody["name"].(string)
706
-	//fmt.Println(name)
707
-	//sign := service.CreateNewUploadPact(name)
708
-	//fmt.Println("sign")
709
-	//information, pdfBase64 := service.SavePdfInformation(name)
682
+	//	item.FirstLetter = firstLetter
683
+	//	service.UpdatePatientNew(item.ID, item.FirstLetter)
684
+	//	// 输出首字母
685
+	//	//fmt.Println("First Letter:", firstLetter)
686
+	//}
710
 
687
 
711
 	pdf := gofpdf.New("P", "mm", "A4", "")
688
 	pdf := gofpdf.New("P", "mm", "A4", "")
712
 	pdf.AddPage()
689
 	pdf.AddPage()
713
 	pdf.Text(5, 10, "血液净化治疗记录单")
690
 	pdf.Text(5, 10, "血液净化治疗记录单")
714
-	//wd := pdf.GetStringWidth(titleStr) + 6
715
-	//fmt.Println("wd", wd)
716
-	//pdf.SetY(0.6)            //先要设置 Y,然后再设置 X。否则,会导致 X 失效
717
-	//pdf.SetX((210 - wd) / 2) //水平居中的算法
718
-	//pdf.AddUTF8Font("simkai", "", "D:/go/src/pkg/mod/github.com/jung-kurt/gofpdf@v1.16.2/font/simfang.ttf")
719
-	//pdf.SetFont("simkai", "", 20)
720
-
721
-	//将字体加载进来
722
-	//AddUTF8Font("给字体起个别名", "", "fontPath")
691
+
723
 	pdf.AddUTF8Font("simfang", "", "D:/go/src/pkg/mod/github.com/jung-kurt/gofpdf@v1.16.2/font/simfang.ttf")
692
 	pdf.AddUTF8Font("simfang", "", "D:/go/src/pkg/mod/github.com/jung-kurt/gofpdf@v1.16.2/font/simfang.ttf")
724
 	pdf.SetFont("simfang", "", 20)
693
 	pdf.SetFont("simfang", "", 20)
725
 	var title = "血液透析(滤过)记录表单"
694
 	var title = "血液透析(滤过)记录表单"
729
 	fmt.Println("wd", wd)
698
 	fmt.Println("wd", wd)
730
 	pdf.SetY(100)            //先要设置 Y,然后再设置 X。否则,会导致 X 失效
699
 	pdf.SetY(100)            //先要设置 Y,然后再设置 X。否则,会导致 X 失效
731
 	pdf.SetX((210 - wd) / 2) //水平居中的算法
700
 	pdf.SetX((210 - wd) / 2) //水平居中的算法
732
-	//pdf.SetLineWidth(0)
733
-
734
-	//pdf.Line(10, 30, 585, 30)
735
-	//pdf.Ln(1)
736
-	//pdf.Write(10, "\n")
737
-	var numuber = "100000"
701
+	var numuber = "张三"
738
 	//表格居中显示
702
 	//表格居中显示
739
 	pdf.SetFont("", "", 14) // 设置加粗字体和字号
703
 	pdf.SetFont("", "", 14) // 设置加粗字体和字号
740
-	pdf.Text(10, 20, "病历号:"+numuber)
704
+	pdf.Text(10, 20, "姓名:"+numuber)
741
 	pdf.SetFont("", "", 14) // 设置加粗字体和字号
705
 	pdf.SetFont("", "", 14) // 设置加粗字体和字号
742
-	pdf.Text(60, 20, "姓名:")
706
+	pdf.Text(35, 20, "性别:"+"男")
743
 	pdf.SetFont("", "", 14) // 设置正常字体和字号
707
 	pdf.SetFont("", "", 14) // 设置正常字体和字号
744
-	pdf.Text(90, 20, "性别:")
708
+	pdf.Text(60, 20, "年龄:"+"18")
745
 	pdf.SetFont("", "", 14) // 设置正常字体和字号
709
 	pdf.SetFont("", "", 14) // 设置正常字体和字号
746
-	pdf.Text(120, 20, "年龄:")
710
+	pdf.Text(90, 20, "门诊:"+"住院")
747
 	pdf.SetFont("", "", 14) // 设置正常字体和字号
711
 	pdf.SetFont("", "", 14) // 设置正常字体和字号
748
-	pdf.Text(150, 20, "透析次数:")
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, "住院号/门诊号:")
749
 	pdf.SetFont("", "", 14) // 设置正常字体和字号
719
 	pdf.SetFont("", "", 14) // 设置正常字体和字号
750
-
751
 	//表格居中显示
720
 	//表格居中显示
752
 	pdf.SetFont("", "", 14) // 设置加粗字体和字号
721
 	pdf.SetFont("", "", 14) // 设置加粗字体和字号
753
 	pdf.Text(10, 30, "入科方式:"+numuber)
722
 	pdf.Text(10, 30, "入科方式:"+numuber)
754
 	pdf.SetFont("", "", 14) // 设置加粗字体和字号
723
 	pdf.SetFont("", "", 14) // 设置加粗字体和字号
755
 	pdf.Text(60, 30, "诊断:")
724
 	pdf.Text(60, 30, "诊断:")
756
 
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()方法创建表格单元格
735
+
757
 	//param1: 单元格的宽,为0时表示一行,单位根据new()里面设置的来
736
 	//param1: 单元格的宽,为0时表示一行,单位根据new()里面设置的来
758
 	//param2: 单元格的高,不能为0,单位根据new()里面设置的来
737
 	//param2: 单元格的高,不能为0,单位根据new()里面设置的来
759
 	//param3: 单元格内容
738
 	//param3: 单元格内容
763
 	//param7: 是否填充单元格,需要调用SetFillColor()方法.默认false
742
 	//param7: 是否填充单元格,需要调用SetFillColor()方法.默认false
764
 	//param8: 内部超链接,没用过
743
 	//param8: 内部超链接,没用过
765
 	//param9: 超链接,没用过
744
 	//param9: 超链接,没用过
766
-	pdf.AddUTF8Font("simfang", "", "D:/go/src/pkg/mod/github.com/jung-kurt/gofpdf@v1.16.2/font/simfang.ttf")
767
-	pdf.SetFont("simfang", "", 14)  // 设置字体、字号
768
-	pdf.SetFillColor(200, 200, 200) // 设置填充颜色
745
+	//pdf.AddUTF8Font("simfang", "", "D:/go/src/pkg/mod/github.com/jung-kurt/gofpdf@v1.16.2/font/simfang.ttf")
746
+	//pdf.SetFont("simfang", "", 8)   // 设置字体、字号
747
+	//pdf.SetFillColor(200, 200, 200) // 设置填充颜色
748
+	//
749
+	//// 设置起始位置
750
+	//var x = 10.0
751
+	//var y = 40.0
752
+	////创建8行2列的表格
753
+	//
754
+	//for j := 0; j < 1; j++ {
755
+	//	// 填充每个单元格的内容
756
+	//	pdf.SetXY(x, y)                                          // 设置当前位置
757
+	//	pdf.CellFormat(20, 15, "时间", "1", 0, "CM", false, 0, "") // 使用CellFormat()方法创建表格单元格
758
+	//	pdf.CellFormat(20, 15, "血压(mmHg)", "1", 0, "CM", false, 0, "")
759
+	//	pdf.CellFormat(20, 15, "脉搏(次/分)", "1", 0, "CM", false, 0, "")
760
+	//	pdf.CellFormat(20, 15, "呼吸(次/分)", "1", 0, "CM", false, 0, "")
761
+	//	pdf.CellFormat(20, 15, "血流量(ml/min)", "1", 0, "CM", false, 0, "")
762
+	//	pdf.CellFormat(20, 15, "静脉压(mmHg)", "1", 0, "CM", false, 0, "")
763
+	//	pdf.CellFormat(20, 15, "跨膜压(mmHg)", "1", 0, "CM", false, 0, "")
764
+	//	pdf.CellFormat(20, 15, "透析液温(℃)", "1", 0, "CM", false, 0, "")
765
+	//	pdf.CellFormat(20, 15, "钠浓度(mmol/L)", "1", 0, "CM", false, 0, "")
766
+	//	pdf.CellFormat(20, 15, "超滤量(ml) ", "1", 0, "CM", false, 0, "")
767
+	//	pdf.CellFormat(35, 15, "病情变化及处理", "1", 0, "CM", false, 0, "")
768
+	//
769
+	//	y += 15 // 下一行起始位置的y坐标增加60(单元格高度)
770
+	//}
771
+	//for j := 0; j < 1; j++ {
772
+	//	// 填充每个单元格的内容
773
+	//	pdf.SetXY(x, y)                                             // 设置当前位置
774
+	//	pdf.CellFormat(20, 15, "13:57", "1", 0, "CM", false, 0, "") // 使用CellFormat()方法创建表格单元格
775
+	//	pdf.CellFormat(20, 15, "120/90", "1", 0, "CM", false, 0, "")
776
+	//	pdf.CellFormat(20, 15, "64", "1", 0, "CM", false, 0, "")
777
+	//	pdf.CellFormat(20, 15, "100", "1", 0, "CM", false, 0, "")
778
+	//	pdf.CellFormat(20, 15, "100", "1", 0, "CM", false, 0, "")
779
+	//	pdf.CellFormat(20, 15, "100", "1", 0, "CM", false, 0, "")
780
+	//	pdf.CellFormat(20, 15, "90", "1", 0, "CM", false, 0, "")
781
+	//	pdf.CellFormat(20, 15, "36.5", "1", 0, "CM", false, 0, "")
782
+	//	pdf.CellFormat(20, 15, "26", "1", 0, "CM", false, 0, "")
783
+	//	pdf.CellFormat(20, 15, "100", "1", 0, "CM", false, 0, "")
784
+	//	pdf.CellFormat(35, 15, "及时九嶷山", "1", 0, "CM", false, 0, "")
785
+	//
786
+	//	y += 15 // 下一行起始位置的y坐标增加60(单元格高度)
787
+	//}
788
+	//x += 200.0 // 下一列起始位置的x坐标增加190(单元格宽度)
789
+	//y = 10.0   // 行起始位置的y坐标重置为10
790
+	//
791
+	//pdf.Ln(2)
769
 
792
 
770
-	// 设置起始位置
771
-	var x = 10.0
772
-	var y = 40.0
773
-	// 创建8行2列的表格
774
-
775
-	for j := 0; j < 1; j++ {
776
-		//cellText := fmt.Sprintf("行%d列%d", i+1, j+1)                 // 填充每个单元格的内容
777
-		pdf.SetXY(x, y)                                         // 设置当前位置
778
-		pdf.CellFormat(15, 15, "时间", "1", 0, "C", false, 0, "") // 使用CellFormat()方法创建表格单元格
779
-		pdf.CellFormat(20, 15, "血压(mmHg)", "1", 0, "CM", false, 0, "")
780
-		pdf.CellFormat(20, 15, "脉搏(次/分)", "1", 0, "CM", false, 0, "")
781
-		pdf.CellFormat(20, 15, "呼吸(次/分)", "1", 0, "CM", false, 0, "")
782
-		pdf.CellFormat(20, 15, "血流量(ml/min)", "1", 0, "CM", false, 0, "")
783
-		pdf.CellFormat(20, 15, "静脉压(mmHg)", "1", 0, "CM", false, 0, "")
784
-		pdf.CellFormat(20, 15, "跨膜压(mmHg)", "1", 0, "CM", false, 0, "")
785
-		pdf.CellFormat(20, 15, "透析液温(℃)", "1", 0, "CM", false, 0, "")
786
-		pdf.CellFormat(20, 15, "钠浓度(mmol/L)", "1", 0, "CM", false, 0, "")
787
-		pdf.CellFormat(20, 15, "超滤量(ml) ", "1", 0, "CM", false, 0, "")
788
-		pdf.CellFormat(35, 15, "病情变化及处理", "1", 0, "CM", false, 0, "")
789
-
790
-		y += 15 // 下一行起始位置的y坐标增加60(单元格高度)
793
+	if err := pdf.OutputFileAndClose("6.pdf"); err != nil {
794
+		panic(err.Error())
791
 	}
795
 	}
792
-	x += 200.0 // 下一列起始位置的x坐标增加190(单元格宽度)
793
-	y = 10.0   // 行起始位置的y坐标重置为10
794
-
795
-	//设置表格单元格大小,
796
-	//pdf.CellFormat(180, 15, "李王", "1", 0, "LM", false, 0, "")
797
 
796
 
798
-	pdf.Ln(2)
799
-	//pdf.Ln(2) 行距2mm
797
+	// 此处可以继续绘制表格的其他部分,例如内容行等。
798
+	// ...
800
 
799
 
801
-	if err := pdf.OutputFileAndClose("6.pdf"); err != nil {
802
-		panic(err.Error())
800
+	// 保存PDF文档到文件
801
+	err := pdf.OutputFileAndClose("treatment_sheet_with_header.pdf")
802
+	if err != nil {
803
+		panic(err)
803
 	}
804
 	}
804
 
805
 
805
 	this.ServeSuccessJSON(map[string]interface{}{
806
 	this.ServeSuccessJSON(map[string]interface{}{

File diff suppressed because it is too large
+ 1453 - 379
service/mobile_dialysis_service.go


+ 0 - 6
service/new_warehouse_service.go View File

1613
 			cancel_count += item.Count
1613
 			cancel_count += item.Count
1614
 		}
1614
 		}
1615
 
1615
 
1616
-		fmt.Println("总出口数量", deliver_number_one)
1617
-		fmt.Println("出库数量", out_count)
1618
-		fmt.Println("退款数来的发阿道夫", cancel_count)
1619
-
1620
-		fmt.Println("查收嗖嗖嗖哦", deliver_number_one-(out_count-cancel_count))
1621
-
1622
 		if deliver_number_one-(out_count-cancel_count) >= 0 {
1616
 		if deliver_number_one-(out_count-cancel_count) >= 0 {
1623
 			if (deliver_number_one - out_count - cancel_count) != 0 {
1617
 			if (deliver_number_one - out_count - cancel_count) != 0 {
1624
 
1618
 

+ 4 - 1
service/pharmacy_service.go View File

1186
 		err = fmt.Errorf("!:%v", err)
1186
 		err = fmt.Errorf("!:%v", err)
1187
 		return
1187
 		return
1188
 	}
1188
 	}
1189
-	//drug, _ := FindBaseDrugLibRecordSeven(orgid, v.DrugId)
1189
+
1190
 	//查询默认仓库
1190
 	//查询默认仓库
1191
 	storeHouseConfig, _ := GetAllStoreHouseConfig(orgid)
1191
 	storeHouseConfig, _ := GetAllStoreHouseConfig(orgid)
1192
 	//查询默认仓库剩余多少库存
1192
 	//查询默认仓库剩余多少库存
1202
 	UpdateBaseDrugSumTwo(v.DrugId, sum_count, orgid)
1202
 	UpdateBaseDrugSumTwo(v.DrugId, sum_count, orgid)
1203
 	//扣减库存
1203
 	//扣减库存
1204
 	UpdateDrugStockCount(v.DrugId, v.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1204
 	UpdateDrugStockCount(v.DrugId, v.UserOrgId, storeHouseConfig.DrugStorehouseOut, sum_count)
1205
+
1206
+	over, _ := FindOverCount(v.DrugId, v.UserOrgId, storeHouseConfig.DrugStorehouseOut)
1207
+	UpdateActOut(over.ID, over.SumInCount, over.FlushCount, over.SumCancelCount)
1205
 	return
1208
 	return
1206
 }
1209
 }
1207
 
1210
 

+ 10 - 0
service/warhouse_service.go View File

621
 
621
 
622
 			BloodHisDrugDeliverInfo(orgID, prescribingNumber, &out, &drup, advice, prescribingNumber, advice.PrescribingNumberUnit)
622
 			BloodHisDrugDeliverInfo(orgID, prescribingNumber, &out, &drup, advice, prescribingNumber, advice.PrescribingNumberUnit)
623
 
623
 
624
+			//查询今日出库的数据
625
+			//if orgID == 10188 || orgID == 10217 || orgID == 10344 {
626
+			//	//查询这个患者今日用过的总数量
627
+			//	GetDrugFlowByWatch(advice.PatientId, advice.DrugId, advice.AdviceDate, advice.UserOrgId)
628
+			//}
629
+
624
 		} else {
630
 		} else {
625
 			return errors.New("药品信息不存在")
631
 			return errors.New("药品信息不存在")
626
 		}
632
 		}
630
 	return
636
 	return
631
 }
637
 }
632
 
638
 
639
+//func GetDrugFlowByWatch(patient_id int64, drug_id int64, advice_date) {
640
+//
641
+//}
642
+
633
 // 药品出库 递归方式
643
 // 药品出库 递归方式
634
 func HisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *models.DrugWarehouseOut, drup *models.BaseDrugLib, advice *models.HisDoctorAdviceInfo) (err error) {
644
 func HisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *models.DrugWarehouseOut, drup *models.BaseDrugLib, advice *models.HisDoctorAdviceInfo) (err error) {
635
 
645