浏览代码

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

28169 1 个月前
父节点
当前提交
e39d1c6a12
共有 4 个文件被更改,包括 353 次插入12 次删除
  1. 239 12
      controllers/his_project_api_controller.go
  2. 77 0
      models/his_models.go
  3. 17 0
      models/patient_models.go
  4. 20 0
      service/his_project_service.go

+ 239 - 12
controllers/his_project_api_controller.go 查看文件

@@ -42,6 +42,8 @@ func HisProjectRouters() {
42 42
 	beego.Router("/api/his/getallprojectlist", &HisProjectApiController{}, "Get:GetAllProjectList")
43 43
 	beego.Router("/api/his/addprojectlist", &HisProjectApiController{}, "Get:AddProjectList")
44 44
 	beego.Router("/api/his/deleteproject", &HisProjectApiController{}, "Get:DeleteProject")
45
+	beego.Router("/api/his/deletedrug", &HisProjectApiController{}, "Get:DeleteDrug")
46
+
45 47
 	beego.Router("/api/his/gethisproject", &HisProjectApiController{}, "Get:GetHisProject")
46 48
 	beego.Router("/api/his/getprojectteam", &HisProjectApiController{}, "Get:GetProjectTeam")
47 49
 	beego.Router("/api/his/getalldoctorlist", &HisProjectApiController{}, "Get:GetAllDoctorList")
@@ -133,6 +135,7 @@ func (this *HisProjectApiController) SaveProject() {
133 135
 
134 136
 	is_print, _ := this.GetInt64("is_print")
135 137
 	is_show, _ := this.GetInt64("is_show")
138
+
136 139
 	theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
137 140
 	adminUserInfo := this.GetAdminUserInfo()
138 141
 	orgId := adminUserInfo.CurrentOrgId
@@ -390,7 +393,6 @@ func (this *HisProjectApiController) DeleteHisProject() {
390 393
 func (this *HisProjectApiController) SaveProjectTeam() {
391 394
 
392 395
 	project_team := this.GetString("project_team")
393
-
394 396
 	price := this.GetString("price")
395 397
 	price_float, _ := strconv.ParseFloat(price, 64)
396 398
 	pinyin := this.GetString("pinyin")
@@ -459,11 +461,13 @@ func (this *HisProjectApiController) SaveProjectTeam() {
459 461
 					}
460 462
 					types := int64(items["type"].(float64))
461 463
 
462
-					if items["number"] == nil || reflect.TypeOf(items["number"]).String() != "string" {
463
-						utils.ErrorLog("number")
464
+					if items["prescribing_number"] == nil || reflect.TypeOf(items["prescribing_number"]).String() != "string" {
465
+						utils.ErrorLog("prescribing_number")
466
+						this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
467
+						return
464 468
 					}
465 469
 
466
-					number, _ := strconv.ParseInt(items["number"].(string), 10, 64)
470
+					number, _ := strconv.ParseInt(items["prescribing_number"].(string), 10, 64)
467 471
 
468 472
 					list := models.XtHisProjectList{
469 473
 						Number:      number,
@@ -484,11 +488,91 @@ func (this *HisProjectApiController) SaveProjectTeam() {
484 488
 				ids_str := strings.Join(ids, ",")
485 489
 				projectTeam.ItemId = ids_str
486 490
 				service.SaveProjectTeam(&projectTeam)
491
+			}
492
+		}
493
+
494
+		if dataBody["drug_info"] != nil && reflect.TypeOf(dataBody["drug_info"]).String() == "[]interface {}" {
495
+			infos, _ := dataBody["drug_info"].([]interface{})
496
+			if len(infos) > 0 {
497
+				var ids []string
498
+
499
+				for _, item := range infos {
500
+
501
+					var advice models.HisDoctorAdviceTeamInfo
502
+
503
+					items := item.(map[string]interface{})
504
+					if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
505
+						utils.ErrorLog("id")
506
+						this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
507
+						return
508
+					}
509
+					id := int64(items["id"].(float64))
510
+
511
+					if items["drug_name"] == nil || reflect.TypeOf(items["drug_name"]).String() != "string" {
512
+						utils.ErrorLog("drug_name")
513
+						this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
514
+						return
515
+					}
516
+					if items["min_unit"] != nil && reflect.TypeOf(items["min_unit"]).String() == "string" {
517
+						drugSpecUnit, _ := items["min_unit"].(string)
518
+						advice.DrugSpecUnit = drugSpecUnit
519
+					}
520
+					if items["remark"] != nil && reflect.TypeOf(items["remark"]).String() == "string" {
521
+						remark, _ := items["remark"].(string)
522
+						advice.Remark = remark
523
+					}
524
+					if items["single_dose"] != nil && reflect.TypeOf(items["single_dose"]).String() == "string" {
525
+						singleDose, _ := strconv.ParseFloat(items["single_dose"].(string), 64)
526
+						advice.SingleDose = singleDose
527
+					}
528
+					if items["single_dose_unit"] != nil && reflect.TypeOf(items["single_dose_unit"]).String() == "string" {
529
+						singleDoseUnit, _ := items["single_dose_unit"].(string)
530
+						advice.SingleDoseUnit = singleDoseUnit
531
+					}
532
+					if items["prescribing_number"] != nil && reflect.TypeOf(items["prescribing_number"]).String() == "string" {
533
+						prescribingNumber, _ := strconv.ParseFloat(items["prescribing_number"].(string), 64)
534
+						advice.PrescribingNumber = prescribingNumber
535
+					}
536
+					if items["prescribing_number_unit"] != nil && reflect.TypeOf(items["prescribing_number_unit"]).String() == "string" {
537
+						prescribingNumberUnit, _ := items["prescribing_number_unit"].(string)
538
+						advice.PrescribingNumberUnit = prescribingNumberUnit
539
+					}
540
+					if items["delivery_way"] != nil && reflect.TypeOf(items["delivery_way"]).String() == "string" {
541
+						deliveryWay, _ := items["delivery_way"].(string)
542
+						advice.DeliveryWay = deliveryWay
543
+					}
544
+					if items["execution_frequency"] != nil && reflect.TypeOf(items["execution_frequency"]).String() == "string" {
545
+						executionFrequency, _ := items["execution_frequency"].(string)
546
+						advice.ExecutionFrequency = executionFrequency
547
+					}
548
+					if items["day"] != nil && reflect.TypeOf(items["day"]).String() == "string" {
549
+						day, _ := items["day"].(string)
550
+						daycount, _ := strconv.ParseInt(day, 10, 64)
551
+						advice.DayCount = daycount
552
+					}
553
+
554
+					adviceName, _ := items["drug_name"].(string)
555
+					adviceDesc, _ := items["advice_desc"].(string)
556
+					advice.UserOrgId = this.GetAdminUserInfo().CurrentOrgId
557
+					advice.AdviceName = adviceName
558
+					advice.AdviceDesc = adviceDesc
559
+					advice.DrugId = id
560
+					advice.Status = 1
561
+					service.CreateDoctorAdviceTeamList(&advice)
562
+					ids = append(ids, strconv.FormatInt(advice.ID, 10))
563
+				}
564
+				ids_str := strings.Join(ids, ",")
565
+				projectTeam.DrugItemId = ids_str
566
+				service.SaveProjectTeam(&projectTeam)
487 567
 				this.ServeSuccessJSON(map[string]interface{}{
488 568
 					"projectTeam": projectTeam,
489 569
 				})
490 570
 			}
491 571
 		}
572
+
573
+		this.ServeSuccessJSON(map[string]interface{}{
574
+			"projectTeam": projectTeam,
575
+		})
492 576
 		return
493 577
 	} else if errcodes == nil {
494 578
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
@@ -524,6 +608,9 @@ func (this *HisProjectApiController) GetProjectTeamDetail() {
524 608
 	ids := strings.Split(projectTeamDetail.ItemId, ",")
525 609
 	hisList, err := service.GetProjectHisListByIds(ids)
526 610
 
611
+	ids_drug := strings.Split(projectTeamDetail.DrugItemId, ",")
612
+	hisList_drug, err := service.GetDrugHisListByIds(ids_drug)
613
+
527 614
 	//list, err := service.GetAllProjectList(orgId)
528 615
 	if err != nil {
529 616
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
@@ -532,7 +619,8 @@ func (this *HisProjectApiController) GetProjectTeamDetail() {
532 619
 	this.ServeSuccessJSON(map[string]interface{}{
533 620
 		"projectTeamDetail": projectTeamDetail,
534 621
 		//"list":              list,
535
-		"hisList": hisList,
622
+		"hisList":      hisList,
623
+		"hisList_drug": hisList_drug,
536 624
 	})
537 625
 	return
538 626
 }
@@ -613,17 +701,134 @@ func (this *HisProjectApiController) UpdatedProjectTeam() {
613 701
 					Type:        types,
614 702
 				}
615 703
 
616
-				service.CreateProjectList(&list)
617
-
704
+				if items["m_id"] == nil || reflect.TypeOf(items["m_id"]).String() != "float64" {
705
+					utils.ErrorLog("m_id")
706
+					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
707
+					return
708
+				}
709
+				m_id := int64(items["m_id"].(float64))
710
+				list.ID = m_id
711
+				service.SaveProjectList(&list)
618 712
 				ids = append(ids, strconv.FormatInt(list.ID, 10))
619
-
620 713
 			}
621 714
 			ids_str := strings.Join(ids, ",")
622 715
 			projectTeam.ItemId = projectTeam.ItemId + "," + ids_str
623 716
 			service.SaveProjectTeam(&projectTeam)
624
-			this.ServeSuccessJSON(map[string]interface{}{
625
-				"projectTeam": projectTeam,
626
-			})
717
+
718
+		}
719
+	}
720
+
721
+	if dataBody["drug_info"] != nil && reflect.TypeOf(dataBody["drug_info"]).String() == "[]interface {}" {
722
+		infos, _ := dataBody["drug_info"].([]interface{})
723
+		if len(infos) > 0 {
724
+			var ids []string
725
+
726
+			for _, item := range infos {
727
+
728
+				var advice models.HisDoctorAdviceTeamInfo
729
+
730
+				items := item.(map[string]interface{})
731
+
732
+				if items["m_id"] == nil || reflect.TypeOf(items["m_id"]).String() != "float64" {
733
+					utils.ErrorLog("id")
734
+					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
735
+					return
736
+				}
737
+				m_id := int64(items["m_id"].(float64))
738
+				advice, _ = service.GetHisDrugByID(m_id)
739
+
740
+				if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
741
+					utils.ErrorLog("id")
742
+					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
743
+					return
744
+				}
745
+				id := int64(items["id"].(float64))
746
+
747
+				if items["drug_name"] == nil || reflect.TypeOf(items["drug_name"]).String() != "string" {
748
+					utils.ErrorLog("drug_name")
749
+					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
750
+					return
751
+				}
752
+				if items["min_unit"] != nil && reflect.TypeOf(items["min_unit"]).String() == "string" {
753
+					drugSpecUnit, _ := items["min_unit"].(string)
754
+					advice.DrugSpecUnit = drugSpecUnit
755
+				}
756
+				if items["remark"] != nil && reflect.TypeOf(items["remark"]).String() == "string" {
757
+					remark, _ := items["remark"].(string)
758
+					advice.Remark = remark
759
+				}
760
+				if items["single_dose"] != nil && reflect.TypeOf(items["single_dose"]).String() == "string" {
761
+					singleDose, _ := strconv.ParseFloat(items["single_dose"].(string), 64)
762
+					fmt.Println("singleDose")
763
+					fmt.Println(singleDose)
764
+
765
+					advice.SingleDose = singleDose
766
+				}
767
+				if items["single_dose_unit"] != nil && reflect.TypeOf(items["single_dose_unit"]).String() == "string" {
768
+					singleDoseUnit, _ := items["single_dose_unit"].(string)
769
+
770
+					fmt.Println("singleDoseUnit")
771
+					fmt.Println(singleDoseUnit)
772
+					advice.SingleDoseUnit = singleDoseUnit
773
+				}
774
+				if items["prescribing_number"] != nil && reflect.TypeOf(items["prescribing_number"]).String() == "string" {
775
+					prescribingNumber, _ := strconv.ParseFloat(items["prescribing_number"].(string), 64)
776
+					advice.PrescribingNumber = prescribingNumber
777
+
778
+					fmt.Println("prescribingNumber")
779
+					fmt.Println(prescribingNumber)
780
+				}
781
+				if items["prescribing_number_unit"] != nil && reflect.TypeOf(items["prescribing_number_unit"]).String() == "string" {
782
+					prescribingNumberUnit, _ := items["prescribing_number_unit"].(string)
783
+					advice.PrescribingNumberUnit = prescribingNumberUnit
784
+
785
+					fmt.Println("prescribing_number_unit")
786
+					fmt.Println(prescribingNumberUnit)
787
+				}
788
+				if items["delivery_way"] != nil && reflect.TypeOf(items["delivery_way"]).String() == "string" {
789
+					deliveryWay, _ := items["delivery_way"].(string)
790
+					advice.DeliveryWay = deliveryWay
791
+
792
+					fmt.Println("delivery_way")
793
+					fmt.Println(deliveryWay)
794
+				}
795
+				if items["execution_frequency"] != nil && reflect.TypeOf(items["execution_frequency"]).String() == "string" {
796
+					executionFrequency, _ := items["execution_frequency"].(string)
797
+					advice.ExecutionFrequency = executionFrequency
798
+
799
+					fmt.Println("execution_frequency")
800
+					fmt.Println(executionFrequency)
801
+				}
802
+				if items["day"] != nil && reflect.TypeOf(items["day"]).String() == "string" {
803
+					day, _ := items["day"].(string)
804
+					daycount, _ := strconv.ParseInt(day, 10, 64)
805
+					advice.DayCount = daycount
806
+
807
+					fmt.Println("day")
808
+					fmt.Println(day)
809
+				}
810
+
811
+				adviceName, _ := items["drug_name"].(string)
812
+				//adviceDesc, _ := items["advice_desc"].(string)
813
+				advice.UserOrgId = this.GetAdminUserInfo().CurrentOrgId
814
+				advice.AdviceName = adviceName
815
+				//advice.AdviceDesc = adviceDesc
816
+				advice.Status = 1
817
+
818
+				advice.DrugId = id
819
+				advice.ID = m_id
820
+				if m_id > 0 {
821
+					service.CreateDoctorAdviceTeamList(&advice)
822
+					ids = append(ids, strconv.FormatInt(advice.ID, 10))
823
+
824
+				} else {
825
+					service.CreateDoctorAdviceTeamList(&advice)
826
+					ids = append(ids, strconv.FormatInt(advice.ID, 10))
827
+				}
828
+			}
829
+			ids_str := strings.Join(ids, ",")
830
+			projectTeam.DrugItemId = ids_str
831
+			service.SaveProjectTeam(&projectTeam)
627 832
 		}
628 833
 	}
629 834
 
@@ -822,7 +1027,8 @@ func (this *HisProjectApiController) GetAllProjectList() {
822 1027
 	orgId := adminUserInfo.CurrentOrgId
823 1028
 	projectList, err := service.GetAllProjectList(orgId, keyword)
824 1029
 	goodInfos, err := service.GetGoodInfomationList(orgId, keyword)
825
-
1030
+	drug, _ := service.GetDrugInfomationList(orgId, keyword)
1031
+	//goodInfos, err := service.GetAllDrugList(orgId)
826 1032
 	//获取列表数据
827 1033
 	hisprojectlist, err := service.GetHisProjectListByOrgId(orgId)
828 1034
 
@@ -834,6 +1040,7 @@ func (this *HisProjectApiController) GetAllProjectList() {
834 1040
 		"projectList":    projectList,
835 1041
 		"hisprojectlist": hisprojectlist,
836 1042
 		"good_info":      goodInfos,
1043
+		"drug":           drug,
837 1044
 	})
838 1045
 	return
839 1046
 }
@@ -894,6 +1101,19 @@ func (this *HisProjectApiController) DeleteProject() {
894 1101
 	return
895 1102
 }
896 1103
 
1104
+func (this *HisProjectApiController) DeleteDrug() {
1105
+	id, _ := this.GetInt64("id")
1106
+	err := service.DeleteDrugList(id)
1107
+	if err != nil {
1108
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "失败")
1109
+		return
1110
+	}
1111
+	returnData := make(map[string]interface{}, 0)
1112
+	returnData["msg"] = "ok"
1113
+	this.ServeSuccessJSON(returnData)
1114
+	return
1115
+}
1116
+
897 1117
 func (this *HisProjectApiController) GetHisProject() {
898 1118
 	adminUserInfo := this.GetAdminUserInfo()
899 1119
 	orgId := adminUserInfo.CurrentOrgId
@@ -1139,14 +1359,21 @@ func (this *HisProjectApiController) GetProjectListById() {
1139 1359
 	adminUserInfo := this.GetAdminUserInfo()
1140 1360
 	orgId := adminUserInfo.CurrentOrgId
1141 1361
 	project_id := this.GetString("project_id")
1362
+	drug_id := this.GetString("drug_id")
1363
+
1142 1364
 	idStrs := strings.Split(project_id, ",")
1365
+	drug_idStrs := strings.Split(drug_id, ",")
1366
+
1143 1367
 	project, err := service.GetProjectListById(orgId, idStrs)
1368
+	advice, _ := service.GetAdviceTeamListById(orgId, drug_idStrs)
1369
+
1144 1370
 	if err != nil {
1145 1371
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
1146 1372
 		return
1147 1373
 	}
1148 1374
 	this.ServeSuccessJSON(map[string]interface{}{
1149 1375
 		"project": project,
1376
+		"advice":  advice,
1150 1377
 	})
1151 1378
 }
1152 1379
 

+ 77 - 0
models/his_models.go 查看文件

@@ -73,6 +73,7 @@ type XtHisProjectTeam struct {
73 73
 	ItemId      string              `gorm:"column:item_id" json:"item_id" form:"item_id"`
74 74
 	List        []*XtHisProjectList `gorm:"-" json:"list" form:"list"`
75 75
 	Sort        int64               `gorm:"column:sort" json:"sort" form:"sort"`
76
+	DrugItemId  string              `gorm:"column:drug_item_id" json:"drug_item_id" form:"drug_item_id"`
76 77
 }
77 78
 
78 79
 func (XtHisProjectTeam) TableName() string {
@@ -3121,3 +3122,79 @@ type NBXtBaseDrug struct {
3121 3122
 func (NBXtBaseDrug) TableName() string {
3122 3123
 	return "xt_base_drug"
3123 3124
 }
3125
+
3126
+type HisDoctorAdviceTeamInfo struct {
3127
+	ID                    int64       `gorm:"column:id" json:"id" form:"id"`
3128
+	UserOrgId             int64       `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
3129
+	PatientId             int64       `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
3130
+	AdviceName            string      `gorm:"column:advice_name" json:"advice_name" form:"advice_name"`
3131
+	AdviceDesc            string      `gorm:"column:advice_desc" json:"advice_desc" form:"advice_desc"`
3132
+	SingleDose            float64     `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
3133
+	SingleDoseUnit        string      `gorm:"column:single_dose_unit" json:"single_dose_unit" form:"single_dose_unit"`
3134
+	PrescribingNumber     float64     `gorm:"column:prescribing_number" json:"prescribing_number" form:"prescribing_number"`
3135
+	PrescribingNumberUnit string      `gorm:"column:prescribing_number_unit" json:"prescribing_number_unit" form:"prescribing_number_unit"`
3136
+	DeliveryWay           string      `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
3137
+	ExecutionFrequency    string      `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
3138
+	AdviceDoctor          int64       `gorm:"column:advice_doctor" json:"advice_doctor" form:"advice_doctor"`
3139
+	Status                int64       `gorm:"column:status" json:"status" form:"status"`
3140
+	CreatedTime           int64       `gorm:"column:created_time" json:"created_time" form:"created_time"`
3141
+	UpdatedTime           int64       `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
3142
+	Remark                string      `gorm:"column:remark" json:"remark" form:"remark"`
3143
+	DrugSpec              float64     `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
3144
+	DrugSpecUnit          string      `gorm:"column:drug_spec_unit" json:"drug_spec_unit" form:"drug_spec_unit"`
3145
+	Groupno               int64       `gorm:"column:groupno" json:"groupno" form:"groupno"`
3146
+	RemindType            int64       `gorm:"column:remind_type" json:"remind_type" form:"remind_type"`
3147
+	FrequencyType         int64       `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
3148
+	DayCount              int64       `gorm:"column:day_count" json:"day_count" form:"day_count"`
3149
+	WeekDay               string      `gorm:"column:week_day" json:"week_day" form:"week_day"`
3150
+	TemplateId            string      `gorm:"column:template_id" json:"template_id" form:"template_id"`
3151
+	Modifier              int64       `gorm:"column:modifier" json:"modifier" form:"modifier"`
3152
+	DrugId                int64       `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
3153
+	Price                 float64     `gorm:"column:price" json:"price" form:"price"`
3154
+	BaseDrugLib           BaseDrugLib `gorm:"ForeignKey:ID;AssociationForeignKey:DrugId" json:"drug"`
3155
+}
3156
+
3157
+func (HisDoctorAdviceTeamInfo) TableName() string {
3158
+	return "his_doctor_advice_team_info"
3159
+}
3160
+
3161
+type NewHisOrderInfo struct {
3162
+	ID               int64   `gorm:"column:id" json:"id" form:"id"`
3163
+	OrderNumber      string  `gorm:"column:order_number" json:"order_number" form:"order_number"`
3164
+	UploadDate       int64   `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
3165
+	AdviceId         int64   `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
3166
+	DetItemFeeSumamt float64 `gorm:"column:det_item_fee_sumamt" json:"det_item_fee_sumamt" form:"det_item_fee_sumamt"`
3167
+	Cnt              float64 `gorm:"column:cnt" json:"cnt" form:"cnt"`
3168
+	Pric             float64 `gorm:"column:pric" json:"pric" form:"pric"`
3169
+	PatientId        int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
3170
+	PricUplmtAmt     float64 `gorm:"column:pric_uplmt_amt" json:"pric_uplmt_amt" form:"pric_uplmt_amt"`
3171
+	SelfpayProp      float64 `gorm:"column:selfpay_prop" json:"selfpay_prop" form:"selfpay_prop"`
3172
+	FulamtOwnpayAmt  float64 `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
3173
+	OverlmtAmt       float64 `gorm:"column:overlmt_amt" json:"overlmt_amt" form:"overlmt_amt"`
3174
+	PreselfpayAmt    float64 `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
3175
+	BasMednFlag      string  `gorm:"column:bas_medn_flag" json:"bas_medn_flag" form:"bas_medn_flag"`
3176
+	MedChrgitmType   string  `gorm:"column:med_chrgitm_type" json:"med_chrgitm_type" form:"med_chrgitm_type"`
3177
+	HiNegoDrugFlag   string  `gorm:"column:hi_nego_drug_flag" json:"hi_nego_drug_flag" form:"hi_nego_drug_flag"`
3178
+	Status           int64   `gorm:"column:status" json:"status" form:"status"`
3179
+	Memo             string  `gorm:"column:memo" json:"memo" form:"memo"`
3180
+	FeedetlSn        string  `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
3181
+	Mtime            int64   `gorm:"column:mtime" json:"mtime" form:"mtime"`
3182
+	InscpScpAmt      float64 `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
3183
+	DrtReimFlag      string  `gorm:"column:drt_reim_flag" json:"drt_reim_flag" form:"drt_reim_flag"`
3184
+	Ctime            int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
3185
+	ListSpItemFlag   string  `gorm:"column:list_sp_item_flag" json:"list_sp_item_flag" form:"list_sp_item_flag"`
3186
+	ChldMedcFlag     string  `gorm:"column:chld_medc_flag" json:"chld_medc_flag" form:"chld_medc_flag"`
3187
+	LmtUsedFlag      string  `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
3188
+	ChrgitmLv        string  `gorm:"column:chrgitm_lv" json:"chrgitm_lv" form:"chrgitm_lv"`
3189
+	UserOrgId        int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
3190
+	HisPatientId     int64   `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
3191
+	OrderId          int64   `gorm:"column:order_id" json:"order_id" form:"order_id"`
3192
+	ProjectId        int64   `gorm:"column:project_id" json:"project_id" form:"project_id"`
3193
+	Type             int64   `gorm:"column:type" json:"type" form:"type"`
3194
+	ItemId           int64   `gorm:"column:item_id" json:"item_id" form:"item_id"`
3195
+	SettleType       int64   `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
3196
+}
3197
+
3198
+func (NewHisOrderInfo) TableName() string {
3199
+	return "his_order_info"
3200
+}

+ 17 - 0
models/patient_models.go 查看文件

@@ -3231,3 +3231,20 @@ type XtDialysisOrderSetting struct {
3231 3231
 func (XtDialysisOrderSetting) TableName() string {
3232 3232
 	return "xt_dialysis_order_setting"
3233 3233
 }
3234
+
3235
+type PharmacyPatients struct {
3236
+	ID          int64  `gorm:"column:id" json:"id" form:"id"`
3237
+	UserOrgId   int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
3238
+	UserId      int64  `gorm:"column:user_id" json:"user_id" form:"user_id"`
3239
+	Avatar      string `gorm:"column:avatar" json:"avatar" form:"avatar"`
3240
+	PatientType int64  `gorm:"column:patient_type" json:"patient_type" form:"patient_type"`
3241
+	DialysisNo  string `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
3242
+	Source      int64  `gorm:"column:source" json:"source" form:"source"`
3243
+	Lapseto     int64  `gorm:"column:lapseto" json:"lapseto" form:"lapseto"`
3244
+	Name        string `gorm:"column:name" json:"name" form:"name"`
3245
+	Status      int64  `gorm:"column:status" json:"status" form:"status"`
3246
+}
3247
+
3248
+func (PharmacyPatients) TableName() string {
3249
+	return "xt_patients"
3250
+}

+ 20 - 0
service/his_project_service.go 查看文件

@@ -220,6 +220,11 @@ func CreateProjectList(list *models.XtHisProjectList) error {
220 220
 	return err
221 221
 }
222 222
 
223
+func SaveProjectList(list *models.XtHisProjectList) error {
224
+
225
+	err := XTWriteDB().Model(&list).Save(&list).Error
226
+	return err
227
+}
223 228
 func GetHisProjectListByOrgId(orgid int64) (projectlist []*models.HisProjectListVm, err error) {
224 229
 
225 230
 	db := XTReadDB().Table("xt_his_project_list as x").Where("x.status = 1")
@@ -243,6 +248,12 @@ func DeleteProjectList(id int64) error {
243 248
 	return err
244 249
 }
245 250
 
251
+func DeleteDrugList(id int64) error {
252
+	list := models.HisDoctorAdviceTeamInfo{}
253
+	err := XTWriteDB().Model(&list).Where("id=? and status = 1", id).Updates(map[string]interface{}{"status": 0}).Error
254
+	return err
255
+}
256
+
246 257
 func GetHisProject(orgid int64) (project []*models.XtHisProject, err error) {
247 258
 
248 259
 	err = XTReadDB().Model(&project).Where("user_org_id = ? and status =1 and medical_status!=1", orgid).Order("sort asc").Find(&project).Error
@@ -311,6 +322,10 @@ func GetProjectListById(orgid int64, ids []string) (project []*models.XtHisProje
311 322
 	return project, err
312 323
 }
313 324
 
325
+func GetAdviceTeamListById(orgid int64, ids []string) (advice []*models.HisDoctorAdviceTeamInfo, err error) {
326
+	err = XTReadDB().Model(&advice).Preload("BaseDrugLib", "status = 1").Where("user_org_id = ? and id in (?) and status = 1", orgid, ids).Find(&advice).Error
327
+	return advice, err
328
+}
314 329
 func GetHisPatientHistory(keyword string, startime int64, endtime int64, registtype int64, limit int64, page int64, orgid int64) (hisPatient []*models.XtHisPatient, total int64, err error) {
315 330
 	offset := (page - 1) * limit
316 331
 	likeKey := "%" + keyword + "%"
@@ -799,3 +814,8 @@ func CreateHisProjectTh11o(project models.HisProject) error {
799 814
 	err := XTWriteDB().Model(&project).Create(&project).Error
800 815
 	return err
801 816
 }
817
+
818
+func GetHisDrugByID(id int64) (project models.HisDoctorAdviceTeamInfo, err error) {
819
+	err = XTReadDB().Model(&project).Where("id = ? and status =1 ", id).First(&project).Error
820
+	return project, err
821
+}