Bladeren bron

耗材参数

XMLWAN 3 jaren geleden
bovenliggende
commit
e869bc112b

+ 163 - 69
controllers/doctors_api_controller.go Bestand weergeven

5
 	"XT_New/models"
5
 	"XT_New/models"
6
 	"XT_New/service"
6
 	"XT_New/service"
7
 	"XT_New/utils"
7
 	"XT_New/utils"
8
+	"encoding/json"
8
 	"fmt"
9
 	"fmt"
9
 	"github.com/astaxie/beego"
10
 	"github.com/astaxie/beego"
10
 	"github.com/jinzhu/gorm"
11
 	"github.com/jinzhu/gorm"
46
 	beego.Router("/api/patient/getinspectiondetail", &DoctorsApiController{}, "Get:GetInspectionDetailByProject")
47
 	beego.Router("/api/patient/getinspectiondetail", &DoctorsApiController{}, "Get:GetInspectionDetailByProject")
47
 	beego.Router("/api/patient/getinspectionitemlist", &DoctorsApiController{}, "Get:GetInspectionItemlist")
48
 	beego.Router("/api/patient/getinspectionitemlist", &DoctorsApiController{}, "Get:GetInspectionItemlist")
48
 	beego.Router("/api/patient/getinitdatelist", &DoctorsApiController{}, "Get:GetInitDateList")
49
 	beego.Router("/api/patient/getinitdatelist", &DoctorsApiController{}, "Get:GetInitDateList")
49
-	beego.Router("/api/patient/savecreationinspection", &DoctorsApiController{}, "Get:SaveCreationInspection")
50
+	beego.Router("/api/patient/savecreationinspection", &DoctorsApiController{}, "Post:SaveCreationInspection")
50
 	beego.Router("/api/patient/getemlatesummarylist", &DoctorsApiController{}, "Get:GetTemplateSummaryList")
51
 	beego.Router("/api/patient/getemlatesummarylist", &DoctorsApiController{}, "Get:GetTemplateSummaryList")
51
 	beego.Router("/api/patient/gettemplatesummarydetail", &DoctorsApiController{}, "Get:GetTemplateSummaryDetail")
52
 	beego.Router("/api/patient/gettemplatesummarydetail", &DoctorsApiController{}, "Get:GetTemplateSummaryDetail")
52
 	beego.Router("/api/patient/gettemplatesummaryprintdetail", &DoctorsApiController{}, "Get:GetTemplateSummaryPrintDetail")
53
 	beego.Router("/api/patient/gettemplatesummaryprintdetail", &DoctorsApiController{}, "Get:GetTemplateSummaryPrintDetail")
53
-	beego.Router("/api/patient/updatetemplatesummary", &DoctorsApiController{}, "Get:UpdateTempalteSummary")
54
+	beego.Router("/api/patient/updatetemplatesummary", &DoctorsApiController{}, "Post:UpdateTempalteSummary")
54
 	beego.Router("/api/patient/deletesummary", &DoctorsApiController{}, "Get:DeleteSummary")
55
 	beego.Router("/api/patient/deletesummary", &DoctorsApiController{}, "Get:DeleteSummary")
55
 }
56
 }
56
 
57
 
763
 
764
 
764
 func (this *DoctorsApiController) SaveCreationInspection() {
765
 func (this *DoctorsApiController) SaveCreationInspection() {
765
 
766
 
766
-	title := this.GetString("title")
767
-
768
-	dryWeight := this.GetString("dry_weight")
767
+	dataBody := make(map[string]interface{}, 0)
768
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
769
+	if err != nil {
770
+		utils.ErrorLog(err.Error())
771
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
772
+		return
773
+	}
774
+	title := dataBody["title"].(string)
775
+	dryWeight := dataBody["dry_weight"].(string)
769
 	dry_weight, _ := strconv.ParseFloat(dryWeight, 64)
776
 	dry_weight, _ := strconv.ParseFloat(dryWeight, 64)
770
-	dialysis_count, _ := this.GetInt64("dialysis_count")
771
-	hd_count, _ := this.GetInt64("hd_count")
772
-	hdf_count, _ := this.GetInt64("hdf_count")
773
-	hp_count, _ := this.GetInt64("hp_count")
774
-	other_count, _ := this.GetInt64("other_count")
775
-	dialzer_apparatus := this.GetString("dialzer_apparatus")
776
-	perfusion_apparatus := this.GetString("perfusion_apparatus")
777
-	anticoagulant, _ := this.GetInt64("anticoagulant")
778
-	kaliumstr := this.GetString("kalium")
777
+	dialysis_count := int64(dataBody["dialysis_count"].(float64))
778
+	hd_count := int64(dataBody["hd_count"].(float64))
779
+	hdf_count := int64(dataBody["hdf_count"].(float64))
780
+	hp_count := int64(dataBody["hp_count"].(float64))
781
+	other_count := int64(dataBody["other_count"].(float64))
782
+	dialzer_apparatus := dataBody["dialzer_apparatus"].(string)
783
+	perfusion_apparatus := dataBody["perfusion_apparatus"].(string)
784
+	anticoagulant := int64(dataBody["anticoagulant"].(float64))
785
+	kaliumstr := dataBody["kalium"].(string)
779
 	kalium, _ := strconv.ParseFloat(kaliumstr, 64)
786
 	kalium, _ := strconv.ParseFloat(kaliumstr, 64)
780
-
781
-	autunitestr := this.GetString("autunite")
787
+	autunitestr := dataBody["autunite"].(string)
782
 	autunite, _ := strconv.ParseFloat(autunitestr, 64)
788
 	autunite, _ := strconv.ParseFloat(autunitestr, 64)
783
-	natriumstr := this.GetString("natrium")
789
+	natriumstr := dataBody["natrium"].(string)
784
 	natrium, _ := strconv.ParseFloat(natriumstr, 64)
790
 	natrium, _ := strconv.ParseFloat(natriumstr, 64)
785
-	hour, _ := this.GetInt64("hour")
786
-	minute, _ := this.GetInt64("minute")
787
-	beforWeight := this.GetString("befor_weight")
791
+	hour := int64(dataBody["hour"].(float64))
792
+	minute := int64(dataBody["minute"].(float64))
793
+	beforWeight := dataBody["befor_weight"].(string)
788
 	befor_weight, _ := strconv.ParseFloat(beforWeight, 64)
794
 	befor_weight, _ := strconv.ParseFloat(beforWeight, 64)
789
-	afterWeight := this.GetString("after_weight")
795
+	afterWeight := dataBody["after_weight"].(string)
790
 	after_weight, _ := strconv.ParseFloat(afterWeight, 64)
796
 	after_weight, _ := strconv.ParseFloat(afterWeight, 64)
791
-	befor_pressure := this.GetString("befor_pressure")
792
-	template_summary_content := this.GetString("template_summary_content")
793
-	template_plan_content := this.GetString("template_plan_content")
794
-	admin_user_id, _ := this.GetInt64("admin_user_id")
795
-	record_time := this.GetString("record_time")
797
+	befor_pressure := dataBody["befor_pressure"].(string)
798
+	template_summary_content := dataBody["template_summary_content"].(string)
799
+	template_plan_content := dataBody["template_plan_content"].(string)
800
+	admin_user_id := int64(dataBody["admin_user_id"].(float64))
801
+	record_time := dataBody["record_time"].(string)
796
 	timeLayout := "2006-01-02"
802
 	timeLayout := "2006-01-02"
797
 	loc, _ := time.LoadLocation("Local")
803
 	loc, _ := time.LoadLocation("Local")
798
 	recordTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_time, loc)
804
 	recordTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_time, loc)
799
-	after_pressure := this.GetString("after_pressure")
800
-	template_summary_id, _ := this.GetInt64("template_summary_id")
801
-	template_plan_id, _ := this.GetInt64("template_plan_id")
802
-	template_inspection_id, _ := this.GetInt64("template_inspection_id")
803
-	patient_id, _ := this.GetInt64("patient_id")
804
-	fmt.Println("patient_id", patient_id)
805
+	after_pressure := dataBody["after_pressure"].(string)
806
+	template_summary_id := int64(dataBody["template_summary_id"].(float64))
807
+	template_plan_id := int64(dataBody["template_plan_id"].(float64))
808
+	patient_id := int64(dataBody["patient_id"].(float64))
805
 	orgId := this.GetAdminUserInfo().CurrentOrgId
809
 	orgId := this.GetAdminUserInfo().CurrentOrgId
806
-	inspect_date := this.GetString("inspect_date")
807
-	project_id := this.GetString("project_id")
810
+	inspect_date := dataBody["inspect_date"].(string)
811
+	project_id := dataBody["project_id"].(string)
812
+	template_inspection_id := int64(dataBody["template_inspection_id"].(float64))
813
+	//title := this.GetString("title")
814
+	//dryWeight := this.GetString("dry_weight")
815
+	//dry_weight, _ := strconv.ParseFloat(dryWeight, 64)
816
+	//dialysis_count, _ := this.GetInt64("dialysis_count")
817
+	//hd_count, _ := this.GetInt64("hd_count")
818
+	//hdf_count, _ := this.GetInt64("hdf_count")
819
+	//hp_count, _ := this.GetInt64("hp_count")
820
+	//other_count, _ := this.GetInt64("other_count")
821
+	//dialzer_apparatus := this.GetString("dialzer_apparatus")
822
+	//perfusion_apparatus := this.GetString("perfusion_apparatus")
823
+	//anticoagulant, _ := this.GetInt64("anticoagulant")
824
+	//kaliumstr := this.GetString("kalium")
825
+	//kalium, _ := strconv.ParseFloat(kaliumstr, 64)
826
+	//
827
+	//autunitestr := this.GetString("autunite")
828
+	//autunite, _ := strconv.ParseFloat(autunitestr, 64)
829
+	//natriumstr := this.GetString("natrium")
830
+	//natrium, _ := strconv.ParseFloat(natriumstr, 64)
831
+	//hour, _ := this.GetInt64("hour")
832
+	//minute, _ := this.GetInt64("minute")
833
+	//beforWeight := this.GetString("befor_weight")
834
+	//befor_weight, _ := strconv.ParseFloat(beforWeight, 64)
835
+	//afterWeight := this.GetString("after_weight")
836
+	//after_weight, _ := strconv.ParseFloat(afterWeight, 64)
837
+	//befor_pressure := this.GetString("befor_pressure")
838
+	//template_summary_content := this.GetString("template_summary_content")
839
+	//template_plan_content := this.GetString("template_plan_content")
840
+	//admin_user_id, _ := this.GetInt64("admin_user_id")
841
+	//record_time := this.GetString("record_time")
842
+	//timeLayout := "2006-01-02"
843
+	//loc, _ := time.LoadLocation("Local")
844
+	//recordTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_time, loc)
845
+	//after_pressure := this.GetString("after_pressure")
846
+	//template_summary_id, _ := this.GetInt64("template_summary_id")
847
+	//template_plan_id, _ := this.GetInt64("template_plan_id")
848
+	//template_inspection_id, _ := this.GetInt64("template_inspection_id")
849
+	//patient_id, _ := this.GetInt64("patient_id")
850
+	//fmt.Println("patient_id", patient_id)
851
+	//orgId := this.GetAdminUserInfo().CurrentOrgId
852
+	//inspect_date := this.GetString("inspect_date")
853
+	//project_id := this.GetString("project_id")
808
 	summary := models.XtTemplateSummary{
854
 	summary := models.XtTemplateSummary{
809
 		StartYear:              0,
855
 		StartYear:              0,
810
 		StartMonth:             0,
856
 		StartMonth:             0,
845
 		ProjectId:              project_id,
891
 		ProjectId:              project_id,
846
 	}
892
 	}
847
 
893
 
848
-	err := service.CreateSummary(&summary)
894
+	err = service.CreateSummary(&summary)
849
 	if err == nil {
895
 	if err == nil {
850
 		this.ServeSuccessJSON(map[string]interface{}{
896
 		this.ServeSuccessJSON(map[string]interface{}{
851
 			"summary": summary,
897
 			"summary": summary,
912
 
958
 
913
 func (this *DoctorsApiController) UpdateTempalteSummary() {
959
 func (this *DoctorsApiController) UpdateTempalteSummary() {
914
 
960
 
915
-	id, _ := this.GetInt64("id")
916
-	title := this.GetString("title")
917
-
918
-	dryWeight := this.GetString("dry_weight")
961
+	dataBody := make(map[string]interface{}, 0)
962
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
963
+	if err != nil {
964
+		utils.ErrorLog(err.Error())
965
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
966
+		return
967
+	}
968
+	id := int64(dataBody["id"].(float64))
969
+	title := dataBody["title"].(string)
970
+	dryWeight := dataBody["dry_weight"].(string)
919
 	dry_weight, _ := strconv.ParseFloat(dryWeight, 64)
971
 	dry_weight, _ := strconv.ParseFloat(dryWeight, 64)
920
-	dialysis_count, _ := this.GetInt64("dialysis_count")
921
-	hd_count, _ := this.GetInt64("hd_count")
922
-	hdf_count, _ := this.GetInt64("hdf_count")
923
-	hp_count, _ := this.GetInt64("hp_count")
924
-	other_count, _ := this.GetInt64("other_count")
925
-	dialzer_apparatus := this.GetString("dialzer_apparatus")
926
-	perfusion_apparatus := this.GetString("perfusion_apparatus")
927
-	anticoagulant, _ := this.GetInt64("anticoagulant")
928
-	kaliumstr := this.GetString("kalium")
972
+	dialysis_count := int64(dataBody["dialysis_count"].(float64))
973
+	hd_count := int64(dataBody["hd_count"].(float64))
974
+	hdf_count := int64(dataBody["hdf_count"].(float64))
975
+	hp_count := int64(dataBody["hp_count"].(float64))
976
+	other_count := int64(dataBody["other_count"].(float64))
977
+	dialzer_apparatus := dataBody["dialzer_apparatus"].(string)
978
+	perfusion_apparatus := dataBody["perfusion_apparatus"].(string)
979
+	anticoagulant := int64(dataBody["anticoagulant"].(float64))
980
+	kaliumstr := dataBody["kalium"].(string)
929
 	kalium, _ := strconv.ParseFloat(kaliumstr, 64)
981
 	kalium, _ := strconv.ParseFloat(kaliumstr, 64)
930
-
931
-	autunitestr := this.GetString("autunite")
982
+	autunitestr := dataBody["autunite"].(string)
932
 	autunite, _ := strconv.ParseFloat(autunitestr, 64)
983
 	autunite, _ := strconv.ParseFloat(autunitestr, 64)
933
-	natriumstr := this.GetString("natrium")
984
+	natriumstr := dataBody["natrium"].(string)
934
 	natrium, _ := strconv.ParseFloat(natriumstr, 64)
985
 	natrium, _ := strconv.ParseFloat(natriumstr, 64)
935
-	hour, _ := this.GetInt64("hour")
936
-	minute, _ := this.GetInt64("minute")
937
-	beforWeight := this.GetString("befor_weight")
986
+	hour := int64(dataBody["hour"].(float64))
987
+	minute := int64(dataBody["minute"].(float64))
988
+	beforWeight := dataBody["befor_weight"].(string)
938
 	befor_weight, _ := strconv.ParseFloat(beforWeight, 64)
989
 	befor_weight, _ := strconv.ParseFloat(beforWeight, 64)
939
-	afterWeight := this.GetString("after_weight")
990
+	afterWeight := dataBody["after_weight"].(string)
940
 	after_weight, _ := strconv.ParseFloat(afterWeight, 64)
991
 	after_weight, _ := strconv.ParseFloat(afterWeight, 64)
941
-	befor_pressure := this.GetString("befor_pressure")
942
-	template_summary_content := this.GetString("template_summary_content")
943
-	template_plan_content := this.GetString("template_plan_content")
944
-	admin_user_id, _ := this.GetInt64("admin_user_id")
945
-	record_time := this.GetString("record_time")
992
+	befor_pressure := dataBody["befor_pressure"].(string)
993
+	template_summary_content := dataBody["template_summary_content"].(string)
994
+	template_plan_content := dataBody["template_plan_content"].(string)
995
+	admin_user_id := int64(dataBody["admin_user_id"].(float64))
996
+	record_time := dataBody["record_time"].(string)
946
 	timeLayout := "2006-01-02"
997
 	timeLayout := "2006-01-02"
947
 	loc, _ := time.LoadLocation("Local")
998
 	loc, _ := time.LoadLocation("Local")
948
 	recordTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_time, loc)
999
 	recordTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_time, loc)
949
-	after_pressure := this.GetString("after_pressure")
950
-	template_summary_id, _ := this.GetInt64("template_summary_id")
951
-	template_plan_id, _ := this.GetInt64("template_plan_id")
952
-	template_inspection_id, _ := this.GetInt64("template_inspection_id")
953
-	patient_id, _ := this.GetInt64("patient_id")
954
-	fmt.Println("patient_id", patient_id)
1000
+	after_pressure := dataBody["after_pressure"].(string)
1001
+	template_summary_id := int64(dataBody["template_summary_id"].(float64))
1002
+	template_plan_id := int64(dataBody["template_plan_id"].(float64))
1003
+	patient_id := int64(dataBody["patient_id"].(float64))
955
 	orgId := this.GetAdminUserInfo().CurrentOrgId
1004
 	orgId := this.GetAdminUserInfo().CurrentOrgId
956
-	inspect_date := this.GetString("inspect_date")
957
-	project_id := this.GetString("project_id")
1005
+	inspect_date := dataBody["inspect_date"].(string)
1006
+	project_id := dataBody["project_id"].(string)
1007
+	template_inspection_id := int64(dataBody["template_inspection_id"].(float64))
1008
+
1009
+	//id, _ := this.GetInt64("id")
1010
+	//title := this.GetString("title")
1011
+	//
1012
+	//dryWeight := this.GetString("dry_weight")
1013
+	//dry_weight, _ := strconv.ParseFloat(dryWeight, 64)
1014
+	//dialysis_count, _ := this.GetInt64("dialysis_count")
1015
+	//hd_count, _ := this.GetInt64("hd_count")
1016
+	//hdf_count, _ := this.GetInt64("hdf_count")
1017
+	//hp_count, _ := this.GetInt64("hp_count")
1018
+	//other_count, _ := this.GetInt64("other_count")
1019
+	//dialzer_apparatus := this.GetString("dialzer_apparatus")
1020
+	//perfusion_apparatus := this.GetString("perfusion_apparatus")
1021
+	//anticoagulant, _ := this.GetInt64("anticoagulant")
1022
+	//kaliumstr := this.GetString("kalium")
1023
+	//kalium, _ := strconv.ParseFloat(kaliumstr, 64)
1024
+	//
1025
+	//autunitestr := this.GetString("autunite")
1026
+	//autunite, _ := strconv.ParseFloat(autunitestr, 64)
1027
+	//natriumstr := this.GetString("natrium")
1028
+	//natrium, _ := strconv.ParseFloat(natriumstr, 64)
1029
+	//hour, _ := this.GetInt64("hour")
1030
+	//minute, _ := this.GetInt64("minute")
1031
+	//beforWeight := this.GetString("befor_weight")
1032
+	//befor_weight, _ := strconv.ParseFloat(beforWeight, 64)
1033
+	//afterWeight := this.GetString("after_weight")
1034
+	//after_weight, _ := strconv.ParseFloat(afterWeight, 64)
1035
+	//befor_pressure := this.GetString("befor_pressure")
1036
+	//template_summary_content := this.GetString("template_summary_content")
1037
+	//template_plan_content := this.GetString("template_plan_content")
1038
+	//admin_user_id, _ := this.GetInt64("admin_user_id")
1039
+	//record_time := this.GetString("record_time")
1040
+	//timeLayout := "2006-01-02"
1041
+	//loc, _ := time.LoadLocation("Local")
1042
+	//recordTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_time, loc)
1043
+	//after_pressure := this.GetString("after_pressure")
1044
+	//template_summary_id, _ := this.GetInt64("template_summary_id")
1045
+	//template_plan_id, _ := this.GetInt64("template_plan_id")
1046
+	//template_inspection_id, _ := this.GetInt64("template_inspection_id")
1047
+	//patient_id, _ := this.GetInt64("patient_id")
1048
+	//fmt.Println("patient_id", patient_id)
1049
+	//orgId := this.GetAdminUserInfo().CurrentOrgId
1050
+	//inspect_date := this.GetString("inspect_date")
1051
+	//project_id := this.GetString("project_id")
958
 	summary := models.XtTemplateSummary{
1052
 	summary := models.XtTemplateSummary{
959
 		ID:                     id,
1053
 		ID:                     id,
960
 		StartYear:              0,
1054
 		StartYear:              0,
995
 		ProjectId:              project_id,
1089
 		ProjectId:              project_id,
996
 		InspectDate:            inspect_date,
1090
 		InspectDate:            inspect_date,
997
 	}
1091
 	}
998
-	err := service.UpdateTempalteSummary(&summary)
1092
+	err = service.UpdateTempalteSummary(&summary)
999
 	if err == nil {
1093
 	if err == nil {
1000
 		this.ServeSuccessJSON(map[string]interface{}{
1094
 		this.ServeSuccessJSON(map[string]interface{}{
1001
 			"list": summary,
1095
 			"list": summary,

+ 7 - 3
controllers/schedule_api_controller.go Bestand weergeven

1980
 	week_time, _ := this.GetInt64("week_time")
1980
 	week_time, _ := this.GetInt64("week_time")
1981
 	start_time, _ := this.GetInt64("start_time")
1981
 	start_time, _ := this.GetInt64("start_time")
1982
 	end_time, _ := this.GetInt64("end_time")
1982
 	end_time, _ := this.GetInt64("end_time")
1983
-	zone, _ := this.GetInt64("zone")
1983
+	//zone, _ := this.GetInt64("zone")
1984
+	zons := this.GetString("zone")
1985
+	zone := strings.Split(zons, ",")
1984
 	adminUserInfo := this.GetAdminUserInfo()
1986
 	adminUserInfo := this.GetAdminUserInfo()
1985
 
1987
 
1986
 	schedule, err := service.GetNextWeekDaySchedule(week_type, week_time, start_time, end_time, adminUserInfo.CurrentOrgId, zone)
1988
 	schedule, err := service.GetNextWeekDaySchedule(week_type, week_time, start_time, end_time, adminUserInfo.CurrentOrgId, zone)
2299
 
2301
 
2300
 	week_type, _ := this.GetInt64("week_type", -1)
2302
 	week_type, _ := this.GetInt64("week_type", -1)
2301
 	week_time, _ := this.GetInt64("week_time")
2303
 	week_time, _ := this.GetInt64("week_time")
2302
-	zone, _ := this.GetInt64("zone")
2304
+	//zone, _ := this.GetInt64("zone")
2305
+	zones := this.GetString("zone")
2306
+	zone := strings.Split(zones, ",")
2303
 	thisTime := time.Now()
2307
 	thisTime := time.Now()
2304
 	weekDay := int(thisTime.Weekday())
2308
 	weekDay := int(thisTime.Weekday())
2305
 	if weekDay == 0 {
2309
 	if weekDay == 0 {
2363
 
2367
 
2364
 	orgId := this.GetAdminUserInfo().CurrentOrgId
2368
 	orgId := this.GetAdminUserInfo().CurrentOrgId
2365
 	if week_type > 0 {
2369
 	if week_type > 0 {
2366
-		list, err := service.GetWeekDayScheduleById(orgId, targetDay.Unix(), week_time, zone)
2370
+		list, err := service.GetWeekDayScheduleByIdThee(orgId, targetDay.Unix(), week_time, zone)
2367
 		if err != nil {
2371
 		if err != nil {
2368
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2372
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2369
 			return
2373
 			return

+ 36 - 38
controllers/self_drug_api_congtroller.go Bestand weergeven

1047
 				return
1047
 				return
1048
 			}
1048
 			}
1049
 			last_price, _ := strconv.ParseFloat(items["last_price"].(string), 64)
1049
 			last_price, _ := strconv.ParseFloat(items["last_price"].(string), 64)
1050
-
1051
-			if items["count"] == nil || reflect.TypeOf(items["count"]).String() != "float64" {
1052
-				utils.ErrorLog("count")
1053
-				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1054
-				return
1055
-			}
1056
-			count := int64(items["count"].(float64))
1050
+			//
1051
+			//if items["count"] == nil || reflect.TypeOf(items["count"]).String() != "float64" {
1052
+			//	utils.ErrorLog("count")
1053
+			//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1054
+			//	return
1055
+			//}
1056
+			//count := int64(items["count"].(float64))
1057
 
1057
 
1058
 			if items["new_price"] == nil || reflect.TypeOf(items["new_price"]).String() != "string" {
1058
 			if items["new_price"] == nil || reflect.TypeOf(items["new_price"]).String() != "string" {
1059
 				utils.ErrorLog("new_price")
1059
 				utils.ErrorLog("new_price")
1092
 				DrugName:          drug_name,
1092
 				DrugName:          drug_name,
1093
 				SpecificationName: "",
1093
 				SpecificationName: "",
1094
 				WarehousingUnit:   warehousing_unit,
1094
 				WarehousingUnit:   warehousing_unit,
1095
-				Count:             count,
1096
 				LastPrice:         last_price,
1095
 				LastPrice:         last_price,
1097
 				RetailPrice:       retail_price,
1096
 				RetailPrice:       retail_price,
1098
 				NewPrice:          new_price,
1097
 				NewPrice:          new_price,
1482
 	dealerList, _ := service.GetAllDealerList(adminUserInfo.CurrentOrgId)
1481
 	dealerList, _ := service.GetAllDealerList(adminUserInfo.CurrentOrgId)
1483
 	var manufacturer_id int64
1482
 	var manufacturer_id int64
1484
 	var dealer_id int64
1483
 	var dealer_id int64
1484
+	timeStr := time.Now().Format("2006-01-02")
1485
+	timeArr := strings.Split(timeStr, "-")
1486
+	total, _ := service.FindAllDrugWarehouseOut(adminUserInfo.CurrentOrgId)
1487
+
1488
+	total = total + 1
1489
+	warehousing_out_order := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000"
1490
+	number, _ := strconv.ParseInt(warehousing_out_order, 10, 64)
1491
+	number = number + total
1492
+	warehousing_out_order = "YPCKD" + strconv.FormatInt(number, 10)
1493
+	operation_time := time.Now().Unix()
1494
+	creater := adminUserInfo.AdminUser.Id
1495
+
1496
+	warehouseOut := models.DrugWarehouseOut{
1497
+		WarehouseOutOrderNumber: warehousing_out_order,
1498
+		OperationTime:           operation_time,
1499
+		OrgId:                   adminUserInfo.CurrentOrgId,
1500
+		Creater:                 creater,
1501
+		Ctime:                   ctime,
1502
+		Status:                  1,
1503
+		WarehouseOutTime:        time.Now().Unix(),
1504
+		Type:                    1,
1505
+	}
1506
+	service.AddSigleDrugWarehouseOut(&warehouseOut)
1485
 	for _, item := range list {
1507
 	for _, item := range list {
1486
 		for _, it := range manufacturerList {
1508
 		for _, it := range manufacturerList {
1487
 			if item.Manufacturer == it.ManufacturerName {
1509
 			if item.Manufacturer == it.ManufacturerName {
1495
 			}
1517
 			}
1496
 		}
1518
 		}
1497
 
1519
 
1498
-		timeStr := time.Now().Format("2006-01-02")
1499
-		timeArr := strings.Split(timeStr, "-")
1500
-		total, _ := service.FindAllDrugWarehouseOut(adminUserInfo.CurrentOrgId)
1501
-
1502
-		total = total + 1
1503
-		warehousing_out_order := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + timeArr[0] + timeArr[1] + timeArr[2] + "000"
1504
-		number, _ := strconv.ParseInt(warehousing_out_order, 10, 64)
1505
-		number = number + total
1506
-		warehousing_out_order = "YPCKD" + strconv.FormatInt(number, 10)
1507
-		operation_time := time.Now().Unix()
1508
-		creater := adminUserInfo.AdminUser.Id
1509
-
1510
-		warehouseOut := models.DrugWarehouseOut{
1511
-			WarehouseOutOrderNumber: warehousing_out_order,
1512
-			OperationTime:           operation_time,
1513
-			OrgId:                   adminUserInfo.CurrentOrgId,
1514
-			Creater:                 creater,
1515
-			Ctime:                   ctime,
1516
-			Status:                  1,
1517
-			WarehouseOutTime:        time.Now().Unix(),
1518
-			Type:                    1,
1519
-		}
1520
-
1521
 		warehouseOutInfo := models.XtDrugWarehouseOutInfo{
1520
 		warehouseOutInfo := models.XtDrugWarehouseOutInfo{
1522
 			WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
1521
 			WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
1523
 			WarehouseOutId:          warehouseOut.ID,
1522
 			WarehouseOutId:          warehouseOut.ID,
1563
 			IsSys:                   0,
1562
 			IsSys:                   0,
1564
 		}
1563
 		}
1565
 		service.CreateWareHouseOutInfo(&warehouseOutInfo)
1564
 		service.CreateWareHouseOutInfo(&warehouseOutInfo)
1566
-		service.AddSigleDrugWarehouseOut(&warehouseOut)
1567
 		service.CreateDrugFlowOne(drugflow)
1565
 		service.CreateDrugFlowOne(drugflow)
1568
 
1566
 
1569
 	}
1567
 	}
2086
 	warehousing_unit := this.GetString("warehousing_unit")
2084
 	warehousing_unit := this.GetString("warehousing_unit")
2087
 	remark := this.GetString("remark")
2085
 	remark := this.GetString("remark")
2088
 	//total := this.GetString("total")
2086
 	//total := this.GetString("total")
2089
-	prof_count, _ := this.GetInt64("prof_count")
2090
-
2087
+	proof_count, _ := this.GetInt64("proof_count")
2088
+	fmt.Println("pof_count2222222", proof_count)
2091
 	inventory := models.XtDrugInventory{
2089
 	inventory := models.XtDrugInventory{
2092
 		WarehouseInfoId: warehouse_info_id,
2090
 		WarehouseInfoId: warehouse_info_id,
2093
-		ProofCount:      prof_count,
2091
+		ProofCount:      proof_count,
2094
 		WarehousingUnit: warehousing_unit,
2092
 		WarehousingUnit: warehousing_unit,
2095
 		Remark:          remark,
2093
 		Remark:          remark,
2096
 	}
2094
 	}
2097
-	err := service.UpdateDrugProofInventory(warehouse_info_id, &inventory)
2095
+	err := service.UpdateDrugProofInventory(id, &inventory)
2098
 	info := models.XtDrugWarehouseInfo{
2096
 	info := models.XtDrugWarehouseInfo{
2099
-		StockMaxNumber: prof_count,
2097
+		StockMaxNumber: proof_count,
2100
 	}
2098
 	}
2101
-	service.UpdateDrugWarehouseInfoById(id, &info)
2099
+	service.UpdateDrugWarehouseInfoById(warehouse_info_id, &info)
2102
 	if err != nil {
2100
 	if err != nil {
2103
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
2101
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "更新设备失败")
2104
 		return
2102
 		return

+ 87 - 4
controllers/stock_in_api_controller.go Bestand weergeven

5147
 			product_date := int64(items["product_date"].(float64))
5147
 			product_date := int64(items["product_date"].(float64))
5148
 			orgId := this.GetAdminUserInfo().CurrentOrgId
5148
 			orgId := this.GetAdminUserInfo().CurrentOrgId
5149
 			Creater := this.GetAdminUserInfo().AdminUser.Id
5149
 			Creater := this.GetAdminUserInfo().AdminUser.Id
5150
+
5151
+			if items["total"] == nil || reflect.TypeOf(items["total"]).String() != "float64" {
5152
+				utils.ErrorLog("total")
5153
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5154
+				return
5155
+			}
5156
+			total := int64(items["total"].(float64))
5157
+
5158
+			if items["good_origin_place"] == nil || reflect.TypeOf(items["good_origin_place"]).String() != "string" {
5159
+				utils.ErrorLog("good_origin_place")
5160
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5161
+				return
5162
+			}
5163
+			good_origin_place := items["good_origin_place"].(string)
5150
 			reportPrice := models.XtStockReportPrice{
5164
 			reportPrice := models.XtStockReportPrice{
5151
 				GoodName:          good_name,
5165
 				GoodName:          good_name,
5152
 				SpecificationName: specification_name,
5166
 				SpecificationName: specification_name,
5173
 				WarehousingInfoId: warehousing_info_id,
5187
 				WarehousingInfoId: warehousing_info_id,
5174
 				ExpiryDate:        expiry_date,
5188
 				ExpiryDate:        expiry_date,
5175
 				ProductDate:       product_date,
5189
 				ProductDate:       product_date,
5190
+				Total:             total,
5191
+				GoodOriginPlace:   good_origin_place,
5176
 			}
5192
 			}
5177
 			err := service.CreateReportPrice(&reportPrice)
5193
 			err := service.CreateReportPrice(&reportPrice)
5178
 			fmt.Println(err)
5194
 			fmt.Println(err)
5277
 		Ctime:                   ctime,
5293
 		Ctime:                   ctime,
5278
 		Status:                  1,
5294
 		Status:                  1,
5279
 		WarehouseOutTime:        ctime,
5295
 		WarehouseOutTime:        ctime,
5280
-		Type:                    2,
5296
+		Type:                    1,
5281
 	}
5297
 	}
5282
 
5298
 
5283
 	_, errcodes := service.FindStockOutByIsSys(adminUserInfo.CurrentOrgId, 0, operation_time)
5299
 	_, errcodes := service.FindStockOutByIsSys(adminUserInfo.CurrentOrgId, 0, operation_time)
5526
 				return
5542
 				return
5527
 			}
5543
 			}
5528
 			warehousing_info_id := int64(items["warehousing_info_id"].(float64))
5544
 			warehousing_info_id := int64(items["warehousing_info_id"].(float64))
5545
+
5546
+			if items["good_origin_place"] == nil || reflect.TypeOf(items["good_origin_place"]).String() != "string" {
5547
+				utils.ErrorLog("good_origin_place")
5548
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
5549
+				return
5550
+			}
5551
+			good_origin_place := items["good_origin_place"].(string)
5529
 			orgId := this.GetAdminUserInfo().CurrentOrgId
5552
 			orgId := this.GetAdminUserInfo().CurrentOrgId
5530
 			Creater := this.GetAdminUserInfo().AdminUser.Id
5553
 			Creater := this.GetAdminUserInfo().AdminUser.Id
5531
 
5554
 
5557
 				ProductDate:       product_date,
5580
 				ProductDate:       product_date,
5558
 				Number:            number,
5581
 				Number:            number,
5559
 				WarehousingInfoId: warehousing_info_id,
5582
 				WarehousingInfoId: warehousing_info_id,
5583
+				GoodOriginPlace:   good_origin_place,
5560
 			}
5584
 			}
5561
 			err = service.CreateInentory(inventory)
5585
 			err = service.CreateInentory(inventory)
5562
 			fmt.Println(err)
5586
 			fmt.Println(err)
5645
 func (this *StockManagerApiController) GetModifyPriceDetail() {
5669
 func (this *StockManagerApiController) GetModifyPriceDetail() {
5646
 
5670
 
5647
 	id, _ := this.GetInt64("id")
5671
 	id, _ := this.GetInt64("id")
5672
+
5648
 	detail, _ := service.GetModifyPriceDetail(id)
5673
 	detail, _ := service.GetModifyPriceDetail(id)
5649
 	this.ServeSuccessJSON(map[string]interface{}{
5674
 	this.ServeSuccessJSON(map[string]interface{}{
5650
 		"detail": detail,
5675
 		"detail": detail,
5661
 	packing_price, _ := strconv.ParseFloat(packingPrice, 64)
5686
 	packing_price, _ := strconv.ParseFloat(packingPrice, 64)
5662
 	remark := this.GetString("remark")
5687
 	remark := this.GetString("remark")
5663
 	good_id, _ := this.GetInt64("good_id")
5688
 	good_id, _ := this.GetInt64("good_id")
5689
+	manufacturer := this.GetString("manufacturer")
5690
+	dealer := this.GetString("dealer")
5664
 	adjust := models.XtStockAdjustPrice{
5691
 	adjust := models.XtStockAdjustPrice{
5665
 		NewPrice:     new_price,
5692
 		NewPrice:     new_price,
5666
 		GoodName:     good_name,
5693
 		GoodName:     good_name,
5667
 		PackingPrice: packing_price,
5694
 		PackingPrice: packing_price,
5668
 		Remark:       remark,
5695
 		Remark:       remark,
5669
 		GoodId:       good_id,
5696
 		GoodId:       good_id,
5697
+		Manufacturer: manufacturer,
5698
+		Dealer:       dealer,
5670
 	}
5699
 	}
5671
 	err := service.UpdateStockPrice(adjust, id)
5700
 	err := service.UpdateStockPrice(adjust, id)
5672
 	fmt.Println(err)
5701
 	fmt.Println(err)
5700
 
5729
 
5701
 	count, _ := this.GetInt64("count")
5730
 	count, _ := this.GetInt64("count")
5702
 	id, _ := this.GetInt64("id")
5731
 	id, _ := this.GetInt64("id")
5732
+	good_name := this.GetString("good_name")
5733
+	specification_name := this.GetString("specification_name")
5734
+	number := this.GetString("number")
5735
+	warehousing_unit := this.GetString("warehousing_unit")
5736
+	buyPrice := this.GetString("buy_price")
5737
+	buy_price, _ := strconv.ParseFloat(buyPrice, 64)
5738
+	packingPrice := this.GetString("packing_price")
5739
+	packing_price, _ := strconv.ParseFloat(packingPrice, 64)
5740
+	good_origin_place := this.GetString("good_origin_place")
5741
+	manufacturer := this.GetString("manufacturer")
5742
+	dealer := this.GetString("dealer")
5743
+	total, _ := this.GetInt64("total")
5744
+	remark := this.GetString("remark")
5745
+	warehousing_info_id, _ := this.GetInt64("warehousing_info_id")
5746
+	good_id, _ := this.GetInt64("good_id")
5703
 	adjust := models.XtStockReportPrice{
5747
 	adjust := models.XtStockReportPrice{
5704
-		Count: count,
5748
+		Count:             count,
5749
+		SpecificationName: specification_name,
5750
+		Number:            number,
5751
+		GoodName:          good_name,
5752
+		WarehousingUnit:   warehousing_unit,
5753
+		BuyPrice:          buy_price,
5754
+		PackingPrice:      packing_price,
5755
+		GoodOriginPlace:   good_origin_place,
5756
+		Manufacturer:      manufacturer,
5757
+		Dealer:            dealer,
5758
+		Total:             total,
5759
+		Remark:            remark,
5760
+		WarehousingInfoId: warehousing_info_id,
5761
+		GoodId:            good_id,
5705
 	}
5762
 	}
5706
 	err := service.ModifyPrice(id, adjust)
5763
 	err := service.ModifyPrice(id, adjust)
5707
 	fmt.Println(err)
5764
 	fmt.Println(err)
5742
 
5799
 
5743
 func (this *StockManagerApiController) ModifyInventory() {
5800
 func (this *StockManagerApiController) ModifyInventory() {
5744
 	id, _ := this.GetInt64("id")
5801
 	id, _ := this.GetInt64("id")
5802
+	good_id, _ := this.GetInt64("good_id")
5803
+	good_name := this.GetString("good_name")
5804
+	specification_name := this.GetString("specification_name")
5805
+	number := this.GetString("number")
5806
+	warehousing_unit := this.GetString("warehousing_unit")
5807
+	buyPrice := this.GetString("buy_price")
5808
+	buy_price, _ := strconv.ParseFloat(buyPrice, 64)
5809
+	packingPrice := this.GetString("packing_price")
5810
+	packing_price, _ := strconv.ParseFloat(packingPrice, 64)
5811
+	total, _ := this.GetInt64("total")
5812
+	good_origin_place := this.GetString("good_origin_place")
5813
+	license_number := this.GetString("license_number")
5814
+	dealer := this.GetString("dealer")
5815
+	manufacturer := this.GetString("manufacturer")
5745
 	count, _ := this.GetInt64("count")
5816
 	count, _ := this.GetInt64("count")
5746
 	remark := this.GetString("remark")
5817
 	remark := this.GetString("remark")
5747
 	inventory := models.XtStockInventory{
5818
 	inventory := models.XtStockInventory{
5748
-		Count:  count,
5749
-		Remark: remark,
5819
+		GoodId:            good_id,
5820
+		GoodName:          good_name,
5821
+		SpecificationName: specification_name,
5822
+		Number:            number,
5823
+		WarehousingUnit:   warehousing_unit,
5824
+		BuyPrice:          buy_price,
5825
+		PackingPrice:      packing_price,
5826
+		Total:             total,
5827
+		GoodOriginPlace:   good_origin_place,
5828
+		LicenseNumber:     license_number,
5829
+		Dealer:            dealer,
5830
+		Manufacturer:      manufacturer,
5831
+		Count:             count,
5832
+		Remark:            remark,
5750
 	}
5833
 	}
5751
 	err := service.ModifyInventory(id, inventory)
5834
 	err := service.ModifyInventory(id, inventory)
5752
 	fmt.Println(err)
5835
 	fmt.Println(err)

+ 1 - 1
models/self_drug_models.go Bestand weergeven

829
 	DoseUnit          string  `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
829
 	DoseUnit          string  `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
830
 	MaxUnit           string  `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
830
 	MaxUnit           string  `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
831
 	MinUnit           string  `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
831
 	MinUnit           string  `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
832
-	Total             int64   `gorm:"column:total" json:"total" form:"total"`
832
+	Total             string  `gorm:"column:total" json:"total" form:"total"`
833
 	DrugOriginPlace   string  `gorm:"column:drug_origin_place" json:"drug_origin_place" form:"drug_origin_place"`
833
 	DrugOriginPlace   string  `gorm:"column:drug_origin_place" json:"drug_origin_place" form:"drug_origin_place"`
834
 }
834
 }

+ 3 - 0
models/stock_models.go Bestand weergeven

947
 	WarehousingInfoId int64   `gorm:"column:warehousing_info_id" json:"warehousing_info_id" form:"warehousing_info_id"`
947
 	WarehousingInfoId int64   `gorm:"column:warehousing_info_id" json:"warehousing_info_id" form:"warehousing_info_id"`
948
 	ExpiryDate        int64   `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
948
 	ExpiryDate        int64   `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
949
 	ProductDate       int64   `gorm:"column:product_date" json:"product_date" form:"product_date"`
949
 	ProductDate       int64   `gorm:"column:product_date" json:"product_date" form:"product_date"`
950
+	Total             int64   `gorm:"column:total" json:"total" form:"total"`
951
+	GoodOriginPlace   string  `gorm:"column:good_origin_place" json:"good_origin_place" form:"good_origin_place"`
950
 }
952
 }
951
 
953
 
952
 func (XtStockReportPrice) TableName() string {
954
 func (XtStockReportPrice) TableName() string {
982
 	WarehousingInfoId int64   `gorm:"column:warehousing_info_id" json:"warehousing_info_id" form:"warehousing_info_id"`
984
 	WarehousingInfoId int64   `gorm:"column:warehousing_info_id" json:"warehousing_info_id" form:"warehousing_info_id"`
983
 	ExpireDate        int64   `gorm:"column:expire_date" json:"expire_date" form:"expire_date"`
985
 	ExpireDate        int64   `gorm:"column:expire_date" json:"expire_date" form:"expire_date"`
984
 	ProductDate       int64   `gorm:"column:product_date" json:"product_date" form:"product_date"`
986
 	ProductDate       int64   `gorm:"column:product_date" json:"product_date" form:"product_date"`
987
+	GoodOriginPlace   string  `gorm:"column:good_origin_place" json:"good_origin_place" form:"good_origin_place"`
985
 }
988
 }
986
 
989
 
987
 func (XtStockInventory) TableName() string {
990
 func (XtStockInventory) TableName() string {

+ 31 - 6
service/schedule_service.go Bestand weergeven

589
 	return list, err
589
 	return list, err
590
 }
590
 }
591
 
591
 
592
-func GetWeekDayScheduleByIdTwo(orgid int64, scheduleDate int64, scheduleType int64, startDate int64, zone int64) (list []*models.VmSchedulesRemind, err error) {
592
+func GetWeekDayScheduleByIdThee(orgid int64, scheduleDate int64, scheduleType int64, zone []string) (list []*models.VmSchedulesRemind, err error) {
593
+
594
+	db := XTReadDB().Table("xt_schedule as x").Where("x.status = 1")
595
+	if orgid > 0 {
596
+		db = db.Where("x.user_org_id = ?", orgid)
597
+	}
598
+	if scheduleDate > 0 {
599
+		db = db.Where("x.schedule_date = ?", scheduleDate)
600
+	}
601
+	if scheduleType > 0 {
602
+		db = db.Where("x.schedule_type = ?", scheduleType)
603
+	}
604
+	if len(zone) > 0 {
605
+		db = db.Where("x.partition_id in (?)", zone)
606
+	}
607
+
608
+	err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1").Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
609
+		return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
610
+	}).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
611
+		return db.Where("status =1").Order("id asc")
612
+	}).Find(&list).Error
613
+
614
+	return list, err
615
+}
616
+
617
+func GetWeekDayScheduleByIdTwo(orgid int64, scheduleDate int64, scheduleType int64, startDate int64, zone []string) (list []*models.VmSchedulesRemind, err error) {
593
 
618
 
594
 	db := XTReadDB().Table("xt_schedule as x").Where("x.status = 1")
619
 	db := XTReadDB().Table("xt_schedule as x").Where("x.status = 1")
595
 	if orgid > 0 {
620
 	if orgid > 0 {
601
 	if scheduleType > 0 {
626
 	if scheduleType > 0 {
602
 		db = db.Where("x.schedule_type = ?", scheduleType)
627
 		db = db.Where("x.schedule_type = ?", scheduleType)
603
 	}
628
 	}
604
-	if zone > 0 {
605
-		db = db.Where("x.partition_id = ?", zone)
629
+	if len(zone) > 0 {
630
+		db = db.Where("x.partition_id in (?)", zone)
606
 	}
631
 	}
607
 
632
 
608
 	err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1").Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
633
 	err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1").Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
758
 	return
783
 	return
759
 }
784
 }
760
 
785
 
761
-func GetNextWeekDaySchedule(weektype int64, weektime int64, startime int64, endtime int64, orgID int64, zone int64) (schedules []*models.WeekSchedule, err error) {
786
+func GetNextWeekDaySchedule(weektype int64, weektime int64, startime int64, endtime int64, orgID int64, zone []string) (schedules []*models.WeekSchedule, err error) {
762
 
787
 
763
 	db := readDb.Table("xt_schedule as s ").Where("s.status =1")
788
 	db := readDb.Table("xt_schedule as s ").Where("s.status =1")
764
 	if orgID > 0 {
789
 	if orgID > 0 {
776
 	if weektype > 0 {
801
 	if weektype > 0 {
777
 		db = db.Where("s.schedule_week = ?", weektype)
802
 		db = db.Where("s.schedule_week = ?", weektype)
778
 	}
803
 	}
779
-	if zone > 0 {
780
-		db = db.Where("s.partition_id = ?", zone)
804
+	if len(zone) > 0 {
805
+		db = db.Where("s.partition_id in (?)", zone)
781
 	}
806
 	}
782
 	err = db.
807
 	err = db.
783
 		Preload("DeviceZone", "status = 1 ").
808
 		Preload("DeviceZone", "status = 1 ").

+ 7 - 7
service/stock_service.go Bestand weergeven

4311
 	if orgid > 0 {
4311
 	if orgid > 0 {
4312
 		db = db.Where("x.org_id = ?", orgid)
4312
 		db = db.Where("x.org_id = ?", orgid)
4313
 	}
4313
 	}
4314
-	err = db.Select("x.id,x.warehousing_id,x.good_id,x.good_type_id,x.number,x.product_date,x.expiry_date,x.warehousing_count,x.price,x.total_price,x.dealer,x.remark,x.warehousing_order,x.warehousing_unit,x.stock_count,x.license_number,x.warehousing_unit,t.good_name,t.specification_name,x.manufacturer,t.packing_price,t.id as good_id,t.packing_unit,t.buy_price").Joins("left join xt_good_information as t on t.id = x.good_id").Where("t.good_name like ? and t.org_id = ?", likeKey, orgid).Order("x.ctime desc").Scan(&info).Error
4314
+	err = db.Group("x.good_id").Select("x.id,x.warehousing_id,x.good_id,x.good_type_id,x.number,x.product_date,x.expiry_date,x.warehousing_count,x.price,x.total_price,t.dealer,x.remark,x.warehousing_order,x.warehousing_unit,x.stock_count,x.license_number,x.warehousing_unit,t.good_name,t.specification_name,t.manufacturer,t.packing_price,t.id as good_id,t.packing_unit,t.buy_price").Joins("left join xt_good_information as t on t.id = x.good_id").Where("t.good_name like ? and t.org_id = ?", likeKey, orgid).Order("x.ctime desc").Scan(&info).Error
4315
 	return info, err
4315
 	return info, err
4316
 }
4316
 }
4317
 
4317
 
4332
 		db = db.Where("x.start_time>=?", startime)
4332
 		db = db.Where("x.start_time>=?", startime)
4333
 	}
4333
 	}
4334
 	if endtime > 0 {
4334
 	if endtime > 0 {
4335
-		db = db.Where("x.end_time<=?", endtime)
4335
+		db = db.Where("x.start_time<=?", endtime)
4336
 	}
4336
 	}
4337
 	if len(keyword) > 0 {
4337
 	if len(keyword) > 0 {
4338
 		db = db.Where("x.warehousing_order = ? or r.user_name like ?", keyword, likeKey)
4338
 		db = db.Where("x.warehousing_order = ? or r.user_name like ?", keyword, likeKey)
4382
 	tab := UserReadDB().Table("sgj_user_admin_role as r").Where("r.status = 1")
4382
 	tab := UserReadDB().Table("sgj_user_admin_role as r").Where("r.status = 1")
4383
 	fmt.Println(table, tab)
4383
 	fmt.Println(table, tab)
4384
 	if startime > 0 {
4384
 	if startime > 0 {
4385
-		db = db.Where("x.start_time>=?", startime)
4385
+		db = db.Where("x.ctime>=?", startime)
4386
 	}
4386
 	}
4387
 	if endtime > 0 {
4387
 	if endtime > 0 {
4388
-		db = db.Where("x.end_time<=?", endtime)
4388
+		db = db.Where("x.ctime<=?", endtime)
4389
 	}
4389
 	}
4390
 	if len(keyword) > 0 {
4390
 	if len(keyword) > 0 {
4391
 		db = db.Where("x.warehousing_order like ? or r.user_name like ?", likeKey, likeKey)
4391
 		db = db.Where("x.warehousing_order like ? or r.user_name like ?", likeKey, likeKey)
4459
 
4459
 
4460
 func UpdateStockPrice(info models.XtStockAdjustPrice, id int64) error {
4460
 func UpdateStockPrice(info models.XtStockAdjustPrice, id int64) error {
4461
 
4461
 
4462
-	err := XTWriteDB().Model(&info).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"new_price": info.NewPrice, "good_name": info.GoodName, "packing_price": info.PackingPrice, "good_id": info.GoodId, "remark": info.Remark}).Error
4462
+	err := XTWriteDB().Model(&info).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"new_price": info.NewPrice, "good_name": info.GoodName, "packing_price": info.PackingPrice, "good_id": info.GoodId, "remark": info.Remark, "manufacturer": info.Manufacturer, "dealer": info.Dealer}).Error
4463
 	return err
4463
 	return err
4464
 }
4464
 }
4465
 
4465
 
4477
 
4477
 
4478
 func ModifyPrice(id int64, info models.XtStockReportPrice) error {
4478
 func ModifyPrice(id int64, info models.XtStockReportPrice) error {
4479
 
4479
 
4480
-	err := XTWriteDB().Model(&info).Where("id = ?", id).Updates(map[string]interface{}{"count": info.Count}).Error
4480
+	err := XTWriteDB().Model(&info).Where("id = ?", id).Updates(map[string]interface{}{"count": info.Count, "specification_name": info.SpecificationName, "good_name": info.GoodName, "number": info.Number, "warehousing_unit": info.WarehousingUnit, "buy_price": info.BuyPrice, "packing_price": info.PackingPrice, "good_origin_place": info.GoodOriginPlace, "manufacturer": info.Manufacturer, "dealer": info.Dealer, "total": info.Total, "remark": info.Remark, "warehousing_info_id": info.WarehousingInfoId, "good_id": info.GoodId}).Error
4481
 	return err
4481
 	return err
4482
 }
4482
 }
4483
 
4483
 
4502
 
4502
 
4503
 func ModifyInventory(id int64, inventory models.XtStockInventory) error {
4503
 func ModifyInventory(id int64, inventory models.XtStockInventory) error {
4504
 
4504
 
4505
-	err := XTWriteDB().Model(&inventory).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"count": inventory.Count, "remark": inventory.Remark}).Error
4505
+	err := XTWriteDB().Model(&inventory).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"good_id": inventory.GoodId, "good_name": inventory.GoodName, "specification_name": inventory.SpecificationName, "number": inventory.Number, "warehousing_unit": inventory.WarehousingUnit, "buy_price": inventory.BuyPrice, "packing_price": inventory.PackingPrice, "total": inventory.Total, "good_origin_place": inventory.GoodOriginPlace, "license_number": inventory.LicenseNumber, "dealer": inventory.Dealer, "manufacturer": inventory.Dealer, "count": inventory.Count, "remark": inventory.Remark}).Error
4506
 	return err
4506
 	return err
4507
 }
4507
 }
4508
 
4508