Browse Source

接口提交

XMLWAN 2 years ago
parent
commit
d1a69129b7

+ 2 - 2
controllers/device_api_controller.go View File

@@ -53,7 +53,7 @@ type DeviceAPIController struct {
53 53
 // /api/device/initdata [get] GetDeviceManageInitData
54 54
 func (this *DeviceAPIController) GetDeviceManageInitData() {
55 55
 	adminInfo := this.GetAdminUserInfo()
56
-	zones, getZonesErr := service.GetAllValidDeviceZones(adminInfo.CurrentOrgId)
56
+	zones, getZonesErr := service.GetAllValidDeviceZonesOne(adminInfo.CurrentOrgId)
57 57
 	if getZonesErr != nil {
58 58
 		this.ErrorLog("获取设备分区列表失败:%v", getZonesErr)
59 59
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -503,7 +503,7 @@ func (this *DeviceAPIController) DisableDevice() {
503 503
 // /api/device/zones [get] GetZones
504 504
 func (this *DeviceAPIController) GetZones() {
505 505
 	adminInfo := this.GetAdminUserInfo()
506
-	zones, getZonesErr := service.GetAllValidDeviceZones(adminInfo.CurrentOrgId)
506
+	zones, getZonesErr := service.GetAllValidDeviceZonesOne(adminInfo.CurrentOrgId)
507 507
 	if getZonesErr != nil {
508 508
 		this.ErrorLog("获取设备分区列表失败:%v", getZonesErr)
509 509
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)

+ 80 - 0
controllers/his_summary_controller.go View File

@@ -3,6 +3,7 @@ package controllers
3 3
 import (
4 4
 	"XT_New/enums"
5 5
 	"XT_New/service"
6
+	"fmt"
6 7
 	"github.com/astaxie/beego"
7 8
 	"time"
8 9
 )
@@ -16,6 +17,9 @@ func HisSummaryApiRegistRouters() {
16 17
 	beego.Router("/api/gethissummarydetaillist", &HisSummaryApiController{}, "Get:GetHisSummaryDetailList")
17 18
 	beego.Router("/api/his/getgatherdetailist", &HisSummaryApiController{}, "Get:GetGatherDetaiList")
18 19
 	beego.Router("/api/his/getdetailpatients", &HisSummaryApiController{}, "Get:GetDetailPatients")
20
+
21
+	beego.Router("/api/his/gethisorderlist", &HisSummaryApiController{}, "Get:GetHisOrderList")
22
+	beego.Router("/api/his/gethisadviceorderlist", &HisSummaryApiController{}, "Get:GetHisAdviceOrderList")
19 23
 }
20 24
 
21 25
 func (this *HisSummaryApiController) GetHisSummaryDetailList() {
@@ -633,3 +637,79 @@ func (this *HisSummaryApiController) GetDetailPatients() {
633 637
 
634 638
 	}
635 639
 }
640
+
641
+func (this *HisSummaryApiController) GetHisOrderList() {
642
+
643
+	patient_id, _ := this.GetInt64("patient_id")
644
+	start_time := this.GetString("start_time")
645
+	end_time := this.GetString("end_time")
646
+	timeLayout := "2006-01-02"
647
+	loc, _ := time.LoadLocation("Local")
648
+	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
649
+	if err != nil {
650
+
651
+	}
652
+	startRecordDateTime := startTime.Unix()
653
+
654
+	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
655
+	if err != nil {
656
+
657
+	}
658
+	endRecordDateTime := endTime.Unix()
659
+	orgId := this.GetAdminUserInfo().CurrentOrgId
660
+	groupList, _ := service.GetOrderInfoList(patient_id, startRecordDateTime, endRecordDateTime, orgId)
661
+	fmt.Println("groupList32332323232232332322323", groupList)
662
+	//list, err := service.GetHisOrderListTwenty(patient_id, startRecordDateTime, endRecordDateTime, orgId)
663
+	if err == nil {
664
+		this.ServeSuccessJSON(map[string]interface{}{
665
+			"groupList": groupList,
666
+			//   "list": list,
667
+
668
+		})
669
+		return
670
+	} else {
671
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
672
+		return
673
+
674
+	}
675
+}
676
+
677
+func (this *HisSummaryApiController) GetHisAdviceOrderList() {
678
+
679
+	patient_id, _ := this.GetInt64("patient_id")
680
+	start_time := this.GetString("start_time")
681
+	end_time := this.GetString("end_time")
682
+	timeLayout := "2006-01-02"
683
+	loc, _ := time.LoadLocation("Local")
684
+	startTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
685
+	if err != nil {
686
+
687
+	}
688
+	startRecordDateTime := startTime.Unix()
689
+
690
+	endTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
691
+	if err != nil {
692
+
693
+	}
694
+	endRecordDateTime := endTime.Unix()
695
+	orgId := this.GetAdminUserInfo().CurrentOrgId
696
+
697
+	list, err := service.GetOrderInfoList(patient_id, startRecordDateTime, endRecordDateTime, orgId)
698
+
699
+	//drugList, err := service.GetAllDrugLibList(orgId)
700
+	//
701
+	//goodList, err := service.GetAllGoodList(orgId)
702
+
703
+	if err == nil {
704
+		this.ServeSuccessJSON(map[string]interface{}{
705
+			"list": list,
706
+			//"drugList":drugList,
707
+			//"goodList":goodList,
708
+		})
709
+		return
710
+	} else {
711
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
712
+		return
713
+
714
+	}
715
+}

+ 5 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go View File

@@ -115,6 +115,11 @@ func (c *CheckWeightApiController) SaveBloodPressure() {
115 115
 				evaluation.BloodAccessPartId = lastPredialysisEvaluation.BloodAccessPartId
116 116
 				evaluation.BloodAccessPartOperaId = lastPredialysisEvaluation.BloodAccessPartOperaId
117 117
 				evaluation.AdditionalWeight = lastPredialysisEvaluation.AdditionalWeight // 衣物重
118
+
119
+				//从化益达 备注默认上一次数据
120
+				if adminUserInfo.Org.Id == 10318 {
121
+					evaluation.Remark = lastPredialysisEvaluation.Remark
122
+				}
118 123
 			}
119 124
 		} else {
120 125
 			evaluation.UpdatedTime = time.Now().Unix()

+ 1 - 1
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -1160,7 +1160,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
1160 1160
 					}
1161 1161
 					if prescribing_number_total <= total {
1162 1162
 						if medical.IsUse == 2 {
1163
-							config, _ := service.GetDrugOpenConfig(adminInfo.Org.Id)
1163
+							config, _ := service.GetDrugOpenConfigOne(adminInfo.Org.Id)
1164 1164
 							if config.IsOpen != 1 {
1165 1165
 								service.HisDrugsDelivery(adminInfo.Org.Id, creater, &advice)
1166 1166
 								//查询默认仓库

+ 2 - 1
controllers/patient_api_controller.go View File

@@ -2124,7 +2124,8 @@ func (c *PatientApiController) ExecDoctorAdvice() {
2124 2124
 				}
2125 2125
 				if prescribing_number_total <= total {
2126 2126
 					if medical.IsUse == 2 {
2127
-						config, _ := service.GetDrugOpenConfig(adminUserInfo.CurrentOrgId)
2127
+						config, _ := service.GetDrugOpenConfigOne(adminUserInfo.CurrentOrgId)
2128
+
2128 2129
 						if config.IsOpen != 1 {
2129 2130
 							service.HisDrugsDelivery(adminUserInfo.CurrentOrgId, item.ExecutionStaff, item)
2130 2131
 

+ 199 - 0
models/his_models.go View File

@@ -2107,3 +2107,202 @@ type VmHisOrder struct {
2107 2107
 func (VmHisOrder) TableName() string {
2108 2108
 	return "his_order"
2109 2109
 }
2110
+
2111
+type HisOrderTenty struct {
2112
+	ID                           int64                        `gorm:"column:id" json:"id" form:"id"`
2113
+	UserOrgId                    int64                        `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2114
+	HisPatientId                 int64                        `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
2115
+	PsnCertType                  string                       `gorm:"column:psn_cert_type" json:"psn_cert_type" form:"psn_cert_type"`
2116
+	SettleAccountsDate           int64                        `gorm:"column:settle_accounts_date" json:"settle_accounts_date" form:"settle_accounts_date"`
2117
+	Ctime                        int64                        `gorm:"column:ctime" json:"ctime" form:"ctime"`
2118
+	Mtime                        int64                        `gorm:"column:mtime" json:"mtime" form:"mtime"`
2119
+	Status                       int64                        `gorm:"column:status" json:"status" form:"status"`
2120
+	Number                       string                       `gorm:"column:number" json:"number" form:"number"`
2121
+	PatientId                    int64                        `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
2122
+	Infcode                      int64                        `gorm:"column:infcode" json:"infcode" form:"infcode"`
2123
+	WarnMsg                      string                       `gorm:"column:warn_msg" json:"warn_msg" form:"warn_msg"`
2124
+	Cainfo                       string                       `gorm:"column:cainfo" json:"cainfo" form:"cainfo"`
2125
+	ErrMsg                       string                       `gorm:"column:err_msg" json:"err_msg" form:"err_msg"`
2126
+	RespondTime                  string                       `gorm:"column:respond_time" json:"respond_time" form:"respond_time"`
2127
+	InfRefmsgid                  string                       `gorm:"column:inf_refmsgid" json:"inf_refmsgid" form:"inf_refmsgid"`
2128
+	OrderStatus                  int64                        `gorm:"column:order_status" json:"order_status" form:"order_status"`
2129
+	MdtrtId                      string                       `gorm:"column:mdtrt_id" json:"mdtrt_id" form:"mdtrt_id"`
2130
+	SetlId                       string                       `gorm:"column:setl_id" json:"setl_id" form:"setl_id"`
2131
+	PsnNo                        string                       `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
2132
+	PsnName                      string                       `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
2133
+	Certno                       string                       `gorm:"column:certno" json:"certno" form:"certno"`
2134
+	Gend                         string                       `gorm:"column:gend" json:"gend" form:"gend"`
2135
+	Naty                         string                       `gorm:"column:naty" json:"naty" form:"naty"`
2136
+	Brdy                         time.Time                    `gorm:"column:brdy" json:"brdy" form:"brdy"`
2137
+	Age                          float64                      `gorm:"column:age" json:"age" form:"age"`
2138
+	Insutype                     string                       `gorm:"column:insutype" json:"insutype" form:"insutype"`
2139
+	PsnType                      string                       `gorm:"column:psn_type" json:"psn_type" form:"psn_type"`
2140
+	CvlservFlag                  string                       `gorm:"column:cvlserv_flag" json:"cvlserv_flag" form:"cvlserv_flag"`
2141
+	SetlTime                     string                       `gorm:"column:setl_time" json:"setl_time" form:"setl_time"`
2142
+	MdtrtCertType                string                       `gorm:"column:mdtrt_cert_type" json:"mdtrt_cert_type" form:"mdtrt_cert_type"`
2143
+	MedType                      string                       `gorm:"column:med_type" json:"med_type" form:"med_type"`
2144
+	MedfeeSumamt                 float64                      `gorm:"column:medfee_sumamt" json:"medfee_sumamt" form:"medfee_sumamt"`
2145
+	FulamtOwnpayAmt              float64                      `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
2146
+	OverlmtSelfPay               float64                      `gorm:"column:overlmt_self_pay" json:"overlmt_self_pay" form:"overlmt_self_pay"`
2147
+	PreselfpayAmt                float64                      `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
2148
+	InscpScpAmt                  float64                      `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
2149
+	ActPayDedc                   float64                      `gorm:"column:act_pay_dedc" json:"act_pay_dedc" form:"act_pay_dedc"`
2150
+	HifpPay                      float64                      `gorm:"column:hifp_pay" json:"hifp_pay" form:"hifp_pay"`
2151
+	CvlservPay                   float64                      `gorm:"column:cvlserv_pay" json:"cvlserv_pay" form:"cvlserv_pay"`
2152
+	PoolPropSelfpay              float64                      `gorm:"column:pool_prop_selfpay" json:"pool_prop_selfpay" form:"pool_prop_selfpay"`
2153
+	HifesPay                     float64                      `gorm:"column:hifes_pay" json:"hifes_pay" form:"hifes_pay"`
2154
+	HifmiPay                     float64                      `gorm:"column:hifmi_pay" json:"hifmi_pay" form:"hifmi_pay"`
2155
+	HifobPay                     float64                      `gorm:"column:hifob_pay" json:"hifob_pay" form:"hifob_pay"`
2156
+	MafPay                       float64                      `gorm:"column:maf_pay" json:"maf_pay" form:"maf_pay"`
2157
+	OthPay                       float64                      `gorm:"column:oth_pay" json:"oth_pay" form:"oth_pay"`
2158
+	FundPaySumamt                float64                      `gorm:"column:fund_pay_sumamt" json:"fund_pay_sumamt" form:"fund_pay_sumamt"`
2159
+	PsnPartAmt                   float64                      `gorm:"column:psn_part_amt" json:"psn_part_amt" form:"psn_part_amt"`
2160
+	AcctPay                      float64                      `gorm:"column:acct_pay" json:"acct_pay" form:"acct_pay"`
2161
+	PsnCashPay                   float64                      `gorm:"column:psn_cash_pay" json:"psn_cash_pay" form:"psn_cash_pay"`
2162
+	HospPartAmt                  float64                      `gorm:"column:hosp_part_amt" json:"hosp_part_amt" form:"hosp_part_amt"`
2163
+	Balc                         float64                      `gorm:"column:balc" json:"balc" form:"balc"`
2164
+	AcctMulaidPay                float64                      `gorm:"column:acct_mulaid_pay" json:"acct_mulaid_pay" form:"acct_mulaid_pay"`
2165
+	MedinsSetlId                 string                       `gorm:"column:medins_setl_id" json:"medins_setl_id" form:"medins_setl_id"`
2166
+	ClrOptins                    string                       `gorm:"column:clr_optins" json:"clr_optins" form:"clr_optins"`
2167
+	ClrWay                       string                       `gorm:"column:clr_way" json:"clr_way" form:"clr_way"`
2168
+	ClrType                      string                       `gorm:"column:clr_type" json:"clr_type" form:"clr_type"`
2169
+	SetlDetail                   string                       `gorm:"column:setl_detail" json:"setl_detail" form:"setl_detail"`
2170
+	PayWay                       int64                        `gorm:"column:pay_way" json:"pay_way" form:"pay_way"`
2171
+	PayPrice                     float64                      `gorm:"column:pay_price" json:"pay_price" form:"pay_price"`
2172
+	PayCardNo                    string                       `gorm:"column:pay_card_no" json:"pay_card_no" form:"pay_card_no"`
2173
+	DiscountPrice                float64                      `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
2174
+	PreferentialPrice            float64                      `gorm:"column:preferential_price" json:"preferential_price" form:"preferential_price"`
2175
+	RealityPrice                 float64                      `gorm:"column:reality_price" json:"reality_price" form:"reality_price"`
2176
+	FoundPrice                   float64                      `gorm:"column:found_price" json:"found_price" form:"found_price"`
2177
+	MedicalInsurancePrice        float64                      `gorm:"column:medical_insurance_price" json:"medical_insurance_price" form:"medical_insurance_price"`
2178
+	PrivatePrice                 float64                      `gorm:"column:private_price" json:"private_price" form:"private_price"`
2179
+	IsMedicineInsurance          int64                        `gorm:"column:is_medicine_insurance" json:"is_medicine_insurance" form:"is_medicine_insurance"`
2180
+	SettleType                   int64                        `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
2181
+	SettleStartTime              int64                        `gorm:"column:settle_start_time" json:"settle_start_time" form:"settle_start_time"`
2182
+	SettleEndTime                int64                        `gorm:"column:settle_end_time" json:"settle_end_time" form:"settle_end_time"`
2183
+	Creator                      int64                        `gorm:"column:creator" json:"creator" form:"creator"`
2184
+	Modify                       int64                        `gorm:"column:modify" json:"modify" form:"modify"`
2185
+	SzChargeInfo                 string                       `gorm:"column:sz_charge_info" json:"sz_charge_info" form:"sz_charge_info"`
2186
+	SzProjectInfo                string                       `gorm:"column:sz_project_info" json:"sz_project_info" form:"sz_project_info"`
2187
+	SzMedicineInsuranceInfo      string                       `gorm:"column:sz_medicine_insurance_info" json:"sz_medicine_insurance_info" form:"sz_medicine_insurance_info"`
2188
+	AccountPrice                 string                       `gorm:"column:account_price" json:"account_price" form:"account_price"`
2189
+	MzNumber                     string                       `gorm:"column:mz_number" json:"mz_number" form:"mz_number"`
2190
+	OrgSetlNumber                string                       `gorm:"column:org_setl_number" json:"org_setl_number" form:"org_setl_number"`
2191
+	YiliaoNumber                 string                       `gorm:"column:yiliao_number" json:"yiliao_number" form:"yiliao_number"`
2192
+	RefundLog                    string                       `gorm:"column:refund_log" json:"refund_log" form:"refund_log"`
2193
+	DetailLog                    string                       `gorm:"column:detail_log" json:"detail_log" form:"detail_log"`
2194
+	FaPiaoCode                   string                       `gorm:"column:fa_piao_code" json:"fa_piao_code" form:"fa_piao_code"`
2195
+	FaPiaoNumber                 string                       `gorm:"column:fa_piao_number" json:"fa_piao_number" form:"fa_piao_number"`
2196
+	RequestLog                   string                       `gorm:"column:request_log" json:"request_log" form:"request_log"`
2197
+	RefundRequestLog             string                       `gorm:"column:refund_request_log" json:"refund_request_log" form:"refund_request_log"`
2198
+	PType                        int64                        `gorm:"column:p_type" json:"p_type" form:"p_type"`
2199
+	IsPre                        int64                        `gorm:"column:is_pre" json:"is_pre" form:"is_pre"`
2200
+	Diagnosis                    string                       `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
2201
+	FaPiaoBatchnumberId          int64                        `gorm:"column:fa_piao_batchnumber_id" json:"fa_piao_batchnumber_id" form:"fa_piao_batchnumber_id"`
2202
+	Decimal                      float64                      `gorm:"column:decimal" json:"decimal" form:"decimal"`
2203
+	HisOrderInfoTwenty           []*HisOrderInfoTwenty        `gorm:"ForeignKey:OrderId;AssociationForeignKey:ID" json:"order_info"`
2204
+	Patients                     Patients                     `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
2205
+	HisHospitalCheckRecordTwenty HisHospitalCheckRecordTwenty `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"hisPatient"`
2206
+}
2207
+
2208
+func (HisOrderTenty) TableName() string {
2209
+	return "his_order"
2210
+}
2211
+
2212
+type HisOrderInfoTwenty struct {
2213
+	ID                           int64                        `gorm:"column:id" json:"id" form:"id"`
2214
+	OrderNumber                  string                       `gorm:"column:order_number" json:"order_number" form:"order_number"`
2215
+	UploadDate                   int64                        `gorm:"column:upload_date" json:"upload_date" form:"upload_date"`
2216
+	AdviceId                     int64                        `gorm:"column:advice_id" json:"advice_id" form:"advice_id"`
2217
+	DetItemFeeSumamt             float64                      `gorm:"column:det_item_fee_sumamt" json:"det_item_fee_sumamt" form:"det_item_fee_sumamt"`
2218
+	Cnt                          float64                      `gorm:"column:cnt" json:"cnt" form:"cnt"`
2219
+	Pric                         float64                      `gorm:"column:pric" json:"pric" form:"pric"`
2220
+	PatientId                    int64                        `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
2221
+	PricUplmtAmt                 float64                      `gorm:"column:pric_uplmt_amt" json:"pric_uplmt_amt" form:"pric_uplmt_amt"`
2222
+	SelfpayProp                  float64                      `gorm:"column:selfpay_prop" json:"selfpay_prop" form:"selfpay_prop"`
2223
+	FulamtOwnpayAmt              float64                      `gorm:"column:fulamt_ownpay_amt" json:"fulamt_ownpay_amt" form:"fulamt_ownpay_amt"`
2224
+	OverlmtAmt                   float64                      `gorm:"column:overlmt_amt" json:"overlmt_amt" form:"overlmt_amt"`
2225
+	PreselfpayAmt                float64                      `gorm:"column:preselfpay_amt" json:"preselfpay_amt" form:"preselfpay_amt"`
2226
+	BasMednFlag                  string                       `gorm:"column:bas_medn_flag" json:"bas_medn_flag" form:"bas_medn_flag"`
2227
+	MedChrgitmType               string                       `gorm:"column:med_chrgitm_type" json:"med_chrgitm_type" form:"med_chrgitm_type"`
2228
+	HiNegoDrugFlag               string                       `gorm:"column:hi_nego_drug_flag" json:"hi_nego_drug_flag" form:"hi_nego_drug_flag"`
2229
+	Status                       int64                        `gorm:"column:status" json:"status" form:"status"`
2230
+	Memo                         string                       `gorm:"column:memo" json:"memo" form:"memo"`
2231
+	FeedetlSn                    string                       `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
2232
+	Mtime                        int64                        `gorm:"column:mtime" json:"mtime" form:"mtime"`
2233
+	InscpScpAmt                  float64                      `gorm:"column:inscp_scp_amt" json:"inscp_scp_amt" form:"inscp_scp_amt"`
2234
+	DrtReimFlag                  string                       `gorm:"column:drt_reim_flag" json:"drt_reim_flag" form:"drt_reim_flag"`
2235
+	Ctime                        int64                        `gorm:"column:ctime" json:"ctime" form:"ctime"`
2236
+	ListSpItemFlag               string                       `gorm:"column:list_sp_item_flag" json:"list_sp_item_flag" form:"list_sp_item_flag"`
2237
+	ChldMedcFlag                 string                       `gorm:"column:chld_medc_flag" json:"chld_medc_flag" form:"chld_medc_flag"`
2238
+	LmtUsedFlag                  string                       `gorm:"column:lmt_used_flag" json:"lmt_used_flag" form:"lmt_used_flag"`
2239
+	ChrgitmLv                    string                       `gorm:"column:chrgitm_lv" json:"chrgitm_lv" form:"chrgitm_lv"`
2240
+	UserOrgId                    int64                        `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2241
+	HisPatientId                 int64                        `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
2242
+	OrderId                      int64                        `gorm:"column:order_id" json:"order_id" form:"order_id"`
2243
+	ProjectId                    int64                        `gorm:"column:project_id" json:"project_id" form:"project_id"`
2244
+	Type                         int64                        `gorm:"column:type" json:"type" form:"type"`
2245
+	ItemId                       int64                        `gorm:"column:item_id" json:"item_id" form:"item_id"`
2246
+	Creator                      int64                        `gorm:"column:creator" json:"creator" form:"creator"`
2247
+	Modify                       int64                        `gorm:"column:modify" json:"modify" form:"modify"`
2248
+	OverPricPsnPay               float64                      `gorm:"column:over_pric_psn_pay" json:"over_pric_psn_pay" form:"over_pric_psn_pay"`
2249
+	AllowReimburse               float64                      `gorm:"column:allow_reimburse" json:"allow_reimburse" form:"allow_reimburse"`
2250
+	SettleType                   int64                        `gorm:"column:settle_type" json:"settle_type" form:"settle_type"`
2251
+	Patients                     Patients                     `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
2252
+	HisHospitalCheckRecordTwenty HisHospitalCheckRecordTwenty `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"hisPatient"`
2253
+	HisOrderTenty                HisOrderTenty                `gorm:"ForeignKey:ID;AssociationForeignKey:OrderId" json:"order"`
2254
+	HisPrescriptionProject       HisPrescriptionProject       `gorm:"ForeignKey:ID;AssociationForeignKey:ProjectId" json:"his_prescription_project"`
2255
+	HisDoctorAdvice              HisDoctorAdvice              `gorm:"ForeignKey:ID;AssociationForeignKey:AdviceId" json:"his_doctor_advice"`
2256
+}
2257
+
2258
+func (HisOrderInfoTwenty) TableName() string {
2259
+	return "his_order_info"
2260
+}
2261
+
2262
+type HisHospitalCheckRecordTwenty struct {
2263
+	ID                   int64  `gorm:"column:id" json:"id" form:"id"`
2264
+	Name                 string `gorm:"column:name" json:"name" form:"name"`
2265
+	MedicalTreatmentType int64  `gorm:"column:medical_treatment_type" json:"medical_treatment_type" form:"medical_treatment_type"`
2266
+	RecordDate           int64  `gorm:"column:record_date" json:"record_date" form:"record_date"`
2267
+	IdCardNo             string `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
2268
+	AdminUserId          int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
2269
+	Departments          int64  `gorm:"column:departments" json:"departments" form:"departments"`
2270
+	UserOrgId            int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2271
+	Status               int64  `gorm:"column:status" json:"status" form:"status"`
2272
+	Ctime                int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
2273
+	Mtime                int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2274
+	PatientId            int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
2275
+	Number               string `gorm:"column:number" json:"number" form:"number"`
2276
+	Doctor               int64  `gorm:"column:doctor" json:"doctor" form:"doctor"`
2277
+	PsnNo                string `gorm:"column:psn_no" json:"psn_no" form:"psn_no"`
2278
+	PsnCertType          string `gorm:"column:psn_cert_type" json:"psn_cert_type" form:"psn_cert_type"`
2279
+	Certno               string `gorm:"column:certno" json:"certno" form:"certno"`
2280
+	PsnName              string `gorm:"column:psn_name" json:"psn_name" form:"psn_name"`
2281
+	Gend                 string `gorm:"column:gend" json:"gend" form:"gend"`
2282
+	Naty                 string `gorm:"column:naty" json:"naty" form:"naty"`
2283
+	MedType              int64  `gorm:"column:med_type" json:"med_type" form:"med_type"`
2284
+	Brdy                 string `gorm:"column:brdy" json:"brdy" form:"brdy"`
2285
+	Iinfo                string `gorm:"column:iinfo" json:"iinfo" form:"iinfo"`
2286
+	Idetinfo             string `gorm:"column:idetinfo" json:"idetinfo" form:"idetinfo"`
2287
+	IptOtpNo             string `gorm:"column:ipt_otp_no" json:"ipt_otp_no" form:"ipt_otp_no"`
2288
+	AdmBed               int64  `gorm:"column:adm_bed" json:"adm_bed" form:"adm_bed"`
2289
+	IdCardType           int64  `gorm:"column:id_card_type" json:"id_card_type" form:"id_card_type"`
2290
+	Diagnosis            string `gorm:"column:diagnosis" json:"diagnosis" form:"diagnosis"`
2291
+	InsutypeType         string `gorm:"column:insutype_type" json:"insutype_type" form:"insutype_type"`
2292
+	SickType             int64  `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
2293
+	MdtrtCertType        string `gorm:"column:mdtrt_cert_type" json:"mdtrt_cert_type" form:"mdtrt_cert_type"`
2294
+	InHosptialTime       string `gorm:"column:in_hosptial_time" json:"in_hosptial_time" form:"in_hosptial_time"`
2295
+	OutHosptialTime      string `gorm:"column:out_hosptial_time" json:"out_hosptial_time" form:"out_hosptial_time"`
2296
+	InHospitalStatus     int64  `gorm:"column:in_hospital_status" json:"in_hospital_status" form:"in_hospital_status"`
2297
+	Certificates         int64  `gorm:"column:certificates" json:"certificates" form:"certificates"`
2298
+	OutHospitalStatus    int64  `gorm:"column:out_hospital_status" json:"out_hospital_status" form:"out_hospital_status"`
2299
+	OutWay               int64  `gorm:"column:out_way" json:"out_way" form:"out_way"`
2300
+	Phone                string `gorm:"column:phone" json:"phone" form:"phone"`
2301
+	BalanceAccountsType  int64  `gorm:"column:balance_accounts_type" json:"balance_accounts_type" form:"balance_accounts_type"`
2302
+	PsnType              int64  `gorm:"column:psn_type" json:"psn_type" form:"psn_type"`
2303
+	InsuplcAdmdvs        string `gorm:"column:insuplc_admdvs" json:"insuplc_admdvs" form:"insuplc_admdvs"`
2304
+}
2305
+
2306
+func (HisHospitalCheckRecordTwenty) TableName() string {
2307
+	return "his_hospital_check_record"
2308
+}

+ 1 - 1
models/patient_schedule_template_models.go View File

@@ -19,7 +19,7 @@ type PatientScheduleTemplateId struct {
19 19
 	OrgID      int64 `gorm:"column:org_id" json:"-" form:"org_id"`
20 20
 	Status     int8  `gorm:"column:status" json:"-" form:"status"`
21 21
 	CreateTime int64 `gorm:"column:ctime" json:"-" form:"ctime"`
22
-	ModifyTime int64 `gorm:"column:mtime" json:"-" form:"mtime"`
22
+	ModifyTime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
23 23
 }
24 24
 
25 25
 func (PatientScheduleTemplateId) TableName() string {

+ 9 - 0
service/device_service.go View File

@@ -261,6 +261,15 @@ func GetAllValidDeviceZones(orgID int64) ([]*models.DeviceZone, error) {
261 261
 	return zones, nil
262 262
 }
263 263
 
264
+func GetAllValidDeviceZonesOne(orgID int64) ([]*models.DeviceZone, error) {
265
+	var zones []*models.DeviceZone
266
+	err := readDb.Model(&models.DeviceZone{}).Where("org_id = ? and status = 1", orgID).Find(&zones).Error
267
+	if err != nil {
268
+		return nil, err
269
+	}
270
+	return zones, nil
271
+}
272
+
264 273
 func GetDeviceZoneByID(orgID int64, zoneID int64) (*models.DeviceZone, error) {
265 274
 	var zone models.DeviceZone
266 275
 	err := readDb.Model(&models.DeviceZone{}).Where("org_id = ? AND id = ?", orgID, zoneID).First(&zone).Error

+ 69 - 0
service/his_summary_service.go View File

@@ -352,3 +352,72 @@ func GetAllHisOrderList(org_id int64, patient_id int64, start_time int64, end_ti
352 352
 
353 353
 	return order, err
354 354
 }
355
+
356
+func GetHisOrderListByMedChrgitemType(patient_id int64, startime int64, endtime int64, orgid int64) (info []*models.HisOrderInfoTwenty, err error) {
357
+
358
+	db := XTReadDB().Model(&models.HisOrderInfoTwenty{}).Where("status = 1")
359
+
360
+	if patient_id > 0 {
361
+		db = db.Where("patient_id = ?", patient_id)
362
+	}
363
+	if startime > 0 {
364
+		db = db.Where("settle_accounts_date >= ?", startime)
365
+	}
366
+	if endtime > 0 {
367
+		db = db.Where("settle_accounts_date<=?", endtime)
368
+	}
369
+	if orgid > 0 {
370
+		db = db.Where("user_org_id = ?", orgid)
371
+	}
372
+	err = db.Group("med_chrgitm_type").Preload("Patients", "status = 1").Preload("HisHospitalCheckRecordTwenty", "status = 1").Find(&info).Error
373
+	return info, err
374
+}
375
+
376
+func GetOrderInfoList(patient_id int64, startime int64, endtime int64, orgid int64) (info []*models.HisOrderInfoTwenty, err error) {
377
+	db := XTReadDB().Model(&models.HisOrderInfoTwenty{}).Where("status = 1")
378
+
379
+	if patient_id > 0 {
380
+		db = db.Where("patient_id = ?", patient_id)
381
+	}
382
+	if startime > 0 {
383
+		db = db.Where("upload_date >= ?", startime)
384
+	}
385
+	if endtime > 0 {
386
+		db = db.Where("upload_date<=?", endtime)
387
+	}
388
+	if orgid > 0 {
389
+		db = db.Where("user_org_id = ?", orgid)
390
+	}
391
+	err = db.Preload("HisOrderTenty", "status = 1").Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
392
+		return db.Where("status = 1 AND user_org_id = ?", orgid).Preload("HisProject").Preload("GoodInfo", "status=1")
393
+	}).Preload("HisDoctorAdvice", "status = 1").Preload("Patients", "status = 1").Preload("HisHospitalCheckRecordTwenty", "status = 1").Find(&info).Error
394
+	return info, err
395
+}
396
+
397
+func GetHisOrderListTwenty(patient_id int64, startime int64, endtime int64, orgid int64) (info []*models.HisOrderTenty, err error) {
398
+
399
+	db := XTReadDB().Model(&models.HisOrderTenty{}).Where("status = 1")
400
+
401
+	if patient_id > 0 {
402
+		db = db.Where("patient_id = ?", patient_id)
403
+	}
404
+
405
+	if startime > 0 {
406
+		db = db.Where("settle_accounts_date>=?", startime)
407
+	}
408
+
409
+	if endtime > 0 {
410
+		db = db.Where("settle_accounts_date<=?", endtime)
411
+	}
412
+
413
+	if orgid > 0 {
414
+		db = db.Where("user_org_id = ?", orgid)
415
+	}
416
+
417
+	err = db.Preload("HisOrderInfoTwenty", "status=1").Preload("Patients", "status = 1").Preload("HisHospitalCheckRecordTwenty", "status=1").Order("settle_accounts_date asc").Find(&info).Error
418
+	return info, err
419
+}
420
+
421
+func GetHisAdviceOrderList() {
422
+
423
+}

+ 8 - 0
service/stock_service.go View File

@@ -6901,6 +6901,14 @@ func GetDrugOpenConfig(orgid int64) (*models.DrugOutConfig, error) {
6901 6901
 	return &config, nil
6902 6902
 }
6903 6903
 
6904
+func GetDrugOpenConfigOne(orgid int64) (models.DrugOutConfig, error) {
6905
+
6906
+	config := models.DrugOutConfig{}
6907
+	err := XTReadDB().Where("user_org_id = ? and status = 1", orgid).Find(&config).Error
6908
+
6909
+	return config, err
6910
+}
6911
+
6904 6912
 func CreateDrugOutConfig(config models.DrugOutConfig) error {
6905 6913
 
6906 6914
 	err := XTWriteDB().Create(&config).Error

+ 1 - 1
service/user_service.go View File

@@ -49,7 +49,7 @@ func GetAllDoctorAndNurse(orgId, appid int64) (doctors []AdminUserList, nurses [
49 49
 
50 50
 func GetAllAdminUsers(orgId, appid int64) (list []*AdminUserList, err error) {
51 51
 
52
-	err = readUserDb.Table("sgj_user_admin_role as uar").Joins("JOIN sgj_user_admin as ua ON ua.id = uar.admin_user_id").Where("uar.status=1 and uar.org_id=? and uar.app_id =? and ua.status=1", orgId, appid).Select("ua.id, uar.user_name as name, uar.user_type").Scan(&list).Error
52
+	err = readUserDb.Table("sgj_user_admin_role as uar").Joins("JOIN sgj_user_admin as ua ON ua.id = uar.admin_user_id").Where("uar.org_id=? and uar.app_id =? and ua.status=1", orgId, appid).Select("ua.id, uar.user_name as name, uar.user_type").Scan(&list).Error
53 53
 	//err = readUserDb.Table("sgj_user_admin_role as uar").Joins("JOIN sgj_user_admin as ua ON ua.id = uar.admin_user_id").Where("uar.status=1  and ua.status=1").Select("ua.id, uar.user_name as name, uar.user_type").Scan(&list).Error
54 54
 	return
55 55
 }

+ 41 - 22
service/warhouse_service.go View File

@@ -273,10 +273,12 @@ func DrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *model
273 273
 		if maxNumber == 1 && minNumber == 0 && drup.MaxUnit != drup.MinUnit {
274 274
 			if (warehouse.StockMinNumber - deliver_number) > 0 {
275 275
 				warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
276
+
277
+				if warehouse.StockMinNumber == 0 {
278
+					warehouse.StockMaxNumber = stock_max_number
279
+				}
276 280
 			}
277
-			if warehouse.StockMinNumber == 0 {
278
-				warehouse.StockMaxNumber = stock_max_number
279
-			}
281
+
280 282
 		}
281 283
 
282 284
 		if drup.MaxUnit != drup.MinUnit {
@@ -514,9 +516,13 @@ func HisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *mo
514 516
 	prescribingNumber_temp := strconv.FormatFloat(math.Abs(prescribingNumber), 'f', 0, 64)
515 517
 	count, _ := strconv.ParseInt(prescribingNumber_temp, 10, 64)
516 518
 
517
-	if advice.PrescribingNumberUnit == drup.MaxUnit {
519
+	if advice.PrescribingNumberUnit == drup.MaxUnit && drup.MaxUnit != drup.MinUnit {
518 520
 		deliver_number = count * drup.MinNumber
519
-	} else {
521
+	}
522
+	if advice.PrescribingNumberUnit == drup.MaxUnit && drup.MaxUnit == drup.MinUnit {
523
+		deliver_number = count * drup.MinNumber
524
+	}
525
+	if advice.PrescribingNumberUnit == drup.MinUnit && drup.MaxUnit != drup.MinUnit {
520 526
 		deliver_number = count
521 527
 	}
522 528
 
@@ -656,9 +662,10 @@ func HisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *mo
656 662
 				return errors.New("库存数量不足")
657 663
 			}
658 664
 		}
659
-
665
+		fmt.Println("max_number23323232323232232323", maxNumber)
666
+		fmt.Println("max_number23323232323232232323", minNumber)
660 667
 		warehouse.StockMaxNumber = warehouse.StockMaxNumber - maxNumber
661
-
668
+		fmt.Println("max_number23323232323232232323", warehouse.StockMaxNumber)
662 669
 		if warehouse.StockMaxNumber < 0 {
663 670
 			warehouse.StockMaxNumber = 0
664 671
 		}
@@ -678,6 +685,9 @@ func HisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *mo
678 685
 				warehouse.StockMinNumber = warehouse.StockMinNumber - minNumber
679 686
 			}
680 687
 
688
+			fmt.Println("deliver_number2332322323323232", deliver_number)
689
+
690
+			fmt.Println("warehouse.StockMinNumber", warehouse.StockMinNumber)
681 691
 			if minNumber == 0 && maxNumber != 1 {
682 692
 				if (warehouse.StockMinNumber - deliver_number) > 0 {
683 693
 					warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
@@ -689,10 +699,10 @@ func HisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *mo
689 699
 		if maxNumber == 1 && minNumber == 0 && drup.MaxUnit != drup.MinUnit {
690 700
 			if (warehouse.StockMinNumber - deliver_number) > 0 {
691 701
 				warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
692
-			}
693 702
 
694
-			if warehouse.StockMinNumber == 0 {
695
-				warehouse.StockMaxNumber = stock_max_number
703
+				if warehouse.StockMinNumber == 0 {
704
+					warehouse.StockMaxNumber = stock_max_number
705
+				}
696 706
 			}
697 707
 		}
698 708
 
@@ -705,6 +715,9 @@ func HisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *mo
705 715
 			warehouse.StockMinNumber = 0
706 716
 		}
707 717
 
718
+		fmt.Println("warehouse.StockMinNumber 2323323232233", warehouse.StockMinNumber)
719
+		fmt.Println("warehouse.StockMaxNumber 2323323232233", warehouse.StockMaxNumber)
720
+
708 721
 		//扣减库存232332332332
709 722
 		errThree := UpDateDrugWarehouseInfoByStock(&warehouse)
710 723
 
@@ -2366,11 +2379,12 @@ func NewDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout *mo
2366 2379
 		if maxNumber == 1 && minNumber == 0 && drup.MaxUnit != drup.MinUnit {
2367 2380
 			if (warehouse.StockMinNumber - deliver_number) > 0 {
2368 2381
 				warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
2369
-			}
2370 2382
 
2371
-			if warehouse.StockMinNumber == 0 {
2372
-				warehouse.StockMaxNumber = stock_max_number
2383
+				if warehouse.StockMinNumber == 0 {
2384
+					warehouse.StockMaxNumber = stock_max_number
2385
+				}
2373 2386
 			}
2387
+
2374 2388
 		}
2375 2389
 
2376 2390
 		if drup.MaxUnit != drup.MinUnit {
@@ -2722,10 +2736,12 @@ func NewHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseout
2722 2736
 		if maxNumber == 1 && minNumber == 0 && drup.MaxUnit != drup.MinUnit {
2723 2737
 			if (warehouse.StockMinNumber - deliver_number) > 0 {
2724 2738
 				warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
2739
+
2740
+				if warehouse.StockMinNumber == 0 {
2741
+					warehouse.StockMaxNumber = stock_max_number
2742
+				}
2725 2743
 			}
2726
-			if warehouse.StockMinNumber == 0 {
2727
-				warehouse.StockMaxNumber = stock_max_number
2728
-			}
2744
+
2729 2745
 		}
2730 2746
 
2731 2747
 		if drup.MaxUnit != drup.MinUnit {
@@ -4444,11 +4460,12 @@ func AutoDrugDeliverInfoTwenty(orgID int64, prescribingNumber int64, warehouseou
4444 4460
 		if maxNumber == 1 && minNumber == 0 && drup.MaxUnit != drup.MinUnit {
4445 4461
 			if (warehouse.StockMinNumber - deliver_number) > 0 {
4446 4462
 				warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
4447
-			}
4448 4463
 
4449
-			if warehouse.StockMinNumber == 0 {
4450
-				warehouse.StockMaxNumber = stock_max_number
4464
+				if warehouse.StockMinNumber == 0 {
4465
+					warehouse.StockMaxNumber = stock_max_number
4466
+				}
4451 4467
 			}
4468
+
4452 4469
 		}
4453 4470
 
4454 4471
 		if drup.MaxUnit != drup.MinUnit {
@@ -4763,10 +4780,12 @@ func AutoDrugDeliverInfoTwentyOne(orgID int64, prescribingNumber int64, warehous
4763 4780
 		if maxNumber == 1 && minNumber == 0 && drup.MaxUnit != drup.MinUnit {
4764 4781
 			if (warehouse.StockMinNumber - deliver_number) > 0 {
4765 4782
 				warehouse.StockMinNumber = warehouse.StockMinNumber - deliver_number
4783
+
4784
+				if warehouse.StockMinNumber == 0 {
4785
+					warehouse.StockMaxNumber = stock_max_number
4786
+				}
4766 4787
 			}
4767
-			if warehouse.StockMinNumber == 0 {
4768
-				warehouse.StockMaxNumber = stock_max_number
4769
-			}
4788
+
4770 4789
 		}
4771 4790
 
4772 4791
 		if drup.MaxUnit != drup.MinUnit {