XMLWAN před 4 roky
rodič
revize
1a94085a70

+ 145 - 13
controllers/dialysis_api_controller.go Zobrazit soubor

@@ -244,8 +244,9 @@ func (c *DialysisApiController) PostPrescription() {
244 244
 	//fmt.Println("下机前推注鱼精蛋白",push_the_protamine)
245 245
 	// var prescription_doctor int64
246 246
 	blood := c.GetString("blood")
247
-	//dialysis_dialyszers := c.GetString("dialysis_dialyszers")
248
-	//dialysis_irrigation := c.GetString("dialysis_irrigation")
247
+	dialysis_dialyszers := c.GetString("dialysis_dialyszers")
248
+
249
+	dialysis_irrigation := c.GetString("dialysis_irrigation")
249 250
 	antioxidant_commodity_name := c.GetString("antioxidant_commodity_name")
250 251
 	displace_speed := c.GetString("displace_speed")
251 252
 	appRole, _ := service.FindAdminRoleTypeById(adminUserInfo.CurrentOrgId, adminUserInfo.AdminUser.Id, adminUserInfo.CurrentAppId)
@@ -327,12 +328,77 @@ func (c *DialysisApiController) PostPrescription() {
327 328
 		AnticoagulantStopTimeHour:  anticoagulant_stop_time_hour,
328 329
 		AnticoagulantStopTimeMin:   anticoagulant_stop_time_min,
329 330
 		Blood:                      blood,
330
-		//DialysisDialyszers:         dialysis_dialyszers,
331
-		//DialysisIrrigation:         dialysis_irrigation,
332
-		AntioxidantCommodityName: antioxidant_commodity_name,
333
-		DisplaceSpeed:            displace_speed,
331
+		DialysisDialyszers:         dialysis_dialyszers,
332
+		DialysisIrrigation:         dialysis_irrigation,
333
+		AntioxidantCommodityName:   antioxidant_commodity_name,
334
+		DisplaceSpeed:              displace_speed,
334 335
 	}
335 336
 
337
+	//查询最近透析准备表里是否存在 透析器 灌流器
338
+
339
+	//splitStr := strings.Split(dialysis_dialyszers, ",")
340
+	//
341
+	//splitIrrigation := strings.Split(dialysis_irrigation, ",")
342
+	//
343
+	//mation, _ := service.GetGoodInfoMation(adminUserInfo.CurrentOrgId)
344
+	//if len(mation)>0{
345
+	//  for _, item := range splitStr {
346
+	//    for _,it := range mation{
347
+	//      if(item == it.SpecificationName){
348
+	//
349
+	//        //查询最近一次的透析器
350
+	//        _, errcode := service.GetDialysisBeforePrepare(it.GoodTypeId, it.ID, adminUserInfo.CurrentOrgId,patient)
351
+	//
352
+	//        if errcode == gorm.ErrRecordNotFound{
353
+	//          //插入数据
354
+	//          prepare := models.DialysisBeforePrepare{
355
+	//            UserOrgId:  adminUserInfo.CurrentOrgId,
356
+	//            PatientId:  patient,
357
+	//            RecordDate: recordDate.Unix(),
358
+	//            GoodTypeId: it.GoodTypeId,
359
+	//            GoodId:     it.ID,
360
+	//            Count:      1,
361
+	//            Ctime:      time.Now().Unix(),
362
+	//            Creater:    adminUserInfo.AdminUser.Id,
363
+	//            Status:1,
364
+	//
365
+	//          }
366
+	//          errcode := service.CreateDialysisBeforePrepareOne(&prepare)
367
+	//          fmt.Println("",errcode)
368
+	//        }
369
+	//      }
370
+	//    }
371
+	//
372
+	//  }
373
+	//
374
+	//  for _, item := range splitIrrigation {
375
+	//    for _,it := range mation{
376
+	//      if(item == it.SpecificationName){
377
+	//        //查询最近一次的透析器
378
+	//        _, errcode := service.GetDialysisBeforePrepare(it.GoodTypeId, it.ID, adminUserInfo.CurrentOrgId,patient)
379
+	//        if errcode == gorm.ErrRecordNotFound{
380
+	//          //插入数据
381
+	//          prepare := models.DialysisBeforePrepare{
382
+	//            UserOrgId:  adminUserInfo.CurrentOrgId,
383
+	//            PatientId:  patient,
384
+	//            RecordDate: recordDate.Unix(),
385
+	//            GoodTypeId: it.GoodTypeId,
386
+	//            GoodId:     it.ID,
387
+	//            Count:      1,
388
+	//            Ctime:      time.Now().Unix(),
389
+	//            Creater:    adminUserInfo.AdminUser.Id,
390
+	//            Status:1,
391
+	//
392
+	//          }
393
+	//          errcode := service.CreateDialysisBeforePrepareOne(&prepare)
394
+	//          fmt.Println(errcode)
395
+	//      }
396
+	//      }
397
+	//    }
398
+	//  }
399
+	//
400
+	//}
401
+
336 402
 	if appRole.UserType == 2 || appRole.UserType == 1 {
337 403
 		prescription.PrescriptionDoctor = appRole.AdminUserId
338 404
 	}
@@ -497,8 +563,8 @@ func (c *DialysisApiController) PostSoulution() {
497 563
 	anticoagulant_stop_time_hour, _ := c.GetInt64("anticoagulant_stop_time_hour", 0)
498 564
 	anticoagulant_stop_time_min, _ := c.GetInt64("anticoagulant_stop_time_min", 0)
499 565
 	blood := c.GetString("blood")
500
-	//dialysis_dialyszers := c.GetString("dialysis_dialyszers")
501
-	//dialysis_irrigation := c.GetString("dialysis_irrigation")
566
+	dialysis_dialyszers := c.GetString("dialysis_dialyszers")
567
+	dialysis_irrigation := c.GetString("dialysis_irrigation")
502 568
 	antioxidant_commodity_name := c.GetString("antioxidant_commodity_name")
503 569
 	displace_speed := c.GetString("displace_speed")
504 570
 	var prescription_doctor int64
@@ -591,12 +657,76 @@ func (c *DialysisApiController) PostSoulution() {
591 657
 		AnticoagulantStopTimeHour: anticoagulant_stop_time_hour,
592 658
 		AnticoagulantStopTimeMin:  anticoagulant_stop_time_min,
593 659
 		Blood:                     blood,
594
-		//DialysisIrrigation:        dialysis_irrigation,
595
-		//DialysisDialyszers:        dialysis_dialyszers,
596
-		AntioxidantCommodityName: antioxidant_commodity_name,
597
-		DisplaceSpeed:            displace_speed,
660
+		DialysisIrrigation:        dialysis_irrigation,
661
+		DialysisDialyszers:        dialysis_dialyszers,
662
+		AntioxidantCommodityName:  antioxidant_commodity_name,
663
+		DisplaceSpeed:             displace_speed,
598 664
 	}
599 665
 
666
+	//查询最近透析准备表里是否存在 透析器 灌流器
667
+
668
+	//splitStr := strings.Split(dialysis_dialyszers, ",")
669
+	//
670
+	//splitIrrigation := strings.Split(dialysis_irrigation, ",")
671
+	//
672
+	//mation, _ := service.GetGoodInfoMation(adminUserInfo.CurrentOrgId)
673
+	//if len(mation)>0{
674
+	//  for _, item := range splitStr {
675
+	//    for _,it := range mation{
676
+	//      if(item == it.SpecificationName){
677
+	//
678
+	//        //查询最近一次的透析器
679
+	//        _, errcode := service.GetDialysisBeforePrepare(it.GoodTypeId, it.ID, adminUserInfo.CurrentOrgId,patient)
680
+	//
681
+	//        if errcode == gorm.ErrRecordNotFound{
682
+	//          //插入数据
683
+	//          prepare := models.DialysisBeforePrepare{
684
+	//            UserOrgId:  adminUserInfo.CurrentOrgId,
685
+	//            PatientId:  patient,
686
+	//            RecordDate: recordDate.Unix(),
687
+	//            GoodTypeId: it.GoodTypeId,
688
+	//            GoodId:     it.ID,
689
+	//            Count:      1,
690
+	//            Ctime:      time.Now().Unix(),
691
+	//            Creater:    adminUserInfo.AdminUser.Id,
692
+	//            Status:1,
693
+	//
694
+	//          }
695
+	//          errcode := service.CreateDialysisBeforePrepareOne(&prepare)
696
+	//          fmt.Println("",errcode)
697
+	//        }
698
+	//      }
699
+	//    }
700
+	//
701
+	//  }
702
+	//
703
+	//  for _, item := range splitIrrigation {
704
+	//    for _,it := range mation{
705
+	//      if(item == it.SpecificationName){
706
+	//        //查询最近一次的透析器
707
+	//        _, errcode := service.GetDialysisBeforePrepare(it.GoodTypeId, it.ID, adminUserInfo.CurrentOrgId,patient)
708
+	//        if errcode == gorm.ErrRecordNotFound{
709
+	//          //插入数据
710
+	//          prepare := models.DialysisBeforePrepare{
711
+	//            UserOrgId:  adminUserInfo.CurrentOrgId,
712
+	//            PatientId:  patient,
713
+	//            RecordDate: recordDate.Unix(),
714
+	//            GoodTypeId: it.GoodTypeId,
715
+	//            GoodId:     it.ID,
716
+	//            Count:      1,
717
+	//            Ctime:      time.Now().Unix(),
718
+	//            Creater:    adminUserInfo.AdminUser.Id,
719
+	//            Status:1,
720
+	//
721
+	//          }
722
+	//          errcode := service.CreateDialysisBeforePrepareOne(&prepare)
723
+	//          fmt.Println(errcode)
724
+	//        }
725
+	//      }
726
+	//    }
727
+	//  }
728
+	//}
729
+
600 730
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(patient, recordDate.Unix(), adminUserInfo.CurrentOrgId)
601 731
 	if dialysisPrescription.ID == 0 { //新增
602 732
 		if appRole.UserType == 2 || appRole.UserType == 1 {
@@ -604,7 +734,7 @@ func (c *DialysisApiController) PostSoulution() {
604 734
 		}
605 735
 
606 736
 		prescription.Creater = adminUserInfo.AdminUser.Id
607
-		//prescription.Creater = adminUserInfo.AdminUser.Id
737
+
608 738
 	} else { //修改
609 739
 
610 740
 		//template, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
@@ -687,6 +817,8 @@ func (c *DialysisApiController) PostSoulution() {
687 817
 		BodyFluidOther:             body_fluid_other,
688 818
 		ReplacementTotal:           replacement_total,
689 819
 		TargetKtv:                  target_ktv,
820
+		DialysisIrrigation:         dialysis_irrigation,
821
+		DialysisDialyszers:         dialysis_dialyszers,
690 822
 	}
691 823
 	err := service.SavePrescriptionAndCreateSolution(&solution, &prescription)
692 824
 	if err == nil {

+ 14 - 0
controllers/gobal_config_api_controller.go Zobrazit soubor

@@ -757,8 +757,11 @@ func (c *GobalConfigApiController) UpdateSystemPrescription() {
757 757
 func (c *GobalConfigApiController) GetAllSystemPrescription() {
758 758
 	adminUserInfo := c.GetAdminUserInfo()
759 759
 	prescriptions, _ := service.FindAllSystemPrescription(adminUserInfo.CurrentOrgId)
760
+
761
+	stockType, _ := service.GetStockType(adminUserInfo.CurrentOrgId)
760 762
 	c.ServeSuccessJSON(map[string]interface{}{
761 763
 		"prescriptions": prescriptions,
764
+		"stockType":     stockType,
762 765
 	})
763 766
 }
764 767
 
@@ -990,6 +993,17 @@ func defaultSystemSolutionFormData(solution *models.SystemPrescription, data []b
990 993
 		solution.Remark = remark
991 994
 	}
992 995
 
996
+	if dataBody["dialysis_dialyszers"] != nil && reflect.TypeOf(dataBody["dialysis_dialyszers"]).String() == "string" {
997
+		dialysisDialyszers := dataBody["dialysis_dialyszers"].(string)
998
+		fmt.Println("dialysisDialysis22222222222", dialysisDialyszers)
999
+		solution.DialysisDialyszers = dialysisDialyszers
1000
+	}
1001
+
1002
+	if dataBody["dialysis_irrigation"] != nil && reflect.TypeOf(dataBody["dialysis_irrigation"]).String() == "string" {
1003
+		dialysisIrrigation := dataBody["dialysis_irrigation"].(string)
1004
+		solution.DialysisIrrigation = dialysisIrrigation
1005
+	}
1006
+
993 1007
 	return
994 1008
 }
995 1009
 

+ 5 - 0
controllers/manager_center_api_controller.go Zobrazit soubor

@@ -1547,6 +1547,11 @@ func (c *ManagerCenterApiController) ModifyGoodInfo() {
1547 1547
 		RetailPrice:            retail_price,
1548 1548
 	}
1549 1549
 
1550
+	totals := service.FindGoodInfoByNameOne(specification_name, adminUserInfo.CurrentOrgId, good_id, id)
1551
+	if totals > 0 {
1552
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeGoodInfoNameExistError)
1553
+		return
1554
+	}
1550 1555
 	err, goodInfos := service.ModifyGoodInfo(&goodInfo)
1551 1556
 	if err == nil {
1552 1557
 		c.ServeSuccessJSON(map[string]interface{}{

+ 236 - 46
controllers/mobile_api_controllers/dialysis_api_controller.go Zobrazit soubor

@@ -91,6 +91,7 @@ func (this *DialysisAPIController) Scheduals() {
91 91
 
92 92
 	if len(scheduals_json_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
93 93
 		scheduals, err := service.MobileGetDialysisScheduals(orgID, date.Unix(), schedualType)
94
+
94 95
 		if err != nil {
95 96
 			this.ErrorLog("获取排班信息失败:%v", err)
96 97
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -117,6 +118,7 @@ func (this *DialysisAPIController) Scheduals() {
117 118
 		} else {
118 119
 
119 120
 		}
121
+
120 122
 		this.ServeSuccessJSON(map[string]interface{}{
121 123
 			"scheduals": dat,
122 124
 			"redis":     "true",
@@ -1163,6 +1165,71 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1163 1165
 		DisplaceSpeed:              displace_speed,
1164 1166
 	}
1165 1167
 
1168
+	//查询最近透析准备表里是否存在 透析器 灌流器
1169
+
1170
+	//
1171
+	//splitStr := strings.Split(dialysis_dialyszers, ",")
1172
+	//
1173
+	//splitIrrigation := strings.Split(dialysis_irrigation, ",")
1174
+	//
1175
+	//mation, _ := service.GetGoodInfoMation(adminUserInfo.Org.Id)
1176
+	//if len(mation)>0{
1177
+	//  for _, item := range splitStr {
1178
+	//    for _,it := range mation{
1179
+	//      if(item == it.SpecificationName){
1180
+	//
1181
+	//        //查询最近一次的透析器
1182
+	//        _, errcode := service.GetDialysisBeforePrepare(it.GoodTypeId, it.ID, adminUserInfo.Org.Id,id)
1183
+	//
1184
+	//        if errcode == gorm.ErrRecordNotFound{
1185
+	//          //插入数据
1186
+	//          prepare := models.DialysisBeforePrepare{
1187
+	//            UserOrgId:  adminUserInfo.Org.Id,
1188
+	//            PatientId:  id,
1189
+	//            RecordDate: recordDate.Unix(),
1190
+	//            GoodTypeId: it.GoodTypeId,
1191
+	//            GoodId:     it.ID,
1192
+	//            Count:      1,
1193
+	//            Ctime:      time.Now().Unix(),
1194
+	//            Creater:    adminUserInfo.AdminUser.Id,
1195
+	//            Status:1,
1196
+	//
1197
+	//          }
1198
+	//          errcode := service.CreateDialysisBeforePrepareOne(&prepare)
1199
+	//          fmt.Println("",errcode)
1200
+	//        }
1201
+	//      }
1202
+	//    }
1203
+	//
1204
+	//  }
1205
+	//
1206
+	//  for _, item := range splitIrrigation {
1207
+	//    for _,it := range mation{
1208
+	//      if(item == it.SpecificationName){
1209
+	//        //查询最近一次的透析器
1210
+	//        _, errcode := service.GetDialysisBeforePrepare(it.GoodTypeId, it.ID, adminUserInfo.Org.Id,id)
1211
+	//        if errcode == gorm.ErrRecordNotFound{
1212
+	//          //插入数据
1213
+	//          prepare := models.DialysisBeforePrepare{
1214
+	//            UserOrgId:  adminUserInfo.Org.Id,
1215
+	//            PatientId:  id,
1216
+	//            RecordDate: recordDate.Unix(),
1217
+	//            GoodTypeId: it.GoodTypeId,
1218
+	//            GoodId:     it.ID,
1219
+	//            Count:      1,
1220
+	//            Ctime:      time.Now().Unix(),
1221
+	//            Creater:    adminUserInfo.AdminUser.Id,
1222
+	//            Status:1,
1223
+	//
1224
+	//          }
1225
+	//          errcode := service.CreateDialysisBeforePrepareOne(&prepare)
1226
+	//          fmt.Println(errcode)
1227
+	//        }
1228
+	//      }
1229
+	//    }
1230
+	//  }
1231
+	//}
1232
+
1166 1233
 	_, dialysisPrescription := service.FindDialysisPrescriptionByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
1167 1234
 	if dialysisPrescription.ID == 0 { //新增
1168 1235
 		//if mode_id > 0 {
@@ -2063,8 +2130,75 @@ func (c *DialysisAPIController) PostSolution() {
2063 2130
 		BodyFluidOther:             body_fluid_other,
2064 2131
 		ReplacementTotal:           replacement_total,
2065 2132
 		TargetKtv:                  target_ktv,
2133
+		DialysisDialyszers:         dialysis_dialyszers,
2134
+		DialysisIrrigation:         dialysis_irrigation,
2066 2135
 	}
2067 2136
 	service.SavePrescriptionAndCreateSolution(&solution, &prescription)
2137
+
2138
+	//查询最近透析准备表里是否存在 透析器 灌流器
2139
+
2140
+	//splitStr := strings.Split(dialysis_dialyszers, ",")
2141
+	//
2142
+	//splitIrrigation := strings.Split(dialysis_irrigation, ",")
2143
+	//
2144
+	//mation, _ := service.GetGoodInfoMation(adminUserInfo.Org.Id)
2145
+	//if len(mation)>0{
2146
+	//  for _, item := range splitStr {
2147
+	//    for _,it := range mation{
2148
+	//      if(item == it.SpecificationName){
2149
+	//
2150
+	//        //查询最近一次的透析器
2151
+	//        _, errcode := service.GetDialysisBeforePrepare(it.GoodTypeId, it.ID, adminUserInfo.Org.Id,id)
2152
+	//
2153
+	//        if errcode == gorm.ErrRecordNotFound{
2154
+	//          //插入数据
2155
+	//          prepare := models.DialysisBeforePrepare{
2156
+	//            UserOrgId:  adminUserInfo.Org.Id,
2157
+	//            PatientId:  id,
2158
+	//            RecordDate: recordDate.Unix(),
2159
+	//            GoodTypeId: it.GoodTypeId,
2160
+	//            GoodId:     it.ID,
2161
+	//            Count:      1,
2162
+	//            Ctime:      time.Now().Unix(),
2163
+	//            Creater:    adminUserInfo.AdminUser.Id,
2164
+	//            Status:1,
2165
+	//
2166
+	//          }
2167
+	//          errcode := service.CreateDialysisBeforePrepareOne(&prepare)
2168
+	//          fmt.Println("",errcode)
2169
+	//        }
2170
+	//      }
2171
+	//    }
2172
+	//
2173
+	//  }
2174
+	//
2175
+	//  for _, item := range splitIrrigation {
2176
+	//    for _,it := range mation{
2177
+	//      if(item == it.SpecificationName){
2178
+	//        //查询最近一次的透析器
2179
+	//        _, errcode := service.GetDialysisBeforePrepare(it.GoodTypeId, it.ID, adminUserInfo.Org.Id,id)
2180
+	//        if errcode == gorm.ErrRecordNotFound{
2181
+	//          //插入数据
2182
+	//          prepare := models.DialysisBeforePrepare{
2183
+	//            UserOrgId:  adminUserInfo.Org.Id,
2184
+	//            PatientId:  id,
2185
+	//            RecordDate: recordDate.Unix(),
2186
+	//            GoodTypeId: it.GoodTypeId,
2187
+	//            GoodId:     it.ID,
2188
+	//            Count:      1,
2189
+	//            Ctime:      time.Now().Unix(),
2190
+	//            Creater:    adminUserInfo.AdminUser.Id,
2191
+	//            Status:1,
2192
+	//
2193
+	//          }
2194
+	//          errcode := service.CreateDialysisBeforePrepareOne(&prepare)
2195
+	//          fmt.Println(errcode)
2196
+	//        }
2197
+	//      }
2198
+	//    }
2199
+	//  }
2200
+	//}
2201
+
2068 2202
 	c.ServeSuccessJSON(map[string]interface{}{
2069 2203
 		"solution":     &solution,
2070 2204
 		"prescription": &prescription,
@@ -3053,21 +3187,21 @@ func (c *DialysisAPIController) CreateConsumables() {
3053 3187
 				}
3054 3188
 
3055 3189
 				count, _ := strconv.ParseInt(items["count"].(string), 10, 64)
3056
-				//commdity_code := items["commdity_code"].(string)
3057
-				//fmt.Println("新建22222222222222",commdity_code)
3190
+				commdity_code := items["commdity_code"].(string)
3191
+				fmt.Println("新建22222222222222", commdity_code)
3058 3192
 				adminUser := c.GetMobileAdminUserInfo()
3059 3193
 				prepare := &models.DialysisBeforePrepare{
3060
-					UserOrgId:  adminUser.Org.Id,
3061
-					PatientId:  patient_id,
3062
-					RecordDate: record_time,
3063
-					GoodId:     good_id,
3064
-					GoodTypeId: good_type_id,
3065
-					Count:      count,
3066
-					Ctime:      time.Now().Unix(),
3067
-					Mtime:      time.Now().Unix(),
3068
-					Creater:    adminUser.AdminUser.Id,
3069
-					Modifier:   0,
3070
-					//CommdityCode:commdity_code,
3194
+					UserOrgId:    adminUser.Org.Id,
3195
+					PatientId:    patient_id,
3196
+					RecordDate:   record_time,
3197
+					GoodId:       good_id,
3198
+					GoodTypeId:   good_type_id,
3199
+					Count:        count,
3200
+					Ctime:        time.Now().Unix(),
3201
+					Mtime:        time.Now().Unix(),
3202
+					Creater:      adminUser.AdminUser.Id,
3203
+					Modifier:     0,
3204
+					CommdityCode: commdity_code,
3071 3205
 				}
3072 3206
 				record_count := service.FindDialysisBeforePrepare(prepare.PatientId, prepare.GoodId, prepare.GoodTypeId, adminUser.Org.Id, record_time)
3073 3207
 				if record_count == 0 {
@@ -3146,22 +3280,22 @@ func (c *DialysisAPIController) CreateConsumables() {
3146 3280
 				}
3147 3281
 				ctime := int64(items["ctime"].(float64))
3148 3282
 
3149
-				//commdity_code := items["commdity_code"].(string)
3150
-				//fmt.Println("commdityecode22222222222222222222",commdity_code)
3283
+				commdity_code := items["commdity_code"].(string)
3284
+				fmt.Println("commdityecode22222222222222222222", commdity_code)
3151 3285
 				prepare := &models.DialysisBeforePrepare{
3152
-					ID:         id,
3153
-					UserOrgId:  adminUser.Org.Id,
3154
-					PatientId:  patient_id,
3155
-					RecordDate: record_time,
3156
-					GoodId:     good_id,
3157
-					GoodTypeId: good_type_id,
3158
-					Count:      count,
3159
-					Ctime:      ctime,
3160
-					Mtime:      time.Now().Unix(),
3161
-					Creater:    creater,
3162
-					Modifier:   adminUser.AdminUser.Id,
3163
-					Status:     1,
3164
-					//CommdityCode: commdity_code,
3286
+					ID:           id,
3287
+					UserOrgId:    adminUser.Org.Id,
3288
+					PatientId:    patient_id,
3289
+					RecordDate:   record_time,
3290
+					GoodId:       good_id,
3291
+					GoodTypeId:   good_type_id,
3292
+					Count:        count,
3293
+					Ctime:        ctime,
3294
+					Mtime:        time.Now().Unix(),
3295
+					Creater:      creater,
3296
+					Modifier:     adminUser.AdminUser.Id,
3297
+					Status:       1,
3298
+					CommdityCode: commdity_code,
3165 3299
 				}
3166 3300
 				updateBeforePrepares = append(updateBeforePrepares, prepare)
3167 3301
 
@@ -3458,23 +3592,23 @@ func (c *DialysisAPIController) EditConsumables() {
3458 3592
 						return
3459 3593
 					}
3460 3594
 					ctime := int64(items["ctime"].(float64))
3461
-					//commdity_code := items["commdity_code"].(string)
3462
-					//fmt.Println("commdityecode22222222222222222222",commdity_code)
3595
+					commdity_code := items["commdity_code"].(string)
3596
+					fmt.Println("commdityecode22222222222222222222", commdity_code)
3463 3597
 					adminUser := c.GetMobileAdminUserInfo()
3464 3598
 					prepare := &models.DialysisBeforePrepare{
3465
-						ID:         id,
3466
-						UserOrgId:  adminUser.Org.Id,
3467
-						PatientId:  patient_id,
3468
-						RecordDate: record_time,
3469
-						GoodId:     good_id,
3470
-						GoodTypeId: good_type_id,
3471
-						Count:      count,
3472
-						Ctime:      ctime,
3473
-						Mtime:      time.Now().Unix(),
3474
-						Creater:    creater,
3475
-						Modifier:   adminUser.AdminUser.Id,
3476
-						Status:     1,
3477
-						//CommdityCode: commdity_code,
3599
+						ID:           id,
3600
+						UserOrgId:    adminUser.Org.Id,
3601
+						PatientId:    patient_id,
3602
+						RecordDate:   record_time,
3603
+						GoodId:       good_id,
3604
+						GoodTypeId:   good_type_id,
3605
+						Count:        count,
3606
+						Ctime:        ctime,
3607
+						Mtime:        time.Now().Unix(),
3608
+						Creater:      creater,
3609
+						Modifier:     adminUser.AdminUser.Id,
3610
+						Status:       1,
3611
+						CommdityCode: commdity_code,
3478 3612
 					}
3479 3613
 					beforePrepares = append(beforePrepares, prepare)
3480 3614
 
@@ -4004,6 +4138,9 @@ func (c *DialysisAPIController) GetDialysisGoods() {
4004 4138
 
4005 4139
 	goodTypes, _ := service.FindAllGoodType(adminUser.Org.Id)
4006 4140
 
4141
+	//获取当天该病人的透析处方
4142
+	prescribe, parseDateErr := service.GetDialysisPrescribe(adminUser.Org.Id, patient_id, date.Unix())
4143
+	good_info, _ := service.FindAllGoodInfo(adminUser.Org.Id)
4007 4144
 	if err == gorm.ErrRecordNotFound {
4008 4145
 
4009 4146
 		dialysisGoods, _, total := service.MobileGetDialysisGoods(adminUser.Org.Id, date.Unix(), schedule_type, partition_id, page, 0, patient_id, "", schedualEndDate)
@@ -4020,6 +4157,8 @@ func (c *DialysisAPIController) GetDialysisGoods() {
4020 4157
 			"dialysis_goods": dialysisGoods,
4021 4158
 			"good_type":      goodTypes,
4022 4159
 			"total":          total,
4160
+			"prescribe":      prescribe,
4161
+			"good_info":      good_info,
4023 4162
 		})
4024 4163
 		return
4025 4164
 
@@ -4043,6 +4182,8 @@ func (c *DialysisAPIController) GetDialysisGoods() {
4043 4182
 				"dialysis_goods": dialysisGoods,
4044 4183
 				"good_type":      goodTypes,
4045 4184
 				"total":          total,
4185
+				"prescribe":      prescribe,
4186
+				"good_info":      good_info,
4046 4187
 			})
4047 4188
 			return
4048 4189
 
@@ -4109,11 +4250,17 @@ func (c *DialysisAPIController) GetStockInGoodInfo() {
4109 4250
 
4110 4251
 	goodUser, _ := service.GetAllStockOutUserDetail(patient_id, adminUser.Org.Id, date.Unix())
4111 4252
 	lastGoodUserDetial, _ := service.GetLastDialysisGoods(patient_id, adminUser.Org.Id, date.Unix())
4253
+
4254
+	//获取今日患者的透析处方参数
4255
+
4256
+	prescribe, parseDateErr := service.GetDialysisPrescribe(adminUser.Org.Id, patient_id, date.Unix())
4257
+
4112 4258
 	c.ServeSuccessJSON(map[string]interface{}{
4113 4259
 		"good_type":      goodTypes,
4114 4260
 		"good_user":      goodUser,
4115 4261
 		"good_info":      good_info,
4116 4262
 		"last_good_user": lastGoodUserDetial,
4263
+		"prescription":   prescribe,
4117 4264
 	})
4118 4265
 	return
4119 4266
 
@@ -4155,15 +4302,16 @@ func (c *DialysisAPIController) CreateOtherStockOutInfo() {
4155 4302
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4156 4303
 					return
4157 4304
 				}
4158
-				good_id := int64(items["good_id"].(float64))
4159 4305
 
4306
+				good_id := int64(items["good_id"].(float64))
4307
+				fmt.Println("goood_id2222222222222222", good_id)
4160 4308
 				if items["good_type_id"] == nil || reflect.TypeOf(items["good_type_id"]).String() != "float64" {
4161 4309
 					utils.ErrorLog("good_type_id")
4162 4310
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4163 4311
 					return
4164 4312
 				}
4165 4313
 				good_type_id := int64(items["good_type_id"].(float64))
4166
-
4314
+				fmt.Println("goood_id2222222222222222", good_type_id)
4167 4315
 				if items["count"] == nil || reflect.TypeOf(items["count"]).String() != "string" {
4168 4316
 					utils.ErrorLog("count")
4169 4317
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -4171,7 +4319,7 @@ func (c *DialysisAPIController) CreateOtherStockOutInfo() {
4171 4319
 				}
4172 4320
 
4173 4321
 				count, _ := strconv.ParseInt(items["count"].(string), 10, 64)
4174
-
4322
+				fmt.Println("count22222222", count)
4175 4323
 				adminUser := c.GetMobileAdminUserInfo()
4176 4324
 				prepare := &models.DialysisBeforePrepare{
4177 4325
 					UserOrgId:  adminUser.Org.Id,
@@ -4421,3 +4569,45 @@ func (c *DialysisAPIController) GetDepartment() {
4421 4569
 	}
4422 4570
 
4423 4571
 }
4572
+
4573
+func (c *DialysisAPIController) GetMobilePrintStockGood() {
4574
+
4575
+	types, _ := c.GetInt("type", 0)
4576
+	start_time := c.GetString("start_time")
4577
+	end_time := c.GetString("end_time")
4578
+	orgId := c.GetMobileAdminUserInfo().Org.Id
4579
+
4580
+	timeLayout := "2006-01-02"
4581
+	loc, _ := time.LoadLocation("Local")
4582
+	var startTime int64
4583
+	if len(start_time) > 0 {
4584
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
4585
+		if err != nil {
4586
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4587
+			return
4588
+		}
4589
+		startTime = theTime.Unix()
4590
+	}
4591
+	var endTime int64
4592
+	if len(end_time) > 0 {
4593
+		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
4594
+		if err != nil {
4595
+			utils.ErrorLog(err.Error())
4596
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
4597
+			return
4598
+		}
4599
+		endTime = theTime.Unix()
4600
+	}
4601
+
4602
+	list, err := service.FindPrintStockGoodInfoByType(types, startTime, endTime, orgId)
4603
+	stockTotal, err := service.GetOutStockTotalCountTwo(startTime, endTime, orgId)
4604
+	if err != nil {
4605
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
4606
+	} else {
4607
+		c.ServeSuccessJSON(map[string]interface{}{
4608
+			"list":       list,
4609
+			"type":       types,
4610
+			"stockTotal": stockTotal,
4611
+		})
4612
+	}
4613
+}

+ 1 - 0
controllers/mobile_api_controllers/mobile_api_router_register.go Zobrazit soubor

@@ -137,4 +137,5 @@ func MobileAPIControllersRegisterRouters() {
137 137
 
138 138
 	beego.Router("/m/api/department/get", &DialysisAPIController{}, "Get:GetDepartment")
139 139
 
140
+	beego.Router("/m/api/getmobileprintstockgood", &DialysisAPIController{}, "Get:GetMobilePrintStockGood")
140 141
 }

+ 25 - 2
controllers/new_mobile_api_controllers/new_manage_api_controller.go Zobrazit soubor

@@ -43,8 +43,7 @@ func (this *NewManageApiController) GetDisInfectionTime() {
43 43
 	unitType, _ := service.GetUnitType(bedid, orgid)
44 44
 	//查询使用登记最后一条消毒记录
45 45
 	infomation, err := service.GetLaseDeviceInfomation(orgid, bedid, scheduledate, scheduletype)
46
-	fmt.Println("infomation========", infomation)
47
-	fmt.Println("err-------", err)
46
+	fmt.Println("err", err)
48 47
 	if err == gorm.ErrRecordNotFound {
49 48
 		//查询改设备是否有消毒计划
50 49
 		plan, errcode := service.GetDisInfectionTime(orgid, unitType.UnitType, scheduletype, scheduleweek)
@@ -216,3 +215,27 @@ func (this *NewManageApiController) SaveDisInfectionInfo() {
216 215
 		}
217 216
 	}
218 217
 }
218
+
219
+func (this *NewManageApiController) GetDeviceInformation() {
220
+
221
+	adminUser := this.GetMobileAdminUserInfo()
222
+	orgid := adminUser.Org.Id
223
+
224
+	scheduleDate := this.GetString("schedule_date")
225
+	recordDate, parseErr := utils.ParseTimeStringToTime("2006-01-02", scheduleDate)
226
+	if parseErr != nil {
227
+		this.ErrorLog("时间解析失败:%v", parseErr)
228
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
229
+		return
230
+	}
231
+	fmt.Println("recordDate2222222", recordDate.Unix())
232
+	//查询今日所有设备使用登记
233
+	information, err := service.GetDeviceInfomation(orgid, recordDate.Unix())
234
+	if err != nil {
235
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
236
+		return
237
+	}
238
+	this.ServeSuccessJSON(map[string]interface{}{
239
+		"information": information,
240
+	})
241
+}

+ 1 - 0
controllers/new_mobile_api_controllers/new_manage_api_router.go Zobrazit soubor

@@ -7,4 +7,5 @@ func NewManageApiControllersRegisterRouters() {
7 7
 	beego.Router("m/api/getequitautoinfo", &NewManageApiController{}, "Get:GetEquitAutoInfo")
8 8
 	beego.Router("m/api/getdisinfection", &NewManageApiController{}, "Get:GetDisInfectionTime")
9 9
 	beego.Router("/m/api/savedisinfectioninfo", &NewManageApiController{}, "Get:SaveDisInfectionInfo")
10
+	beego.Router("/m/api/getdeviceinformation", &NewManageApiController{}, "Get:GetDeviceInformation")
10 11
 }

+ 15 - 0
controllers/patient_api_controller.go Zobrazit soubor

@@ -854,6 +854,8 @@ func (c *PatientApiController) UpdateDialysisSolution() {
854 854
 		BloodAccess:                solution.BloodAccess,
855 855
 		DialysateFlow:              solution.DialysateFlow,
856 856
 		DialysateTemperature:       solution.DialysateTemperature,
857
+		DialysisIrrigation:         solution.DialysisIrrigation,
858
+		DialysisDialyszers:         solution.DialysisDialyszers,
857 859
 	}
858 860
 	service.UpdatePatientDialysisSolutionOne(solution.PatientId, adminUserInfo.CurrentOrgId, &prescription, todayTime.Unix())
859 861
 	if err != nil {
@@ -926,9 +928,11 @@ func (c *PatientApiController) GetPatientDialysisSolutionList() {
926 928
 	adminUserInfo := c.GetAdminUserInfo()
927 929
 
928 930
 	solutions, total, _ := service.GetPatientDialysisSolutionList(adminUserInfo.CurrentOrgId, id, page, limit)
931
+	stockType, _ := service.GetStockType(adminUserInfo.CurrentOrgId)
929 932
 	c.ServeSuccessJSON(map[string]interface{}{
930 933
 		"solutions": solutions,
931 934
 		"total":     total,
935
+		"stockType": stockType,
932 936
 	})
933 937
 	return
934 938
 }
@@ -3395,6 +3399,17 @@ func defaultSolutionFormData(solution *models.DialysisSolution, data []byte, met
3395 3399
 
3396 3400
 		solution.CreatedTime = created_time
3397 3401
 	}
3402
+
3403
+	if dataBody["dialysis_dialyszers"] != nil && reflect.TypeOf(dataBody["dialysis_dialyszers"]).String() == "string" {
3404
+		dialysisDialyszers := dataBody["dialysis_dialyszers"].(string)
3405
+		solution.DialysisDialyszers = dialysisDialyszers
3406
+	}
3407
+
3408
+	if dataBody["dialysis_irrigation"] != nil && reflect.TypeOf(dataBody["dialysis_irrigation"]).String() == "string" {
3409
+		dialysisIrrigation := dataBody["dialysis_irrigation"].(string)
3410
+		solution.DialysisIrrigation = dialysisIrrigation
3411
+	}
3412
+
3398 3413
 	return
3399 3414
 }
3400 3415
 

+ 126 - 0
controllers/schedule_api_controller.go Zobrazit soubor

@@ -44,6 +44,8 @@ func ScheduleApiRegistRouters() {
44 44
 	beego.Router("/api/schedule/getthreeweeklist", &ScheduleApiController{}, "Get:GetThreeWeekList")
45 45
 
46 46
 	beego.Router("/api/schedule/getallzones", &ScheduleApiController{}, "Get:GetAllZones")
47
+
48
+	beego.Router("/api/schedule/copypatientschedules", &ScheduleApiController{}, "Get:GetCopyPatientSchedules")
47 49
 }
48 50
 
49 51
 func (c *ScheduleApiController) GetWeekPanels() {
@@ -1992,3 +1994,127 @@ func (this *ScheduleApiController) GetAllZones() {
1992 1994
 		"zones": zones,
1993 1995
 	})
1994 1996
 }
1997
+
1998
+func (this *ScheduleApiController) GetCopyPatientSchedules() {
1999
+	adminUserInfo := this.GetAdminUserInfo()
2000
+	orgId := adminUserInfo.CurrentOrgId
2001
+	start_time, _ := this.GetInt64("start_time")
2002
+	fmt.Println("start_time", start_time)
2003
+	end_time, _ := this.GetInt64("end_time")
2004
+	fmt.Println("end_time", end_time)
2005
+	copy_startime, _ := this.GetInt64("copy_startime")
2006
+	fmt.Println("copy_startime", copy_startime)
2007
+	copy_endtime, _ := this.GetInt64("copy_endtime")
2008
+
2009
+	//获取本周患者排班
2010
+	schedules, _ := service.GetWeekSchedules(orgId, start_time, end_time)
2011
+
2012
+	//查询复制中的排班日期是否存在
2013
+	_, errcode := service.GetLastWeekSchedule(orgId, copy_startime, copy_endtime)
2014
+
2015
+	if errcode == gorm.ErrRecordNotFound {
2016
+		//如果没有直接新增
2017
+
2018
+		for _, item := range schedules {
2019
+			//fmt.Println(item.StartTime+604800)
2020
+			//礼拜1
2021
+			if item.ScheduleWeek == 1 {
2022
+				item.ScheduleDate = copy_startime
2023
+			}
2024
+			if item.ScheduleWeek == 2 {
2025
+				item.ScheduleDate = copy_startime + 86400
2026
+			}
2027
+			if item.ScheduleWeek == 3 {
2028
+				item.ScheduleDate = copy_startime + 172800
2029
+			}
2030
+			if item.ScheduleWeek == 4 {
2031
+				item.ScheduleDate = copy_startime + 259200
2032
+			}
2033
+			if item.ScheduleWeek == 5 {
2034
+				item.ScheduleDate = copy_startime + 345600
2035
+			}
2036
+
2037
+			if item.ScheduleWeek == 6 {
2038
+				item.ScheduleDate = copy_startime + 432000
2039
+			}
2040
+			//礼拜天
2041
+			if item.ScheduleWeek == 0 {
2042
+				item.ScheduleDate = copy_endtime
2043
+			}
2044
+			schedule := models.XtSchedule{
2045
+				UserOrgId:    item.UserOrgId,
2046
+				PartitionId:  item.PartitionId,
2047
+				BedId:        item.BedId,
2048
+				PatientId:    item.PatientId,
2049
+				ScheduleDate: item.ScheduleDate,
2050
+				ScheduleType: item.ScheduleType,
2051
+				ScheduleWeek: item.ScheduleWeek,
2052
+				ModeId:       item.ModeId,
2053
+				Status:       1,
2054
+				CreatedTime:  time.Now().Unix(),
2055
+			}
2056
+
2057
+			err := service.AddPatientSchedule(&schedule)
2058
+			if err != nil {
2059
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2060
+				return
2061
+			}
2062
+			this.ServeSuccessJSON(map[string]interface{}{
2063
+				"schedule": schedule,
2064
+			})
2065
+		}
2066
+	} else if errcode == nil {
2067
+
2068
+		//先清除复制周的排班
2069
+		errcode := service.UpdatePatientSchedule(orgId, copy_startime, copy_endtime)
2070
+		fmt.Println(errcode)
2071
+		for _, item := range schedules {
2072
+			//fmt.Println(item.StartTime+604800)
2073
+			//礼拜1
2074
+			if item.ScheduleWeek == 1 {
2075
+				item.ScheduleDate = copy_startime
2076
+			}
2077
+			if item.ScheduleWeek == 2 {
2078
+				item.ScheduleDate = copy_startime + 86400
2079
+			}
2080
+			if item.ScheduleWeek == 3 {
2081
+				item.ScheduleDate = copy_startime + 172800
2082
+			}
2083
+			if item.ScheduleWeek == 4 {
2084
+				item.ScheduleDate = copy_startime + 259200
2085
+			}
2086
+			if item.ScheduleWeek == 5 {
2087
+				item.ScheduleDate = copy_startime + 345600
2088
+			}
2089
+
2090
+			if item.ScheduleWeek == 6 {
2091
+				item.ScheduleDate = copy_startime + 432000
2092
+			}
2093
+			//礼拜天
2094
+			if item.ScheduleWeek == 0 {
2095
+				item.ScheduleDate = copy_endtime
2096
+			}
2097
+			schedule := models.XtSchedule{
2098
+				UserOrgId:    item.UserOrgId,
2099
+				PartitionId:  item.PartitionId,
2100
+				BedId:        item.BedId,
2101
+				PatientId:    item.PatientId,
2102
+				ScheduleDate: item.ScheduleDate,
2103
+				ScheduleType: item.ScheduleType,
2104
+				ScheduleWeek: item.ScheduleWeek,
2105
+				ModeId:       item.ModeId,
2106
+				Status:       1,
2107
+				CreatedTime:  time.Now().Unix(),
2108
+			}
2109
+
2110
+			err := service.AddPatientSchedule(&schedule)
2111
+			if err != nil {
2112
+				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
2113
+				return
2114
+			}
2115
+			this.ServeSuccessJSON(map[string]interface{}{
2116
+				"schedule": schedule,
2117
+			})
2118
+		}
2119
+	}
2120
+}

+ 1 - 0
controllers/stock_good_api_controller.go Zobrazit soubor

@@ -51,6 +51,7 @@ func (c *StockGoodApiController) CreateGoodType() {
51 51
 	total := service.FindAllGoodTypeTotal(adminUserInfo.CurrentOrgId)
52 52
 	code := strconv.FormatInt(total+1, 10)
53 53
 	code = "34000000" + code
54
+
54 55
 	goodType := models.GoodsType{
55 56
 		TypeCode:       code,
56 57
 		TypeName:       type_name,

+ 2 - 0
models/dialysis.go Zobrazit soubor

@@ -355,6 +355,8 @@ type DoctorAdvices struct {
355 355
 	AnticoagulantShouji        float64         `gorm:"column:anticoagulant_shouji" json:"anticoagulant_shouji" form:"anticoagulant_shouji"`
356 356
 	AnticoagulantWeichi        float64         `gorm:"column:anticoagulant_weichi" json:"anticoagulant_weichi" form:"anticoagulant_weichi"`
357 357
 	AnticoagulantZongliang     float64         `gorm:"column:anticoagulant_zongliang" json:"anticoagulant_zongliang" form:"anticoagulant_zongliang"`
358
+	DialysisDialyszers         string          `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
359
+	DialysisIrrigation         string          `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
358 360
 }
359 361
 
360 362
 type DoctorAdvice struct {

+ 2 - 0
models/gobal_models.go Zobrazit soubor

@@ -82,6 +82,8 @@ type SystemPrescription struct {
82 82
 	Ultrafiltration            float64 `gorm:"column:ultrafiltration" json:"ultrafiltration" form:"ultrafiltration"`
83 83
 	BodyFluidOther             string  `gorm:"column:body_fluid_other" json:"body_fluid_other" form:"body_fluid_other"`
84 84
 	TargetKtv                  float64 `gorm:"column:target_ktv" json:"target_ktv" form:"target_ktv"`
85
+	DialysisDialyszers         string  `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
86
+	DialysisIrrigation         string  `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
85 87
 }
86 88
 
87 89
 func (SystemPrescription) TableName() string {

+ 4 - 0
models/patient_models.go Zobrazit soubor

@@ -246,6 +246,8 @@ type DialysisPrescriptionList struct {
246 246
 	DialyzerPerfusionApparatus string  `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus" form:"dialyzer_perfusion_apparatus"`
247 247
 	TargetUltrafiltration      float64 `gorm:"column:target_ultrafiltration" json:"target_ultrafiltration"`
248 248
 	BloodAccess                int64   `gorm:"column:blood_access" json:"blood_access"`
249
+	DialysisDialyszers         string  `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
250
+	DialysisIrrigation         string  `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
249 251
 }
250 252
 
251 253
 func (DialysisPrescriptionList) TableName() string {
@@ -325,6 +327,8 @@ type DialysisSolution struct {
325 327
 	DialyzerPerfusionApparatus string  `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus"`
326 328
 	BodyFluidOther             string  `gorm:"column:body_fluid_other" json:"body_fluid_other"`
327 329
 	TargetKtv                  float64 `gorm:"column:target_ktv" json:"target_ktv"`
330
+	DialysisDialyszers         string  `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
331
+	DialysisIrrigation         string  `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
328 332
 }
329 333
 
330 334
 func (DialysisSolution) TableName() string {

+ 2 - 0
models/user_models.go Zobrazit soubor

@@ -335,6 +335,8 @@ type XtDialysisSolution struct {
335 335
 	Ultrafiltration            float64 `gorm:"column:ultrafiltration" json:"ultrafiltration" form:"ultrafiltration"`
336 336
 	BodyFluidOther             string  `gorm:"column:body_fluid_other" json:"body_fluid_other" form:"body_fluid_other"`
337 337
 	TargetKtv                  float64 `gorm:"column:target_ktv" json:"target_ktv" form:"target_ktv"`
338
+	DialysisDialyszers         string  `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
339
+	DialysisIrrigation         string  `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
338 340
 }
339 341
 
340 342
 func (XtDialysisSolution) TableName() string {

+ 25 - 0
service/dialysis_service.go Zobrazit soubor

@@ -1148,3 +1148,28 @@ func SaveHisDoctorAdvice(advice *models.HisDoctorAdviceInfo) (err error) {
1148 1148
 	err = writeDb.Save(&advice).Error
1149 1149
 	return
1150 1150
 }
1151
+
1152
+func GetGoodInfoMation(orgid int64) (goodinfo []*models.GoodInfo, err error) {
1153
+
1154
+	err = XTReadDB().Model(&goodinfo).Where("org_id = ? and status = 1", orgid).Find(&goodinfo).Error
1155
+	return goodinfo, err
1156
+}
1157
+
1158
+func GetDialysisBeforePrepare(goodTypeId int64, goodId int64, orgid int64, patientId int64) (*models.DialysisBeforePrepare, error) {
1159
+
1160
+	prepare := models.DialysisBeforePrepare{}
1161
+	err := XTReadDB().Where("good_type_id = ? and good_id = ? and user_org_id = ? and status =1 and patient_id = ?", goodTypeId, goodId, orgid, patientId).Last(&prepare).Error
1162
+	if err == gorm.ErrRecordNotFound {
1163
+		return nil, err
1164
+	}
1165
+	if err != nil {
1166
+		return nil, err
1167
+	}
1168
+	return &prepare, nil
1169
+}
1170
+
1171
+func CreateDialysisBeforePrepareOne(prepare *models.DialysisBeforePrepare) error {
1172
+
1173
+	err := XTReadDB().Create(&prepare).Error
1174
+	return err
1175
+}

+ 41 - 0
service/gobal_config_service.go Zobrazit soubor

@@ -354,3 +354,44 @@ func GetDrugCancelOrder(startime int64, endtime int64, orgid int64, orderType in
354 354
 
355 355
 	return cancel, total, err
356 356
 }
357
+
358
+func FindPrintStockGoodInfoByType(types int, startTime int64, end_time int64, orgId int64) (list []*models.StockInfo, err error) {
359
+
360
+	db := XTReadDB().Model(&models.StockInfo{})
361
+	db = db.Where("xt_good_information.org_id = ? AND xt_good_information.status = 1", orgId)
362
+	if types == 1 {
363
+		db = db.Joins("JOIN xt_warehouse_info AS info ON info.good_id=xt_good_information.id AND info.status = 1 AND info.org_id = ?", orgId).Group("xt_good_information.id")
364
+		db = db.Preload("QueryWarehousingInfo", func(db *gorm.DB) *gorm.DB {
365
+			return db.Where("xt_warehouse_info.org_id = ? AND xt_warehouse_info.status = 1", orgId).Joins("JOIN xt_warehouse AS warehouse ON warehouse.id = xt_warehouse_info.warehousing_id AND warehouse.status = 1 AND warehouse.warehousing_time >=? AND warehouse.warehousing_time<= ? AND warehouse.org_id = ?", startTime, end_time, orgId)
366
+		})
367
+	} else if types == 2 {
368
+		db = db.Joins("JOIN xt_sales_return_info AS info ON info.good_id=xt_good_information.id AND info.status = 1 AND info.org_id = ?", orgId).Group("xt_good_information.id")
369
+		db = db.Preload("QuerySalesReturnInfo", func(db *gorm.DB) *gorm.DB {
370
+			return db.Where("xt_sales_return_info.org_id = ? AND xt_sales_return_info.status = 1", orgId).Joins("JOIN xt_sales_return AS sales ON sales.id = xt_sales_return_info.sales_return_id AND sales.status = 1 AND sales.return_time >=? AND sales.return_time<= ? AND sales.org_id = ?", startTime, end_time, orgId)
371
+		})
372
+
373
+	} else if types == 3 {
374
+		db = db.Joins("JOIN xt_warehouse_out_info AS info ON info.good_id=xt_good_information.id AND info.status = 1 AND info.org_id = ?", orgId).Group("xt_good_information.id")
375
+		db = db.Preload("QueryWarehouseOutInfo", func(db *gorm.DB) *gorm.DB {
376
+			return db.Where("xt_warehouse_out_info.org_id = ? AND xt_warehouse_out_info.status = 1", orgId).Joins("JOIN xt_warehouse_out ON xt_warehouse_out.id = xt_warehouse_out_info.warehouse_out_id AND xt_warehouse_out.status = 1 AND xt_warehouse_out.warehouse_out_time >=? AND xt_warehouse_out.warehouse_out_time<= ? AND xt_warehouse_out.org_id = ? ", startTime, end_time, orgId)
377
+		})
378
+
379
+	} else if types == 4 {
380
+
381
+		db = db.Joins("JOIN xt_cancel_stock_info AS info ON info.good_id=xt_good_information.id AND info.status = 1 AND info.org_id = ?", orgId).Group("xt_good_information.id")
382
+		db = db.Preload("QueryCancelStockInfo", func(db *gorm.DB) *gorm.DB {
383
+			return db.Where("xt_cancel_stock_info.org_id = ? AND xt_cancel_stock_info.status = 1", orgId).Joins("JOIN xt_cancel_stock AS cancel ON cancel.id = xt_cancel_stock_info.cancel_stock_id AND cancel.status = 1 AND cancel.return_time >=? AND cancel.return_time<= ? AND cancel.org_id = ?", startTime, end_time, orgId)
384
+		})
385
+
386
+	}
387
+	db = db.Preload("GoodsType", "org_id = ? AND status = 1", orgId)
388
+	err = db.Order("ctime desc").Find(&list).Error
389
+	return
390
+}
391
+
392
+func GetOutStockTotalCountTwo(startime int64, endtime int64, orgid int64) (autoMatic []*models.NewXtAutomaticReduceDetail, err error) {
393
+
394
+	err = XTReadDB().Raw("SELECT good_id,SUM(b.count) as count FROM (SELECT DISTINCT x.patient_id,x.good_id,x.record_time,x.count FROM xt_automatic_reduce_detail as x WHERE x.org_id = ? and x.record_time >= ? and x.record_time<=? and `status` = 1)  as b GROUP BY good_id", orgid, startime, endtime).Scan(&autoMatic).Error
395
+
396
+	return autoMatic, err
397
+}

+ 6 - 0
service/manage_service.go Zobrazit soubor

@@ -1236,3 +1236,9 @@ func DeleteEquit(id int64) (models.DeviceAddmacher, error) {
1236 1236
 	err := UserWriteDB().Model(&addmacher).Where("id=?", id).Updates(map[string]interface{}{"status": 0}).Error
1237 1237
 	return addmacher, err
1238 1238
 }
1239
+
1240
+func GetDeviceInfomation(orgid int64, scheduledate int64) (information []*models.DeviceInformation, err error) {
1241
+
1242
+	err = UserReadDB().Model(&information).Where("user_org_id = ? and date = ? and status =1", orgid, scheduledate).Find(&information).Error
1243
+	return information, err
1244
+}

+ 1 - 1
service/patient_service.go Zobrazit soubor

@@ -1476,6 +1476,6 @@ func GetDialysisCount(orgid int64, partitionid int64) (order []*models.BloodDial
1476 1476
 
1477 1477
 func UpdatePatientDialysisSolutionOne(patientid int64, orgid int64, prescription *models.DialysisPrescription, timenow int64) error {
1478 1478
 
1479
-	err = XTWriteDB().Model(&prescription).Where("patient_id = ? and user_org_id = ? and record_date = ? ", patientid, orgid, timenow).Updates(map[string]interface{}{"dialyzer": prescription.Dialyzer, "anticoagulant": prescription.Anticoagulant, "mode_id": prescription.ModeId, "dialysis_duration_hour": prescription.DialysisDurationHour, "anticoagulant_shouji": prescription.AnticoagulantShouji, "anticoagulant_weichi": prescription.AnticoagulantWeichi, "anticoagulant_zongliang": prescription.AnticoagulantZongliang, "kalium": prescription.Kalium, "sodium": prescription.Sodium, "calcium": prescription.Calcium, "dialyzer_perfusion_apparatus": prescription.DialyzerPerfusionApparatus, "blood_access": prescription.BloodAccess, "dialysate_flow": prescription.DialysateFlow, "dialysate_temperature": prescription.DialysateTemperature}).Error
1479
+	err = XTWriteDB().Model(&prescription).Where("patient_id = ? and user_org_id = ? and record_date = ? ", patientid, orgid, timenow).Updates(map[string]interface{}{"dialyzer": prescription.Dialyzer, "anticoagulant": prescription.Anticoagulant, "mode_id": prescription.ModeId, "dialysis_duration_hour": prescription.DialysisDurationHour, "anticoagulant_shouji": prescription.AnticoagulantShouji, "anticoagulant_weichi": prescription.AnticoagulantWeichi, "anticoagulant_zongliang": prescription.AnticoagulantZongliang, "kalium": prescription.Kalium, "sodium": prescription.Sodium, "calcium": prescription.Calcium, "dialyzer_perfusion_apparatus": prescription.DialyzerPerfusionApparatus, "blood_access": prescription.BloodAccess, "dialysate_flow": prescription.DialysateFlow, "dialysate_temperature": prescription.DialysateTemperature, "dialysis_dialyszers": prescription.DialysisDialyszers, "dialysis_irrigation": prescription.DialysisIrrigation}).Error
1480 1480
 	return err
1481 1481
 }

+ 3 - 3
service/patientmanage_service.go Zobrazit soubor

@@ -527,7 +527,7 @@ func GetNewDoctorAdvice(patientID int64, advice_type int64, start int64, end int
527 527
 		db = db.Where("x.start_time<=?", end)
528 528
 	}
529 529
 	//offset := (page - 1) * limit
530
-	err = db.Group("x.id").Count(&total).Select("x.id, x.user_org_id, x.patient_id, x.advice_type, x.advice_date, x.record_date, x.start_time, x.advice_name,x.advice_desc, x.reminder_date, x.drug_spec, x.drug_spec_unit, x.single_dose, x.single_dose_unit, x.prescribing_number, x.prescribing_number_unit, x.delivery_way, x.execution_frequency, x.advice_doctor, x.status, x.created_time,x.updated_time, x.advice_affirm, x.remark, x.stop_time, x.stop_reason, x.stop_doctor, x.stop_state, x.parent_id, x.execution_time, x.execution_staff, x.execution_state, x.checker, x.check_state, x.check_time, x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.parent_id,r.user_name,s.dialyzer_perfusion_apparatus,s.anticoagulant,s.anticoagulant_shouji,s.anticoagulant_weichi,s.anticoagulant_zongliang, IF(x.parent_id > 0, x.parent_id, x.id) as advice_order").Joins("Left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.advice_doctor").Joins("left join xt_dialysis_prescription as s on s.patient_id = x.patient_id and s.record_date = x.advice_date and s.user_org_id = ?", orgID).Order("start_time desc, groupno desc, advice_order desc, id asc").Scan(&doctoradvice).Error
530
+	err = db.Group("x.id").Count(&total).Select("x.id, x.user_org_id, x.patient_id, x.advice_type, x.advice_date, x.record_date, x.start_time, x.advice_name,x.advice_desc, x.reminder_date, x.drug_spec, x.drug_spec_unit, x.single_dose, x.single_dose_unit, x.prescribing_number, x.prescribing_number_unit, x.delivery_way, x.execution_frequency, x.advice_doctor, x.status, x.created_time,x.updated_time, x.advice_affirm, x.remark, x.stop_time, x.stop_reason, x.stop_doctor, x.stop_state, x.parent_id, x.execution_time, x.execution_staff, x.execution_state, x.checker, x.check_state, x.check_time, x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.parent_id,r.user_name,s.dialyzer_perfusion_apparatus,s.anticoagulant,s.anticoagulant_shouji,s.anticoagulant_weichi,s.anticoagulant_zongliang,s.dialysis_dialyszers,s.dialysis_irrigation, IF(x.parent_id > 0, x.parent_id, x.id) as advice_order").Joins("Left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.advice_doctor").Joins("left join xt_dialysis_prescription as s on s.patient_id = x.patient_id and s.record_date = x.advice_date and s.user_org_id = ?", orgID).Order("start_time desc, groupno desc, advice_order desc, id asc").Scan(&doctoradvice).Error
531 531
 	fmt.Print("err", err)
532 532
 	return
533 533
 
@@ -562,7 +562,7 @@ func GetNewDoctorAdviceOne(patientID int64, advice_type int64, start int64, end
562 562
 		db = db.Where("x.start_time<=?", end)
563 563
 	}
564 564
 	offset := (page - 1) * limit
565
-	err = db.Order("x.start_time desc").Group("x.start_time").Count(&total).Offset(offset).Limit(limit).Select("x.id, x.user_org_id, x.patient_id, x.advice_type, x.advice_date, x.record_date, x.start_time, x.advice_name,x.advice_desc, x.reminder_date, x.drug_spec, x.drug_spec_unit, x.single_dose, x.single_dose_unit, x.prescribing_number, x.prescribing_number_unit, x.delivery_way, x.execution_frequency, x.advice_doctor, x.status, x.created_time,x.updated_time, x.advice_affirm, x.remark, x.stop_time, x.stop_reason, x.stop_doctor, x.stop_state, x.parent_id, x.execution_time, x.execution_staff, x.execution_state, x.checker, x.check_state, x.check_time, x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.parent_id,r.user_name,s.dialyzer_perfusion_apparatus,s.anticoagulant,s.anticoagulant_shouji,s.anticoagulant_weichi,s.anticoagulant_zongliang, IF(x.parent_id > 0, x.parent_id, x.id) as advice_order").Joins("Left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.advice_doctor").Joins("left join xt_dialysis_prescription as s on s.patient_id = x.patient_id and s.record_date = x.advice_date and s.user_org_id = ?", orgID).Scan(&doctoradvice).Error
565
+	err = db.Order("x.start_time desc").Group("x.start_time").Count(&total).Offset(offset).Limit(limit).Select("x.id, x.user_org_id, x.patient_id, x.advice_type, x.advice_date, x.record_date, x.start_time, x.advice_name,x.advice_desc, x.reminder_date, x.drug_spec, x.drug_spec_unit, x.single_dose, x.single_dose_unit, x.prescribing_number, x.prescribing_number_unit, x.delivery_way, x.execution_frequency, x.advice_doctor, x.status, x.created_time,x.updated_time, x.advice_affirm, x.remark, x.stop_time, x.stop_reason, x.stop_doctor, x.stop_state, x.parent_id, x.execution_time, x.execution_staff, x.execution_state, x.checker, x.check_state, x.check_time, x.groupno,x.remind_type,x.frequency_type,x.day_count,x.week_day,x.parent_id,r.user_name,s.dialyzer_perfusion_apparatus,s.anticoagulant,s.anticoagulant_shouji,s.anticoagulant_weichi,s.anticoagulant_zongliang,s.dialysis_dialyszers,s.dialysis_irrigation, IF(x.parent_id > 0, x.parent_id, x.id) as advice_order").Joins("Left join sgj_users.sgj_user_admin_role as r on r.admin_user_id = x.advice_doctor").Joins("left join xt_dialysis_prescription as s on s.patient_id = x.patient_id and s.record_date = x.advice_date and s.user_org_id = ?", orgID).Scan(&doctoradvice).Error
566 566
 	fmt.Print("错误是什么", err)
567 567
 	return
568 568
 }
@@ -654,7 +654,7 @@ func GetlongDialysisrecord(patientid int64, startime int64, endtime int64, limit
654 654
 	}
655 655
 	offset := (page - 1) * limit
656 656
 	err = db.Count(&total).Order("x.created_time desc").Offset(offset).Limit(limit).Group("x.id").
657
-		Select("x.id,x.name,x.sub_name,x.user_org_id,x.patient_id,x.parent_id,x.type,x.period,x.times,x.anticoagulant,x.anticoagulant_shouji,x.anticoagulant_weichi,x.anticoagulant_zongliang,x.anticoagulant_gaimingcheng,x.anticoagulant_gaijiliang,x.mode_name,x.mode_id,x.dialysis_duration,x.replacement_way,x.hemodialysis_machine,x.blood_filter,x.perfusion_apparatus,x.blood_flow_volume,x.dewater,x.displace_liqui,x.glucose,x.dry_weight,x.dialysate_flow,x.kalium,x.sodium,x.calcium,x.bicarbonate,x.doctor,x.first_dialysis,x.remark,x.initiate_mode,x.affirm_state,x.use_state,x.status,x.registrars_id,x.created_time,x.updated_time,x.solution_type,x.dialysate_temperature,x.conductivity,x.dialysis_duration_hour,x.dialysis_duration_minute,x.target_ultrafiltration,x.dialysate_formulation,x.dialyzer,x.replacement_total,x.dialyzer_perfusion_apparatus,x.body_fluid,x.special_medicine,x.special_medicine_other,x.displace_liqui_part,x.displace_liqui_value,x.blood_access,x.ultrafiltration,x.body_fluid_other,x.target_ktv").Find(&prescription).Error
657
+		Select("x.id,x.name,x.sub_name,x.user_org_id,x.patient_id,x.parent_id,x.type,x.period,x.times,x.anticoagulant,x.anticoagulant_shouji,x.anticoagulant_weichi,x.anticoagulant_zongliang,x.anticoagulant_gaimingcheng,x.anticoagulant_gaijiliang,x.mode_name,x.mode_id,x.dialysis_duration,x.replacement_way,x.hemodialysis_machine,x.blood_filter,x.perfusion_apparatus,x.blood_flow_volume,x.dewater,x.displace_liqui,x.glucose,x.dry_weight,x.dialysate_flow,x.kalium,x.sodium,x.calcium,x.bicarbonate,x.doctor,x.first_dialysis,x.remark,x.initiate_mode,x.affirm_state,x.use_state,x.status,x.registrars_id,x.created_time,x.updated_time,x.solution_type,x.dialysate_temperature,x.conductivity,x.dialysis_duration_hour,x.dialysis_duration_minute,x.target_ultrafiltration,x.dialysate_formulation,x.dialyzer,x.replacement_total,x.dialyzer_perfusion_apparatus,x.body_fluid,x.special_medicine,x.special_medicine_other,x.displace_liqui_part,x.displace_liqui_value,x.blood_access,x.ultrafiltration,x.body_fluid_other,x.target_ktv,x.dialysis_dialyszers,x.dialysis_irrigation").Find(&prescription).Error
658 658
 
659 659
 	return
660 660
 }

+ 30 - 0
service/schedule_service.go Zobrazit soubor

@@ -719,3 +719,33 @@ func UpdatedDialysisPrescription(prescription *models.DialysisPrescription, reco
719 719
 	err := XTWriteDB().Model(&prescription).Where("record_date = ? and patient_id = ? and user_org_id = ?", recordDate, patientid, orgid).Update(map[string]interface{}{"mode_id": prescription.ModeId, "updated_time": time.Now().Unix()}).Error
720 720
 	return err
721 721
 }
722
+
723
+func GetWeekSchedules(orgid int64, startime int64, endtime int64) (scheudle []*models.XtSchedule, err error) {
724
+
725
+	err = XTReadDB().Model(&scheudle).Where("user_org_id = ? and status = 1 and schedule_date>=? and schedule_date<=?", orgid, startime, endtime).Find(&scheudle).Error
726
+	return scheudle, err
727
+}
728
+
729
+func GetLastWeekSchedule(orgid int64, startime int64, endtime int64) (*models.XtSchedule, error) {
730
+	schedule := models.XtSchedule{}
731
+	err := XTReadDB().Where("user_org_id = ? and status =1 and schedule_date>=? and schedule_date<=?", orgid, startime, endtime).Find(&schedule).Error
732
+	if err == gorm.ErrRecordNotFound {
733
+		return nil, err
734
+	}
735
+	if err != nil {
736
+		return nil, err
737
+	}
738
+	return &schedule, nil
739
+}
740
+func AddPatientSchedule(schedule *models.XtSchedule) error {
741
+
742
+	err := XTWriteDB().Create(&schedule).Error
743
+	return err
744
+}
745
+
746
+func UpdatePatientSchedule(orgid int64, startime int64, endtime int64) error {
747
+
748
+	schedule := models.XtSchedule{}
749
+	err := XTWriteDB().Model(&schedule).Where("user_org_id = ? and schedule_date>=? and schedule_date<=? and status =1", orgid, startime, endtime).Updates(map[string]interface{}{"status": 0}).Error
750
+	return err
751
+}

+ 30 - 1
service/stock_service.go Zobrazit soubor

@@ -121,6 +121,30 @@ func FindAllGoodTypeTotal(orgId int64) (total int64) {
121 121
 	return
122 122
 }
123 123
 
124
+func GetGoodsTypeIsExist(orgid int64) (*models.GoodsType, error) {
125
+	goodsType := models.GoodsType{}
126
+	err := XTReadDB().Where("org_id = ? and stock_attribute = 2 and status =1", orgid).Find(&goodsType).Error
127
+	if err == gorm.ErrRecordNotFound {
128
+		return nil, err
129
+	}
130
+	if err != nil {
131
+		return nil, err
132
+	}
133
+	return &goodsType, nil
134
+}
135
+
136
+func GetGoodsTypeIsExistOne(orgid int64) (*models.GoodsType, error) {
137
+	goodsType := models.GoodsType{}
138
+	err := XTReadDB().Where("org_id = ? and stock_attribute = 3 and status = 1", orgid).Find(&goodsType).Error
139
+	if err == gorm.ErrRecordNotFound {
140
+		return nil, err
141
+	}
142
+	if err != nil {
143
+		return nil, err
144
+	}
145
+	return &goodsType, nil
146
+}
147
+
124 148
 func AddSigleGoodType(goodType *models.GoodsType) (error, *models.GoodsType) {
125 149
 	err := writeDb.Create(&goodType).Error
126 150
 	return err, goodType
@@ -233,7 +257,7 @@ func FindGoodInfoList(orgId int64, page int64, limit int64, keyword string, is_u
233 257
 	db = db.Preload("GoodsType", "org_id = ? AND status = 1", orgId)
234 258
 	if len(keyword) > 0 {
235 259
 		likeKey := "%" + keyword + "%"
236
-		db = db.Where("good_code LIKE ? OR specification_name LIKE ?", likeKey, likeKey)
260
+		db = db.Where("good_code LIKE ? OR good_name LIKE ?", likeKey, likeKey)
237 261
 	} else {
238 262
 		if is_use > 0 {
239 263
 			if is_use == 1 {
@@ -1940,6 +1964,11 @@ func FindGoodInfoByName(name string, org_id int64, good_type_id int64) (total in
1940 1964
 	return
1941 1965
 }
1942 1966
 
1967
+func FindGoodInfoByNameOne(name string, org_id int64, good_type_id int64, id int64) (total int64) {
1968
+	readDb.Model(&models.GoodInfo{}).Where("org_id = ? AND status = 1 AND specification_name = ? AND good_type_id = ? and id <> ? ", org_id, name, good_type_id, id).Count(&total)
1969
+	return
1970
+}
1971
+
1943 1972
 func FindAllGoodTypeByType(types int64) (goodType []*models.GoodsType, err error) {
1944 1973
 	err = readDb.Model(&models.GoodsType{}).Where("type = ? AND status = 1", types).Find(&goodType).Error
1945 1974
 	return goodType, err