Kaynağa Gözat

耗材参数

XMLWAN 3 yıl önce
ebeveyn
işleme
eb076244fd

+ 232 - 0
controllers/doctors_api_controller.go Dosyayı Görüntüle

@@ -46,6 +46,11 @@ func DoctorApiRegistRouters() {
46 46
 	beego.Router("/api/patient/getinspectiondetail", &DoctorsApiController{}, "Get:GetInspectionDetailByProject")
47 47
 	beego.Router("/api/patient/getinspectionitemlist", &DoctorsApiController{}, "Get:GetInspectionItemlist")
48 48
 	beego.Router("/api/patient/getinitdatelist", &DoctorsApiController{}, "Get:GetInitDateList")
49
+	beego.Router("/api/patient/savecreationinspection", &DoctorsApiController{}, "Get:SaveCreationInspection")
50
+	beego.Router("/api/patient/getemlatesummarylist", &DoctorsApiController{}, "Get:GetTemplateSummaryList")
51
+	beego.Router("/api/patient/gettemplatesummarydetail", &DoctorsApiController{}, "Get:GetTemplateSummaryDetail")
52
+	beego.Router("/api/patient/gettemplatesummaryprintdetail", &DoctorsApiController{}, "Get:GetTemplateSummaryPrintDetail")
53
+	beego.Router("/api/patient/updatetemplatesummary", &DoctorsApiController{}, "Get:UpdateTempalteSummary")
49 54
 }
50 55
 
51 56
 func (c *DoctorsApiController) ScheduleAdvices() {
@@ -723,11 +728,238 @@ func (this *DoctorsApiController) GetInitDateList() {
723 728
 
724 729
 	prescription_list, _ := service.GetDialysisPrescriptionDataList(patient_id)
725 730
 	befor_list, err := service.GetDialysisBeforInitDateList(patient_id)
731
+	after_list, err := service.GetDialysisAssementAfter(patient_id)
732
+	//统计透析次数
733
+	modelist, err := service.GetDialysisDialysisMode(patient_id)
734
+	orgId := this.GetAdminUserInfo().CurrentOrgId
735
+	docList, _ := service.GetAllDoctorThree(orgId)
736
+	stockType, err := service.GetStockType(orgId)
726 737
 
738
+	summaryList, err := service.GetTemplateSummary(orgId)
739
+	planList, err := service.GetTemplatePlan(orgId)
727 740
 	if err == nil {
728 741
 		this.ServeSuccessJSON(map[string]interface{}{
729 742
 			"beforlist":         befor_list,
730 743
 			"prescription_list": prescription_list,
744
+			"after_list":        after_list,
745
+			"modelist":          modelist,
746
+			"docList":           docList,
747
+			"stockType":         stockType,
748
+			"summaryList":       summaryList,
749
+			"planList":          planList,
750
+		})
751
+		return
752
+	}
753
+}
754
+
755
+func (this *DoctorsApiController) SaveCreationInspection() {
756
+
757
+	title := this.GetString("title")
758
+	dry_weight, _ := this.GetFloat("dry_weight")
759
+	fmt.Println("hhhhhhhhhhhhh", dry_weight)
760
+	dialysis_count, _ := this.GetInt64("dialysis_count")
761
+	hd_count, _ := this.GetInt64("hd_count")
762
+	hdf_count, _ := this.GetInt64("hdf_count")
763
+	hp_count, _ := this.GetInt64("hp_count")
764
+	other_count, _ := this.GetInt64("other_count")
765
+	dialzer_apparatus := this.GetString("dialzer_apparatus")
766
+	perfusion_apparatus := this.GetString("perfusion_apparatus")
767
+	anticoagulant, _ := this.GetInt64("anticoagulant")
768
+	fmt.Println(anticoagulant)
769
+	kalium, _ := this.GetFloat("kalium")
770
+	autunite, _ := this.GetFloat("autunite")
771
+	natrium, _ := this.GetFloat("natrium")
772
+	hour, _ := this.GetInt64("hour")
773
+	minute, _ := this.GetInt64("minute")
774
+	befor_weight, _ := this.GetFloat("befor_weight")
775
+	after_weight, _ := this.GetFloat("after_weight")
776
+	befor_pressure := this.GetString("befor_pressure")
777
+	template_summary_content := this.GetString("template_summary_content")
778
+	template_plan_content := this.GetString("template_plan_content")
779
+	template_inspection_content := this.GetString("template_inspection_content")
780
+	fmt.Println("hhhh232233232232332232323", template_inspection_content)
781
+	admin_user_id, _ := this.GetInt64("admin_user_id")
782
+	record_time := this.GetString("record_time")
783
+	timeLayout := "2006-01-02"
784
+	loc, _ := time.LoadLocation("Local")
785
+	recordTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
786
+	after_pressure := this.GetString("after_pressure")
787
+	template_summary_id, _ := this.GetInt64("template_summary_id")
788
+	template_plan_id, _ := this.GetInt64("template_plan_id")
789
+	template_inspection_id, _ := this.GetInt64("template_inspection_id")
790
+	patient_id, _ := this.GetInt64("patient_id")
791
+	fmt.Println("patient_id", patient_id)
792
+	orgId := this.GetAdminUserInfo().CurrentOrgId
793
+	summary := models.XtTemplateSummary{
794
+		StartYear:                 0,
795
+		StartMonth:                0,
796
+		Radio:                     0,
797
+		Quarter:                   0,
798
+		DryWeight:                 dry_weight,
799
+		DialysisCount:             dialysis_count,
800
+		HdCount:                   hd_count,
801
+		HdfCount:                  hdf_count,
802
+		HpCount:                   hp_count,
803
+		OtherCount:                other_count,
804
+		DialzerApparatus:          dialzer_apparatus,
805
+		PerfusionApparatus:        perfusion_apparatus,
806
+		Anticoagulant:             anticoagulant,
807
+		Kalium:                    kalium,
808
+		Autunite:                  autunite,
809
+		Natrium:                   natrium,
810
+		Hour:                      hour,
811
+		Minute:                    minute,
812
+		BeforWeight:               befor_weight,
813
+		AfterWeight:               after_weight,
814
+		BeforPressure:             befor_pressure,
815
+		AfterPressure:             after_pressure,
816
+		TemplateSummaryId:         template_summary_id,
817
+		TemplateSummaryContent:    template_summary_content,
818
+		TemplatePlanId:            template_plan_id,
819
+		TemplatePlanContent:       template_plan_content,
820
+		TemplateInspectionId:      template_inspection_id,
821
+		TemplateInspectionContent: template_inspection_content,
822
+		AdminUserId:               admin_user_id,
823
+		RecordTime:                recordTime.Unix(),
824
+		PatientId:                 patient_id,
825
+		UserOrgId:                 orgId,
826
+		Status:                    1,
827
+		Ctime:                     time.Now().Unix(),
828
+		Mtime:                     0,
829
+		Title:                     title,
830
+	}
831
+
832
+	err := service.CreateSummary(&summary)
833
+	if err == nil {
834
+		this.ServeSuccessJSON(map[string]interface{}{
835
+			"summary": summary,
836
+		})
837
+		return
838
+	}
839
+
840
+}
841
+
842
+func (this *DoctorsApiController) GetTemplateSummaryList() {
843
+	patient_id, _ := this.GetInt64("patient_id")
844
+	orgId := this.GetAdminUserInfo().CurrentOrgId
845
+	list, err := service.GetTemplateSummaryList(patient_id, orgId)
846
+	if err == nil {
847
+		this.ServeSuccessJSON(map[string]interface{}{
848
+			"list": list,
849
+		})
850
+		return
851
+	}
852
+}
853
+
854
+func (this *DoctorsApiController) GetTemplateSummaryDetail() {
855
+
856
+	id, _ := this.GetInt64("id")
857
+	list, err := service.GetTemplateSummaryDetail(id)
858
+	if err == nil {
859
+		this.ServeSuccessJSON(map[string]interface{}{
860
+			"list": list,
861
+		})
862
+		return
863
+	}
864
+}
865
+
866
+func (this *DoctorsApiController) GetTemplateSummaryPrintDetail() {
867
+
868
+	id, _ := this.GetInt64("id")
869
+	list, err := service.GetTemplateSummaryPrintDetail(id)
870
+	orgId := this.GetAdminUserInfo().CurrentOrgId
871
+	doctorList, _ := service.GetAllDoctorThree(orgId)
872
+	if err == nil {
873
+		this.ServeSuccessJSON(map[string]interface{}{
874
+			"list":       list,
875
+			"doctorList": doctorList,
876
+		})
877
+		return
878
+	}
879
+}
880
+
881
+func (this *DoctorsApiController) UpdateTempalteSummary() {
882
+
883
+	id, _ := this.GetInt64("id")
884
+	title := this.GetString("title")
885
+	dry_weight, _ := this.GetFloat("dry_weight")
886
+	fmt.Println("hhhhhhhhhhhhh", dry_weight)
887
+	dialysis_count, _ := this.GetInt64("dialysis_count")
888
+	hd_count, _ := this.GetInt64("hd_count")
889
+	hdf_count, _ := this.GetInt64("hdf_count")
890
+	hp_count, _ := this.GetInt64("hp_count")
891
+	other_count, _ := this.GetInt64("other_count")
892
+	dialzer_apparatus := this.GetString("dialzer_apparatus")
893
+	perfusion_apparatus := this.GetString("perfusion_apparatus")
894
+	anticoagulant, _ := this.GetInt64("anticoagulant")
895
+	fmt.Println(anticoagulant)
896
+	kalium, _ := this.GetFloat("kalium")
897
+	autunite, _ := this.GetFloat("autunite")
898
+	natrium, _ := this.GetFloat("natrium")
899
+	hour, _ := this.GetInt64("hour")
900
+	minute, _ := this.GetInt64("minute")
901
+	befor_weight, _ := this.GetFloat("befor_weight")
902
+	after_weight, _ := this.GetFloat("after_weight")
903
+	befor_pressure := this.GetString("befor_pressure")
904
+	template_summary_content := this.GetString("template_summary_content")
905
+	template_plan_content := this.GetString("template_plan_content")
906
+	template_inspection_content := this.GetString("template_inspection_content")
907
+	fmt.Println("hhhh232233232232332232323", template_inspection_content)
908
+	admin_user_id, _ := this.GetInt64("admin_user_id")
909
+	record_time := this.GetString("record_time")
910
+	timeLayout := "2006-01-02"
911
+	loc, _ := time.LoadLocation("Local")
912
+	recordTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_time+" 00:00:00", loc)
913
+	after_pressure := this.GetString("after_pressure")
914
+	template_summary_id, _ := this.GetInt64("template_summary_id")
915
+	template_plan_id, _ := this.GetInt64("template_plan_id")
916
+	template_inspection_id, _ := this.GetInt64("template_inspection_id")
917
+	patient_id, _ := this.GetInt64("patient_id")
918
+	fmt.Println("patient_id", patient_id)
919
+	orgId := this.GetAdminUserInfo().CurrentOrgId
920
+	summary := models.XtTemplateSummary{
921
+		ID:                        id,
922
+		StartYear:                 0,
923
+		StartMonth:                0,
924
+		Radio:                     0,
925
+		Quarter:                   0,
926
+		DryWeight:                 dry_weight,
927
+		DialysisCount:             dialysis_count,
928
+		HdCount:                   hd_count,
929
+		HdfCount:                  hdf_count,
930
+		HpCount:                   hp_count,
931
+		OtherCount:                other_count,
932
+		DialzerApparatus:          dialzer_apparatus,
933
+		PerfusionApparatus:        perfusion_apparatus,
934
+		Anticoagulant:             anticoagulant,
935
+		Kalium:                    kalium,
936
+		Autunite:                  autunite,
937
+		Natrium:                   natrium,
938
+		Hour:                      hour,
939
+		Minute:                    minute,
940
+		BeforWeight:               befor_weight,
941
+		AfterWeight:               after_weight,
942
+		BeforPressure:             befor_pressure,
943
+		AfterPressure:             after_pressure,
944
+		TemplateSummaryId:         template_summary_id,
945
+		TemplateSummaryContent:    template_summary_content,
946
+		TemplatePlanId:            template_plan_id,
947
+		TemplatePlanContent:       template_plan_content,
948
+		TemplateInspectionId:      template_inspection_id,
949
+		TemplateInspectionContent: template_inspection_content,
950
+		AdminUserId:               admin_user_id,
951
+		RecordTime:                recordTime.Unix(),
952
+		PatientId:                 patient_id,
953
+		UserOrgId:                 orgId,
954
+		Status:                    1,
955
+		Ctime:                     time.Now().Unix(),
956
+		Mtime:                     0,
957
+		Title:                     title,
958
+	}
959
+	err := service.UpdateTempalteSummary(&summary)
960
+	if err == nil {
961
+		this.ServeSuccessJSON(map[string]interface{}{
962
+			"list": summary,
731 963
 		})
732 964
 		return
733 965
 	}

+ 17 - 1
controllers/drug_stock_api_contorller.go Dosyayı Görüntüle

@@ -265,7 +265,23 @@ func (c *StockDrugApiController) CreateDrugWarehouse() {
265 265
 	errs := service.CreateDrugWarehousingInfo(warehousingInfo)
266 266
 	if errs == nil {
267 267
 		//更改库存
268
-		service.UpdateDrugInfo(warehousingInfo)
268
+		var total float64
269
+		var min_number int64
270
+		for _, item := range warehousingInfo {
271
+			//查询刚入库耗材的库存
272
+			wareseInfo, _ := service.FindDrugWaresingCount(item.DrugId, item.OrgId)
273
+			//更新药品库的总量
274
+			info, _ := service.FindeDrugInfo(item.DrugId)
275
+
276
+			min_number = wareseInfo.StockMaxNumber * info.MinNumber
277
+			str := strconv.FormatInt(min_number, 10)
278
+			minFloat, _ := strconv.ParseFloat(str, 64)
279
+			total = info.Total + minFloat
280
+			lib := models.BaseDrugLib{
281
+				Total: total,
282
+			}
283
+			service.UpdateBaseDrug(&lib, item.DrugId)
284
+		}
269 285
 	}
270 286
 	//创建流水单
271 287
 	service.CreateDrugFlow(drugFlow)

+ 1 - 0
controllers/print_data_api_controller.go Dosyayı Görüntüle

@@ -17,6 +17,7 @@ func PrintDataAPIControllerRegistRouters() {
17 17
 	beego.Router("/api/print/course", &PrintDataAPIController{}, "get:CourseRecordPrintData")
18 18
 	beego.Router("/api/print/getlastafterweight", &PrintDataAPIController{}, "get:GetLastAfterWeight")
19 19
 	beego.Router("/api/stock/getgooddetailprintlist", &PrintDataAPIController{}, "get:GetGoodDetailPrintList")
20
+
20 21
 }
21 22
 
22 23
 type PrintDataAPIController struct {

+ 31 - 0
controllers/stock_in_api_controller.go Dosyayı Görüntüle

@@ -99,6 +99,9 @@ func StockManagerApiRegistRouters() {
99 99
 
100 100
 	beego.Router("/api/cancel/getcancelexportlist", &StockManagerApiController{}, "Get:GetCancelExportList")
101 101
 
102
+	//耗材调价
103
+	beego.Router("/api/stock/postsearchgoodwarehouselist", &StockManagerApiController{}, "Get:GetSearchGoodWarehouseList")
104
+
102 105
 }
103 106
 
104 107
 func (c *StockManagerApiController) CreateWarehouse() {
@@ -278,6 +281,20 @@ func (c *StockManagerApiController) CreateWarehouse() {
278 281
 
279 282
 	info, _ := service.FindLastWarehousingInfo(warehousing.WarehousingOrder)
280 283
 
284
+	for _, item := range warehousingInfo {
285
+		goodInfo, _ := service.GetGoodInformationByGoodId(item.GoodId)
286
+		str := strconv.FormatInt(item.WarehousingCount, 10)
287
+		minFloat, _ := strconv.ParseFloat(str, 64)
288
+
289
+		good := models.GoodInfo{
290
+			Total: minFloat + goodInfo.Total,
291
+		}
292
+		//更该库存
293
+		parseDateErr := service.UpdateGoodInfoList(good, goodInfo.ID)
294
+		break
295
+		fmt.Println(parseDateErr)
296
+	}
297
+
281 298
 	if errs != nil {
282 299
 		utils.ErrorLog(errs.Error())
283 300
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateStockInFail)
@@ -4682,3 +4699,17 @@ func (this *StockManagerApiController) GetCancelExportList() {
4682 4699
 		"list": list,
4683 4700
 	})
4684 4701
 }
4702
+
4703
+func (this *StockManagerApiController) GetSearchGoodWarehouseList() {
4704
+
4705
+	keyword := this.GetString("keyword")
4706
+	orgId := this.GetAdminUserInfo().CurrentOrgId
4707
+	list, _ := service.GetSearchGoodWarehouseList(keyword, orgId)
4708
+	manufacturerList, _ := service.GetAllManufacturerList(orgId)
4709
+	dealerList, _ := service.GetAllDealerList(orgId)
4710
+	this.ServeSuccessJSON(map[string]interface{}{
4711
+		"list":             list,
4712
+		"manufacturerList": manufacturerList,
4713
+		"dealerList":       dealerList,
4714
+	})
4715
+}

+ 45 - 0
models/patient_models.go Dosyayı Görüntüle

@@ -1016,3 +1016,48 @@ type ExportLog struct {
1016 1016
 func (ExportLog) TableName() string {
1017 1017
 	return "xt_export_log"
1018 1018
 }
1019
+
1020
+type XtTemplateSummary struct {
1021
+	ID                        int64   `gorm:"column:id" json:"id" form:"id"`
1022
+	StartYear                 int64   `gorm:"column:start_year" json:"start_year" form:"start_year"`
1023
+	StartMonth                int64   `gorm:"column:start_month" json:"start_month" form:"start_month"`
1024
+	Radio                     int64   `gorm:"column:radio" json:"radio" form:"radio"`
1025
+	Quarter                   int64   `gorm:"column:quarter" json:"quarter" form:"quarter"`
1026
+	DryWeight                 float64 `gorm:"column:dry_weight" json:"dry_weight" form:"dry_weight"`
1027
+	DialysisCount             int64   `gorm:"column:dialysis_count" json:"dialysis_count" form:"dialysis_count"`
1028
+	HdCount                   int64   `gorm:"column:hd_count" json:"hd_count" form:"hd_count"`
1029
+	HdfCount                  int64   `gorm:"column:hdf_count" json:"hdf_count" form:"hdf_count"`
1030
+	HpCount                   int64   `gorm:"column:hp_count" json:"hp_count" form:"hp_count"`
1031
+	OtherCount                int64   `gorm:"column:other_count" json:"other_count" form:"other_count"`
1032
+	DialzerApparatus          string  `gorm:"column:dialzer_apparatus" json:"dialzer_apparatus" form:"dialzer_apparatus"`
1033
+	PerfusionApparatus        string  `gorm:"column:perfusion_apparatus" json:"perfusion_apparatus" form:"perfusion_apparatus"`
1034
+	Anticoagulant             int64   `gorm:"column:anticoagulant" json:"anticoagulant" form:"anticoagulant"`
1035
+	Kalium                    float64 `gorm:"column:kalium" json:"kalium" form:"kalium"`
1036
+	Autunite                  float64 `gorm:"column:autunite" json:"autunite" form:"autunite"`
1037
+	Natrium                   float64 `gorm:"column:natrium" json:"natrium" form:"natrium"`
1038
+	Hour                      int64   `gorm:"column:hour" json:"hour" form:"hour"`
1039
+	Minute                    int64   `gorm:"column:minute" json:"minute" form:"minute"`
1040
+	BeforWeight               float64 `gorm:"column:befor_weight" json:"befor_weight" form:"befor_weight"`
1041
+	AfterWeight               float64 `gorm:"column:after_weight" json:"after_weight" form:"after_weight"`
1042
+	BeforPressure             string  `gorm:"column:befor_pressure" json:"befor_pressure" form:"befor_pressure"`
1043
+	AfterPressure             string  `gorm:"column:after_pressure" json:"after_pressure" form:"after_pressure"`
1044
+	TemplateSummaryId         int64   `gorm:"column:template_summary_id" json:"template_summary_id" form:"template_summary_id"`
1045
+	TemplateSummaryContent    string  `gorm:"column:template_summary_content" json:"template_summary_content" form:"template_summary_content"`
1046
+	TemplatePlanId            int64   `gorm:"column:template_plan_id" json:"template_plan_id" form:"template_plan_id"`
1047
+	TemplatePlanContent       string  `gorm:"column:template_plan_content" json:"template_plan_content" form:"template_plan_content"`
1048
+	TemplateInspectionId      int64   `gorm:"column:template_inspection_id" json:"template_inspection_id" form:"template_inspection_id"`
1049
+	TemplateInspectionContent string  `gorm:"column:template_inspection_content" json:"template_inspection_content" form:"template_inspection_content"`
1050
+	AdminUserId               int64   `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
1051
+	RecordTime                int64   `gorm:"column:record_time" json:"record_time" form:"record_time"`
1052
+	PatientId                 int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1053
+	UserOrgId                 int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1054
+	Status                    int64   `gorm:"column:status" json:"status" form:"status"`
1055
+	Ctime                     int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
1056
+	Mtime                     int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
1057
+	Title                     string  `gorm:"column:title" json:"title" form:"title"`
1058
+	//Patients models.Patients  `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
1059
+}
1060
+
1061
+func (XtTemplateSummary) TableName() string {
1062
+	return "xt_template_summary"
1063
+}

+ 29 - 0
models/stock_models.go Dosyayı Görüntüle

@@ -769,3 +769,32 @@ type VmStockFlowOne struct {
769 769
 	Ctime                   int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
770 770
 	Name                    string  `gorm:"column:name" json:"name" form:"name"`
771 771
 }
772
+
773
+type BloodWarehouseInfo struct {
774
+	ID                int64   `gorm:"column:id" json:"id" form:"id"`
775
+	WarehousingId     int64   `gorm:"column:warehousing_id" json:"warehousing_id" form:"warehousing_id"`
776
+	GoodId            int64   `gorm:"column:good_id" json:"good_id" form:"good_id"`
777
+	GoodTypeId        int64   `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
778
+	Number            string  `gorm:"column:number" json:"number" form:"number"`
779
+	ProductDate       int64   `gorm:"column:product_date" json:"product_date" form:"product_date"`
780
+	ExpiryDate        int64   `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
781
+	WarehousingCount  int64   `gorm:"column:warehousing_count" json:"warehousing_count" form:"warehousing_count"`
782
+	WarehousingUnit   string  `gorm:"column:warehousing_unit" json:"warehousing_unit" form:"warehousing_unit"`
783
+	StockCount        int64   `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
784
+	Price             float64 `gorm:"column:price" json:"price" form:"price"`
785
+	TotalPrice        float64 `gorm:"column:total_price" json:"total_price" form:"total_price"`
786
+	Dealer            int64   `gorm:"column:dealer" json:"dealer" form:"dealer"`
787
+	Manufacturer      int64   `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
788
+	Remark            string  `gorm:"column:remark" json:"remark" form:"remark"`
789
+	Ctime             int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
790
+	Mtime             int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
791
+	Status            int64   `gorm:"column:status" json:"status" form:"status"`
792
+	OrgId             int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
793
+	IsReturn          int64   `gorm:"column:is_return" json:"is_return" form:"is_return"`
794
+	WarehousingOrder  string  `gorm:"column:warehousing_order" json:"warehousing_order" form:"warehousing_order"`
795
+	Type              int64   `gorm:"column:type" json:"type" form:"type"`
796
+	LicenseNumber     string  `gorm:"column:license_number" json:"license_number" form:"license_number"`
797
+	GoodName          string  `gorm:"column:good_name" json:"good_name" form:"good_name"`
798
+	PackingPrice      float64 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
799
+	SpecificationName string  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
800
+}

+ 67 - 2
service/patientmanage_service.go Dosyayı Görüntüle

@@ -1677,8 +1677,8 @@ func GetInspectionItemlist(patientid int64, inspect_date []string, projectid []s
1677 1677
 	return inspection, err
1678 1678
 }
1679 1679
 
1680
-func GetDialysisBeforInitDateList(patient_id int64) (models.DialysisAssesmentBefor, error) {
1681
-	befor := models.DialysisAssesmentBefor{}
1680
+func GetDialysisBeforInitDateList(patient_id int64) (models.PredialysisEvaluation, error) {
1681
+	befor := models.PredialysisEvaluation{}
1682 1682
 	db := XTReadDB().Model(&befor).Where("status = 1")
1683 1683
 	if patient_id > 0 {
1684 1684
 		db = db.Where("patient_id = ? and assessment_date>=1627747200 and assessment_date<=1630339200 ", patient_id)
@@ -1698,3 +1698,68 @@ func GetDialysisPrescriptionDataList(patient_id int64) (models.DialysisPrescript
1698 1698
 	err = db.Last(&prescription).Error
1699 1699
 	return prescription, err
1700 1700
 }
1701
+
1702
+func GetDialysisAssementAfter(patient_id int64) (models.AssessmentAfterDislysis, error) {
1703
+
1704
+	after := models.AssessmentAfterDislysis{}
1705
+	db := XTReadDB().Model(&after).Where("status = 1")
1706
+	if patient_id > 0 {
1707
+		db = db.Where("patient_id = ? and assessment_date>=1627747200 and assessment_date<=1630339200", patient_id)
1708
+	}
1709
+	err = db.Last(&after).Error
1710
+	return after, err
1711
+}
1712
+
1713
+func GetDialysisDialysisMode(patient_id int64) (counts []*models.PatientPrescriptionCountStruct, err error) {
1714
+
1715
+	db := readDb.Table("xt_dialysis_order as o").Where("o.status = 1")
1716
+	table := readDb.Table("xt_schedule as s").Where("s.status = 1")
1717
+	fmt.Println(table)
1718
+	p := readDb.Table("xt_patients as p").Where("p.status = 1")
1719
+	fmt.Println(p)
1720
+	//if starttime > 0 {
1721
+	//  db = db.Where("o.dialysis_date >=?", starttime)
1722
+	//}
1723
+	//if endtime > 0 {
1724
+	//  db = db.Where("o.dialysis_date<=?", endtime)
1725
+	//}
1726
+	//if orgid > 0 {
1727
+	//  db = db.Where("o.user_org_id = ?", orgid)
1728
+	//}
1729
+	if patient_id > 0 {
1730
+		db = db.Where("o.patient_id = ?", patient_id)
1731
+	}
1732
+	err = db.Where("o.dialysis_date >=1627747200 and o.dialysis_date<=1630339200").Select("s.mode_id,count(s.mode_id) as count").Joins("left join xt_schedule as s on s.patient_id = o.patient_id and s.schedule_date = o.dialysis_date and s.status= 1").Joins("left join xt_patients as  p on o.patient_id = p.id").Group("s.mode_id").Scan(&counts).Error
1733
+	return counts, err
1734
+}
1735
+
1736
+func CreateSummary(summary *models.XtTemplateSummary) error {
1737
+
1738
+	err = XTWriteDB().Create(&summary).Error
1739
+	return err
1740
+}
1741
+
1742
+func UpdateTempalteSummary(summary *models.XtTemplateSummary) error {
1743
+
1744
+	err = XTWriteDB().Save(&summary).Error
1745
+	return err
1746
+}
1747
+
1748
+func GetTemplateSummaryList(patientid int64, orgid int64) (summary []*models.XtTemplateSummary, err error) {
1749
+
1750
+	err = XTReadDB().Where("patient_id = ? and user_org_id = ? and status = 1", patientid, orgid).Find(&summary).Error
1751
+	return summary, err
1752
+}
1753
+
1754
+func GetTemplateSummaryDetail(id int64) (models.XtTemplateSummary, error) {
1755
+	summary := models.XtTemplateSummary{}
1756
+	err := XTReadDB().Model(&summary).Where("id=?", id).Find(&summary).Error
1757
+	return summary, err
1758
+}
1759
+
1760
+func GetTemplateSummaryPrintDetail(id int64) (models.XtTemplateSummary, error) {
1761
+
1762
+	summary := models.XtTemplateSummary{}
1763
+	err := XTReadDB().Model(&summary).Where("id=? and status = 1", id).Preload("Patients", "status = 1").Find(&summary).Error
1764
+	return summary, err
1765
+}

+ 33 - 2
service/stock_service.go Dosyayı Görüntüle

@@ -488,8 +488,8 @@ func UpdateDrugInfo(warehousingInfo []*models.DrugWarehouseInfo) (err error) {
488 488
 func FindDrugWaresingCount(drug_id int64, orgid int64) (models.XtDrugWarehouseInfo, error) {
489 489
 
490 490
 	info := models.XtDrugWarehouseInfo{}
491
-	db := XTReadDB().Table("xt_drug_warehouse_info as x").Where("x.status = 1")
492
-	err = db.Select("x.stock_max_number,x.drug_id").Where("x.drug_id = ? and x.org_id = ? and x.status =1", drug_id, orgid).Last(&info).Error
491
+	db := XTReadDB().Table("xt_drug_warehouse_info").Where("status = 1")
492
+	err = db.Select("stock_max_number,drug_id").Where("drug_id = ? and org_id = ? and status =1", drug_id, orgid).Last(&info).Error
493 493
 	return info, err
494 494
 }
495 495
 
@@ -3376,6 +3376,11 @@ func GetGoodInformationByGoodId(good_id int64) (models.GoodInfo, error) {
3376 3376
 	err := XTReadDB().Where("id = ? and status = 1", good_id).Find(&info).Error
3377 3377
 	return info, err
3378 3378
 }
3379
+func UpdateGoodInfoList(info models.GoodInfo, id int64) error {
3380
+
3381
+	err := XTWriteDB().Model(&info).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"total": info.Total}).Error
3382
+	return err
3383
+}
3379 3384
 
3380 3385
 func GetExprotStockList(orgid int64, orderid []string, startime int64, endtime int64) (info []*models.StWarehousingInfo, err error) {
3381 3386
 
@@ -4266,3 +4271,29 @@ func GetCancelDrugStockOutInfo(warehouse_info_id int64, drug_id int64) (info []*
4266 4271
 	err = XTReadDB().Model(&info).Where("batch_number_id =? and drug_id = ? and status = 1", warehouse_info_id, drug_id).Find(&info).Error
4267 4272
 	return info, err
4268 4273
 }
4274
+
4275
+func GetTemplateSummary(orgid int64) (config []*models.Dataconfig, err error) {
4276
+
4277
+	err = XTReadDB().Model(&config).Where("module='template_summary' and parent_id=? and org_id in (?)", 0, orgid).Find(&config).Error
4278
+	return config, err
4279
+
4280
+}
4281
+
4282
+func GetTemplatePlan(orgid int64) (config []*models.Dataconfig, err error) {
4283
+
4284
+	err = XTReadDB().Model(&config).Where("module='template_plan' and parent_id=? and org_id in (?)", 0, orgid).Find(&config).Error
4285
+	return config, err
4286
+}
4287
+
4288
+func GetSearchGoodWarehouseList(keyword string, orgid int64) (info []*models.BloodWarehouseInfo, err error) {
4289
+
4290
+	db := XTReadDB().Table("xt_warehouse_info as x").Where("x.status = 1")
4291
+	table := XTReadDB().Table("xt_goood_information as t").Where("t.status")
4292
+	fmt.Println(table)
4293
+	likeKey := "%" + keyword + "%"
4294
+	if orgid > 0 {
4295
+		db = db.Where("x.org_id = ?", orgid)
4296
+	}
4297
+	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").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
4298
+	return info, err
4299
+}

+ 5 - 0
service/user_service.go Dosyayı Görüntüle

@@ -107,6 +107,11 @@ func GetAllDoctor(orgid int64, appid int64) (appRole []*models.App_Role, err err
107 107
 	return appRole, err
108 108
 }
109 109
 
110
+func GetAllDoctorThree(orgid int64) (appRole []*models.App_Role, err error) {
111
+	err = UserReadDB().Where("org_id = ? AND status = ? AND  (user_type = ? OR user_type = ?) ", orgid, 1, 2, 1).Find(&appRole).Error
112
+	return appRole, err
113
+}
114
+
110 115
 func QueryDryWeight(orgid int64, patientid int64) (*models.SgjPatientDryweight, error) {
111 116
 	var dryweight models.SgjPatientDryweight
112 117
 	var err error