陈少旭 6 miesięcy temu
rodzic
commit
d0e65cbc5a
2 zmienionych plików z 729 dodań i 708 usunięć
  1. 711 679
      controllers/sg/his_api_controller.go
  2. 18 29
      service/his_service.go

Plik diff jest za duży
+ 711 - 679
controllers/sg/his_api_controller.go


+ 18 - 29
service/his_service.go Wyświetl plik

@@ -531,8 +531,8 @@ func FindLastPatientPrescriptionInfoTwo1(org_id int64, patient_id int64) (info m
531 531
 	return
532 532
 }
533 533
 
534
-func FindLastPatientPrescriptionInfoTwo2(org_id int64, patient_id int64,start_time string, end_time string) (info []models.HisPrescriptionInfo, err error) {
535
-	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND patient_id = ? and p_type = 1 and FROM_UNIXTIME(record_date) >= ? and FROM_UNIXTIME(record_date) <= ?", org_id, patient_id,start_time,end_time).Find(&info).Error
534
+func FindLastPatientPrescriptionInfoTwo2(org_id int64, patient_id int64, start_time string, end_time string) (info []models.HisPrescriptionInfo, err error) {
535
+	err = readDb.Model(&models.HisPrescriptionInfo{}).Where("user_org_id = ? AND status = 1 AND patient_id = ? and p_type = 1 and FROM_UNIXTIME(record_date) >= ? and FROM_UNIXTIME(record_date) <= ?", org_id, patient_id, start_time, end_time).Find(&info).Error
536 536
 	return
537 537
 }
538 538
 
@@ -618,7 +618,7 @@ type HisOrder struct {
618 618
 	PrivatePrice            float64 `gorm:"column:private_price" json:"private_price" form:"private_price"`
619 619
 	Creator                 int64   `gorm:"column:creator" json:"creator" form:"creator"`
620 620
 	Modify                  int64   `gorm:"column:modify" json:"modify" form:"modify"`
621
-	MedType                  int64   `gorm:"column:med_type" json:"med_type" form:"med_type"`
621
+	MedType                 int64   `gorm:"column:med_type" json:"med_type" form:"med_type"`
622 622
 	IsPre                   int64   `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
623 623
 	SzChargeInfo            string  `gorm:"column:sz_charge_info" json:"sz_charge_info" form:"sz_charge_info"`
624 624
 	SzProjectInfo           string  `gorm:"column:sz_project_info" json:"sz_project_info" form:"sz_project_info"`
@@ -627,7 +627,7 @@ type HisOrder struct {
627 627
 	OrgSetlNumber           string  `gorm:"column:org_setl_number" json:"org_setl_number" form:"org_setl_number"`
628 628
 	PayWays                 string  `gorm:"column:pay_ways" json:"pay_way" form:"pay_ways"`
629 629
 	OthDesc                 string  `gorm:"column:oth_desc" json:"oth_desc" form:"oth_desc"`
630
-	SetlDetail              string    `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
630
+	SetlDetail              string  `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
631 631
 
632 632
 	HisOrderInfo        models.HisOrderInfo        `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order_info"`
633 633
 	Patients            models.Patients            `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
@@ -1011,7 +1011,7 @@ func GetOrderByTime(start_time int64, end_time int64, org_id int64, insutype str
1011 1011
 	}
1012 1012
 	if len(clr_type) > 0 {
1013 1013
 		if mdtrtareaAdmvs == "150499" {
1014
-			if clr_type == "11"  {
1014
+			if clr_type == "11" {
1015 1015
 				db = db.Where("clr_type = ?", clr_type)
1016 1016
 			}
1017 1017
 
@@ -1020,10 +1020,10 @@ func GetOrderByTime(start_time int64, end_time int64, org_id int64, insutype str
1020 1020
 			db = db.Where("clr_type = ?", clr_type)
1021 1021
 		}
1022 1022
 	} else {
1023
-		if len(clr_type) == 0{
1023
+		if len(clr_type) == 0 {
1024 1024
 			db = db.Where("clr_type = ?", "")
1025 1025
 
1026
-		}else{
1026
+		} else {
1027 1027
 			db = db.Where("clr_type = ?", "9903")
1028 1028
 
1029 1029
 		}
@@ -1061,7 +1061,6 @@ func GetOrderByTimeFour(start_time int64, end_time int64, org_id int64) (orders
1061 1061
 	return
1062 1062
 }
1063 1063
 
1064
-
1065 1064
 func GetOrderByTime11222(start_time int64, end_time int64, org_id int64) (orders []*models.HisOrder, err error) {
1066 1065
 	db := readDb.Model(&models.HisOrder{})
1067 1066
 	db = db.Where("user_org_id = ? AND status = 1 AND order_status = 2 AND is_medicine_insurance = 1 AND UNIX_TIMESTAMP(setl_time)  <= ? AND UNIX_TIMESTAMP(setl_time) >= ?", org_id, end_time, start_time)
@@ -1071,12 +1070,11 @@ func GetOrderByTime11222(start_time int64, end_time int64, org_id int64) (orders
1071 1070
 
1072 1071
 func GetOrderByTimeFourfor11(start_time int64, end_time int64, org_id int64) (orders []*models.HisOrder, err error) {
1073 1072
 	db := readDb.Model(&models.HisOrder{})
1074
-db = db.Where("user_org_id = ? AND status = 1 AND order_status = 2 AND is_medicine_insurance = 1 AND UNIX_TIMESTAMP(setl_time)  <= ? AND UNIX_TIMESTAMP(setl_time) >= ? and med_type = 11", org_id, end_time, start_time)
1073
+	db = db.Where("user_org_id = ? AND status = 1 AND order_status = 2 AND is_medicine_insurance = 1 AND UNIX_TIMESTAMP(setl_time)  <= ? AND UNIX_TIMESTAMP(setl_time) >= ? and med_type = 11", org_id, end_time, start_time)
1075 1074
 	err = db.Find(&orders).Error
1076 1075
 	return
1077 1076
 }
1078 1077
 
1079
-
1080 1078
 func GetOrderByTimeThree(start_time int64, end_time int64, org_id int64, insutype string, clr_type string) (orders []*models.HisOrder, err error) {
1081 1079
 	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = ? AND status = 1  AND is_medicine_insurance = 1 AND UNIX_TIMESTAMP(setl_time) <= ? AND UNIX_TIMESTAMP(setl_time) >= ? AND insutype = ?", org_id, end_time, start_time, insutype).Find(&orders).Error
1082 1080
 	return
@@ -1334,7 +1332,6 @@ func GetBathchMyPorjecgListtwo(org_id int64) (project []*models.MyHisProject, er
1334 1332
 
1335 1333
 	err = db.Where("status = 1 and user_org_id = ?", org_id).Find(&project).Error
1336 1334
 
1337
-
1338 1335
 	return project, err
1339 1336
 }
1340 1337
 func GetBatchDoctorList(idss []int64) (role []*models.SgjUserAdminRole, err error) {
@@ -1374,7 +1371,6 @@ func UpdateHisPrescriptionHisID1111(his_patient_id int64, patient_id int64, reco
1374 1371
 	return
1375 1372
 }
1376 1373
 
1377
-
1378 1374
 func GetHisPatientInfoList(org_id int64, patient_id int64, record_date int64) (info []*models.HisPatient, err error) {
1379 1375
 	err = readDb.Model(&models.HisPatient{}).Where("user_org_id = ? AND status = 1 AND record_date = ? AND patient_id = ?", org_id, record_date, patient_id).Find(&info).Error
1380 1376
 	return
@@ -1558,14 +1554,12 @@ func GetAllHisOrder10278() (his []*models.HisOrder, err error) {
1558 1554
 	return
1559 1555
 }
1560 1556
 
1561
-
1562 1557
 func GetAllHisOrder10265() (his []*models.HisOrder, err error) {
1563 1558
 	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10265  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= '2023-09-01 00:00:00'").Order("setl_time asc").Find(&his).Error
1564 1559
 	fmt.Println(err)
1565 1560
 	return
1566 1561
 }
1567 1562
 
1568
-
1569 1563
 //	func GetAllHisOrder2(org_id int64) (his []models.HisOrder, err error) {
1570 1564
 //		err = readDb.Model(&models.HisOrder{}).Where("id = 180753").Order("setl_time asc").First(&his).Error
1571 1565
 //		return
@@ -1667,14 +1661,15 @@ func GetOrderDetailByTimeTen(start_time string, end_time string, org_id int64, f
1667 1661
 	return
1668 1662
 }
1669 1663
 
1670
-//
1671
-func Saveflow(flow models.HisPrescriptionFlow){
1664
+func Saveflow(flow models.HisPrescriptionFlow) {
1672 1665
 	writeDb.Save(&flow)
1673 1666
 }
1674 1667
 
1668
+func Createflow(flow models.HisPrescriptionFlow) {
1669
+	writeDb.Create(&flow)
1670
+}
1675 1671
 
1676
-
1677
-func GetNewHisPrescriptionTenone(org_id int64,number string) (prescription []*models.HisPrescriptionTen, err error) {
1672
+func GetNewHisPrescriptionTenone(org_id int64, number string) (prescription []*models.HisPrescriptionTen, err error) {
1678 1673
 	err = readDb.Model(&models.HisPrescriptionTen{}).
1679 1674
 		Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1680 1675
 			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisOrderInfo", "status = 1").Preload("BaseDrugLib", "status=1")
@@ -1688,26 +1683,20 @@ func GetNewHisPrescriptionTenone(org_id int64,number string) (prescription []*mo
1688 1683
 }
1689 1684
 
1690 1685
 func GetHisOrderByIDThree(start_time string) (his []*models.HisOrder, err error) {
1691
-	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10265  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= ?",start_time).Order("setl_time asc").Find(&his).Error
1686
+	err = readDb.Model(&models.HisOrder{}).Where(" user_org_id = 10265  AND status = 1  AND  order_status = 2 AND setl_id <> ''  AND setl_time >= ?", start_time).Order("setl_time asc").Find(&his).Error
1692 1687
 	fmt.Println(err)
1693 1688
 	return
1694 1689
 }
1695 1690
 
1696
-
1697
-
1698
-func UpDatePrescriptionNumber111(user_org_id int64, start_time int64, end_time int64, number string,patient_id int64) (err error) {
1699
-	err = writeDb.Model(&models.HisPrescription{}).Where("user_org_id = ? AND status = 1 AND record_date >= ? and record_date <= ? and patient_id = ? and order_status = 1", user_org_id, start_time,end_time,patient_id).Updates(map[string]interface{}{"batch_number": number, "mtime": time.Now().Unix()}).Error
1691
+func UpDatePrescriptionNumber111(user_org_id int64, start_time int64, end_time int64, number string, patient_id int64) (err error) {
1692
+	err = writeDb.Model(&models.HisPrescription{}).Where("user_org_id = ? AND status = 1 AND record_date >= ? and record_date <= ? and patient_id = ? and order_status = 1", user_org_id, start_time, end_time, patient_id).Updates(map[string]interface{}{"batch_number": number, "mtime": time.Now().Unix()}).Error
1700 1693
 	return
1701 1694
 }
1702
-func UpDatePrescriptionNumber222(user_org_id int64,id int64, number string,patient_id int64) (err error) {
1703
-	err = writeDb.Model(&models.HisPrescription{}).Where("user_org_id = ? AND status = 1 AND id = ? and patient_id = ?", user_org_id, id,patient_id).Updates(map[string]interface{}{"batch_number": number, "mtime": time.Now().Unix()}).Error
1695
+func UpDatePrescriptionNumber222(user_org_id int64, id int64, number string, patient_id int64) (err error) {
1696
+	err = writeDb.Model(&models.HisPrescription{}).Where("user_org_id = ? AND status = 1 AND id = ? and patient_id = ?", user_org_id, id, patient_id).Updates(map[string]interface{}{"batch_number": number, "mtime": time.Now().Unix()}).Error
1704 1697
 	return
1705 1698
 }
1706 1699
 
1707
-
1708
-
1709
-
1710
-
1711 1700
 func GetAllHisOrderTwo10485() (his []*models.HisOrder, err error) {
1712 1701
 	err = readDb.Model(&models.HisOrder{}).Where("user_org_id = 10485  AND status = 1  AND  order_status = 2 AND setl_id <> '' AND  setl_time >= '2024-01-01 00:00:00' ").Order("setl_time asc").Find(&his).Error
1713 1702
 	fmt.Println(err)