Browse Source

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

陈少旭 11 months ago
parent
commit
449f40e51b

BIN
XT_New.exe View File


+ 2 - 2
controllers/doctors_api_controller.go View File

1647
 	excution_way, _ := c.GetInt64("excution_way")
1647
 	excution_way, _ := c.GetInt64("excution_way")
1648
 	cost_type, _ := c.GetInt64("cost_type")
1648
 	cost_type, _ := c.GetInt64("cost_type")
1649
 	execution_frequency := c.GetString("execution_frequency")
1649
 	execution_frequency := c.GetString("execution_frequency")
1650
-
1650
+	keyword := c.GetString("keyword")
1651
 	date, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", schedualDate)
1651
 	date, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", schedualDate)
1652
 	if parseDateErr != nil {
1652
 	if parseDateErr != nil {
1653
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1653
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1657
 	adminUserInfo := c.GetAdminUserInfo()
1657
 	adminUserInfo := c.GetAdminUserInfo()
1658
 	orgID := adminUserInfo.CurrentOrgId
1658
 	orgID := adminUserInfo.CurrentOrgId
1659
 
1659
 
1660
-	scheduals, err := service.MobileGetLongScheduleDoctorAdvices(orgID, date.Unix(), adviceType, patientType, adminUserInfo.AdminUser.Id, delivery_way, schedule_type, partition_type, patient_id, excution_way, cost_type, execution_frequency)
1660
+	scheduals, err := service.MobileGetLongScheduleDoctorAdvices(orgID, date.Unix(), adviceType, patientType, adminUserInfo.AdminUser.Id, delivery_way, schedule_type, partition_type, patient_id, excution_way, cost_type, execution_frequency, keyword)
1661
 
1661
 
1662
 	adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
1662
 	adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
1663
 	if err != nil {
1663
 	if err != nil {

+ 0 - 4
controllers/his_api_controller.go View File

1969
 								//查询该药品是否存在开药记录
1969
 								//查询该药品是否存在开药记录
1970
 								advicelist, _ := service.GetHisAdviceListByDrugIdEight(drug_id, patient_id, recordDateTime, adviceId)
1970
 								advicelist, _ := service.GetHisAdviceListByDrugIdEight(drug_id, patient_id, recordDateTime, adviceId)
1971
 
1971
 
1972
-								fmt.Println("wooooooooooooo", advicelist.ID)
1973
-								fmt.Println("prescribingNumberUnit", prescribingNumberUnit)
1974
-								fmt.Println("prescribingNumberUnit", drug.MinUnit)
1975
-								fmt.Println("prescribingNumberUnit", drug.MaxUnit)
1976
 								//新增处方
1972
 								//新增处方
1977
 								if advicelist.ID == 0 {
1973
 								if advicelist.ID == 0 {
1978
 									all_count, _ := strconv.ParseFloat(totals, 64)
1974
 									all_count, _ := strconv.ParseFloat(totals, 64)

+ 6 - 1
controllers/mobile_api_controllers/dialysis_api_controller.go View File

3430
 				ultrafiltration_rate = ultrafiltration_rate / 1000
3430
 				ultrafiltration_rate = ultrafiltration_rate / 1000
3431
 			}
3431
 			}
3432
 
3432
 
3433
+			if adminUserInfo.Org.Id == 10629 {
3434
+				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 1000 / float64(totalMin) * 60 * 1000)
3435
+				ultrafiltration_rate = ultrafiltration_rate / 1000
3436
+			}
3437
+
3433
 		}
3438
 		}
3434
 	}
3439
 	}
3435
 
3440
 
4466
 
4471
 
4467
 			}
4472
 			}
4468
 
4473
 
4469
-			if adminInfo.Org.Id == 10551 || adminInfo.Org.Id == 10617 || adminInfo.Org.Id == 10580 {
4474
+			if adminInfo.Org.Id == 10551 || adminInfo.Org.Id == 10617 || adminInfo.Org.Id == 10580 || adminInfo.Org.Id == 10629 {
4470
 
4475
 
4471
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 1000 / float64(totalMin) * 60 * 1000)
4476
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 1000 / float64(totalMin) * 60 * 1000)
4472
 				record.UltrafiltrationRate = ultrafiltration_rate / 1000
4477
 				record.UltrafiltrationRate = ultrafiltration_rate / 1000

+ 5 - 1
controllers/mobile_api_controllers/patient_api_controller.go View File

2865
 			newprescribe.Status = 1
2865
 			newprescribe.Status = 1
2866
 			newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
2866
 			newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
2867
 			newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
2867
 			newprescribe.DialysisDialyszers = lastDialysisPrescribe.DialysisDialyszers
2868
-			newprescribe.DialysisStrainer = dialysisSolution.DialysisStrainer
2868
+
2869
+			if dialysisSolution != nil && dialysisSolution.DialysisStrainer != "" {
2870
+				newprescribe.DialysisStrainer = dialysisSolution.DialysisStrainer
2871
+			}
2872
+
2869
 			newprescribe.Remark = lastDialysisPrescription.Remark
2873
 			newprescribe.Remark = lastDialysisPrescription.Remark
2870
 			newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2874
 			newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2871
 			_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, theAssessmentDateTime, adminUserInfo.Org.Id)
2875
 			_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, theAssessmentDateTime, adminUserInfo.Org.Id)

+ 14 - 0
controllers/self_drug_api_congtroller.go View File

3848
 			for _, it := range losses {
3848
 			for _, it := range losses {
3849
 				item.WareStartEndStockInventoryLosses = append(item.WareStartEndStockInventoryLosses, it)
3849
 				item.WareStartEndStockInventoryLosses = append(item.WareStartEndStockInventoryLosses, it)
3850
 			}
3850
 			}
3851
+
3852
+			//获取期初结余
3853
+			balanceList, _ := service.GetInitBalanceList(item.ID, orgId, startTime, endTime, storeConfig.StorehouseOutInfo)
3854
+
3855
+			for _, it := range balanceList {
3856
+				item.StWarehousingInfoTwo = append(item.StWarehousingInfoTwo, it)
3857
+			}
3858
+
3859
+			//期间减少
3860
+			banceOutList, _ := service.GetInitOutBanceList(item.ID, orgId, startTime, endTime, storeConfig.StorehouseOutInfo)
3861
+			for _, it := range banceOutList {
3862
+				item.WarehouseOutInfoTenty = append(item.WarehouseOutInfoTenty, it)
3863
+			}
3864
+
3851
 		}
3865
 		}
3852
 
3866
 
3853
 		if err != nil {
3867
 		if err != nil {

+ 30 - 25
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
 )
665
 
664
 
666
 func (this *SignApiController) UploadPrintOrder() {
665
 func (this *SignApiController) UploadPrintOrder() {
667
 
666
 
668
-	list, _ := service.GetAllPatientNew(10375)
669
-	for _, item := range list {
670
-
671
-		hans := item.Name // 要转换的汉字字符串
672
-		// 创建一个拼音转换器
673
-		p := pinyin.NewArgs()
674
-
675
-		// 将汉字转为拼音
676
-		pinyinSlice := pinyin.Pinyin(hans, p)
677
-
678
-		// 输出拼音
679
-		fmt.Println("Pinyin:", pinyinSlice)
667
+	orderList, _ := service.GetDialysisOrderListOne(21741)
680
 
668
 
681
-		// 获取首字母
682
-		firstLetter := ""
683
-		for _, py := range pinyinSlice {
684
-			if len(py) > 0 {
685
-				firstLetter += string(py[0][0])
686
-			}
687
-		}
688
-
689
-		item.FirstLetter = firstLetter
690
-		service.UpdatePatientNew(item.ID, item.FirstLetter)
691
-		// 输出首字母
692
-		//fmt.Println("First Letter:", firstLetter)
669
+	for _, item := range orderList {
670
+		service.UpdateSchedulePatient(item.PatientId, item.DialysisDate, item.ZoneId, item.BedID)
693
 	}
671
 	}
694
 
672
 
673
+	//list, _ := service.GetAllPatientNew(10375)
674
+	//for _, item := range list {
675
+	//
676
+	//	hans := item.Name // 要转换的汉字字符串
677
+	//	// 创建一个拼音转换器
678
+	//	p := pinyin.NewArgs()
679
+	//
680
+	//	// 将汉字转为拼音
681
+	//	pinyinSlice := pinyin.Pinyin(hans, p)
682
+	//
683
+	//	// 输出拼音
684
+	//	fmt.Println("Pinyin:", pinyinSlice)
685
+	//
686
+	//	// 获取首字母
687
+	//	firstLetter := ""
688
+	//	for _, py := range pinyinSlice {
689
+	//		if len(py) > 0 {
690
+	//			firstLetter += string(py[0][0])
691
+	//		}
692
+	//	}
693
+	//
694
+	//	item.FirstLetter = firstLetter
695
+	//	service.UpdatePatientNew(item.ID, item.FirstLetter)
696
+	//	// 输出首字母
697
+	//	//fmt.Println("First Letter:", firstLetter)
698
+	//}
699
+
695
 	//baseList, _ := service.GeteAllBaseList(10375)
700
 	//baseList, _ := service.GeteAllBaseList(10375)
696
 	//for _, item := range baseList {
701
 	//for _, item := range baseList {
697
 	//	hans := item.DrugName // 要转换的汉字字符串
702
 	//	hans := item.DrugName // 要转换的汉字字符串

+ 3 - 4
models/new_stock_models.go View File

286
 	WarehouseOutInfoStart  []*VmStockFlowTwenty
286
 	WarehouseOutInfoStart  []*VmStockFlowTwenty
287
 	WarehouseInfoEnd       []*VmStockFlowTwenty //期末入库量
287
 	WarehouseInfoEnd       []*VmStockFlowTwenty //期末入库量
288
 	StartFlowWarehouseInfo []*VmStockFlowTwenty //本期增加
288
 	StartFlowWarehouseInfo []*VmStockFlowTwenty //本期增加
289
+
290
+	StWarehousingInfoTwo  []*StWarehousingInfoOne  `gorm:"json:"new_warehouse_info_start"` //期间增加
291
+	WarehouseOutInfoTenty []*WarehouseOutInfoTenty `gorm:"json:"new_warehouse_out_info"`
289
 	//期初结余
292
 	//期初结余
290
 	StartFlowInfo    []*VmStockFlowTwenty
293
 	StartFlowInfo    []*VmStockFlowTwenty
291
 	StartOutFlowInfo []*VmStockFlowTwenty
294
 	StartOutFlowInfo []*VmStockFlowTwenty
308
 	WareStartEndStockInventoryProfit []*VmStockFlowTwenty //期间盘盈
311
 	WareStartEndStockInventoryProfit []*VmStockFlowTwenty //期间盘盈
309
 	WareStartEndStockInventoryLosses []*VmStockFlowTwenty //期间盘亏
312
 	WareStartEndStockInventoryLosses []*VmStockFlowTwenty //期间盘亏
310
 
313
 
311
-	//newOverInCount     []*VmStockFlowTwenty
312
-	//newOverOuntCount   []*VmStockFlowTwenty
313
-	//newOverCancelCount []*VmStockFlowTwenty
314
-
315
 	//期初结余
314
 	//期初结余
316
 	GoodStartFlowInfo VmStockFlowTwenty
315
 	GoodStartFlowInfo VmStockFlowTwenty
317
 	//期末结余
316
 	//期末结余

+ 29 - 0
models/stock_models.go View File

113
 	return "xt_warehouse_info"
113
 	return "xt_warehouse_info"
114
 }
114
 }
115
 
115
 
116
+type StWarehousingInfoOne struct {
117
+	ID               int64  `gorm:"column:id" json:"id"`
118
+	GoodId           int64  `gorm:"column:good_id" json:"good_id"`
119
+	WarehousingCount int64  `gorm:"column:warehousing_count" json:"warehousing_count"`
120
+	WarehousingUnit  string `gorm:"column:warehousing_unit" json:"warehousing_unit"`
121
+	PackingUnit      string `json:"packing_unit"`
122
+	StorehouseId     int64  `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
123
+	OrgId            int64  `gorm:"column:org_id" json:"org_id"`
124
+}
125
+
126
+func (StWarehousingInfoOne) TableName() string {
127
+	return "xt_warehouse_info"
128
+}
129
+
116
 type XtWarehouse struct {
130
 type XtWarehouse struct {
117
 	ID               int64  `gorm:"column:id" json:"id" form:"id"`
131
 	ID               int64  `gorm:"column:id" json:"id" form:"id"`
118
 	WarehousingOrder string `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
132
 	WarehousingOrder string `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
1689
 func (WarehousingInfoNight) TableName() string {
1703
 func (WarehousingInfoNight) TableName() string {
1690
 	return "xt_warehouse_info"
1704
 	return "xt_warehouse_info"
1691
 }
1705
 }
1706
+
1707
+type WarehouseOutInfoTenty struct {
1708
+	ID            int64 `gorm:"column:id" json:"id" form:"id"`
1709
+	GoodId        int64 `gorm:"column:good_id" json:"good_id" form:"good_id"`
1710
+	Count         int64 `gorm:"column:count" json:"count" form:"count"`
1711
+	Mtime         int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
1712
+	Ctime         int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
1713
+	Status        int64 `gorm:"column:status" json:"status" form:"status"`
1714
+	OrgId         int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
1715
+	SysRecordTime int64 `gorm:"column:sys_record_time" json:"sys_record_time" form:"sys_record_time"`
1716
+}
1717
+
1718
+func (WarehouseOutInfoTenty) TableName() string {
1719
+	return "xt_warehouse_out_info"
1720
+}

+ 370 - 93
service/mobile_dialysis_service.go View File

8699
 	return weight, err
8699
 	return weight, err
8700
 }
8700
 }
8701
 
8701
 
8702
-func MobileGetLongScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceType int, patientType int, adminUserId int64, deliverWay string, scheduleType int64, partitonType int64, patient_id int64, execution_state int64, cost_type int64, execution_frequency string) ([]*MScheduleDoctorAdviceVM, error) {
8702
+func MobileGetLongScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceType int, patientType int, adminUserId int64, deliverWay string, scheduleType int64, partitonType int64, patient_id int64, execution_state int64, cost_type int64, execution_frequency string, keyword string) ([]*MScheduleDoctorAdviceVM, error) {
8703
 
8703
 
8704
 	var vms []*MScheduleDoctorAdviceVM
8704
 	var vms []*MScheduleDoctorAdviceVM
8705
 	adviceWhere := ""
8705
 	adviceWhere := ""
8706
+	keyword = "%" + keyword + "%"
8706
 	adviceCondition := []interface{}{}
8707
 	adviceCondition := []interface{}{}
8707
 	if adviceType == 1 {
8708
 	if adviceType == 1 {
8708
 		if patientType == 0 {
8709
 		if patientType == 0 {
8710
 				if execution_state > 0 {
8711
 				if execution_state > 0 {
8711
 					if cost_type > 0 {
8712
 					if cost_type > 0 {
8712
 						if len(execution_frequency) > 0 {
8713
 						if len(execution_frequency) > 0 {
8713
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and patient_id = ? and execution_state = ? and is_settle = ? and execution_frequency = ?"
8714
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, cost_type, execution_frequency)
8714
+							if len(keyword) > 0 {
8715
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and patient_id = ? and execution_state = ? and is_settle = ? and execution_frequency = ? and advice_name like ?"
8716
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, cost_type, execution_frequency, keyword)
8717
+							} else {
8718
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and patient_id = ? and execution_state = ? and is_settle = ? and execution_frequency = ?"
8719
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, cost_type, execution_frequency)
8720
+							}
8721
+
8715
 						} else {
8722
 						} else {
8716
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 and patient_id = ? and execution_state = ? and is_settle = ?"
8717
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, cost_type)
8723
+							if len(keyword) > 0 {
8724
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 and patient_id = ? and execution_state = ? and is_settle = ? and advice_name like ?"
8725
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, cost_type, keyword)
8726
+							} else {
8727
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 and patient_id = ? and execution_state = ? and is_settle = ?"
8728
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, cost_type)
8729
+							}
8730
+
8718
 						}
8731
 						}
8719
 
8732
 
8720
 					} else {
8733
 					} else {
8721
 						if len(execution_frequency) > 0 {
8734
 						if len(execution_frequency) > 0 {
8722
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 and patient_id = ? and execution_state = ? and execution_frequency = ?"
8723
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, execution_frequency)
8735
+							if len(keyword) > 0 {
8736
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 and patient_id = ? and execution_state = ? and execution_frequency = ? and advice_name like ?"
8737
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, execution_frequency, keyword)
8738
+							} else {
8739
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 and patient_id = ? and execution_state = ? and execution_frequency = ?"
8740
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, execution_frequency)
8741
+							}
8742
+
8724
 						} else {
8743
 						} else {
8725
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and patient_id = ? and execution_state = ?"
8726
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state)
8744
+							if len(keyword) > 0 {
8745
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and patient_id = ? and execution_state = ? and advice_name like ?"
8746
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, keyword)
8747
+							} else {
8748
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and patient_id = ? and execution_state = ?"
8749
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state)
8750
+							}
8751
+
8727
 						}
8752
 						}
8728
 
8753
 
8729
 					}
8754
 					}
8731
 				} else {
8756
 				} else {
8732
 					if cost_type > 0 {
8757
 					if cost_type > 0 {
8733
 						if len(execution_frequency) > 0 {
8758
 						if len(execution_frequency) > 0 {
8734
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and patient_id = ? and is_settle = ? and execution_frequency = ?"
8735
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, cost_type, execution_frequency)
8759
+							if len(keyword) > 0 {
8760
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and patient_id = ? and is_settle = ? and execution_frequency = ? and advice_name like ?"
8761
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, cost_type, execution_frequency, keyword)
8762
+							} else {
8763
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and patient_id = ? and is_settle = ? and execution_frequency = ?"
8764
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, cost_type, execution_frequency)
8765
+							}
8766
+
8736
 						} else {
8767
 						} else {
8737
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and patient_id = ? and is_settle = ? "
8738
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, cost_type)
8768
+							if len(keyword) > 0 {
8769
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and patient_id = ? and is_settle = ? and advice_name like ?"
8770
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, cost_type, keyword)
8771
+							} else {
8772
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and patient_id = ? and is_settle = ? "
8773
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, cost_type)
8774
+							}
8775
+
8739
 						}
8776
 						}
8740
 
8777
 
8741
 					} else {
8778
 					} else {
8742
 						if len(execution_frequency) > 0 {
8779
 						if len(execution_frequency) > 0 {
8743
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 and patient_id = ? and execution_frequency = ?"
8744
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_frequency)
8780
+							if len(keyword) > 0 {
8781
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 and patient_id = ? and execution_frequency = ? and advice_name like ?"
8782
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_frequency, keyword)
8783
+							} else {
8784
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 and patient_id = ? and execution_frequency = ?"
8785
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_frequency)
8786
+							}
8787
+
8745
 						} else {
8788
 						} else {
8746
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 and patient_id = ? "
8747
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id)
8789
+							if len(keyword) > 0 {
8790
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 and patient_id = ? and advice_name like ?"
8791
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, keyword)
8792
+							} else {
8793
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 and patient_id = ? "
8794
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id)
8795
+							}
8796
+
8748
 						}
8797
 						}
8749
 
8798
 
8750
 					}
8799
 					}
8755
 				if execution_state > 0 {
8804
 				if execution_state > 0 {
8756
 					if cost_type > 0 {
8805
 					if cost_type > 0 {
8757
 						if len(execution_frequency) > 0 {
8806
 						if len(execution_frequency) > 0 {
8758
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and execution_state = ? and is_settle = ? and execution_frequency = ?"
8759
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, cost_type, execution_frequency)
8807
+							if len(keyword) > 0 {
8808
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and execution_state = ? and is_settle = ? and execution_frequency = ? and advice_name like ?"
8809
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, cost_type, execution_frequency, keyword)
8810
+							} else {
8811
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and execution_state = ? and is_settle = ? and execution_frequency = ?"
8812
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, cost_type, execution_frequency)
8813
+							}
8814
+
8760
 						} else {
8815
 						} else {
8761
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and execution_state = ? and is_settle = ?"
8762
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, cost_type)
8816
+							if len(keyword) > 0 {
8817
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and execution_state = ? and is_settle = ? and advice_name like ?"
8818
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, cost_type, keyword)
8819
+							} else {
8820
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and execution_state = ? and is_settle = ?"
8821
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, cost_type)
8822
+							}
8823
+
8763
 						}
8824
 						}
8764
 
8825
 
8765
 					} else {
8826
 					} else {
8766
 						if len(execution_frequency) > 0 {
8827
 						if len(execution_frequency) > 0 {
8767
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and execution_state = ? and execution_frequency = ?"
8768
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, execution_frequency)
8828
+							if len(keyword) > 0 {
8829
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and execution_state = ? and execution_frequency = ? and advice_name like ?"
8830
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, execution_frequency, keyword)
8831
+							} else {
8832
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and execution_state = ? and execution_frequency = ?"
8833
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, execution_frequency)
8834
+							}
8835
+
8769
 						} else {
8836
 						} else {
8770
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and execution_state = ?"
8771
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state)
8837
+							if len(keyword) > 0 {
8838
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and execution_state = ? and advice_name like ?"
8839
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, keyword)
8840
+							} else {
8841
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and execution_state = ?"
8842
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state)
8843
+							}
8844
+
8772
 						}
8845
 						}
8773
 
8846
 
8774
 					}
8847
 					}
8775
 
8848
 
8776
 				} else {
8849
 				} else {
8777
 					if cost_type > 0 {
8850
 					if cost_type > 0 {
8778
-						adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and is_settle = ? "
8779
-						adviceCondition = append(adviceCondition, adviceWhere, orgID, cost_type)
8851
+						if len(keyword) > 0 {
8852
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and is_settle = ? and advice_name like ?"
8853
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, cost_type, keyword)
8854
+						} else {
8855
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and is_settle = ? "
8856
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, cost_type)
8857
+						}
8858
+
8780
 					} else {
8859
 					} else {
8781
-						adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1   "
8782
-						adviceCondition = append(adviceCondition, adviceWhere, orgID)
8860
+						if len(keyword) > 0 {
8861
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  and advice_name like ?"
8862
+							adviceCondition = append(adviceCondition, adviceWhere, orgID, keyword)
8863
+						} else {
8864
+							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1   "
8865
+							adviceCondition = append(adviceCondition, adviceWhere, orgID)
8866
+						}
8867
+
8783
 					}
8868
 					}
8784
 
8869
 
8785
 				}
8870
 				}
8791
 				if execution_state > 0 {
8876
 				if execution_state > 0 {
8792
 					if cost_type > 0 {
8877
 					if cost_type > 0 {
8793
 						if len(execution_frequency) > 0 {
8878
 						if len(execution_frequency) > 0 {
8794
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and patient_id = ? and execution_state = ? and  is_settle = ? and execution_frequency = ?"
8795
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, execution_state, cost_type, execution_frequency)
8879
+							if len(keyword) > 0 {
8880
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and patient_id = ? and execution_state = ? and  is_settle = ? and execution_frequency = ? and advice_name like ?"
8881
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, execution_state, cost_type, execution_frequency, keyword)
8882
+							} else {
8883
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and patient_id = ? and execution_state = ? and  is_settle = ? and execution_frequency = ?"
8884
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, execution_state, cost_type, execution_frequency)
8885
+							}
8886
+
8796
 						} else {
8887
 						} else {
8797
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and patient_id = ? and execution_state = ? and  is_settle = ?"
8798
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, execution_state, cost_type)
8888
+							if len(keyword) > 0 {
8889
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and patient_id = ? and execution_state = ? and  is_settle = ? and advice_name like ?"
8890
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, execution_state, cost_type, keyword)
8891
+							} else {
8892
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and patient_id = ? and execution_state = ? and  is_settle = ?"
8893
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, execution_state, cost_type)
8894
+							}
8895
+
8799
 						}
8896
 						}
8800
 
8897
 
8801
 					} else {
8898
 					} else {
8802
 						if len(execution_frequency) > 0 {
8899
 						if len(execution_frequency) > 0 {
8803
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND advice_doctor = ? and patient_id = ? and execution_state = ? and execution_frequency = ?"
8804
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, execution_state, execution_frequency)
8900
+							if len(keyword) > 0 {
8901
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND advice_doctor = ? and patient_id = ? and execution_state = ? and execution_frequency = ? and advice_name like ?"
8902
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, execution_state, execution_frequency, keyword)
8903
+							} else {
8904
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND advice_doctor = ? and patient_id = ? and execution_state = ? and execution_frequency = ?"
8905
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, execution_state, execution_frequency)
8906
+							}
8907
+
8805
 						} else {
8908
 						} else {
8806
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and patient_id = ? and execution_state = ?"
8807
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, execution_state)
8909
+							if len(keyword) > 0 {
8910
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and patient_id = ? and execution_state = ? and advice_name like ?"
8911
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, execution_state, keyword)
8912
+							} else {
8913
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and patient_id = ? and execution_state = ?"
8914
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, execution_state)
8915
+							}
8916
+
8808
 						}
8917
 						}
8809
 
8918
 
8810
 					}
8919
 					}
8812
 				} else {
8921
 				} else {
8813
 					if cost_type > 0 {
8922
 					if cost_type > 0 {
8814
 						if len(execution_frequency) > 0 {
8923
 						if len(execution_frequency) > 0 {
8815
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and patient_id = ? and is_settle = ?and execution_frequency = ?"
8816
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, cost_type, execution_frequency)
8924
+							if len(keyword) > 0 {
8925
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and patient_id = ? and is_settle = ?and execution_frequency = ? and advice_name like ?"
8926
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, cost_type, execution_frequency, keyword)
8927
+							} else {
8928
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and patient_id = ? and is_settle = ?and execution_frequency = ?"
8929
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, cost_type, execution_frequency)
8930
+							}
8931
+
8817
 						} else {
8932
 						} else {
8818
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND advice_doctor = ? and patient_id = ? and is_settle = ?"
8819
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, cost_type)
8933
+							if len(keyword) > 0 {
8934
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND advice_doctor = ? and patient_id = ? and is_settle = ? and advice_name like ?"
8935
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, cost_type, keyword)
8936
+							} else {
8937
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND advice_doctor = ? and patient_id = ? and is_settle = ?"
8938
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, cost_type)
8939
+							}
8940
+
8820
 						}
8941
 						}
8821
 
8942
 
8822
 					} else {
8943
 					} else {
8823
 						if len(execution_frequency) > 0 {
8944
 						if len(execution_frequency) > 0 {
8824
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and patient_id = ? and execution_frequency = ?"
8825
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, execution_frequency)
8945
+							if len(keyword) > 0 {
8946
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and patient_id = ? and execution_frequency = ? and advice_name like ?"
8947
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, execution_frequency, keyword)
8948
+							} else {
8949
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and patient_id = ? and execution_frequency = ?"
8950
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, execution_frequency)
8951
+							}
8952
+
8826
 						} else {
8953
 						} else {
8827
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND advice_doctor = ? and patient_id = ?"
8828
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id)
8954
+							if len(keyword) > 0 {
8955
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND advice_doctor = ? and patient_id = ? and advice_name like ?"
8956
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id, keyword)
8957
+							} else {
8958
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND advice_doctor = ? and patient_id = ?"
8959
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, patient_id)
8960
+							}
8961
+
8829
 						}
8962
 						}
8830
 
8963
 
8831
 					}
8964
 					}
8836
 				if execution_state > 0 {
8969
 				if execution_state > 0 {
8837
 					if cost_type > 0 {
8970
 					if cost_type > 0 {
8838
 						if len(execution_frequency) > 0 {
8971
 						if len(execution_frequency) > 0 {
8839
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND advice_doctor = ? and execution_state=? and is_settle = ?and execution_frequency = ?"
8840
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, execution_state, cost_type, execution_frequency)
8972
+							if len(keyword) > 0 {
8973
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND advice_doctor = ? and execution_state=? and is_settle = ?and execution_frequency = ? and advice_name like ?"
8974
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, execution_state, cost_type, execution_frequency, keyword)
8975
+							} else {
8976
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND advice_doctor = ? and execution_state=? and is_settle = ?and execution_frequency = ?"
8977
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, execution_state, cost_type, execution_frequency)
8978
+							}
8979
+
8841
 						} else {
8980
 						} else {
8842
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and execution_state=? and is_settle = ?"
8843
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, execution_state, cost_type)
8981
+							if len(keyword) > 0 {
8982
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and execution_state=? and is_settle = ? and advice_name like ?"
8983
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, execution_state, cost_type, keyword)
8984
+							} else {
8985
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and execution_state=? and is_settle = ?"
8986
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, execution_state, cost_type)
8987
+							}
8988
+
8844
 						}
8989
 						}
8845
 
8990
 
8846
 					} else {
8991
 					} else {
8847
 						if len(execution_frequency) > 0 {
8992
 						if len(execution_frequency) > 0 {
8848
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and execution_state=?and execution_frequency = ?"
8849
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, execution_state, execution_frequency)
8993
+							if len(keyword) > 0 {
8994
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and execution_state=?and execution_frequency = ? and advice_name like ?"
8995
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, execution_state, execution_frequency, keyword)
8996
+							} else {
8997
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and execution_state=?and execution_frequency = ?"
8998
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, execution_state, execution_frequency)
8999
+							}
9000
+
8850
 						} else {
9001
 						} else {
8851
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and execution_state=?"
8852
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, execution_state)
9002
+							if len(keyword) > 0 {
9003
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and execution_state=? and advice_name like ?"
9004
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, execution_state, keyword)
9005
+							} else {
9006
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and execution_state=?"
9007
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, execution_state)
9008
+							}
9009
+
8853
 						}
9010
 						}
8854
 
9011
 
8855
 					}
9012
 					}
8857
 				} else {
9014
 				} else {
8858
 					if cost_type > 0 {
9015
 					if cost_type > 0 {
8859
 						if len(execution_frequency) > 0 {
9016
 						if len(execution_frequency) > 0 {
8860
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and  is_settle = ? and execution_frequency = ?"
8861
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, cost_type, execution_frequency)
9017
+							if len(keyword) > 0 {
9018
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and  is_settle = ? and execution_frequency = ? and advice_name like ?"
9019
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, cost_type, execution_frequency, keyword)
9020
+							} else {
9021
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and  is_settle = ? and execution_frequency = ?"
9022
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, cost_type, execution_frequency)
9023
+							}
9024
+
8862
 						} else {
9025
 						} else {
8863
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and  is_settle = ? "
8864
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, cost_type)
9026
+							if len(keyword) > 0 {
9027
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and  is_settle = ? and advice_name like ?"
9028
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, cost_type, keyword)
9029
+							} else {
9030
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and  is_settle = ? "
9031
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, cost_type)
9032
+							}
9033
+
8865
 						}
9034
 						}
8866
 
9035
 
8867
 					} else {
9036
 					} else {
8868
 						if len(execution_frequency) > 0 {
9037
 						if len(execution_frequency) > 0 {
8869
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and execution_frequency = ?"
8870
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, execution_frequency)
9038
+							if len(keyword) > 0 {
9039
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and execution_frequency = ? and advice_name like ?"
9040
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, execution_frequency, keyword)
9041
+							} else {
9042
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND advice_doctor = ? and execution_frequency = ?"
9043
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, execution_frequency)
9044
+							}
9045
+
8871
 						} else {
9046
 						} else {
8872
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND advice_doctor = ? "
8873
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId)
9047
+							if len(keyword) > 0 {
9048
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND advice_doctor = ?  and advice_name like ?"
9049
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId, keyword)
9050
+							} else {
9051
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND advice_doctor = ? "
9052
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, adminUserId)
9053
+							}
9054
+
8874
 						}
9055
 						}
8875
 
9056
 
8876
 					}
9057
 					}
8884
 				if execution_state > 0 {
9065
 				if execution_state > 0 {
8885
 					if cost_type > 0 {
9066
 					if cost_type > 0 {
8886
 						if len(execution_frequency) > 0 {
9067
 						if len(execution_frequency) > 0 {
8887
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and execution_state = ? and is_settle = ?and execution_frequency = ?"
8888
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, cost_type, execution_frequency)
9068
+							if len(keyword) > 0 {
9069
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and execution_state = ? and is_settle = ?and execution_frequency = ? and advice_name like ?"
9070
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, cost_type, execution_frequency, keyword)
9071
+							} else {
9072
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and execution_state = ? and is_settle = ?and execution_frequency = ?"
9073
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, cost_type, execution_frequency)
9074
+							}
9075
+
8889
 						} else {
9076
 						} else {
8890
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and execution_state = ? and is_settle = ?"
8891
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, cost_type)
9077
+							if len(keyword) > 0 {
9078
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and execution_state = ? and is_settle = ? and advice_name like ?"
9079
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, cost_type, keyword)
9080
+							} else {
9081
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and execution_state = ? and is_settle = ?"
9082
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, cost_type)
9083
+							}
9084
+
8892
 						}
9085
 						}
8893
 
9086
 
8894
 					} else {
9087
 					} else {
8895
 						if len(execution_frequency) > 0 {
9088
 						if len(execution_frequency) > 0 {
8896
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and execution_state = ? and execution_frequency = ?"
8897
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, execution_frequency)
9089
+							if len(keyword) > 0 {
9090
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and execution_state = ? and execution_frequency = ? and advice_name like ?"
9091
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, execution_frequency, keyword)
9092
+							} else {
9093
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and execution_state = ? and execution_frequency = ?"
9094
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, execution_frequency)
9095
+							}
9096
+
8898
 						} else {
9097
 						} else {
8899
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and execution_state = ?"
8900
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state)
9098
+							if len(keyword) > 0 {
9099
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and execution_state = ? and advice_name like ?"
9100
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state, keyword)
9101
+							} else {
9102
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and execution_state = ?"
9103
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_state)
9104
+							}
9105
+
8901
 						}
9106
 						}
8902
 
9107
 
8903
 					}
9108
 					}
8905
 				} else {
9110
 				} else {
8906
 					if cost_type > 0 {
9111
 					if cost_type > 0 {
8907
 						if len(execution_frequency) > 0 {
9112
 						if len(execution_frequency) > 0 {
8908
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and is_settle = ? and execution_frequency = ?"
8909
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, cost_type, execution_frequency)
9113
+							if len(keyword) > 0 {
9114
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and is_settle = ? and execution_frequency = ? and advice_name like ?"
9115
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, cost_type, execution_frequency, keyword)
9116
+							} else {
9117
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and is_settle = ? and execution_frequency = ?"
9118
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, cost_type, execution_frequency)
9119
+							}
9120
+
8910
 						} else {
9121
 						} else {
8911
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and is_settle = ?"
8912
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, cost_type)
9122
+							if len(keyword) > 0 {
9123
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and is_settle = ? and advice_name like ?"
9124
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, cost_type, keyword)
9125
+							} else {
9126
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ? and is_settle = ?"
9127
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, cost_type)
9128
+							}
9129
+
8913
 						}
9130
 						}
8914
 
9131
 
8915
 					} else {
9132
 					} else {
8916
 						if len(execution_frequency) > 0 {
9133
 						if len(execution_frequency) > 0 {
8917
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ?  and execution_frequency = ?"
8918
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_frequency)
9134
+							if len(keyword) > 0 {
9135
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ?  and execution_frequency = ? and advice_name like ?"
9136
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_frequency, keyword)
9137
+							} else {
9138
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and patient_id = ?  and execution_frequency = ?"
9139
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, execution_frequency)
9140
+							}
9141
+
8919
 						} else {
9142
 						} else {
8920
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND execution_staff = 0 and patient_id = ?"
8921
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id)
9143
+							if len(keyword) > 0 {
9144
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND execution_staff = 0 and patient_id = ? and advice_name like ?"
9145
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id, keyword)
9146
+							} else {
9147
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND execution_staff = 0 and patient_id = ?"
9148
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, patient_id)
9149
+							}
9150
+
8922
 						}
9151
 						}
8923
 
9152
 
8924
 					}
9153
 					}
8929
 
9158
 
8930
 					if cost_type > 0 {
9159
 					if cost_type > 0 {
8931
 						if len(execution_frequency) > 0 {
9160
 						if len(execution_frequency) > 0 {
8932
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1AND execution_staff = 0 and execution_state = ? and is_settle = ? and execution_frequency = ?"
8933
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, cost_type, execution_frequency)
9161
+							if len(keyword) > 0 {
9162
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1AND execution_staff = 0 and execution_state = ? and is_settle = ? and execution_frequency = ? and advice_name like ?"
9163
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, cost_type, execution_frequency, keyword)
9164
+							} else {
9165
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1AND execution_staff = 0 and execution_state = ? and is_settle = ? and execution_frequency = ?"
9166
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, cost_type, execution_frequency)
9167
+							}
9168
+
8934
 						} else {
9169
 						} else {
8935
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1AND execution_staff = 0 and execution_state = ? and is_settle = ?"
8936
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, cost_type)
9170
+							if len(keyword) > 0 {
9171
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1AND execution_staff = 0 and execution_state = ? and is_settle = ? and advice_name like ?"
9172
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, cost_type, keyword)
9173
+							} else {
9174
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1AND execution_staff = 0 and execution_state = ? and is_settle = ?"
9175
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, cost_type)
9176
+							}
9177
+
8937
 						}
9178
 						}
8938
 
9179
 
8939
 					} else {
9180
 					} else {
8940
 						if len(execution_frequency) > 0 {
9181
 						if len(execution_frequency) > 0 {
8941
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND execution_staff = 0 and execution_state = ? and execution_frequency = ?"
8942
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, execution_frequency)
9182
+							if len(keyword) > 0 {
9183
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND execution_staff = 0 and execution_state = ? and execution_frequency = ? and advice_name like ?"
9184
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, execution_frequency, keyword)
9185
+							} else {
9186
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND execution_staff = 0 and execution_state = ? and execution_frequency = ?"
9187
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, execution_frequency)
9188
+							}
9189
+
8943
 						} else {
9190
 						} else {
8944
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and execution_state = ?"
8945
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state)
9191
+							if len(keyword) > 0 {
9192
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and execution_state = ? and advice_name like ?"
9193
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state, keyword)
9194
+							} else {
9195
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and execution_state = ?"
9196
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_state)
9197
+							}
9198
+
8946
 						}
9199
 						}
8947
 
9200
 
8948
 					}
9201
 					}
8951
 
9204
 
8952
 					if cost_type > 0 {
9205
 					if cost_type > 0 {
8953
 						if len(execution_frequency) > 0 {
9206
 						if len(execution_frequency) > 0 {
8954
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND execution_staff = 0 and is_settle = ? and execution_frequency = ?"
8955
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, cost_type, execution_frequency)
9207
+							if len(keyword) > 0 {
9208
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND execution_staff = 0 and is_settle = ? and execution_frequency = ? and advice_name like ?"
9209
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, cost_type, execution_frequency, keyword)
9210
+							} else {
9211
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND execution_staff = 0 and is_settle = ? and execution_frequency = ?"
9212
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, cost_type, execution_frequency)
9213
+							}
9214
+
8956
 						} else {
9215
 						} else {
8957
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and is_settle = ?"
8958
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, cost_type)
9216
+							if len(keyword) > 0 {
9217
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and is_settle = ? and advice_name like ?"
9218
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, cost_type, keyword)
9219
+							} else {
9220
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and is_settle = ?"
9221
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, cost_type)
9222
+							}
9223
+
8959
 						}
9224
 						}
8960
 
9225
 
8961
 					} else {
9226
 					} else {
8962
 						if len(execution_frequency) > 0 {
9227
 						if len(execution_frequency) > 0 {
8963
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND execution_staff = 0 and execution_frequency = ?"
8964
-							adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_frequency)
9228
+							if len(keyword) > 0 {
9229
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND execution_staff = 0 and execution_frequency = ? and advice_name like ?"
9230
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_frequency, keyword)
9231
+							} else {
9232
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1 AND execution_staff = 0 and execution_frequency = ?"
9233
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, execution_frequency)
9234
+							}
9235
+
8965
 						} else {
9236
 						} else {
8966
-							adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0"
8967
-							adviceCondition = append(adviceCondition, adviceWhere, orgID)
9237
+							if len(keyword) > 0 {
9238
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0 and advice_name like ?"
9239
+								adviceCondition = append(adviceCondition, adviceWhere, orgID, keyword)
9240
+							} else {
9241
+								adviceWhere = "status = 1 AND user_org_id = ? AND advice_type = 1  AND execution_staff = 0"
9242
+								adviceCondition = append(adviceCondition, adviceWhere, orgID)
9243
+							}
9244
+
8968
 						}
9245
 						}
8969
 
9246
 
8970
 					}
9247
 					}

+ 5 - 1
service/patient_service.go View File

79
 
79
 
80
 	}
80
 	}
81
 	if lapseto != 2 && lapseto != 3 {
81
 	if lapseto != 2 && lapseto != 3 {
82
-		if orgID != 10579 && orgID != 10600 {
82
+		if orgID != 10579 && orgID != 10600 && orgID != 10587 {
83
 			err = db.Order("p.id desc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
83
 			err = db.Order("p.id desc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
84
 		}
84
 		}
85
 
85
 
87
 			err = db.Order("p.dialysis_no asc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
87
 			err = db.Order("p.dialysis_no asc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
88
 		}
88
 		}
89
 
89
 
90
+		if orgID == 10587 {
91
+			err = db.Order("p.created_time desc").Select(" p.id, p.user_org_id, p.user_id, p.patient_type, p.dialysis_no, p.admission_number, p.source, p.lapseto, p.partition_id, p.bed_id, p.name, p.alias, p.gender, p.marital_status, p.id_card_no, p.birthday, p.reimbursement_way_id, p.health_care_type, p.health_care_no, p.health_care_due_date, p.height, p.blood_type, p.rh, p.health_care_due_alert_date, p.education_level, p.profession, p.phone, p.home_telephone, p.relative_phone, p.relative_relations, p.home_address, p.work_unit, p.unit_address, p.children, p.receiving_date, p.is_hospital_first_dialysis, p.first_dialysis_date, p.first_dialysis_hospital, p.induction_period, p.initial_dialysis, p.total_dialysis, p.attending_doctor_id, p.head_nurse_id, p.evaluate, p.diagnose, p.remark, p.registrars_id, p.registrars, p.qr_code, p.binding_state, p.status, p.created_time, p.updated_time,p.user_sys_before_count,p.out_reason,p.death_time,p.is_infectious").Group("p.id").Count(&total).Offset(offset).Limit(limit).Find(&patients).Error
92
+		}
93
+
90
 	}
94
 	}
91
 
95
 
92
 	return
96
 	return

+ 11 - 2
service/pharmacy_service.go View File

1026
 	//针对阜阳经沃
1026
 	//针对阜阳经沃
1027
 	if orgid != 10480 {
1027
 	if orgid != 10480 {
1028
 		for _, v := range advice_info {
1028
 		for _, v := range advice_info {
1029
+
1029
 			//扣减库存
1030
 			//扣减库存
1030
 			if !IsPharmacyDelivery(v.DrugId, orgid) {
1031
 			if !IsPharmacyDelivery(v.DrugId, orgid) {
1031
 				continue
1032
 				continue
1056
 			//退药
1057
 			//退药
1057
 			UpdateHisPrescriptionInfo(v.PatientId, v.AdviceDate, v.UserOrgId)
1058
 			UpdateHisPrescriptionInfo(v.PatientId, v.AdviceDate, v.UserOrgId)
1058
 
1059
 
1060
+			//退药
1061
+			UpdateHisPrescriptionInfoOne(v.PatientId, v.AdviceDate, v.UserOrgId)
1062
+
1059
 		}
1063
 		}
1060
 	}
1064
 	}
1061
 
1065
 
2272
 }
2276
 }
2273
 
2277
 
2274
 func UpdateHisPrescriptionInfo(patient_id int64, advice_date int64, user_org_id int64) error {
2278
 func UpdateHisPrescriptionInfo(patient_id int64, advice_date int64, user_org_id int64) error {
2275
-
2276
 	err = XTWriteDB().Model(&models.HisDoctorAdvice{}).Where("patient_id = ? and advice_date = ? and user_org_id= ? and status=1", patient_id, advice_date, user_org_id).Updates(map[string]interface{}{"is_medicine": 0}).Error
2279
 	err = XTWriteDB().Model(&models.HisDoctorAdvice{}).Where("patient_id = ? and advice_date = ? and user_org_id= ? and status=1", patient_id, advice_date, user_org_id).Updates(map[string]interface{}{"is_medicine": 0}).Error
2277
 
2280
 
2278
-	err = XTWriteDB().Model(&models.HisPrintPrescription{}).Where("patient_id = ? and record_date = ? and user_org_id = ? and status=1", patient_id, advice_date, user_org_id).Updates(map[string]interface{}{"is_medicine": 0}).Error
2281
+	err = XTWriteDB().Model(&models.HisPrescription{}).Where("patient_id = ? and record_date = ? and user_org_id = ? and status=1", patient_id, advice_date, user_org_id).Updates(map[string]interface{}{"is_medicine": 0}).Error
2282
+	return err
2283
+}
2284
+
2285
+func UpdateHisPrescriptionInfoOne(patient_id int64, advice_date int64, user_org_id int64) error {
2286
+
2287
+	err = XTWriteDB().Model(&models.HisPrescription{}).Where("patient_id = ? and record_date = ? and user_org_id = ? and status=1", patient_id, advice_date, user_org_id).Updates(map[string]interface{}{"is_medicine": 0}).Error
2279
 	return err
2288
 	return err
2280
 }
2289
 }
2281
 
2290
 

+ 49 - 0
service/self_drug_service.go View File

3012
 
3012
 
3013
 	return goodinfo, total, err
3013
 	return goodinfo, total, err
3014
 }
3014
 }
3015
+
3016
+func GetInitBalanceList(good_id int64, user_org_id int64, start_time int64, end_time int64, storehouse_id int64) (list []*models.StWarehousingInfoOne, err error) {
3017
+
3018
+	db := XTReadDB().Model(&list).Where("status=1")
3019
+
3020
+	if good_id > 0 {
3021
+		db = db.Where("good_id = ?", good_id)
3022
+	}
3023
+	if user_org_id > 0 {
3024
+		db = db.Where("org_id = ?", user_org_id)
3025
+	}
3026
+
3027
+	if start_time > 0 {
3028
+		db = db.Where("ctime<=?", start_time)
3029
+	}
3030
+
3031
+	if storehouse_id > 0 {
3032
+		db = db.Where("storehouse_id = ?", storehouse_id)
3033
+	}
3034
+
3035
+	err = db.Find(&list).Error
3036
+
3037
+	return list, err
3038
+
3039
+}
3040
+
3041
+func GetInitOutBanceList(good_id int64, user_org_id int64, start_time int64, end_time int64, storehouse_id int64) (list []*models.WarehouseOutInfoTenty, err error) {
3042
+
3043
+	db := XTReadDB().Model(&list).Where("status=1")
3044
+
3045
+	if good_id > 0 {
3046
+		db = db.Where("good_id = ?", good_id)
3047
+	}
3048
+	if user_org_id > 0 {
3049
+		db = db.Where("org_id = ?", user_org_id)
3050
+	}
3051
+
3052
+	if start_time > 0 {
3053
+		db = db.Where("ctime<=?", start_time)
3054
+	}
3055
+
3056
+	if storehouse_id > 0 {
3057
+		db = db.Where("storehouse_id = ?", storehouse_id)
3058
+	}
3059
+
3060
+	err = db.Find(&list).Error
3061
+
3062
+	return list, err
3063
+}

+ 13 - 0
service/sign_service.go View File

2212
 	err := XTWriteDB().Model(&models.WarehouseOutInfo{}).Where("warehouse_out_id = ? and status=1", id).Updates(map[string]interface{}{"warehouse_out_order_number": warehouse_out_order_number}).Error
2212
 	err := XTWriteDB().Model(&models.WarehouseOutInfo{}).Where("warehouse_out_id = ? and status=1", id).Updates(map[string]interface{}{"warehouse_out_order_number": warehouse_out_order_number}).Error
2213
 	return err
2213
 	return err
2214
 }
2214
 }
2215
+
2216
+func GetDialysisOrderListOne(patient_id int64) (order []*models.DialysisOrder, err error) {
2217
+
2218
+	err = XTReadDB().Where("patient_id = ? and status=1 and user_org_id =10495", patient_id).Find(&order).Error
2219
+
2220
+	return order, err
2221
+}
2222
+
2223
+func UpdateSchedulePatient(patient_id int64, schedule_date int64, zone_id int64, bed_id int64) error {
2224
+
2225
+	err := XTWriteDB().Model(&models.XtSchedule{}).Where("patient_id = ? and schedule_date =? and partition_id = ? and bed_id =?", patient_id, schedule_date, zone_id, bed_id).Updates(map[string]interface{}{"status": 1}).Error
2226
+	return err
2227
+}