28169 2 miesięcy temu
rodzic
commit
9c4e0cf0ae

BIN
XT_New.exe Wyświetl plik


+ 2 - 2
controllers/doctors_api_controller.go Wyświetl plik

@@ -1647,7 +1647,7 @@ func (c *DoctorsApiController) GetLongScheduleAdvicesList() {
1647 1647
 	excution_way, _ := c.GetInt64("excution_way")
1648 1648
 	cost_type, _ := c.GetInt64("cost_type")
1649 1649
 	execution_frequency := c.GetString("execution_frequency")
1650
-
1650
+	keyword := c.GetString("keyword")
1651 1651
 	date, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", schedualDate)
1652 1652
 	if parseDateErr != nil {
1653 1653
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -1657,7 +1657,7 @@ func (c *DoctorsApiController) GetLongScheduleAdvicesList() {
1657 1657
 	adminUserInfo := c.GetAdminUserInfo()
1658 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 1662
 	adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
1663 1663
 	if err != nil {

+ 0 - 4
controllers/his_api_controller.go Wyświetl plik

@@ -1964,10 +1964,6 @@ func (c *HisApiController) CreateHisPrescription() {
1964 1964
 								//查询该药品是否存在开药记录
1965 1965
 								advicelist, _ := service.GetHisAdviceListByDrugIdEight(drug_id, patient_id, recordDateTime, adviceId)
1966 1966
 
1967
-								fmt.Println("wooooooooooooo", advicelist.ID)
1968
-								fmt.Println("prescribingNumberUnit", prescribingNumberUnit)
1969
-								fmt.Println("prescribingNumberUnit", drug.MinUnit)
1970
-								fmt.Println("prescribingNumberUnit", drug.MaxUnit)
1971 1967
 								//新增处方
1972 1968
 								if advicelist.ID == 0 {
1973 1969
 									all_count, _ := strconv.ParseFloat(totals, 64)

+ 6 - 1
controllers/mobile_api_controllers/dialysis_api_controller.go Wyświetl plik

@@ -3430,6 +3430,11 @@ func (this *DialysisAPIController) StartDialysis() {
3430 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,7 +4471,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
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 4476
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 1000 / float64(totalMin) * 60 * 1000)
4472 4477
 				record.UltrafiltrationRate = ultrafiltration_rate / 1000

+ 5 - 1
controllers/mobile_api_controllers/patient_api_controller.go Wyświetl plik

@@ -2865,7 +2865,11 @@ func (c *PatientApiController) EditAssessmentBeforeDislysis() {
2865 2865
 			newprescribe.Status = 1
2866 2866
 			newprescribe.DialysisIrrigation = lastDialysisPrescribe.DialysisIrrigation
2867 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 2873
 			newprescribe.Remark = lastDialysisPrescription.Remark
2870 2874
 			newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
2871 2875
 			_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, theAssessmentDateTime, adminUserInfo.Org.Id)

+ 14 - 0
controllers/self_drug_api_congtroller.go Wyświetl plik

@@ -3848,6 +3848,20 @@ func (this *SelfDrugApiController) GetGoodNewPurchaseStockQuery() {
3848 3848
 			for _, it := range losses {
3849 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 3867
 		if err != nil {

+ 30 - 25
controllers/sign_api_controller.go Wyświetl plik

@@ -8,7 +8,6 @@ import (
8 8
 	"fmt"
9 9
 	"github.com/astaxie/beego"
10 10
 	"github.com/jung-kurt/gofpdf"
11
-	"github.com/mozillazg/go-pinyin"
12 11
 	"io/ioutil"
13 12
 	"time"
14 13
 )
@@ -665,33 +664,39 @@ func (this *SignApiController) GetEnterPriseDetail() {
665 664
 
666 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 700
 	//baseList, _ := service.GeteAllBaseList(10375)
696 701
 	//for _, item := range baseList {
697 702
 	//	hans := item.DrugName // 要转换的汉字字符串

+ 3 - 4
models/new_stock_models.go Wyświetl plik

@@ -286,6 +286,9 @@ type GoodInfoTwenty struct {
286 286
 	WarehouseOutInfoStart  []*VmStockFlowTwenty
287 287
 	WarehouseInfoEnd       []*VmStockFlowTwenty //期末入库量
288 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 293
 	StartFlowInfo    []*VmStockFlowTwenty
291 294
 	StartOutFlowInfo []*VmStockFlowTwenty
@@ -308,10 +311,6 @@ type GoodInfoTwenty struct {
308 311
 	WareStartEndStockInventoryProfit []*VmStockFlowTwenty //期间盘盈
309 312
 	WareStartEndStockInventoryLosses []*VmStockFlowTwenty //期间盘亏
310 313
 
311
-	//newOverInCount     []*VmStockFlowTwenty
312
-	//newOverOuntCount   []*VmStockFlowTwenty
313
-	//newOverCancelCount []*VmStockFlowTwenty
314
-
315 314
 	//期初结余
316 315
 	GoodStartFlowInfo VmStockFlowTwenty
317 316
 	//期末结余

+ 29 - 0
models/stock_models.go Wyświetl plik

@@ -113,6 +113,20 @@ func (StWarehousingInfo) TableName() string {
113 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 130
 type XtWarehouse struct {
117 131
 	ID               int64  `gorm:"column:id" json:"id" form:"id"`
118 132
 	WarehousingOrder string `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
@@ -1689,3 +1703,18 @@ type WarehousingInfoNight struct {
1689 1703
 func (WarehousingInfoNight) TableName() string {
1690 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 Wyświetl plik

@@ -8699,10 +8699,11 @@ func GetPatientDryWeight(org_id int64, patient_id int64) (weight []*models.SgjPa
8699 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 8704
 	var vms []*MScheduleDoctorAdviceVM
8705 8705
 	adviceWhere := ""
8706
+	keyword = "%" + keyword + "%"
8706 8707
 	adviceCondition := []interface{}{}
8707 8708
 	if adviceType == 1 {
8708 8709
 		if patientType == 0 {
@@ -8710,20 +8711,44 @@ func MobileGetLongScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceT
8710 8711
 				if execution_state > 0 {
8711 8712
 					if cost_type > 0 {
8712 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 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 8733
 					} else {
8721 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 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,20 +8756,44 @@ func MobileGetLongScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceT
8731 8756
 				} else {
8732 8757
 					if cost_type > 0 {
8733 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 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 8778
 					} else {
8742 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 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,31 +8804,67 @@ func MobileGetLongScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceT
8755 8804
 				if execution_state > 0 {
8756 8805
 					if cost_type > 0 {
8757 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 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 8826
 					} else {
8766 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 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 8849
 				} else {
8777 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 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,20 +8876,44 @@ func MobileGetLongScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceT
8791 8876
 				if execution_state > 0 {
8792 8877
 					if cost_type > 0 {
8793 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 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 8898
 					} else {
8802 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 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,20 +8921,44 @@ func MobileGetLongScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceT
8812 8921
 				} else {
8813 8922
 					if cost_type > 0 {
8814 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 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 8943
 					} else {
8823 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 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,20 +8969,44 @@ func MobileGetLongScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceT
8836 8969
 				if execution_state > 0 {
8837 8970
 					if cost_type > 0 {
8838 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 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 8991
 					} else {
8847 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 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,20 +9014,44 @@ func MobileGetLongScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceT
8857 9014
 				} else {
8858 9015
 					if cost_type > 0 {
8859 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 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 9036
 					} else {
8868 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 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,20 +9065,44 @@ func MobileGetLongScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceT
8884 9065
 				if execution_state > 0 {
8885 9066
 					if cost_type > 0 {
8886 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 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 9087
 					} else {
8895 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 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,20 +9110,44 @@ func MobileGetLongScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceT
8905 9110
 				} else {
8906 9111
 					if cost_type > 0 {
8907 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 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 9132
 					} else {
8916 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 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,20 +9158,44 @@ func MobileGetLongScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceT
8929 9158
 
8930 9159
 					if cost_type > 0 {
8931 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 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 9180
 					} else {
8940 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 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,20 +9204,44 @@ func MobileGetLongScheduleDoctorAdvices(orgID int64, scheduleDate int64, adviceT
8951 9204
 
8952 9205
 					if cost_type > 0 {
8953 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 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 9226
 					} else {
8962 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 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 Wyświetl plik

@@ -79,7 +79,7 @@ func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bind
79 79
 
80 80
 	}
81 81
 	if lapseto != 2 && lapseto != 3 {
82
-		if orgID != 10579 && orgID != 10600 {
82
+		if orgID != 10579 && orgID != 10600 && orgID != 10587 {
83 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,6 +87,10 @@ func GetPatientList(orgID int64, keywords string, page, limit, schedulType, bind
87 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 96
 	return

+ 11 - 2
service/pharmacy_service.go Wyświetl plik

@@ -1026,6 +1026,7 @@ func DrugWithdrawal(orgid, patient_id, stime, etime, creater int64) (err error)
1026 1026
 	//针对阜阳经沃
1027 1027
 	if orgid != 10480 {
1028 1028
 		for _, v := range advice_info {
1029
+
1029 1030
 			//扣减库存
1030 1031
 			if !IsPharmacyDelivery(v.DrugId, orgid) {
1031 1032
 				continue
@@ -1056,6 +1057,9 @@ func DrugWithdrawal(orgid, patient_id, stime, etime, creater int64) (err error)
1056 1057
 			//退药
1057 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,10 +2276,15 @@ func UpdateAdviceFlow(id int64) error {
2272 2276
 }
2273 2277
 
2274 2278
 func UpdateHisPrescriptionInfo(patient_id int64, advice_date int64, user_org_id int64) error {
2275
-
2276 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 2288
 	return err
2280 2289
 }
2281 2290
 

+ 49 - 0
service/self_drug_service.go Wyświetl plik

@@ -3012,3 +3012,52 @@ func GetPurchaseStockQueryList(good_type int64, keyword string, page int64, limi
3012 3012
 
3013 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 Wyświetl plik

@@ -2212,3 +2212,16 @@ func UpdateWarehouseOutOrderInfo(id int64, warehouse_out_order_number string) er
2212 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 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
+}